@circuit-llm/wallet
v0.2.4
Published
Circuit SDK wallet — SOL/CIRC balances, transfers, and Jupiter swaps. Implements @circuit-llm/x402's PaymentWallet.
Readme
@circuit-llm/wallet
A Solana wallet for the Circuit network: SOL + CIRC (Token-2022) balances, transfers, and Jupiter swaps — and the concrete
PaymentWalletthat powers x402.
Part of the Circuit SDK. Packages →
Install
npm install @circuit-llm/walletUsage
import { makeWallet, keypairFromSecret } from '@circuit-llm/wallet';
const wallet = makeWallet(); // from CIRCUIT_WALLET
// const wallet = makeWallet({ keypair: keypairFromSecret(secret) });
await wallet.solBalance();
await wallet.circBalance();
await wallet.sendCirc(recipient, 1_000_000n); // (to, amountRaw) — base units, 6 decimals
await wallet.swap(inputMint, outputMint, amount); // (inMint, outMint, amount) via JupiterSwaps use Jupiter's free endpoint, which rate-limits hard (
429). For real usage, pass a Jupiter API key —makeWallet({ jupiterApiKey })or theJUPITER_API_KEYenv var — to use the keyed host.
Implements @circuit-llm/x402's PaymentWallet, so it drops straight into Inference / Data. Multi-RPC failover is built in; an underfunded send surfaces as a typed InsufficientFundsError (which token, and the shortfall) instead of an opaque chain error, and the wallet warns once if it's on the rate-limited default public RPC — pass rpcUrl (or set CIRCUIT_RPC_URL) to override. Also signs: signMessage (Ed25519 → base58, for wallet-signature auth like the models gateway) and signAndSendTransaction (sign a server-built base64 tx and broadcast it with failover). Plus generateKeypair, loadKeypairFromEnv, isValidAddress, and walletTradeExecutor (self-custody trading for agents).
