The Sui wallet adapter handles USDC payments on Sui networks.
Quick setup
import { GalliunClient, createSuiWalletAdapter } from "@galliun/sdk";
const client = new GalliunClient({
baseUrl: "https://api.galliun.com",
chain: "sui",
wallet: createSuiWalletAdapter(suiSigner),
});
Signer interface
interface SuiWalletSigner {
address: string;
client: SuiClient;
signAndExecuteTransaction: (tx: Transaction) => Promise<{ digest: string }>;
signPersonalMessage?: (message: Uint8Array) => Promise<{ signature: string }>;
}
Integrate with @mysten/dapp-kit or your preferred Sui wallet provider.
Built-in USDC payment
createSuiWalletAdapter(signer) includes built-in USDC transfer via @mysten/sui. The adapter:
- Constructs atomic USDC split transfers (provider + platform fee legs) from the 402 accept option
- Executes via
signAndExecuteTransaction - Returns a payment proof with the transaction digest as
txHash
Custom pay override
import { createSuiWalletAdapterWithPay, payUsdcOnSui } from "@galliun/sdk";
const wallet = createSuiWalletAdapterWithPay(suiSigner, async (option, requirement, signer) => {
return payUsdcOnSui(option, signer);
});
Note: custom pay adapters do not include signMessage by default. That is optional.
Networks
Common networks: testnet, mainnet. The 402 accept option specifies the required network — your wallet must be on the matching network.
Verification
The API Sui adapter verifies:
- Transaction digest exists and succeeded
- Sender matches
payer - Treasury received exact USDC amount
- Coin type matches configured USDC type
Common mistakes
- Wrong network — testnet vs mainnet mismatch
- Insufficient SUI for gas — USDC transfer requires SUI for gas fees
- Missing coin type — accept option must include the correct USDC coin type