
Bankr X402 Sdk Token Swaps
- 362 installs
- 80 repo stars
- Updated March 24, 2026
- bankrbot/claude-plugins
bankr x402 sdk - token swaps is a Claude Code skill that adds Bankr SDK swap flows with AI-powered 0x routing and ERC20 approval handling for developers building x402 or Bankr apps that fund payments or settle in expecte
About
bankr x402 sdk - token swaps is a BankrBot x402-sdk-dev Claude plugin skill (version 1.1.0) for building token swaps with the `@bankr/sdk` BankrClient and AI-powered 0x routing. Prompt patterns support amount swaps (`Swap 0.1 ETH to USDC`), dollar buys (`Buy $100 worth of DEGEN`), percentage sells (`Swap 50% of my ETH`), and chain-specific requests on Base, Ethereum, Polygon, and Solana—with Base as the default network. TypeScript examples call `client.promptAndWait()` and inspect `result.transactions` for swap metadata including `approvalRequired`, pre-built `approvalTx`, and `allowanceTarget` for ERC20 approvals before executing swap transactions. Related skills cover sdk-capabilities, sdk-transaction-builder, and sdk-wallet-operations. Use when x402 merchants or treasuries must rebalance into payment assets programmatically.
- swap quote and slippage handling
- wallet and allowance setup patterns
- routing across supported chains and tokens
- linking swaps to x402 payment funding
- failure recovery for partial or reverted trades
Bankr X402 Sdk Token Swaps by the numbers
- 362 all-time installs (skills.sh)
- Ranked #43 of 479 Web3 & Blockchain skills by installs in the Skillselion catalog
- Data as of Jul 31, 2026 (Skillselion catalog sync)
npx skills add https://github.com/bankrbot/claude-plugins --skill bankr-x402-sdk---token-swapsAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 362 |
|---|---|
| repo stars | ★ 80 |
| Last updated | March 24, 2026 |
| Repository | bankrbot/claude-plugins ↗ |
How do you add token swaps to Bankr x402 apps?
Add token swap flows to x402 or Bankr apps so users can fund payments, rebalance treasuries, or settle in the asset a merchant expects.
Who is it for?
Developers embedding Bankr SDK swaps into x402 payment apps to fund wallets, rebalance treasuries, or settle in merchant-expected tokens.
Skip if: Projects only submitting raw calldata without Bankr SDK should use bankr arbitrary transaction skills instead of x402 swap integration.
When should I use this skill?
User asks to swap tokens, buy crypto with USD amounts, handle ERC20 approvals, or integrate 0x routing via Bankr SDK.
What you get
BankrClient swap integration code, ERC20 approval flow, and executed swap transactions with 0x-routed metadata.
- Swap integration code
- Approval transaction flow
By the numbers
- Supports 4 chains: Base (default), Ethereum, Polygon, Solana
- Documents 3 ERC20 approval metadata fields: approvalRequired, approvalTx, allowanceTarget
- Skill version 1.1.0 in x402-sdk-dev plugin
Files
Safety & Access Control
Comprehensive safety guidance for using the Bankr API and CLI.
API Key Types
Bankr uses a single key format (bk_...) with capability flags:
| Flag | Controls | Default |
|---|---|---|
agentApiEnabled | /agent/* endpoints | false |
llmGatewayEnabled | LLM Gateway at llm.bankr.bot | false |
readOnly | Restricts agent to read-only tools | false |
Manage flags at bankr.bot/api.
Read-Only API Keys
When readOnly: true, all write tools are filtered from the agent session:
Allowed: Balances, prices, analytics, portfolio, research Blocked: Swaps, transfers, NFT purchases, staking, orders, token launches, leverage, Polymarket bets, claims
The /agent/sign and /agent/submit endpoints return 403 for read-only keys.
IP Whitelisting
Set allowedIps on your API key to restrict usage to specific IPs. Requests from non-whitelisted IPs are rejected with 403.
- Empty array = all IPs allowed (default)
- Non-empty array = only listed IPs can use the key
Dedicated Agent Wallet
When building autonomous agents, create a separate Bankr account rather than using your personal wallet:
- Limited exposure — compromised key only exposes agent wallet funds
- Clear accounting — agent transactions isolated from personal activity
- Independent controls — apply stricter access controls without affecting personal use
- Easy revocation — disable agent account without disrupting primary wallet
Recommended Funding
| Chain | Gas Buffer | Trading Capital |
|---|---|---|
| Base | 0.01-0.05 ETH | As needed |
| Polygon | 5-10 MATIC | As needed |
| Ethereum | 0.05-0.1 ETH | As needed |
| Solana | 0.1-0.5 SOL | As needed |
Rate Limits
| Tier | Daily Limit |
|---|---|
| Standard | 100 messages/day |
| Bankr Club | 1,000 messages/day |
| Custom | Set per API key |
Reset window is 24 hours from first message (rolling), not midnight.
Key Management
- Store keys in environment variables (
BANKR_API_KEY,BANKR_LLM_KEY), never in source code - Add
~/.bankr/and.envto.gitignore - Rotate keys periodically at bankr.bot/api
- Revoke immediately if compromised
- Use separate keys for Agent API vs LLM Gateway if needed
Transaction Safety
- Test first — small amounts on Base/Polygon before scaling
- Verify recipients — double-check addresses before transfers
- Gas buffer — keep enough native tokens for gas
- Immediate execution —
/agent/submitexecutes with no confirmation prompt - Understand calldata — verify trusted source for arbitrary transactions
Pre-Deployment Checklist
- Use a dedicated agent wallet, not your personal account
- Fund with limited amounts appropriate to purpose
- Set read-only if agent only queries data
- Configure IP whitelisting for server-side agents
- Store keys in environment variables
- Test with small amounts first
- Implement error handling for rate limits (429) and access control (403)
Related skills
How it compares
Use for SDK-managed 0x swaps with approvals; use arbitrary-transactions for pre-built raw calldata.
FAQ
How does bankr x402 sdk token swaps handle ERC20 approvals?
bankr x402 sdk - token swaps checks swap transaction metadata for `approvalRequired`. When true, developers send the pre-built `approvalTx` first, optionally referencing `allowanceTarget` for manual approvals, then broadcast the main swap transaction from metadata returned by Ban
Which chains does the Bankr x402 SDK swap skill support?
bankr x402 sdk - token swaps lists four supported chains—Base (default), Ethereum, Polygon, and Solana—with native tokens ETH, ETH, MATIC, and SOL respectively. Chain-specific prompts follow patterns like `Swap 0.1 ETH to USDC on Base` through the @bankr/sdk client.