{
 "openapi": "3.1.0",
 "info": {
  "title": "Jimbob Tools",
  "version": "1.0.0",
  "description": "Pay-per-call crypto utility APIs for AI agents, paid via x402. Built and run by an AI agent."
 },
 "servers": [
  {
   "url": "https://jimbob-tools.jimbobtools.workers.dev"
  }
 ],
 "paths": {
  "/api/address/validate": {
   "get": {
    "summary": "Validate a crypto address offline (format + checksum) and identify its chain, network and type. Supports Monero (standard/integrated/subaddress, returns public keys and payment ID), Bitcoin (P2PKH/P2SH/SegWit/Taproot), Litecoin, Dogecoin, Tron, Solana and EVM (EIP-55 checksum). Use before sending funds.",
    "x-price-usd": 0.001,
    "x-payment": "x402 exact, USDC on Base (eip155:8453)",
    "parameters": [
     {
      "name": "address",
      "in": "query",
      "required": true,
      "description": "Address to check",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "chain",
      "in": "query",
      "required": false,
      "description": "Optional hint: xmr|btc|ltc|doge|trx|sol|evm",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result"
     },
     "400": {
      "description": "Bad input (not charged)"
     },
     "402": {
      "description": "Payment required (x402)"
     }
    }
   }
  },
  "/api/xmr/tx-status": {
   "get": {
    "summary": "Look up a Monero transaction by txid on public nodes: whether it is in the mempool or mined, block height, confirmations, fee, number of outputs, and double-spend flag.",
    "x-price-usd": 0.002,
    "x-payment": "x402 exact, USDC on Base (eip155:8453)",
    "parameters": [
     {
      "name": "txid",
      "in": "query",
      "required": true,
      "description": "64-hex Monero transaction id",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result"
     },
     "400": {
      "description": "Bad input (not charged)"
     },
     "402": {
      "description": "Payment required (x402)"
     }
    }
   }
  },
  "/api/xmr/verify-payment": {
   "get": {
    "summary": "Prove how much XMR a Monero transaction paid to an address, without a wallet. Give txid + recipient address + either the sender's tx private key (tx_key, as from get_tx_key) or the recipient's private VIEW key (view_key). Returns matched outputs, decoded amounts and confirmations. View key is used in memory only, never stored or logged; spend keys are never needed.",
    "x-price-usd": 0.01,
    "x-payment": "x402 exact, USDC on Base (eip155:8453)",
    "parameters": [
     {
      "name": "txid",
      "in": "query",
      "required": true,
      "description": "64-hex txid",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "address",
      "in": "query",
      "required": true,
      "description": "Recipient Monero address (standard, integrated or subaddress)",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "tx_key",
      "in": "query",
      "required": false,
      "description": "Sender tx private key (64 hex, or longer with additional keys)",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "view_key",
      "in": "query",
      "required": false,
      "description": "Recipient private view key (64 hex). Alternative to tx_key.",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result"
     },
     "400": {
      "description": "Bad input (not charged)"
     },
     "402": {
      "description": "Payment required (x402)"
     }
    }
   }
  },
  "/api/xmr/make-integrated": {
   "get": {
    "summary": "Build a Monero integrated address from a standard address and an 8-byte payment ID (or generate one). Offline; no node, no secrets. Prefer subaddresses for new apps, but many merchants still use integrated addresses.",
    "x-price-usd": 0.001,
    "x-payment": "x402 exact, USDC on Base (eip155:8453)",
    "parameters": [
     {
      "name": "address",
      "in": "query",
      "required": true,
      "description": "Standard Monero address",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "payment_id",
      "in": "query",
      "required": false,
      "description": "16 hex chars (8 bytes). Random if omitted.",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result"
     },
     "400": {
      "description": "Bad input (not charged)"
     },
     "402": {
      "description": "Payment required (x402)"
     }
    }
   }
  },
  "/api/ln/decode-invoice": {
   "get": {
    "summary": "Decode a BOLT11 Lightning invoice: network, amount (msat/sat/BTC), expiry, payment hash, description, payee node key, CLTV. Signature presence is reported; full signature verification against the payee key is not performed when the optional n tag is absent.",
    "x-price-usd": 0.002,
    "x-payment": "x402 exact, USDC on Base (eip155:8453)",
    "parameters": [
     {
      "name": "invoice",
      "in": "query",
      "required": true,
      "description": "BOLT11 string (lnbc... / lntb...)",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result"
     },
     "400": {
      "description": "Bad input (not charged)"
     },
     "402": {
      "description": "Payment required (x402)"
     }
    }
   }
  },
  "/api/bip39/validate": {
   "get": {
    "summary": "Validate a BIP39 English mnemonic checksum (12/15/18/21/24 words). Returns valid/invalid only. Never derives or returns a seed, xprv, or private key — do not send secrets you care about to any third party.",
    "x-price-usd": 0.001,
    "x-payment": "x402 exact, USDC on Base (eip155:8453)",
    "parameters": [
     {
      "name": "mnemonic",
      "in": "query",
      "required": true,
      "description": "Space-separated English BIP39 words",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result"
     },
     "400": {
      "description": "Bad input (not charged)"
     },
     "402": {
      "description": "Payment required (x402)"
     }
    }
   }
  },
  "/api/nostr/validate": {
   "get": {
    "summary": "Validate Nostr bech32 entities (npub, note, nevent, nprofile, naddr) or verify a NIP-01 event JSON (id + schnorr signature). Rejects nsec. Useful before following a link or accepting an event from an untrusted feed.",
    "x-price-usd": 0.0015,
    "x-payment": "x402 exact, USDC on Base (eip155:8453)",
    "parameters": [
     {
      "name": "entity",
      "in": "query",
      "required": false,
      "description": "npub/note/nevent/nprofile/naddr or 64-hex",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "event",
      "in": "query",
      "required": false,
      "description": "NIP-01 event as a JSON string (use instead of entity)",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result"
     },
     "400": {
      "description": "Bad input (not charged)"
     },
     "402": {
      "description": "Payment required (x402)"
     }
    }
   }
  },
  "/api/btc/decode-tx": {
   "get": {
    "summary": "Decode a raw Bitcoin transaction hex (legacy or segwit): txid, wtxid, version, locktime, inputs/outputs, values, vsize/weight. Offline; not broadcast. Fee unknown without input values.",
    "x-price-usd": 0.003,
    "x-payment": "x402 exact, USDC on Base (eip155:8453)",
    "parameters": [
     {
      "name": "tx_hex",
      "in": "query",
      "required": true,
      "description": "Raw transaction as hex",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "JSON result"
     },
     "400": {
      "description": "Bad input (not charged)"
     },
     "402": {
      "description": "Payment required (x402)"
     }
    }
   }
  }
 }
}