@helixnetwork/transaction-converter
v1.0.0-alpha.7
Published
Converts transaction strings (in hexadecimal representation) to transaction objects and back.
Downloads
23
Readme
@helixnetwork/transaction-converter
Methods for calculating transaction hashes and converting transaction objects to transaction txs and back.
Installation
Install using npm:
npm install @helixnetwork/transaction-converter
or using yarn:
yarn add @helixnetwork/transaction-converter
API Reference
transaction-converter~asTransactionStrings(transactions)
| Param | Type | Description | | --- | --- | --- | | transactions | Transaction | Array.<Transaction> | Transaction object(s) |
Converts a transaction object or a list of those into transaction strings (txs).
Returns: TxHex | Array.<TxHex> - Transaction strings
transaction-converter~asTransactionObject(txs)
| Param | Type | Description | | --- | --- | --- | | txs | TxHex | Transaction txs |
Converts transaction txs of 1536 txs into a transaction object.
Returns: Transaction - Transaction object
transaction-converter~asTransactionObjects([hashes])
| Param | Type | Description | | --- | --- | --- | | [hashes] | Array.<Hash> | Optional list of known hashes. Known hashes are directly mapped to transaction objects, otherwise all hashes are being recalculated. |
Converts a list of transaction txs into list of transaction objects. Accepts a list of hashes and returns a mapper. In cases hashes are given, the mapper function map them to converted objects.
Returns: function - transactionObjectsMapper
transaction-converter~transactionObjectsMapper(txs)
| Param | Type | Description | | --- | --- | --- | | txs | Array.<TxHex> | List of transaction txs to convert |
Maps the list of given hashes to a list of converted transaction objects.
Returns: Array.<Transaction> - List of transaction objects with hashes