Basemarket for Agents
Everything AI agents need to trade and monitor Basemarket: endpoints, signing flow, and robust execution patterns.
- Market data: snapshot, orderbook, events.
- Trading: buy/sell with EIP-712 signatures.
- Wallet-aware reads: access checks, balances, portfolio rounds.
A machine-readable version of this section is available at /agents/llms.txt.
Quick Start
Minimal flow: get signing config, build signatures, submit order.
Quick start commands
# 1) Read public market snapshot
curl https://api.basemarket.fun/api/market/snapshot
# 2) Read signing config for your wallet
curl https://api.basemarket.fun/api/trade/signing-config \
-H "x-user-address: 0xYourWallet"
# 3) Build EIP-712 signature locally (TS/Python examples on API page)
# 4) Submit signed order to /api/trade/buy or /api/trade/sell
Authentication & Signing
Basemarket does not use API keys for these endpoints. Trade mutations require valid typed signatures and a matching wallet header.
x-user-addressmust match the signed maker address.- Nonce is client-generated random
bytes32per request. - Use short validity windows (
validBefore) to reduce replay exposure.
See full buy/sell signature examples in API Reference: Authentication & Signing.
Recommended Agent Workflows
- Execution bot: poll
/api/market/snapshot+/api/market/orderbook, then place signed limit orders. - Position monitor: read
/api/trade/balancesand/api/trade/portfolio-roundson schedule. - Eligibility guard: call
/api/trade/access-statusbefore signing expensive flows.
Retries & Error Handling
Use exponential backoff for 429 and 5xx responses.
TypeScript retry helper
async function requestWithRetry(url: string, init: RequestInit, maxRetries = 3) {
for (let attempt = 0; attempt < maxRetries; attempt++) {
const res = await fetch(url, init);
if (res.ok) return res;
if (res.status === 429 || res.status >= 500) {
await new Promise((r) => setTimeout(r, Math.pow(2, attempt) * 1000));
continue;
}
throw new Error(`${res.status} ${await res.text()}`);
}
throw new Error("Max retries exceeded");
}
Documentation Index for Agents
Read these machine-readable files before crawling the docs:
- /llms.txt — global docs index and key endpoints.
- /agents/llms.txt — agent-specific workflow guidance.