Installation
Three Developer Personas
The SDK serves three types of developers:Merchant
You have an API or data source to monetize. Gate endpoints with x402, publish your manifest, and register on-chain.
Buyer Agent
Your AI agent needs external data. Give it a wallet, discover merchants on-chain, and pay autonomously.
Hybrid
Sell one service, buy others. A code review agent that pays a scraping agent for context.
Quick Examples
Initialize a Wallet
Merchant: Gate an Endpoint
Buyer: Discover & Pay
Register On-Chain
Full API Surface
| Export | Category | Description |
|---|---|---|
AgentWallet | Core | Wallet creation, signing, balance queries |
KeyManager | Core | AES-256-GCM encrypted keystore |
PolicyEngine | Core | Spending policy enforcement |
AuditLogger | Core | Transaction audit trail |
createCoreServices | Core | Service factory for full initialization |
SolanaConnection | Core | Managed RPC connection |
TransactionBuilder | Protocol | Construct and sign Solana transactions |
SplTokenService | Protocol | SPL token operations (mint, transfer, ATA) |
X402Client | Protocol | Buyer-side x402 payment handling |
X402ServerService | Protocol | Merchant-side x402 verification |
createX402Paywall | Middleware | Express middleware for x402 gating |
discoverRegistry | Registry | Scan on-chain registry for merchants |
buildRegistrationTx | Registry | Build SPL Memo registration transaction |
getRegistryAddress | Registry | Get the registry coordination wallet |
MasterFunder | Relay | Auto-fund new agent wallets |
KoraService | Relay | Gasless transaction relay |
WELL_KNOWN_TOKENS | Utility | Token symbol → mint address mapping |