1.0.0-alpha.7 • Published 5 years ago

@helixnetwork/transaction-converter v1.0.0-alpha.7

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

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

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

ParamTypeDescription
txsTxHexTransaction txs

Converts transaction txs of 1536 txs into a transaction object.

Returns: Transaction - Transaction object

transaction-converter~asTransactionObjects(hashes)

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

ParamTypeDescription
txsArray.<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