SVM Gas Sponsorship is Dynamic’s built-in feature that automatically sponsors Solana (SVM) transaction fees for embedded wallet users.
SVM Gas Sponsorship is available exclusively for V3 MPC embedded wallets. It works automatically once enabled - no code changes required.
Overview
When enabled in your dashboard, the SDK automatically:
- Intercepts transactions before signing
- Sends them to Dynamic’s backend for sponsorship
- Returns a sponsored transaction with Dynamic as the fee payer
- User signs the sponsored transaction
- Transaction is broadcast to the network
- Go to the Dynamic Dashboard
- Navigate to Settings > Embedded Wallets
- Ensure Solana (SOL) is enabled in your chain configurations
- Toggle on SVM Gas Sponsorship
Usage
Once enabled, transactions are automatically sponsored. No code changes needed:
import { signAndSendTransaction } from '@dynamic-labs-sdk/solana';
// Transaction is automatically sponsored if feature is enabled
const sendTransaction = async (walletAccount, transaction) => {
const { signature } = await signAndSendTransaction({
transaction,
walletAccount
});
console.log('Transaction sent successfully.', signature);
};
import { getDynamicClient } from '@dynamic-labs-sdk/core';
const client = getDynamicClient();
const settings = client.getProjectSettings();
const sponsorshipEnabled = settings?.sdk?.embeddedWallets?.svmGasSponsorshipEnabled ?? false;
console.log('SVM Gas Sponsorship:', sponsorshipEnabled ? 'Enabled' : 'Disabled');
Limitations
| Limitation | Details |
|---|
| Wallet type | Embedded wallets only (V3 MPC) |
| Transaction size | Maximum 2KB base64-encoded |
| Already-signed | Transactions with signatures are not sponsored |
| Batching | Each transaction sponsored individually |
Fallback Behavior
If sponsorship fails, the SDK falls back to the original transaction. Users will need SOL for gas fees in this case.
Error Handling
import { signAndSendTransaction } from '@dynamic-labs-sdk/solana';
const sendTransactionWithFallback = async (walletAccount, transaction) => {
try {
const { signature } = await signAndSendTransaction({
transaction,
walletAccount
});
return { success: true, signature };
} catch (error) {
const errorMessage = error.message?.toLowerCase() || '';
if (errorMessage.includes('insufficient')) {
return {
success: false,
error: 'Insufficient balance for transaction'
};
} else if (errorMessage.includes('sponsor')) {
return {
success: false,
error: 'Gas sponsorship failed, SOL required for fees'
};
}
return { success: false, error: error.message };
}
};