Parses a JSON string representing block transactions and converts them into an array of BlockTransaction instances.
The input data is expected to be a JSON object with categories (e.g., '0', '1', etc.) mapping to arrays of TransactionHash objects.
Each category corresponds to a specific type of transaction, such as Mint, Auction, etc.
Returns
An array of BlockTransaction instances representing the transactions in the block.
Throws
If the input data is not valid JSON or does not conform to the expected structure.
Example
constjsonData = '{"0": [{"transactionV1": "hash1"}], "1": [{"transactionV1": "hash2"}]}'; consttransactions = parseBlockTransactions(jsonData); console.log(transactions); // Outputs an array of BlockTransaction instances for Mint and Auction transactions.
Parameters
data: string
A JSON string containing transaction categories as keys ('0', '1', etc.), with each key pointing to an array of TransactionHash objects.
Parses a JSON string representing block transactions and converts them into an array of
BlockTransaction
instances. The input data is expected to be a JSON object with categories (e.g., '0', '1', etc.) mapping to arrays ofTransactionHash
objects. Each category corresponds to a specific type of transaction, such as Mint, Auction, etc.Returns
An array of
BlockTransaction
instances representing the transactions in the block.Throws
If the input
data
is not valid JSON or does not conform to the expected structure.Example