> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# signEip7702Authorization

# signEip7702Authorization

Signs an EIP-7702 authorization for ZeroDev kernel delegation. This function creates a signed authorization that allows a wallet to delegate its execution to the ZeroDev kernel contract.

The signed authorization can then be passed to `createKernelClientForWalletAccount` via the `eip7702Auth` parameter. This is useful for singleUse MFA flows where you need to separate the authorization signing step from the transaction step.

## Usage

```javascript theme={"system"}
import { signEip7702Authorization } from "@dynamic-labs-sdk/zerodev";
import { createKernelClientForWalletAccount } from "@dynamic-labs-sdk/zerodev";
import { isEvmWalletAccount } from "@dynamic-labs-sdk/evm";
import { getPrimaryWalletAccount } from "@dynamic-labs-sdk/client";

const walletAccount = getPrimaryWalletAccount();

if (walletAccount && isEvmWalletAccount(walletAccount)) {
  // Sign the EIP-7702 authorization
  const eip7702Auth = await signEip7702Authorization({
    smartWalletAccount: walletAccount,
  });

  // Use the authorization when creating the kernel client
  const kernelClient = await createKernelClientForWalletAccount({
    smartWalletAccount: walletAccount,
    eip7702Auth,
  });
}
```

## Parameters

| Parameter            | Type                       | Description                                                                          |
| -------------------- | -------------------------- | ------------------------------------------------------------------------------------ |
| `smartWalletAccount` | `EvmWalletAccount`         | The EVM smart wallet account to sign the authorization for                           |
| `networkId`          | `string` (optional)        | The network ID to use for signing. If not provided, uses the wallet's active network |
| `client`             | `DynamicClient` (optional) | The Dynamic client instance. Only required when using multiple clients.              |

## Returns

`Promise<SignAuthorizationReturnType>` - A promise that resolves to the signed EIP-7702 authorization.

## Examples

### Basic usage

```javascript theme={"system"}
const eip7702Auth = await signEip7702Authorization({
  smartWalletAccount: walletAccount,
});
```

### With specific network

```javascript theme={"system"}
const eip7702Auth = await signEip7702Authorization({
  smartWalletAccount: walletAccount,
  networkId: "137", // Polygon
});
```

### With singleUse MFA flow

This pattern is useful when you need to sign the authorization during an MFA step, then use it later for the transaction:

```javascript theme={"system"}
import { signEip7702Authorization, createKernelClientForWalletAccount } from "@dynamic-labs-sdk/zerodev";

// Step 1: Sign authorization (can be done during MFA verification)
const eip7702Auth = await signEip7702Authorization({
  smartWalletAccount: walletAccount,
});

// Step 2: Later, create kernel client with pre-signed authorization
const kernelClient = await createKernelClientForWalletAccount({
  smartWalletAccount: walletAccount,
  eip7702Auth,
});

// Step 3: Send transaction
const txHash = await kernelClient.sendTransaction({
  to: recipientAddress,
  value: parseEther("0.01"),
  data: "0x",
});
```

## Related functions

* [createKernelClientForWalletAccount](/javascript/reference/zerodev/create-kernel-client-for-wallet-account) - Create a ZeroDev Kernel client
* [getSignerForSmartWalletAccount](/javascript/reference/zerodev/get-signer-for-smart-wallet-account) - Get the signer for a smart wallet
