Rlp.from
Encodes a Bytes.Bytes
or Hex.Hex
value into a Recursive-Length Prefix (RLP) value.
Imports
Named
import { Rlp } from 'ox'
Examples
import { Bytes, Rlp } from 'ox'
Rlp.from('0x68656c6c6f20776f726c64', { as: 'Hex' })
0x8b68656c6c6f20776f726c64 Rlp.from(Bytes.from([139, 104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]), { as: 'Bytes' })
Uint8Array([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100])
Definition
function from<as>(
value: RecursiveArray<Bytes.Bytes> | RecursiveArray<Hex.Hex>,
options: from.Options<as>,
): from.ReturnType<as>
Source: src/Rlp.ts
Parameters
value
- Type:
RecursiveArray<Bytes.Bytes> | RecursiveArray<Hex.Hex>
The Bytes.Bytes
or Hex.Hex
value to encode.
options
- Type:
from.Options<as>
Options.
options.as
- Type:
"Bytes" | "Hex" | as
The type to convert the RLP value to.
Return Type
The RLP value.
from.ReturnType<as>
Error Type
Rlp.from.ErrorType