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

# EVM Gas Sponsorship

> Sponsor EVM transaction fees for your users with Dynamic's built-in gas sponsorship feature.

> [!NOTE]
>
> EVM Gas Sponsorship on testnets is available on every plan. Sponsoring mainnet transactions requires an Enterprise plan. [Contact us](https://www.dynamic.xyz/talk-to-us) to learn more about upgrading your plan.

Normally, a user needs to hold some of a network's native token, such as ETH, to pay the gas fee on every transaction. Gas sponsorship lets your app pay those fees instead, so users can transact without topping up a wallet.

> [!NOTE]
>
> EVM Gas Sponsorship works only with V3 MPC embedded wallets. It does not work with external wallets such as MetaMask.

## Quick start

**1. Turn on gas sponsorship in the Dynamic Console**

1. Go to the [Dynamic Console](https://console.dynamic.xyz).
2. Open the [smart wallets settings](https://console.dynamic.xyz/dashboard/smart-wallets).
3. Make sure the EVM chains you want to sponsor are enabled.
4. Enable EVM gas sponsorship, then choose which of the [supported networks](https://www.dynamic.xyz/docs/embedded-wallets/gas-sponsorship.md#supported-chains) to sponsor.

**2. Send a sponsored transaction**

Call `sendSponsoredTransaction` on `DynamicSDK.instance().evm` with a list of `EarnSponsoredCall` values and the user's wallet. It returns the relayed transaction hash.

```swift theme={"system"}
import DynamicSDKSwift

let sdk = DynamicSDK.instance()

func sendSponsoredTransaction(
    wallet: BaseWallet,
    recipientAddress: String
) async throws -> String {
    try await sdk.evm.sendSponsoredTransaction(
        calls: [
            EarnSponsoredCall(
                target: recipientAddress,
                data: "0x",
                value: "10000000000000000"
            )
        ],
        wallet: wallet
    )
}
```

The user pays no gas, and the first sponsored transaction handles the one-time EIP-7702 delegation setup automatically.

## What goes in `calls`

Each `EarnSponsoredCall` describes one action the transaction performs.

| Field | Type | Description |
| - | - | - |
| `target` | `String` | The recipient or contract address the call targets. |
| `data` | `String` | The ABI-encoded action to run on the target. Use `"0x"` for a plain native-token transfer. |
| `value` | `String` | The amount of native token to send with the call, in wei as a decimal string. Use `"0"` for none. |

Gas fields are intentionally absent from a sponsored call because the relayer funds gas.

## Batch calls

A sponsored transaction can carry multiple calls. The calls execute atomically in order: either every call succeeds or the transaction reverts. The following example approves an ERC-20 spend and then calls the spender contract in one sponsored transaction:

```swift theme={"system"}
import DynamicSDKSwift
import SwiftBigInt

let sdk = DynamicSDK.instance()

func approveAndDeposit(
    wallet: BaseWallet,
    tokenAddress: String,
    spenderAddress: String,
    amount: BigUInt,
    depositCalldata: String
) async throws -> String {
    let approveData = Erc20.encodeApprove(
        spender: spenderAddress,
        amount: amount
    )

    return try await sdk.evm.sendSponsoredTransaction(
        calls: [
            EarnSponsoredCall(
                target: tokenAddress,
                data: approveData,
                value: "0"
            ),
            EarnSponsoredCall(
                target: spenderAddress,
                data: depositCalldata,
                value: "0"
            )
        ],
        wallet: wallet
    )
}
```

Use `erc20Allowance` to read the allowance a spender already holds, so you can skip an approval the wallet already granted:

```swift theme={"system"}
let allowance = try await sdk.evm.erc20Allowance(
    token: tokenAddress,
    owner: wallet.address,
    spender: spenderAddress,
    chainId: 8453
)
```

## Check sponsorship availability

`isGasSponsorshipEnabled` reports whether the environment can sponsor EVM transactions. Use it before building a sponsored flow, and keep a wallet-paid path for when it returns `false`:

```swift theme={"system"}
if try await sdk.evm.isGasSponsorshipEnabled() {
    let hash = try await sdk.evm.sendSponsoredTransaction(
        calls: calls,
        wallet: wallet
    )
} else {
    // Fall back to sendTransaction with gas fields.
}
```

## Earn integration

When [Earn](https://www.dynamic.xyz/docs/swift/earn.md) executes an EVM vault action, its `sponsored` parameter routes the approval and vault call through gas sponsorship automatically. See [Gas sponsorship](https://www.dynamic.xyz/docs/swift/earn.md#gas-sponsorship) in the Earn guide.

## Next steps

* [SVM Gas Sponsorship](https://www.dynamic.xyz/docs/swift/wallets/solana/svm-gas-sponsorship.md) - Sponsor Solana transaction fees.
* [Earn](https://www.dynamic.xyz/docs/swift/earn.md) - Deposit into yield vaults with sponsored execution.
* [Send ETH](https://www.dynamic.xyz/docs/swift/wallets/evm/send-eth.md) - Send wallet-paid EVM transactions.


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