Skip to content

Calls.encode

Encodes a set of ERC-7821 calls.

Imports

Named
import { Calls } from 'ox/erc7821'

Examples

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

Definition

function encode(
  calls: readonly Call[],
  options?: encode.Options,
): `0x${string}`

Source: src/erc7821/Calls.ts

Parameters

calls

  • Type: readonly Call[]

Calls to encode.

calls.data

  • Type: 0x${string}
  • Optional

calls.to

  • Type: abitype_Address

calls.value

  • Type: bigintType
  • Optional

options

  • Type: encode.Options
  • Optional

Options for the encoding.

options.opData

  • Type: 0x${string}
  • Optional

Additional data to include for execution.

Return Type

The encoded calls.

0x${string}