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

# delegatedSendSponsoredTransaction

> Sign, relay, and wait for a gas-sponsored EVM transaction on behalf of a delegated wallet's owner.

`delegatedSendSponsoredTransaction` signs an EIP-712 `AuthorizedExecutions` intent for a batch of calls, relays it to Dynamic's sponsorship backend, and polls until the transaction lands on-chain. Use it when you hold a user's delegated key share and want the transaction to be gas-sponsored.

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

## Function signature

```typescript theme={"system"}
delegatedSendSponsoredTransaction(
  client: DelegatedEvmWalletClient,
  params: {
    walletId: string;
    walletApiKey: string;
    keyShare: ServerKeyShare;
    walletAddress: Hex;
    userId: string;
    shareSetId?: string;
    chainId: number;
    rpcUrl?: string;
    calls: SponsoredTransactionCall[];
    authorization?: SerializedAuthorization;
    autoDelegate?: boolean;
    nonce?: bigint;
    validForSeconds?: number;
    traceContext?: TraceContext;
  }
): Promise<{ transactionHash: Hex }>
```

## 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. Required for relay attribution. |
| `chainId` | `number` | Target chain ID. |
| `calls` | `SponsoredTransactionCall[]` | The batch of calls to execute. |

### 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. |
| `rpcUrl` | `string` | RPC URL used to read the wallet's delegation state and EOA nonce. Required on first use unless you pass a pre-signed `authorization`. |
| `authorization` | `SerializedAuthorization` | Pre-signed EIP-7702 authorization. Takes priority over `autoDelegate`. |
| `autoDelegate` | `boolean` | Whether to auto-sign an EIP-7702 authorization when the wallet is not delegated. Defaults to `true`. |
| `nonce` | `bigint` | Bitmap nonce for the signed intent. A random unused one is generated when omitted. |
| `validForSeconds` | `number` | How long the signed intent stays valid. Defaults to `600` (10 minutes). |
| `traceContext` | `TraceContext` | Distributed tracing context. |

Each entry in `calls` is a `SponsoredTransactionCall`:

| Field | Type | Description |
| - | - | - |
| `target` | `Hex` | The address you are sending to or the contract to call. |
| `data` | `Hex` | Calldata to execute on the target. Use `0x` for a plain native-token transfer. |
| `value` | `bigint` | Amount of native token (in wei) to send with the call. |

## Returns

`Promise<{ transactionHash: Hex }>` — the on-chain transaction hash once the relay reports success.

## Example

```typescript theme={"system"}
import {
  createDelegatedEvmWalletClient,
  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 { transactionHash } = await delegatedSendSponsoredTransaction(client, {
  walletId: credentials.walletId,
  walletApiKey: credentials.walletApiKey,
  keyShare: credentials.keyShare,
  walletAddress: credentials.publicKey,
  userId: endUser.id,
  chainId: 8453,
  rpcUrl: process.env.BASE_RPC_URL,
  calls: [{
    target: recipientAddress,
    data: '0x',
    value: parseEther('0.01'),
  }],
});

console.log('Sponsored transaction confirmed:', transactionHash);
```

## Splitting sign and send

To sign in one process and relay from another, call [`delegatedSignSponsoredTransaction`](https://docs.dynamic.xyz/docs/node/reference/evm/delegated-sign-sponsored-transaction) first and pass the returned `SignedSponsoredTransaction` to `sendSponsoredTransaction` on a `DynamicEvmWalletClient` with `userId`.

## Error handling

If sponsorship cannot go through, `delegatedSendSponsoredTransaction` throws. Wrap the call in a `try/catch` so you can surface a message and decide what to do next.

```typescript theme={"system"}
try {
  const { transactionHash } = await delegatedSendSponsoredTransaction(client, params);
} catch (error) {
  console.error('Sponsorship failed:', error.message);
}
```

## Related

* [`delegatedSignSponsoredTransaction`](https://docs.dynamic.xyz/docs/node/reference/evm/delegated-sign-sponsored-transaction) — sign a sponsored intent without relaying
* [`delegatedSign7702Authorization`](https://docs.dynamic.xyz/docs/node/reference/evm/delegated-sign-7702-authorization) — manage the one-time EIP-7702 delegation step
* [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.