@helixnetwork/bundle
v1.0.0-alpha.7
Published
Utilities for generating and schnorr bundles
Downloads
12
Readme
@helixnetwork/bundle
Utilities for generating and sign bundles. A bundle in Helix is an atomic set of transactions.
Installation
Install using npm:
npm install @helixnetwork/bundle
or using yarn:
yarn add @helixnetwork/bundle
API Reference
bundle~createBundle(entries)
| Param | Type | Description | | --- | --- | --- | | entries | Array.<BundleEntry> | Entries of signle or multiple transactions with the same address |
Creates a bunlde with given transaction entries.
Returns: Array.<Transaction> - List of transactions in the bundle
bundle~addEntry(transactions, entry)
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| transactions | Array.<Transaction> | | List of transactions currently in the bundle |
| entry | object | | Entry of single or multiple transactions with the same address |
| [entry.length] | number | 1 | Entry length, which indicates how many transactions in the bundle will occupy |
| [entry.address] | TxHex | | Address, defaults to all-0s |
| [entry.value] | number | 0 | Value to transfer in HLX |
| [entry.signatureMessageFragments] | Array.<string> | | Array of signature message fragments txs, defaults to all-0s |
| [entry.timestamp] | number | | Transaction timestamp, defaults to Math.floor(Date.now() / 1000)
|
| [entry.tag] | TxHex | | Optional Tag, defaults to null tag (all-0s) |
Creates a bunlde with given transaction entries
Returns: Array.<Transaction> - Bundle
bundle~addTxHex(transactions, fragments, [offset])
| Param | Type | Default | Description | | --- | --- | --- | --- | | transactions | Array.<Transaction> | | Transactions in the bundle | | fragments | Array.<TxHex> | | Message signature fragments to add | | [offset] | number | 0 | Optional offset to start appending signature message fragments |
Adds a list of txs in the bundle starting at offset
Returns: Array.<Transaction> - Transactions of finalized bundle
bundle~finalizeBundle(transactions)
| Param | Type | Description | | --- | --- | --- | | transactions | Array.<Transaction> | Transactions in the bundle |
Finalizes the bundle by calculating the bundle hash
Returns: Array.<Transaction> - Transactions of finalized bundle