The Solana wallet adapter handles SPL USDC payments on Solana networks.
Quick setup
import { GalliunClient, createSolanaWalletAdapter } from "@galliun/sdk";
import { Connection } from "@solana/web3.js";
const connection = new Connection("https://api.devnet.solana.com");
const client = new GalliunClient({
baseUrl: "https://api.galliun.com",
chain: "solana",
wallet: createSolanaWalletAdapter(solanaSigner, connection),
});
Signer interface
interface SolanaWalletSigner {
publicKey: PublicKey;
sendTransaction: (tx: Transaction, connection: Connection) => Promise<string>;
signMessage?: (message: Uint8Array) => Promise<Uint8Array>;
}
Integrate with @solana/wallet-adapter-react or your preferred Solana wallet.
Built-in SPL USDC payment
createSolanaWalletAdapter(signer, connection) includes built-in SPL USDC transfer. The adapter:
- Constructs atomic SPL USDC split transfers (provider + platform fee legs)
- Signs and sends via
sendTransaction - Returns a payment proof with the transaction signature as
txHash
Custom pay override
import { createSolanaWalletAdapterWithPay, payUsdcOnSolana } from "@galliun/sdk";
const wallet = createSolanaWalletAdapterWithPay(solanaSigner, async (option, requirement, signer) => {
return payUsdcOnSolana(option, signer, connection);
});
Networks
Common networks: devnet, mainnet-beta. Match your wallet network to the 402 accept option.
Message signing
Built-in adapter includes optional signMessage (bs58-encoded). Not required for protected API payments.
Verification
The API Solana adapter verifies:
- Transaction signature exists and succeeded
- Commitment level per platform config
- SPL token mint matches configured USDC mint
- Treasury received exact amount
Common mistakes
- RPC rate limits — use a dedicated RPC provider in production
- Missing USDC ATA — payer needs an associated token account with USDC
- Wrong mint — devnet vs mainnet USDC mint addresses differ