@waves/blocks-json-parser
v0.1.2
Published
A function to parse Waves blocks from Waves Node API into JavaScript, preserving Long values and sanitizing assetId fields (null -> 'WAVES')
Downloads
13
Readme
@waves/blocks-json-parser
A package that parses blocks from Waves Node API into JS objects of the same shape, with the ability to preserve Long values and sanitize asset names.
API
parseBlock(blockText, [options]);blockTexta raw JSON string from APIoptionslong: a factory creating Long values from strings. For example,long.jsorbignumber.jscan be used.assetId: a transform for fields containing asset IDs. By default, changesnullvalues from API to'WAVES'.
Usage
const parseBlock = require('@waves/blocks-json-parser');
const Long = require('long');
parseBlock(blocksText, { long: x => Long.fromString(x) });