Skip to main content
Use isSolanaGasSponsorshipEnabled to check if SVM gas sponsorship is enabled in your project settings before attempting to send sponsored transactions.

Usage

import { isSolanaGasSponsorshipEnabled } from '@dynamic-labs-sdk/solana';

const sendTransaction = async (walletAccount, transaction) => {
  if (isSolanaGasSponsorshipEnabled()) {
    // Use sponsored transaction
    const { signature } = await signAndSendSponsoredTransaction({
      transaction,
      walletAccount,
    });
    return signature;
  }

  // Fall back to regular transaction
  const { signature } = await signAndSendTransaction({
    transaction,
    walletAccount,
  });
  return signature;
};

Return value

TypeDescription
booleantrue if SVM gas sponsorship is enabled, false otherwise

Requirements

  • A Dynamic Client must be initialized before calling this function
  • SVM gas sponsorship must be enabled in the Dynamic Dashboard under Settings > Embedded Wallets