Skip to content

Rlp

Utility functions for encoding and decoding Recursive Length Prefix structures.

Examples

import { Hex, Rlp } from 'ox'
 
const data = Rlp.fromHex([Hex.fromString('hello'), Hex.fromString('world')])
'0xcc8568656c6c6f85776f726c64'
const values = Rlp.toHex(data)
[Hex.fromString('hello'), Hex.fromString('world')]

Functions

NameDescription
Rlp.fromEncodes a Bytes.Bytes or Hex.Hex value into a Recursive-Length Prefix (RLP) value.
Rlp.fromBytesEncodes a Bytes.Bytes value into a Recursive-Length Prefix (RLP) value.
Rlp.fromHexEncodes a Hex.Hex value into a Recursive-Length Prefix (RLP) value.
Rlp.toBytesDecodes a Recursive-Length Prefix (RLP) value into a Bytes.Bytes value.
Rlp.toHexDecodes a Recursive-Length Prefix (RLP) value into a Hex.Hex value.