Skip to content

Frame.validate

Returns whether a Frame.Frame satisfies frame-local constraints.

Performs the same checks as Frame.assert, returning false instead of throwing when the frame is invalid.

Imports

Named
import { Frame } from 'ox'

Examples

Basic Usage

Check whether a frame is structurally valid.

import { Frame } from 'ox'
 
const valid = Frame.validate({
  executionGas: 50_000n,
  flags: 'approveExecutionAndPayment',
  mode: 'verify'
})
true

Definition

function validate(
  frame: Frame,
): boolean

Source: src/core/Frame.ts

Parameters

frame

  • Type: Frame

The frame to validate.

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

Whether the frame satisfies frame-local constraints.

boolean