Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

x402-sdk-dev Plugin

Claude Code integration for @bankr/sdk - AI-assisted Web3 development with multi-chain DeFi.

Features

  • Multi-Chain: Base, Polygon, Ethereum (EVM chains)
  • Token Trading: Swaps, buys, and cross-chain bridges with 0x routing
  • Leveraged Trading: Avantis commodities, forex, and crypto with up to 150x leverage
  • NFT Operations: Buy, discover listings, view holdings
  • Market Data: Prices, analysis, trending tokens, portfolio balances
  • x402 Payments: $0.01 USDC per request (Base network)
  • 13 Transaction Types: Swaps, transfers, approvals, NFT ops, bridges, staking

Note: Solana and Polymarket are not supported via the SDK (wallet mode limitations).

Quick Start

1. Install Plugin

Claude Code:

claude plugin marketplace add BankrBot/claude-plugins
claude plugin install bankr-x402-sdk-dev@bankr-claude-plugins

Other Coding Tools (Cursor, OpenCode, Gemini CLI, Antigravity, etc.):

Only skills are compatible with other platforms. Agents, commands, hooks, and MCP servers require Claude Code.

bunx skills add BankrBot/claude-plugins

2. Install SDK

bun add @bankr/sdk
# or
npm install @bankr/sdk

3. Configure Environment

export BANKR_PRIVATE_KEY=0x...  # Required: pays $0.01 USDC per request (needs USDC on Base)
export BANKR_WALLET_ADDRESS=0x... # Optional: receives swapped tokens
export BANKR_API_URL=https://api.bankr.bot  # Optional

Skills

Skill Description
sdk-capabilities Full guide to all supported operations and prompts
sdk-wallet-operations Client init, wallet config, address derivation
sdk-token-swaps Multi-chain swaps with 0x routing
sdk-balance-queries Token balances, portfolio values
sdk-transaction-builder Transfers, approvals, NFTs, DeFi
sdk-job-management Async job control and monitoring
x402-project-templates Directory structures for bot, web-service, dashboard, cli projects
x402-client-patterns Reusable client code, executor, and common project files

Agent

sdk-assistant - Bankr SDK development assistant. Routes to appropriate skills based on user needs.

Commands

Command Description
/bankr-x402-sdk-dev:scaffold [type] Scaffold a complete project using the Bankr x402 SDK

Project types: bot, web-service, dashboard, cli

Quick start:

/bankr-x402-sdk-dev:scaffold bot

This creates a complete project with bankr-client.ts, transaction executor, package.json, tsconfig.json, and environment configuration.

Basic Usage

import { BankrClient } from "@bankr/sdk";

const client = new BankrClient({
  privateKey: process.env.BANKR_PRIVATE_KEY as `0x${string}`,
  walletAddress: process.env.BANKR_WALLET_ADDRESS,
});

// Token swap
const swap = await client.promptAndWait({
  prompt: "Swap 0.1 ETH to USDC on Base",
});

// Balance query
const balances = await client.promptAndWait({
  prompt: "What are my token balances?",
});

// Execute returned transaction with your wallet (viem/ethers)
const tx = swap.transactions?.[0].metadata.transaction;

Critical: 0x Swap Approval

For ERC20 swaps, you must approve the allowanceTarget before executing:

const result = await client.promptAndWait({ prompt: "Swap 100 USDC to WETH" });
const swapTx = result.transactions?.find(tx => tx.type === "swap");

if (swapTx?.metadata.allowanceTarget) {
  // 1. Approve allowanceTarget to spend your tokens
  // 2. Then execute swapTx.metadata.transaction
}

See 0x AllowanceHolder docs.

Transaction Types

swap | approval | transfer_erc20 | transfer_eth | convert_eth_to_weth | convert_weth_to_eth | transfer_nft | mint_manifold_nft | mint_seadrop_nft | buy_nft | avantisTrade | swapCrossChain | manage_bankr_staking

Two-Wallet System

  • Payment Wallet (privateKey): Pays $0.01 USDC per request. Must have USDC on Base.
  • Context Wallet (walletAddress): Receives swapped tokens. Can be different from payment wallet.

Troubleshooting

Error Solution
"Payment required" Add USDC to payment wallet on Base
"Invalid wallet address" Check 0x-prefixed address format
Transaction fails Approve allowanceTarget for ERC20 swaps
Timeout Increase timeout or use manual polling

Links

SDK Package | Bankr | Docs | Discord | x402 Protocol