SVM gas sponsorship is an enterprise-only feature. Contact Dynamic to learn more about upgrading your plan.
- Require KYC or another verification before sponsoring a user.
- Apply custom rate limits or budgets per user or per wallet.
- Enforce custom preconditions for each user or wallet, such as a plan tier, a region, or an existing balance.
- Sponsor only specific actions, such as a swap through a route you approve, and reject everything else.
The example below uses the JavaScript client SDK to sign and broadcast and the Node server SDK to build and sponsor. It builds a swap from a LI.FI quote, so the transaction comes straight from the API and your server never assembles instructions by hand.
How it works
- Your backend builds the transaction, validates it and the user, and asks Dynamic to sponsor it on behalf of that user.
- Dynamic returns the transaction with the sponsor as fee payer and the sponsor’s signature already in place.
- The client signs the transaction as the user and broadcasts it.
1. Restrict sponsorship to your server
First, make sure SVM gas sponsorship is enabled for your environment. In the Dynamic Console, go to Sponsor Gas → Dynamic and enable Sponsor Network Fees (Solana), with Solana enabled in your embedded wallet chain configuration. Then, in the same card, turn on Restrict sponsorship to server-side requests. With it on, only your server can request sponsorship for Solana transactions. The change reaches end users the next time their app loads. While the setting is on, client SDKs stop requesting sponsorship, so a transaction your app sends without going through your backend is paid for by the user.2. Build the transaction on your backend
Authenticate the Node SDK with your environment API token. Read the sponsor address withgetSponsorAddress and pass it to LI.FI as svmSponsor. LI.FI then builds the transaction with the sponsor as fee payer, so the quote you get back is ready to sponsor as is.
This example swaps 0.05 SOL for USDC. Both getSponsorAddress and the userId option of sponsorTransaction used later require @dynamic-labs-wallet/node-svm version 1.1.64 or later.
x-lifi-api-key header for higher rate limits. You can create one on the LI.FI Partner Portal.
3. Validate on your backend
Before asking for sponsorship, apply your own rules to the user and to the transaction. The checks below are your business policy. Dynamic separately verifies that the wallet signing the transaction belongs to theuserId you send, in your environment.
4. Sponsor on behalf of the user
Authenticate the request, derive the user and wallet on the server, run your checks, and callsponsorTransaction with the user’s userId. Dynamic returns the transaction with the sponsor’s signature. The user’s signature slot stays empty.
userId tells Dynamic which end user the transaction is for. The wallet that signs the transaction must belong to that user in your environment, and Dynamic rejects the request otherwise. Omit userId only when you sponsor transactions signed by your own server wallets.
5. Sign and broadcast on the client
The client requests the sponsored transaction from your API, signs it with the user’s wallet, and broadcasts it.Related
- SVM Gas Sponsorship: the default client-side flow and setup.
- Signing and Sending Transactions:
signTransactionand the other Solana signing functions. - Getting Solana Connection: create a connection from a wallet account’s network.
- sponsorTransaction: the Node SDK method that sponsors a transaction for a user.
- getSponsorAddress: read the sponsor address to build transactions that name it as fee payer.
- EVM Server-Controlled Sponsorship: the same pattern for EVM chains.