Files
common/packages/code-primitives-json
Jaco Greeff 78e01a0e16 Combine util, types & trie into common (#150)
* Pull in trie repo

* Bring in types repo
2018-06-26 21:26:51 +02:00
..

polkadotjs isc style npm travis maintainability coverage dependency devDependency

@polkadot/primitives-json

Conversion of Polkadot types to and from a structure with Json-only primitives, ready for serialisation. As such, it does not stringify itself, rather converts from complex classes to the correct Json reprsentation.

Usage

Installation -

npm install --save @polkadot/primitives-json

Usage -

const { parachainIdDecode, parachainIdEncode } from '@polkadot/primitives-json');

parachainIdDecode(     // step 3 - BN `0x123456`
  parachainIdEncode(   // step 1 -  string `'0x123456'`
    new BN('0x123456') // step 0 - BN `0x123456`
  )
);