Skip to content

A function to parse blocks from Waves Node API into JavaScript, preserving Long values and sanitizing assetId fields (null -> 'WAVES')

Notifications You must be signed in to change notification settings

wavesplatform/blocks-json-parser-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@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]);
  • 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

const parseBlock = require('@waves/blocks-json-parser');
const Long = require('long');

parseBlock(blocksText, { long: x => Long.fromString(x) });

About

A function to parse blocks from Waves Node API into JavaScript, preserving Long values and sanitizing assetId fields (null -> 'WAVES')

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published