A Next.js widget for interacting with the Bankr External Orders API. Supports limit, stop, DCA, and TWAP orders with wallet connection and EIP-712 signing.
- Wallet Connection: Connect via RainbowKit (supports WalletConnect, Base wallet, MetaMask, etc.)
- Chain Support: Base (more soon)
- Order Types: Limit Buy/Sell, Stop Buy/Sell, DCA, TWAP
- Order Management: View, track, and cancel orders
- EIP-712 Signing: Secure order signing with typed data
- Install dependencies:
bun install- Create
.env.localfile:
# Backend API (server-side, not exposed to browser)
API_BACKEND_URL=https://api.bankr.bot/trading/order
API_KEY=your-api-key-here
# Client-side (optional overrides)
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=your-walletconnect-project-id- Run the development server:
bun dev| Variable | Description | Required |
|---|---|---|
API_BACKEND_URL |
Backend API URL (server-side only, default: https://api.bankr.bot/trading/order) |
No |
API_KEY |
API key (server-side only) | Yes |
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID |
WalletConnect project ID (use "demo" for local) | No |
NEXT_PUBLIC_API_BASE_URL |
Override proxy path (default: /api/order) |
No |
Create an API https://bankr.bot/api
src/
├── app/
│ ├── api/
│ │ └── order/[...path]/route.ts # API proxy (avoids CORS)
│ ├── layout.tsx # Root layout with providers
│ ├── page.tsx # Main widget page
│ ├── providers.tsx # wagmi + RainbowKit + React Query providers
│ └── globals.css # Tailwind styles
├── components/
│ ├── WalletButton.tsx # Wallet connect/disconnect button
│ ├── OrderForm.tsx # Order creation form
│ ├── OrderList.tsx # Orders table view
│ └── OrderDetail.tsx # Order details modal with cancel
└── lib/
├── api.ts # API client functions
├── types.ts # TypeScript interfaces
├── constants.ts # Chain configs, tokens, order types
├── wagmi.ts # wagmi/RainbowKit configuration
└── hooks/
├── useOrderSubmit.ts # Quote + sign + submit flow
├── useOrders.ts # List orders with polling
└── useCancel.ts # Cancel order flow
| Endpoint | Method | Description |
|---|---|---|
/quote |
POST | Create order quote |
/submit |
POST | Submit signed order |
/list |
POST | List orders for wallet |
/:orderId |
GET | Get order details |
/cancel/:orderId |
POST | Cancel order |
- User fills order form (type, tokens, amount, price/interval)
- Widget creates quote via
/quoteendpoint - If approval needed, user approves token spend
- User signs EIP-712 typed data
- Widget submits order via
/submitendpoint - Order appears in orders list
- User clicks cancel on an open order
- Widget constructs CancelOrder EIP-712 typed data
- User signs cancellation
- Widget calls
/cancel/:orderIdwith signature
MIT