fromRlp โ
Decodes a Recursive-Length Prefix (RLP) value into a decoded hex value or byte array.
Import โ
ts
import { fromRlp } from 'viem'
Usage โ
ts
import { fromRlp } from 'viem'
fromRlp('0x850123456789', 'hex')
// "0x123456789"
fromRlp('0xc67f7f838081e8', 'hex')
// ['0x7f', '0x7f', '0x8081e8']
fromRlp('0x89010203040506070809', 'bytes')
// Uint8Array [1, 2, 3, 4, 5, 6, 7, 8, 9]
fromRlp(new Uint8Array ([133, 1, 35, 69, 103, 137]), 'hex')
// "0x123456789"
Returns โ
Hex | ByteArray
The hex value or byte array.
Parameters โ
value โ
- Type:
Hex | ByteArray
The RLP value to decode.
to โ
- Type:
"bytes" | "hex"
The output type.