- Home
- Skills
- Bankrbot
- Claude Plugins
- X402 Client Patterns
x402-client-patterns_skill
- JavaScript
70
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill bankrbot/claude-plugins --skill x402-client-patterns- SKILL.md8.6 KB
Overview
This skill provides reusable client code and common project files for integrating the Bankr x402 SDK in TypeScript projects. It includes a ready-to-use bankr-client.ts, a transaction executor using viem, and standard configuration files (package.json, tsconfig.json, .env.example, .gitignore). Use it to get a consistent, secure SDK client setup that handles micropayments, transaction execution, and environment validation.
How this skill works
The bankr-client.ts initializes a BankrClient using environment variables and re-exports wallet address and SDK types. The executor.ts maps chain IDs to viem chains, builds a wallet client from the private key, and exposes executeTransaction and executeAllTransactions helpers that submit transactions returned by the SDK. Common files provide build, run, and development scripts plus TypeScript and environment templates so projects start with a consistent structure.
When to use it
- Bootstrapping a new Bankr SDK TypeScript project or plugin
- Implementing bankr-client.ts or needing a uniform client pattern
- Executing on-chain transactions returned by the SDK with viem
- Creating package.json, tsconfig.json, and .env templates for SDK projects
- Building web services, CLIs, or scripts that call Bankr SDK endpoints
Best practices
- Keep BANKR_PRIVATE_KEY in a secure environment, never commit it to source control
- Fund the payment wallet with USDC on Base to cover $0.01 per request
- Validate chain IDs before execution and review transactions before sending
- Use onStatusUpdate callbacks to surface progress and errors to users
- Add framework-specific dependencies (Express, commander) only when needed
Example use cases
- Query token prices or balances via bankrClient.promptAndWait without executing transactions
- Perform swaps: request a swap from the SDK, inspect metadata, then execute with executeTransaction
- Automate batch flows: collect SDK responses and run executeAllTransactions to submit a sequence
- Build an Express endpoint that proxys prompts to Bankr SDK and returns responses
- Create a CLI tool (commander) that prompts the SDK and optionally executes returned txs
FAQ
BANKR_PRIVATE_KEY is required. Optionally set BANKR_WALLET_ADDRESS and BANKR_API_URL to override defaults.
How much does each SDK request cost?
Each API request charges $0.01 USDC, paid from the configured payment wallet on Base.
Which chains are supported by the executor?
The provided executor maps chain IDs for Base (8453), Ethereum mainnet (1), and Polygon (137). Extend the chains map to add more.
Do balance or price queries create transactions?
No. Queries like price or balance requests return responses without transactions; only actionable operations return tx objects.