# Frame

Utilities for constructing, validating, and encoding [EIP-8141](https://eips.ethereum.org/EIPS/eip-8141) call frames.

A [`Frame.Frame`](/api/Frame/types#frame) describes a call with an execution mode, approval flags,
and separate execution and state gas limits.

## Examples

### Creating Frames

Use [`Frame.from`](/api/Frame/from) to construct a frame with named mode and flags.

```ts twoslash
import { Frame } from 'ox'

const frame = Frame.from({
  flags: 'approveExecutionAndPayment',
  gas: 50_000n,
  mode: 'verify'
})
```

## Functions

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Frame.assert`](/api/Frame/assert) | Asserts that a [`Frame.Frame`](/api/Frame/types#frame) satisfies frame-local constraints. |
| [`Frame.from`](/api/Frame/from) | Coerces a frame object into a [`Frame.Frame`](/api/Frame/types#frame). |
| [`Frame.fromRpc`](/api/Frame/fromRpc) | Converts an RPC frame to a frame. |
| [`Frame.fromTuple`](/api/Frame/fromTuple) | Converts a [`Frame.Tuple`](/api/Frame/types#tuple) to a [`Frame.Frame`](/api/Frame/types#frame). |
| [`Frame.toRpc`](/api/Frame/toRpc) | Converts a frame to its JSON-RPC representation. |
| [`Frame.toTuple`](/api/Frame/toTuple) | Converts a [`Frame.Frame`](/api/Frame/types#frame) to its RLP-ready [`Frame.Tuple`](/api/Frame/types#tuple). |
| [`Frame.validate`](/api/Frame/validate) | Returns whether a [`Frame.Frame`](/api/Frame/types#frame) satisfies frame-local constraints. |

## Errors

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Frame.InvalidError`](/api/Frame/errors#frameinvaliderror) | Thrown when an EIP-8141 frame is structurally invalid. |

## Types

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Frame.Flags`](/api/Frame/types#frameflags) | Numeric approval and batching bits, or a named flag value. |
| [`Frame.Frame`](/api/Frame/types#frameframe) | An EIP-8141 call frame. |
| [`Frame.Mode`](/api/Frame/types#framemode) | A numeric or named frame execution mode. |
| [`Frame.Rpc`](/api/Frame/types#framerpc) | JSON-RPC representation of a frame. |
| [`Frame.Tuple`](/api/Frame/types#frametuple) | RLP-ready frame tuple. Empty target bytes refer to the transaction sender. |
