# @waves/blocks-json-parser

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

Latest version **0.1.2** (published 2018-07-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @waves/blocks-json-parser
pnpm add @waves/blocks-json-parser
yarn add @waves/blocks-json-parser
bun add @waves/blocks-json-parser
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2018-07-19 |
| First published | 2018-07-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 31.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Dmitry Shuranov |
| Maintainers | beregovoy68, dvshur, ebceu4, hypnagonia, ishmidt, jahsus, tsigel, vba2000, wavesadmin, xenohunter |

## Links

- npm: https://www.npmjs.com/package/@waves/blocks-json-parser
- Repository: https://github.com/wavesplatform/blocks-json-parser-js
- npm.io page: https://npm.io/package/@waves/blocks-json-parser

## Dependencies (1)

- [json-to-ast](https://npm.io/package/json-to-ast.md) ^2.0.3

## Recent versions

- 0.1.2 (latest) — 2018-07-19
- 0.1.1 — 2018-07-19
- 0.1.0 — 2018-07-19
- 0.0.1 — 2018-07-12

## 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) });
```

---
_Source: https://npm.io/package/@waves/blocks-json-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
