To sponsor gas fees for transactions on Solana, see our guide here.

When sending a transaction from an embedded wallet, you can customize the signature prompt by using Privy’s native sendTransaction method.

In addition to signing messages, you can sign and send transactions on the Solana blockchain. Privy supports both legacy and v0 (versioned) transactions.

sendTransaction(transaction: Transaction): Promise<Transaction>;

As an example, you can send a transaction on Solana with connected Solana external and embedded wallets like so:

import {PublicKey, Transaction, Connection, SystemProgram} from '@solana/web3.js';
import {useSolanaWallets} from '@privy-io/react-auth';

...

// The rest of this code must be placed within a React component
// Get Solana wallet
const {ready, wallets} = useSolanaWallets();
const wallet = wallets[0];

// Build transaction request. You should adapt this logic for the particular
// type of transaction you need.
if (!ready || !wallet) return;

// Configure your connection to point to the correct Solana network
let connection = new Connection(clusterApiUrl('devnet'));

// Build out the transaction object for your desired program
// https://solana-labs.github.io/solana-web3.js/classes/Transaction.html
let transaction = new Transaction();

// Send transaction
console.log(await wallet.sendTransaction!(transaction, connection));