{"skill":{"slug":"bondterminal-x402","displayName":"Bondterminal X402","summary":"Query BondTerminal API using x402 keyless payments. No API key needed — pay $0.01 USDC per request on Base mainnet. Use when users ask for Argentine bond dat...","description":"---\nname: bondterminal-x402\ndescription: >\n  Query BondTerminal API using x402 keyless payments. No API key needed —\n  pay $0.01 USDC per request on Base mainnet. Use when users ask for Argentine\n  bond data, analytics, cashflows, history, riesgo país, or ISIN/ticker lookups\n  (e.g. AL30, GD30, US040114HS26). Supports automatic 402 → payment → retry.\nmetadata:\n  author: 0juano\n  version: \"2.1.0\"\n---\n\n# BondTerminal x402\n\nQuery the BondTerminal API with x402 pay-per-call auth. No API key, no subscription — just sign and pay per request.\n\n**Cost:** $0.01 USDC per request on Base mainnet.\n\n## API Endpoints\n\nBase URL: `https://bondterminal.com/api/v1`\n\n| Method | Endpoint | Description | Auth |\n|--------|----------|-------------|------|\n| GET | `/treasury-curve` | US Treasury yield curve | Free |\n| GET | `/bonds` | List all bonds (60+) | x402 |\n| GET | `/bonds/:id` | Bond details by ISIN or local ticker | x402 |\n| GET | `/bonds/:id/analytics` | Price, YTM, duration, spreads | x402 |\n| GET | `/bonds/:id/cashflows` | Cashflow schedule | x402 |\n| GET | `/bonds/:id/history` | Historical price/yield/spread | x402 |\n| POST | `/calculate` | Bond analytics from custom price | x402 |\n| GET | `/riesgo-pais` | Current Argentina country risk | x402 |\n| GET | `/riesgo-pais/history` | Historical riesgo país series | x402 |\n| POST | `/calculate/batch` | Batch calculations | Bearer only |\n\n**Identifier formats:** ISIN (`US040114HS26`), local ticker with D/C suffix (`AL30D`, `GD30D`).\n\nFull docs: https://bondterminal.com/developers\nEndpoint reference in this skill: `references/endpoints.md`\n\n## How x402 Works\n\n1. Call any x402 endpoint without auth → server returns `402` with `PAYMENT-REQUIRED` header\n2. Decode the header (base64 JSON) to get payment requirements (amount, asset, network, payTo)\n3. Sign an EIP-3009 `transferWithAuthorization` via the x402 client library\n4. Retry the request with the signed payment in the `PAYMENT-SIGNATURE` header (v2), with `X-PAYMENT` as legacy fallback\n5. Server verifies payment via Coinbase facilitator, returns data + `PAYMENT-RESPONSE` header\n\n## Setup\n\n### 1. Install dependencies\n\n```bash\nnpm install @x402/core @x402/evm viem\n```\n\n> **Note:** The code examples use ES modules. Use `.mjs` file extension or add `\"type\": \"module\"` to your `package.json`.\n\n### 2. Configure a signer\n\nThe x402 payment flow requires an EVM signer on Base mainnet with USDC balance. Configure your signer following the [x402 EVM documentation](https://github.com/coinbase/x402/tree/main/packages/evm).\n\nThe signer must implement `{ address, signTypedData }` — any viem-compatible wallet client works (hardware wallet, KMS, injected provider, etc).\n\nSee `references/signer-setup.md` for a complete signer configuration example.\n\n### 3. Register the x402 client\n\n```javascript\nimport { x402Client } from '@x402/core/client';\nimport { x402HTTPClient } from '@x402/core/http';\nimport { ExactEvmScheme } from '@x402/evm'; // exact export name\n\n// signer = { address, signTypedData } — see references/signer-setup.md\nconst scheme = new ExactEvmScheme(signer);\nconst client = new x402Client();\nclient.register('eip155:8453', scheme); // Base mainnet\nconst httpClient = new x402HTTPClient(client);\n```\n\n## Fetching Bond Data\n\n```javascript\nasync function fetchBT(path) {\n  const url = `https://bondterminal.com/api/v1${path}`;\n  let res = await fetch(url);\n\n  if (res.status === 402) {\n    const paymentRequired = httpClient.getPaymentRequiredResponse(\n      (name) => res.headers.get(name),\n      await res.json()\n    );\n    const payload = await httpClient.createPaymentPayload(paymentRequired);\n\n    // Preferred v2 header\n    res = await fetch(url, {\n      headers: httpClient.encodePaymentSignatureHeader(payload),\n    });\n\n    // Legacy fallback for servers still expecting X-PAYMENT\n    if (res.status === 402) {\n      const encoded = Buffer.from(JSON.stringify(payload)).toString('base64');\n      res = await fetch(url, { headers: { 'X-PAYMENT': encoded } });\n    }\n  }\n\n  if (!res.ok) {\n    throw new Error(`BondTerminal request failed (${res.status})`);\n  }\n\n  return res.json();\n}\n\n// Examples\nconst bonds = await fetchBT('/bonds');\nconst analytics = await fetchBT('/bonds/AL30D/analytics');\nconst riesgo = await fetchBT('/riesgo-pais');\n```\n\n## Quick Test\n\nValidate both free and paid flows:\n\n```javascript\nawait fetchBT('/treasury-curve'); // free route (no payment)\nawait fetchBT('/riesgo-pais');    // paid route (triggers x402 flow)\n```\n\n## Wallet Requirements\n\nThe signing wallet needs:\n- **USDC on Base** — for the $0.01 payment per request\n\nNo ETH for gas is required — x402 uses EIP-3009 (off-chain signature), not on-chain transactions.\n\n## Notes\n\n- `POST /calculate/batch` requires a Bearer API key subscription — not available via x402\n- Local tickers require D/C suffix: `AL30D` (USD), `AL30C` (ARS) — not `AL30`\n- Settlement is on-chain: each paid call produces a verifiable transaction hash\n- The `PAYMENT-RESPONSE` header contains settlement metadata (payer, tx hash, network)\n","topics":["Payment"],"tags":{"latest":"0.2.1"},"stats":{"comments":0,"downloads":376,"installsAllTime":14,"installsCurrent":0,"stars":0,"versions":6},"createdAt":1771382759250,"updatedAt":1779077036099},"latestVersion":{"version":"0.2.1","createdAt":1771437206574,"changelog":"Version 0.2.1\n\n- Added detailed EVM signer setup instructions, with a new reference file (`references/signer-setup.md`).\n- Improved onboarding: separated dependency installation, signer configuration, and x402 client registration into clear steps.\n- Updated documentation to clarify ES module requirements and viem wallet compatibility.\n- Noted that no ETH for gas is needed: x402 uses EIP-3009 (off-chain signature).\n- Other clarifications and example enhancements for easier setup and usage.","license":null},"metadata":null,"owner":{"handle":"0juano","userId":"s17dntbp2aydf3rsrw39y64qvh884s8d","displayName":"0juano","image":"https://avatars.githubusercontent.com/u/10681989?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1779919414701}}