> ## 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.

# delegatedSign7702Authorization

> Sign an EIP-7702 authorization for a delegated EVM wallet to enable gas-sponsored transactions.

`delegatedSign7702Authorization` signs an EIP-7702 authorization delegating the end user's EOA to the Dynamic gasless contract. Use it when you want to activate or replace the one-time delegation step yourself before sending sponsored transactions.

> [!NOTE]
>
> EVM Gas Sponsorship is an enterprise-only feature and works with V3 MPC embedded wallets only.

## Function signature

```typescript theme={"system"}
delegatedSign7702Authorization(
  client: DelegatedEvmWalletClient,
  params: {
    walletId: string;
    walletApiKey: string;
    keyShare: ServerKeyShare;
    walletAddress: Hex;
    userId: string;
    shareSetId?: string;
    chainId: number;
    nonce?: number;
    rpcUrl?: string;
  }
): Promise<SerializedAuthorization>
```

## Parameters

### Required

| Parameter | Type | Description |
| - | - | - |
| `client` | `DelegatedEvmWalletClient` | The delegated client from [`createDelegatedEvmWalletClient()`](https://docs.dynamic.xyz/docs/node/reference/evm/create-delegated-evm-wallet-client). |
| `walletId` | `string` | The wallet ID from the delegation webhook. |
| `walletApiKey` | `string` | The wallet-specific API key from the delegation webhook. |
| `keyShare` | `ServerKeyShare` | The delegated server key share from the delegation webhook. |
| `walletAddress` | `Hex` | The wallet's EOA address (`publicKey` from the webhook). |
| `userId` | `string` | UUID of the end user who owns the wallet. |
| `chainId` | `number` | Target chain ID. |

### Optional

| Parameter | Type | Description |
| - | - | - |
| `shareSetId` | `string` | The `shareSetId` from the `wallet.delegation.created` webhook payload. Omit and the server resolves the correct share set by wallet ID. |
| `nonce` | `number` | EOA nonce. Fetched from the chain via `rpcUrl` when omitted. |
| `rpcUrl` | `string` | RPC URL used to fetch the EOA nonce. Required when `nonce` is omitted. |

## Returns

`Promise<SerializedAuthorization>` — the signed EIP-7702 authorization. Pass it to [`delegatedSignSponsoredTransaction`](https://docs.dynamic.xyz/docs/node/reference/evm/delegated-sign-sponsored-transaction) or [`delegatedSendSponsoredTransaction`](https://docs.dynamic.xyz/docs/node/reference/evm/delegated-send-sponsored-transaction) as `authorization`.

## Example

```typescript theme={"system"}
import {
  createDelegatedEvmWalletClient,
  delegatedSign7702Authorization,
  delegatedSendSponsoredTransaction,
} from '@dynamic-labs-wallet/node-evm';
import { parseEther } from 'viem';

const client = createDelegatedEvmWalletClient({
  environmentId: process.env.DYNAMIC_ENVIRONMENT_ID,
  apiKey: process.env.DYNAMIC_SERVER_API_KEY,
});

const endUser = { id: 'user-uuid' };
const recipientAddress = '0xRecipientAddress';
// Replace with the decrypted delegation payload from your webhook handler
const credentials = {
  walletId: 'wallet-id',
  walletApiKey: 'wallet-api-key',
  keyShare: 'encrypted-key-share',
  publicKey: '0xWalletAddress',
};

const authorization = await delegatedSign7702Authorization(client, {
  walletId: credentials.walletId,
  walletApiKey: credentials.walletApiKey,
  keyShare: credentials.keyShare,
  walletAddress: credentials.publicKey,
  userId: endUser.id,
  chainId: 8453,
  rpcUrl: process.env.BASE_RPC_URL,
});

const { transactionHash } = await delegatedSendSponsoredTransaction(client, {
  walletId: credentials.walletId,
  walletApiKey: credentials.walletApiKey,
  keyShare: credentials.keyShare,
  walletAddress: credentials.publicKey,
  userId: endUser.id,
  chainId: 8453,
  calls: [{
    target: recipientAddress,
    data: '0x',
    value: parseEther('0.01'),
  }],
  authorization,
});
```

## Related

* [`delegatedSendSponsoredTransaction`](https://docs.dynamic.xyz/docs/node/reference/evm/delegated-send-sponsored-transaction) — sign, relay, and wait in one call
* [`delegatedSignSponsoredTransaction`](https://docs.dynamic.xyz/docs/node/reference/evm/delegated-sign-sponsored-transaction) — sign a sponsored intent without relaying
* [EVM Gas Sponsorship](https://docs.dynamic.xyz/docs/node/wallets/server-wallets/gas-sponsorship-evm.md) — full guide


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.