1.0.0-alpha.7 • Published 5 years ago

@helixnetwork/bundle v1.0.0-alpha.7

Weekly downloads
8
License
MIT
Repository
github
Last release
5 years ago

@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)

ParamTypeDescription
entriesArray.<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)

ParamTypeDefaultDescription
transactionsArray.<Transaction>List of transactions currently in the bundle
entryobjectEntry of single or multiple transactions with the same address
entry.lengthnumber1Entry length, which indicates how many transactions in the bundle will occupy
entry.addressTxHexAddress, defaults to all-0s
entry.valuenumber0Value to transfer in HLX
entry.signatureMessageFragmentsArray.<string>Array of signature message fragments txs, defaults to all-0s
entry.timestampnumberTransaction timestamp, defaults to Math.floor(Date.now() / 1000)
entry.tagTxHexOptional Tag, defaults to null tag (all-0s)

Creates a bunlde with given transaction entries

Returns: Array.<Transaction> - Bundle

bundle~addTxHex(transactions, fragments, offset)

ParamTypeDefaultDescription
transactionsArray.<Transaction>Transactions in the bundle
fragmentsArray.<TxHex>Message signature fragments to add
offsetnumber0Optional 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)

ParamTypeDescription
transactionsArray.<Transaction>Transactions in the bundle

Finalizes the bundle by calculating the bundle hash

Returns: Array.<Transaction> - Transactions of finalized bundle