Skip to content

Calls

Utility functions for encoding and decoding ERC-7821 calls.

Examples

Below are some examples demonstrating common usages of the Calls module:

Encoding calls

Calls can be encoded using Calls.encode.

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

Decoding calls

Calls can be decoded using Calls.decode.

import { Calls } from 'ox/erc7821'
 
const { calls } = Calls.decode('0x...')

Functions

NameDescription
Calls.decodeDecodes a set of ERC-7821 calls from encoded data.
Calls.encodeEncodes a set of ERC-7821 calls.
Calls.getAbiParametersGets the ABI parameters for the ERC-7821 calls.

Types

NameDescription
Calls.Call