# Execute

Utility functions for encoding and decoding [ERC-7821](https://eips.ethereum.org/EIPS/eip-7821) `execute` function data.

## Examples

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

* [Encoding `execute` Function Data](#encoding-`execute`-function-data)

* [Decoding `execute` Function Data](#decoding-`execute`-function-data)

### Encoding `execute` Function Data

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

```ts twoslash
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`.

```ts twoslash
import { Execute } from 'ox/erc7821'

const { calls } = Execute.decodeData('0xe9ae5c53...')
```

## Functions

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Execute.decodeBatchOfBatchesData`](/ercs/erc7821/Execute/decodeBatchOfBatchesData) | Decodes batches from ERC-7821 `execute` function data in "batch of batches" mode. |
| [`Execute.decodeData`](/ercs/erc7821/Execute/decodeData) | Decodes calls from ERC-7821 `execute` function data. |
| [`Execute.encodeBatchOfBatchesData`](/ercs/erc7821/Execute/encodeBatchOfBatchesData) | Encodes calls for the ERC-7821 `execute` function with "batch of batches" mode. |
| [`Execute.encodeData`](/ercs/erc7821/Execute/encodeData) | Encodes calls for the ERC-7821 `execute` function. |

## Types

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Execute.Batch`](/ercs/erc7821/Execute/types#executebatch) |  |
| [`Execute.Call`](/ercs/erc7821/Execute/types#executecall) |  |
