Skip to content

Calls.decode

Decodes a set of ERC-7821 calls from encoded data.

Imports

Named
import { Calls } from 'ox/erc7821'

Examples

import { Calls } from 'ox/erc7821'
 
const data = Calls.decode('0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000cafebabecafebabecafebabecafebabecafebabe000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000004deadbeef00000000000000000000000000000000000000000000000000000000000000000000000000000000deadbeefdeadbeefdeadbeefdeadbeefdeadbeef000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000004cafebabe00000000000000000000000000000000000000000000000000000000')
{
calls: [
{
data: '0xdeadbeef',
to: '0xcafebabecafebabecafebabecafebabecafebabe',
value: 1n,
},
{
data: '0xcafebabe',
to: '0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef',
value: 2n,
},
]
}

Definition

function decode(
  data: Hex.Hex,
  options?: decode.Options,
): decode.ReturnType

Source: src/erc7821/Calls.ts

Parameters

data

  • Type: Hex.Hex

The encoded calls data.

options

  • Type: decode.Options
  • Optional

Options for decoding.

options.opData

  • Type: boolean
  • Optional

Whether to decode opData if present.

Return Type

The decoded calls and optional opData.

decode.ReturnType