Wallet adapters bridge the SDK to your user's wallet for on-chain USDC payments in the exact_split model.

Interface

interface PaymentWalletAdapter {
  chain: "sui" | "solana";
  address(): Promise<string>;
  pay(input: PaymentAcceptOption, requirement: PaymentRequirement): Promise<PaymentProof>;
  signMessage?(message: string): Promise<string>;
}

Required methods

Method Purpose
chain Chain identifier matching 402 accepts ("sui" or "solana")
address() Returns payer wallet address
pay() Sends atomic USDC tx with all splits[] legs, returns payment proof

Optional methods

Method Purpose
signMessage() Optional — not required for protected API payments

Payment rail selection

When the API returns 402, the SDK calls selectPaymentOption(requirement, chain) to pick the accept option matching your client's chain config. Your adapter's pay() receives that option (including splits[]) plus the full requirement.

The wallet must send one atomic on-chain transaction with separate USDC legs to each split recipient (provider + platform fee).

Built-in adapters

Chain Factory Notes
Sui createSuiWalletAdapter(signer) Built-in USDC pay with split legs
Solana createSolanaWalletAdapter(signer, connection) Built-in SPL USDC pay with split legs

Custom pay overrides: createSuiWalletAdapterWithPay, createSolanaWalletAdapterWithPay.

EVM/Base adapters were removed. See Base / EVM.

Custom adapter

import type { PaymentWalletAdapter } from "@galliun/sdk";

const myWallet: PaymentWalletAdapter = {
  chain: "sui",
  async address() {
    return "0x...";
  },
  async pay(option, requirement) {
    const txHashOrDigest = await sendUsdcSplits(option.splits);
    return buildPaymentProof({
      requirement,
      chain: option.chain,
      network: option.network,
      asset: option.asset,
      payer: await this.address(),
      txHashOrDigest,
    });
  },
};

Use buildPaymentProof() from the SDK to construct proofs consistently.

Chain compatibility

Your adapter's chain must match a configured payment rail on the endpoint. If the endpoint only accepts Sui, a Solana adapter will fail with unsupported_chain.

Common mistakes

Next steps