Skip to content

Frame.toTuple

Converts a Frame.Frame to its RLP-ready Frame.Tuple.

Named mode and flags are encoded as integers. An omitted target and zero integer fields are encoded as empty bytes. Omitted mode and flags default to zero; omitted gas limits and value default to 0n, and data defaults to '0x'.

Imports

Named
import { Frame } from 'ox'

Examples

Basic Usage

Encode a verification frame in the field order required by EIP-8141.

import { Frame } from 'ox'
 
const tuple = Frame.toTuple({
  executionGas: 50_000n,
  flags: 'approveExecutionAndPayment',
  mode: 'verify'
})
['0x01', '0x03', '0x', ['0xc350', '0x'], '0x', '0x']

Definition

function toTuple(
  frame: Frame,
): Tuple

Source: src/core/Frame.ts

Parameters

frame

  • Type: Frame

The frame to convert.

frame.data

  • Type: 0x${string}
  • Optional

Frame calldata.

frame.executionGas

  • Type: bigintType
  • Optional

Execution gas budget.

frame.flags

  • Type: Flags
  • Optional

Approval scope and atomic batching bits.

frame.mode

  • Type: Mode
  • Optional

Execution context: default, verify, or sender.

frame.stateGas

  • Type: bigintType
  • Optional

State gas budget.

frame.to

  • Type: Address.Address | undefined
  • Optional

Target address. Omit to target the transaction sender.

frame.value

  • Type: bigintType
  • Optional

Value transferred by a sender frame, in wei.

Return Type

The encoded frame tuple.

Tuple