# Execute

> Documentation index: [llms.txt](https://namera.ai/llms.txt).

Source: https://namera.ai/docs/sdk/reference/executions/execute

Prepare, authorize, and submit one or more EVM calls.

`namera.executions.execute(request)` validates and signs the prepared operation, then queues it for broadcast. Each invocation starts a new submission.

## Usage [#usage]

Install `@namera-ai/sdk` and `viem`. Replace the example IDs and recipient with your own. The selected session must permit these calls on Base Sepolia.

<Tabs items={["index.ts", "client.ts"]}>
<Tab value="index.ts">

```ts title="index.ts"
import { namera } from "./client";
import { parseEther } from "viem";

const execution = await namera.executions.execute({
  namespace: "eip155",
  walletId: "0199dfe1-0000-7000-8000-000000000001",
  sessionKeyId: "0199dfe1-0000-7000-8000-000000000002",
  chainId: "eip155:84532",
  calls: [
    {
      to: "0x2222222222222222222222222222222222222222",
      value: parseEther("0.001"),
      data: "0x",
    },
  ],
  sponsor: true,
});

if (!execution.success) throw new Error(execution.error.message);

console.log(execution.data);
```

</Tab>
<Tab value="client.ts">

```ts title="client.ts"
import { NameraClient } from "@namera-ai/sdk";

export const namera = new NameraClient({
  apiKey: process.env.NAMERA_API_KEY!,
});
```

</Tab>
</Tabs>

## Returns [#returns]

API methods return a `Promise<NameraResult<T, E>>`. When `success` is `true`,
`data` contains the value described below and `error` is `null`. On failure,
`data` is `null` and `error` describes the failure.

The JSON example shows the complete successful `data`, with illustrative values.
Date-time values use ISO strings in JSON; bigint values use decimal strings.
See [Handling Results and Errors](https://namera.ai/docs/sdk/handling-results-and-errors) for the error shape.

- **`namespace`** (`"eip155"`): Chain namespace.
- **`submissionId`** (`string`): ID to pass to executions.getStatus().
- **`status`** (`"prepared" | "submitted" | "confirmed" | "failed"`): Current submission state. Prepared is queued, not confirmed.
- **`userOperationHash`** (`` `0x${string}` ``): ERC-4337 user-operation hash, not a transaction hash.

### Example Response [#example-response]

<div className="docs-response">

```json
{
  "namespace": "eip155",
  "submissionId": "0199dfe1-0000-7000-8000-000000000003",
  "status": "prepared",
  "userOperationHash": "0x1111111111111111111111111111111111111111111111111111111111111111"
}
```

</div>

## Parameters [#parameters]

Pass an `ExecuteRequest` object. Fields below are required unless marked optional.

### namespace [#namespace]

- **Type:** `"eip155"`
- **Required**

The blockchain namespace. Use `"eip155"` for every currently supported Namera
network. This is not a chain ID; select the specific network with `chainId`.

```ts title="index.ts"
import { namera } from "./client";
import { parseEther } from "viem";

const execution = await namera.executions.execute({
  namespace: "eip155", // [!code focus]
  walletId: "0199dfe1-0000-7000-8000-000000000001",
  sessionKeyId: "0199dfe1-0000-7000-8000-000000000002",
  chainId: "eip155:84532",
  calls: [
    {
      to: "0x2222222222222222222222222222222222222222",
      value: parseEther("0.001"),
      data: "0x",
    },
  ],
  sponsor: true,
});

if (!execution.success) throw new Error(execution.error.message);

console.log(execution.data);
```

### walletId [#walletid]

- **Type:** `string`
- **Required**

The account UUID returned by `wallets.list()` or `wallets.get()`. Pass its `id`,
not its onchain `address`. The account must be accessible to the client’s credential.

```ts title="index.ts"
import { namera } from "./client";
import { parseEther } from "viem";

const execution = await namera.executions.execute({
  namespace: "eip155",
  walletId: "0199dfe1-0000-7000-8000-000000000001", // [!code focus]
  sessionKeyId: "0199dfe1-0000-7000-8000-000000000002",
  chainId: "eip155:84532",
  calls: [
    {
      to: "0x2222222222222222222222222222222222222222",
      value: parseEther("0.001"),
      data: "0x",
    },
  ],
  sponsor: true,
});

if (!execution.success) throw new Error(execution.error.message);

console.log(execution.data);
```

### sessionKeyId [#sessionkeyid]

- **Type:** `string`
- **Required**

The session-key UUID returned by `sessionKeys.list()` or `sessionKeys.get()`.
This identifies the delegated session, not its signing key or network installation.
Your credential must have an active grant for this key.

For execution or signing, choose a key belonging to `walletId` with a confirmed
installation on `chainId` and permissions that allow the requested operation.

```ts title="index.ts"
import { namera } from "./client";
import { parseEther } from "viem";

const execution = await namera.executions.execute({
  namespace: "eip155",
  walletId: "0199dfe1-0000-7000-8000-000000000001",
  sessionKeyId: "0199dfe1-0000-7000-8000-000000000002", // [!code focus]
  chainId: "eip155:84532",
  calls: [
    {
      to: "0x2222222222222222222222222222222222222222",
      value: parseEther("0.001"),
      data: "0x",
    },
  ],
  sponsor: true,
});

if (!execution.success) throw new Error(execution.error.message);

console.log(execution.data);
```

### chainId [#chainid]

- **Type:** `SupportedEvmChainId`
- **Required**

The target network in CAIP-2 format. For Base Sepolia, use `"eip155:84532"`,
not `84532` or `"84532"`. Use the network on which the account will execute, sign, or verify the payload.

The SDK restricts this field to the [supported network IDs](https://namera.ai/docs/sdk/supported-networks).
Network availability is also checked by the API.

```ts title="index.ts"
import { namera } from "./client";
import { parseEther } from "viem";

const execution = await namera.executions.execute({
  namespace: "eip155",
  walletId: "0199dfe1-0000-7000-8000-000000000001",
  sessionKeyId: "0199dfe1-0000-7000-8000-000000000002",
  chainId: "eip155:84532", // [!code focus]
  calls: [
    {
      to: "0x2222222222222222222222222222222222222222",
      value: parseEther("0.001"),
      data: "0x",
    },
  ],
  sponsor: true,
});

if (!execution.success) throw new Error(execution.error.message);

console.log(execution.data);
```

### calls [#calls]

- **Type:** `readonly { to: EthereumAddress; value: bigint; data: Hex }[]`
- **Required**

One or more EVM calls, in execution order. Every call uses the same account,
network, and session key. Supply all three fields on each call; there are no
implicit values for `value` or `data`.

```ts title="index.ts"
import { namera } from "./client";
import { parseEther } from "viem";

const execution = await namera.executions.execute({
  namespace: "eip155",
  walletId: "0199dfe1-0000-7000-8000-000000000001",
  sessionKeyId: "0199dfe1-0000-7000-8000-000000000002",
  chainId: "eip155:84532",
  calls: [
    {
      to: "0x2222222222222222222222222222222222222222",
      value: parseEther("0.001"), // [!code focus]
      data: "0x",
    },
  ],
  sponsor: true,
});

if (!execution.success) throw new Error(execution.error.message);

console.log(execution.data);
```

#### calls.to [#callsto]

- **Type:** `EthereumAddress` (`` `0x${string}` ``)
- **Required**

The 20-byte recipient or contract address. Native transfers target the recipient;
contract calls target the contract, not the recipient encoded in its arguments.
The session’s permissions must allow this target.

```ts title="index.ts"
import { namera } from "./client";
import { parseEther } from "viem";

const execution = await namera.executions.execute({
  namespace: "eip155",
  walletId: "0199dfe1-0000-7000-8000-000000000001",
  sessionKeyId: "0199dfe1-0000-7000-8000-000000000002",
  chainId: "eip155:84532",
  calls: [
    {
      to: "0x2222222222222222222222222222222222222222", // [!code focus]
      value: parseEther("0.001"),
      data: "0x",
    },
  ],
  sponsor: true,
});

if (!execution.success) throw new Error(execution.error.message);

console.log(execution.data);
```

#### calls.value [#callsvalue]

- **Type:** `bigint`
- **Required**

The native-token amount in wei. Use `parseEther("0.001")` for 0.001 ETH or `0n`
for a call that sends no native tokens. Negative amounts are rejected. ERC-20
amounts belong in encoded calldata, not this field.

```ts title="index.ts"
import { namera } from "./client";
import { parseEther } from "viem";

const execution = await namera.executions.execute({
  namespace: "eip155",
  walletId: "0199dfe1-0000-7000-8000-000000000001",
  sessionKeyId: "0199dfe1-0000-7000-8000-000000000002",
  chainId: "eip155:84532",
  calls: [
    {
      to: "0x2222222222222222222222222222222222222222",
      value: parseEther("0.001"), // [!code focus]
      data: "0x",
    },
  ],
  sponsor: true,
});

if (!execution.success) throw new Error(execution.error.message);

console.log(execution.data);
```

#### calls.data [#callsdata]

- **Type:** `Hex` (`` `0x${string}` ``)
- **Required**

The encoded contract call. Use `"0x"` for a native transfer. For contract functions,
use viem’s `encodeFunctionData`; the SDK does not accept `abi`, `functionName`, or
`args` directly in a call.

```ts title="index.ts"
import { namera } from "./client";
import { encodeFunctionData, erc20Abi, parseUnits } from "viem";

const result = await namera.executions.execute({
  namespace: "eip155",
  walletId: "0199dfe1-0000-7000-8000-000000000001",
  sessionKeyId: "0199dfe1-0000-7000-8000-000000000002",
  chainId: "eip155:84532",
  calls: [
    {
      to: "0x3333333333333333333333333333333333333333",
      value: 0n,
      data: encodeFunctionData({
        // [!code focus:5]
        abi: erc20Abi,
        functionName: "transfer",
        args: ["0x2222222222222222222222222222222222222222", parseUnits("1", 6)],
      }),
    },
  ],
});
if (!result.success) throw new Error(result.error.message);

console.log(result.data);
```

This encodes a transfer of one token with six decimals. Use your token’s actual
decimals and pass its contract address as `to`.

### sponsor [#sponsor]

- **Type:** `boolean`
- **Optional**
- **Default:** `true`

Sponsorship covers gas, not transferred assets, and remains subject to workspace allowances and policies.

Set `false` to pay from the account. Fund both the transfer and gas, and configure [maxGasCostWei](https://namera.ai/docs/sdk/reference/client/namera-client#maxgascostwei). A custom signer must carry its own fee ceiling.

See [Sponsor Gas](https://namera.ai/docs/sdk/guides/transactions/sponsor-gas) for a complete self-funded example.

```ts title="index.ts"
import { namera } from "./client";
import { parseEther } from "viem";

const execution = await namera.executions.execute({
  namespace: "eip155",
  walletId: "0199dfe1-0000-7000-8000-000000000001",
  sessionKeyId: "0199dfe1-0000-7000-8000-000000000002",
  chainId: "eip155:84532",
  calls: [
    {
      to: "0x2222222222222222222222222222222222222222",
      value: parseEther("0.001"),
      data: "0x",
    },
  ],
  sponsor: true, // [!code focus]
});

if (!execution.success) throw new Error(execution.error.message);

console.log(execution.data);
```

## Behavior [#behavior]

Use [Get Submission Status](https://namera.ai/docs/sdk/reference/executions/get-submission-status) to track this submission. Do not call execute again to poll. Internal preparation retries reuse one idempotency key; completion retries reuse the same submission.

## Errors [#errors]

Policy, authorization, billing, and execution failures return `success: false`. Prepared-operation validation failures use `kind: "signer"`. See [Handling Results and Errors](https://namera.ai/docs/sdk/handling-results-and-errors)
for authentication, transport, and contract errors.

Guide: [Transfer Assets](https://namera.ai/docs/sdk/guides/transactions/transfer-assets).
