Files
common/packages/util-rlp/docs/README.md
T
Jaco Greeff e832aebb07 Introduce @polkadot/util-rlp (#76)
* Add toU8a conversions

* Add u8a utilities

* @polkadot/rlp with encoding

* Decoding test runthrough

* Update util locations

* Convert util-triehash to use util-rlp

* Allow keccak from Uint8Array

* Pass Uint8Array to keccak input

* Update documentation

* Skip some doc generation

* Update @polkadot/dev

* Update doc typo

* Update allocations

* Retrieve tests from ethereumjs-testing

* Simplify test retrieval

* Exclude etereumjs-testing from flow
2018-02-08 14:50:54 +01:00

859 B

Available interfaces

Utility methods to encode and decode Ethereum RLP. Adapted from the EthereumJS implementation

Available methods

decode

Decodes the input RLP.

decoder (input?: Uint8Array): Uint8Array | Array<*>

From an input, decod the RLP and return the result as a Uint8Array or Array.

import { decode } from '@polkadot/util-rlp';

encode(new Uint8Array([0x83, 0x64, 0x6f, 0x67])) // => 'dog' as Uint8Array

encode

Encodes the input value into RLP.

encode (input: any): Uint8Array

From an input, calculate the RLP and return the result as a Uint8Array.

import { encode } from '@polkadot/util-rlp';

encode('dog') // => [0x83, 0x64, 0x6f, 0x67]