Skip to content

Execute

Utility functions for encoding and decoding ERC-7821 execute function data.

Examples

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

Encoding execute Function Data

The execute function data can be encoded using Execute.encodeData.

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

Decoding execute Function Data

The execute function data can be decoded using Execute.decodeData.

import { Execute } from 'ox/erc7821'
 
const { calls } = Execute.decodeData('0xe9ae5c53...')

Functions

NameDescription
Execute.decodeBatchOfBatchesDataDecodes batches from ERC-7821 execute function data in "batch of batches" mode.
Execute.decodeDataDecodes calls from ERC-7821 execute function data.
Execute.encodeBatchOfBatchesDataEncodes calls for the ERC-7821 execute function with "batch of batches" mode.
Execute.encodeDataEncodes calls for the ERC-7821 execute function.

Types

NameDescription
Execute.Batch
Execute.Call