Skip to main content

Installation

Install the Bankr SDK for TypeScript/JavaScript applications that need to manage their own wallet and transaction submission.

note

Most users should start with the Agent API or OpenClaw skill — they're simpler and handle wallet management for you.

The SDK is designed for advanced use cases where you need:

  • To manage your own wallet and submit transactions yourself
  • Fine-grained control over transaction data
  • Integration with existing wallet infrastructure

How the SDK Works

Unlike the Agent API (which executes transactions for you), the SDK:

  1. Accepts prompts and returns transaction data
  2. You submit the transactions to the blockchain using your own wallet
  3. Payments are made via x402 micropayments ($0.01 USDC per request)

This gives you full control but requires more integration work.

Requirements

  • Node.js 18+ or Bun
  • USDC on Base (for x402 payments)
  • A wallet private key (for signing payments and transactions)

Install

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

Dependencies

The SDK uses these peer dependencies:

  • viem — Ethereum interactions
  • x402-fetch — Payment protocol

These are included automatically.

Quick Start

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

// Initialize with your private key
const client = new BankrClient({
privateKey: '0x...', // Your wallet private key
baseUrl: 'https://api.bankr.bot', // Production endpoint
});

// Send a prompt and wait for results
const result = await client.promptAndWait({
prompt: 'what is the price of ETH?',
});

console.log(result.response);
// "ETH is currently trading at $3,245.67"

Configuration Options

const client = new BankrClient({
// Required
privateKey: '0x...',

// Recommended
baseUrl: 'https://api.bankr.bot', // Production API endpoint

// Optional
timeout: 600000, // Request timeout (10 min default)
walletAddress: '0x...', // Context wallet (defaults to derived)
});

Environment Variables

Store your private key securely:

# .env
BANKR_PRIVATE_KEY=0x...
import { BankrClient } from '@bankr/sdk';

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

TypeScript

The SDK is fully typed. Import types as needed:

import {
BankrClient,
BankrClientConfig,
PromptOptions,
JobStatus,
Transaction,
} from '@bankr/sdk';

Next Steps