Recommended: JavaScript SDK with React Hooks
For new React apps, we recommend the JavaScript SDK with React Hooks (
@dynamic-labs-sdk/react-hooks) instead of the legacy React SDK documented here. The JS SDK comes with many benefits such as a much smaller bundle size and other optimizations. Use the React quickstart (JavaScript SDK) to get started.EVM Gas Sponsorship is available exclusively for V3 MPC embedded wallets. Contact us to enable it for your project.
How it works
A sponsored transaction is a batch of{ target, data, value } calls that Dynamic submits on-chain on the user’s behalf:
- The user’s embedded wallet signs an EIP-712 intent that authorizes the calls, binds them to a relayer address, and sets a deadline.
- The first time a wallet is sponsored, the SDK also signs an EIP-7702 authorization to delegate the EOA to Dynamic’s gasless delegation contract. After activation, the delegation persists on-chain and is reused on subsequent transactions.
- Dynamic’s relayer submits the transaction. The lifecycle is
pending→submitted→success(orfailure). The on-chain transaction hash is available once the relay reportssubmitted.
Prerequisites
Before you start, make sure you have:- A React app set up with
DynamicContextProviderandEthereumWalletConnectors. See the React quickstart. - V3 MPC embedded wallets enabled in Settings > Embedded Wallets in the Dynamic dashboard.
- EVM Gas Sponsorship enabled for your environment. Contact us to turn it on.
- The wallet’s active network is one of the supported chains below.
Supported chains
Dynamic operates relayers on the following EVM chains. Mainnet
Testnet
Setup
EVM gas sponsorship is exposed through@dynamic-labs-sdk/evm. Install it alongside the React-hooks package that lets you reactively read wallet accounts:
- npm
- yarn
- pnpm
- bun
DynamicContextProvider.
Check if sponsorship is enabled
isEvmGasSponsorshipEnabled returns synchronously based on the project settings already loaded by the SDK. Use it to gate UI before showing a “Send gasless” button.
Send a sponsored transaction
sendSponsoredTransaction signs the intent, hands it to the relayer, and resolves once the transaction is included on-chain. The calls array supports batches — every entry runs atomically.
Use useGetWalletAccounts from @dynamic-labs-sdk/react-hooks to reactively get the EVM embedded wallet:
Call shape
Each entry incalls describes a single call inside the sponsored batch:
For contract calls, encode
data with encodeFunctionData from viem:
Options
Pass these alongsidewalletAccount and calls:
Split signing and relaying
For retry, batching, or custom UI flows you can split the steps:signSponsoredTransactionreturns the signed intent without contacting the relayer.relaySponsoredTransactionsends a signed intent (or signs and sends in one step) and returns arequestId.waitForSponsoredTransactionpolls arequestIduntil the relay reports inclusion on-chain.getEVMSponsoredTransactionStatusdoes a one-shot status read for custom polling.
status.status is one of pending, submitted, success, or failure. status.transactionHash is populated once the relay reports submitted; status.errorMessage is populated on failure.
EIP-7702 delegation
The first sponsored transaction from a given wallet activates EIP-7702 delegation to Dynamic’s gasless contract. By defaultsendSponsoredTransaction and relaySponsoredTransaction handle this for you via autoDelegate: true. If you want to manage delegation explicitly — for example, to surface an “Enable gasless” button before the first transaction — use these functions directly.
Check delegation status
Sign a 7702 authorization
sign7702Authorization returns a signed authorization without broadcasting anything. Pass it to a later sendSponsoredTransaction, relaySponsoredTransaction, or activate7702Delegation call.
Activate delegation explicitly
activate7702Delegation sends a sponsored transaction whose only purpose is to activate the delegation on-chain. After it resolves, subsequent sponsored transactions skip the authorization step.
Error handling
Sponsorship failures throw aSponsorTransactionError — there is no silent fallback. The error is thrown when:
- The relay returns a terminal failure or polling times out.
- The sponsorship API rejects the request.
- The wallet provider does not support sponsored transactions (e.g. external wallets).
try/catch and surface a useful message to the user: