Skip to content

BankrBot/x402-cli-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bankr x402 CLI Example

A command-line interface example demonstrating how to use the Bankr SDK with x402 payments. This example shows how to interact with the Bankr AI agent for DeFi operations using USDC micropayments.

Features

  • 🤖 Interactive CLI for Bankr AI agent
  • 💰 x402 USDC payment integration
  • 📊 Real-time feedback with loading indicators
  • 🎨 Beautiful terminal UI with colors

Prerequisites

  • Bun runtime installed
  • USDC on Base network for payments
  • Private key for payment wallet

Installation

# Clone the repository
git clone https://github.com/BankrBot/x402-cli-example.git
cd x402-cli-example

# Install dependencies
bun install

Configuration

  1. Copy the example environment file:
cp .env-example .env
  1. Edit .env and add your configuration:
# Required: Payment wallet private key for x402 USDC payments
PRIVATE_KEY=0xYourPrivateKeyHere

# Optional: Context wallet for Bankr prompts and transactions
# If not provided, defaults to the address derived from PRIVATE_KEY
WALLET_ADDRESS=

# Optional: Enable debug mode to see full JSON responses
DEBUG=false

Usage

Run the CLI:

bun start

Follow the interactive prompts to:

  • Enter prompts for the Bankr AI agent
  • View responses and estimated costs
  • Confirm and execute transactions
  • Monitor operation status

x402 Payment Protocol

x402 is a payment protocol that enables micropayments for API calls. This example uses it to pay for:

  • Interacting with Bankr

Payments are made in USDC on Base network, $0.10 per request.

Learn More

License

MIT

About

A CLI demo of using the Bankr x402 SDK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published