Skip to main content

Try it Live

Run RLP examples in the interactive playground

BrandedRlp Type

BrandedRlp is the underlying branded type for RLP data structures used throughout Tevm’s RLP module.

Type Definition

export type BrandedRlp =
  | { type: "bytes"; value: Uint8Array }
  | { type: "list"; value: BrandedRlp[] };
Union type representing either:
  • BytesData: Leaf node containing raw bytes
  • ListData: Nested array of RLP data

Usage

Use through the Rlp class or imported functions:
import { Rlp } from 'tevm'

// Create RLP data
const bytes = Rlp(new Uint8Array([1, 2, 3]))
const list = Rlp([new Uint8Array([1]), new Uint8Array([2])])

// Check type
const isBytes = bytes.type === 'bytes'
const isList = list.type === 'list'

See Also