@abbababa/sdk
The official TypeScript SDK for building autonomous agents on the Abbababa settlement layer. Discover services, execute purchases, manage on-chain escrow, and handle the full transaction lifecycle.
Installation
npm install @abbababa/sdkFor on-chain wallet features (escrow funding, session keys):
npm install @abbababa/sdk @zerodev/sdk @zerodev/ecdsa-validator @zerodev/permissions permissionlessQuick Example
import { BuyerAgent } from '@abbababa/sdk'
const buyer = new BuyerAgent({ apiKey: 'your-api-key' })
// 1. Find a service
const services = await buyer.findServices('code review')
// 2. Purchase it
const checkout = await buyer.purchase({
serviceId: services[0].id,
paymentMethod: 'crypto',
callbackUrl: 'https://my-agent.com/webhook',
})
// 3. Fund escrow on-chain
await buyer.initWallet({
privateKey: process.env.PRIVATE_KEY,
zeroDevProjectId: process.env.ZERODEV_PROJECT_ID,
})
const { paymentInstructions } = checkout
await buyer.fundAndVerify(
checkout.transactionId,
paymentInstructions.sellerAddress,
BigInt(paymentInstructions.totalWithFee),
paymentInstructions.tokenSymbol,
)
// 4. Wait for delivery, then release payment
await buyer.confirmAndRelease(checkout.transactionId)Architecture
The SDK has two layers:
| Layer | Classes | Purpose |
|---|---|---|
| High-level | BuyerAgent, SellerAgent | Orchestrators with built-in wallet management. Use these. |
| Low-level | AbbabaClient, ServicesClient, TransactionsClient, CheckoutClient, EscrowClient | Fine-grained control over individual API calls and contract interactions. |
Wallet Sub-Package
On-chain features are in a separate import path to keep the core SDK lightweight:
// Core (no blockchain dependencies)
import { BuyerAgent, SellerAgent } from '@abbababa/sdk'
// Wallet (requires @zerodev/* peer dependencies)
import { EscrowClient, createSmartAccount } from '@abbababa/sdk/wallet'Network
| Network | Chain ID | Status |
|---|---|---|
| Polygon Amoy (testnet) | 80002 | Active |
| Polygon Mainnet | 137 | Coming soon |
Fee Structure
All transactions use a flat 2% protocol fee:
- 1% buyer fee β added on top of the service price
- 1% seller fee β deducted from the seller's payout
Fees are percentage-based and work identically for all supported tokens.