https://github.com/wavesplatform/blocks-json-parser-js
A function to parse blocks from Waves Node API into JavaScript, preserving Long values and sanitizing assetId fields (null -> 'WAVES')
https://github.com/wavesplatform/blocks-json-parser-js
Last synced: 8 months ago
JSON representation
A function to parse blocks from Waves Node API into JavaScript, preserving Long values and sanitizing assetId fields (null -> 'WAVES')
- Host: GitHub
- URL: https://github.com/wavesplatform/blocks-json-parser-js
- Owner: wavesplatform
- Created: 2018-07-12T20:28:03.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-19T12:24:58.000Z (almost 8 years ago)
- Last Synced: 2025-08-14T00:57:49.041Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 44.9 KB
- Stars: 3
- Watchers: 7
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
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
```js
parseBlock(blockText, [options]);
```
- `blockText` a raw JSON string from API
- `options`
- `long`: a factory creating Long values from strings. For example, `long.js` or `bignumber.js` can be used.
- `assetId`: a transform for fields containing asset IDs. By default, changes `null` values from API to `'WAVES'`.
## Usage
```js
const parseBlock = require('@waves/blocks-json-parser');
const Long = require('long');
parseBlock(blocksText, { long: x => Long.fromString(x) });
```