{"openapi":"3.1.0","info":{"title":"x402 Chain Tools","version":"1.0.0","description":"Blockchain wallet, token, transaction and preflight tools for AI agents. Data network: Base Mainnet / eip155:8453. Payment networks are declared separately and do not change tool response semantics.","contact":{"email":"x402.chain.tools@gmail.com"}},"jsonSchemaDialect":"https://json-schema.org/draft/2020-12/schema","tags":[{"name":"base","description":"Base Mainnet read-only blockchain data."},{"name":"x402","description":"Pay-per-request endpoints using x402 V2."}],"x-data-network":{"caip2":"eip155:8453","name":"Base Mainnet"},"x-payment-networks":[{"caip2":"eip155:8453","name":"Base Mainnet","asset":{"symbol":"USDC","address":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","decimals":6}},{"caip2":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","name":"Solana Mainnet","asset":{"symbol":"USDC","address":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","decimals":6}}],"paths":{"/health":{"get":{"operationId":"getHealth","summary":"Check service health","description":"Free health check for x402 Chain Tools on Base Mainnet.","security":[],"responses":{"200":{"description":"Service is healthy.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"service":{"type":"string","const":"x402-chain-tools"},"status":{"type":"string","const":"healthy"},"network":{"type":"string","const":"eip155:8453"}},"required":["ok","service","status","network"],"additionalProperties":false}}}}}}},"/chain/block":{"post":{"operationId":"block","summary":"Check the latest or current Base Mainnet block number. Use this to get the live Base block height.","description":"Check the latest or current Base Mainnet block number. Use this to get the live Base block height. This read-only Base Mainnet endpoint requires x402 payment.","tags":["x402","blockchain","base"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"required":[],"additionalProperties":false},"example":{}}}},"responses":{"200":{"description":"Successful read-only chain response.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"network":{"type":"string","const":"eip155:8453"},"block":{"type":"object","properties":{"number":{"type":["integer","string"]},"number_hex":{"type":"string","pattern":"^0x[0-9a-fA-F]+$"}},"required":["number","number_hex"],"additionalProperties":false}},"required":["ok","network","block"],"additionalProperties":false},"example":{"ok":true,"network":"eip155:8453","block":{"number":0,"number_hex":"0x0"}}}}},"400":{"description":"Invalid JSON or request input.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"402":{"description":"Payment Required. The PAYMENT-REQUIRED response header contains the authoritative x402 V2 challenge."},"502":{"description":"Base RPC returned an invalid response.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"503":{"description":"Payment configuration or an upstream dependency is unavailable.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"504":{"description":"Base RPC request timed out.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}}}}},"/chain/balance":{"post":{"operationId":"balance","summary":"Check the native ETH balance or gas balance of a Base wallet address. Use this to see how much Base ETH the wallet has.","description":"Check the native ETH balance or gas balance of a Base wallet address. Use this to see how much Base ETH the wallet has. This read-only Base Mainnet endpoint requires x402 payment.","tags":["x402","base","wallet"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Base wallet address."}},"required":["address"],"additionalProperties":false},"example":{"address":"0x0000000000000000000000000000000000000001"}}}},"responses":{"200":{"description":"Successful read-only chain response.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"network":{"type":"string","const":"eip155:8453"},"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Queried address."},"balance":{"type":"object","properties":{"wei":{"type":"string"},"eth":{"type":"string"}},"required":["wei","eth"],"additionalProperties":false}},"required":["ok","network","address","balance"],"additionalProperties":false},"example":{"ok":true,"network":"eip155:8453","address":"0x0000000000000000000000000000000000000001","balance":{"wei":"0","eth":"0"}}}}},"400":{"description":"Invalid JSON or request input.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"402":{"description":"Payment Required. The PAYMENT-REQUIRED response header contains the authoritative x402 V2 challenge."},"502":{"description":"Base RPC returned an invalid response.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"503":{"description":"Payment configuration or an upstream dependency is unavailable.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"504":{"description":"Base RPC request timed out.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}}}}},"/chain/token-balance":{"post":{"operationId":"get_token_balance","summary":"Get ERC20 token balance for a Base wallet address. Use an ERC20 token contract address to return raw, decimal, and formatted token balance values.","description":"Get ERC20 token balance for a Base wallet address. Use an ERC20 token contract address to return raw, decimal, and formatted token balance values. This read-only Base Mainnet endpoint requires x402 payment.","tags":["x402","base","wallet","erc20"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Base wallet address."},"token":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"ERC-20 token contract address on Base."}},"required":["address","token"],"additionalProperties":false},"example":{"address":"0x0000000000000000000000000000000000000001","token":"0x0000000000000000000000000000000000000002"}}}},"responses":{"200":{"description":"Successful read-only chain response.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"network":{"type":"string","const":"eip155:8453"},"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Queried wallet address."},"token":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Queried token contract."},"balance":{"type":"object","properties":{"raw":{"type":"string"},"decimals":{"type":"integer","minimum":0},"formatted":{"type":"string"}},"required":["raw","decimals","formatted"],"additionalProperties":false}},"required":["ok","network","address","token","balance"],"additionalProperties":false},"example":{"ok":true,"network":"eip155:8453","address":"0x0000000000000000000000000000000000000001","token":"0x0000000000000000000000000000000000000002","balance":{"raw":"0","decimals":6,"formatted":"0"}}}}},"400":{"description":"Invalid JSON or request input.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"402":{"description":"Payment Required. The PAYMENT-REQUIRED response header contains the authoritative x402 V2 challenge."},"502":{"description":"Base RPC returned an invalid response.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"503":{"description":"Payment configuration or an upstream dependency is unavailable.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"504":{"description":"Base RPC request timed out.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}}}}},"/chain/allowance":{"post":{"operationId":"allowance","summary":"Get ERC20 allowance for an owner wallet and spender on Base. Return the approved token amount and whether the allowance is unlimited.","description":"Get ERC20 allowance for an owner wallet and spender on Base. Return the approved token amount and whether the allowance is unlimited. This read-only Base Mainnet endpoint requires x402 payment.","tags":["x402","base","wallet","erc20"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"owner":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Token owner address."},"token":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"ERC-20 token contract address on Base."},"spender":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Spender address."}},"required":["owner","token","spender"],"additionalProperties":false},"example":{"owner":"0x0000000000000000000000000000000000000001","token":"0x0000000000000000000000000000000000000002","spender":"0x0000000000000000000000000000000000000003"}}}},"responses":{"200":{"description":"Successful read-only chain response.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"network":{"type":"string","const":"eip155:8453"},"owner":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Token owner address."},"token":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Token contract address."},"spender":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Spender address."},"allowance":{"type":"object","properties":{"raw":{"type":"string"},"decimals":{"type":"integer","minimum":0},"formatted":{"type":"string"},"unlimited":{"type":"boolean"}},"required":["raw","decimals","formatted","unlimited"],"additionalProperties":false}},"required":["ok","network","owner","token","spender","allowance"],"additionalProperties":false},"example":{"ok":true,"network":"eip155:8453","owner":"0x0000000000000000000000000000000000000001","token":"0x0000000000000000000000000000000000000002","spender":"0x0000000000000000000000000000000000000003","allowance":{"raw":"0","decimals":6,"formatted":"0","unlimited":false}}}}},"400":{"description":"Invalid JSON or request input.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"402":{"description":"Payment Required. The PAYMENT-REQUIRED response header contains the authoritative x402 V2 challenge."},"502":{"description":"Base RPC returned an invalid response.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"503":{"description":"Payment configuration or an upstream dependency is unavailable.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"504":{"description":"Base RPC request timed out.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}}}}},"/chain/transaction-lookup":{"post":{"operationId":"transaction_lookup","summary":"Lookup Base transaction by hash on Base Mainnet. Return sender, recipient, value, nonce, block, gas fields, and input data when found.","description":"Lookup Base transaction by hash on Base Mainnet. Return sender, recipient, value, nonce, block, gas fields, and input data when found. This read-only Base Mainnet endpoint requires x402 payment.","tags":["x402","blockchain","base","transactions"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"hash":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$","description":"Base Mainnet transaction hash."}},"required":["hash"],"additionalProperties":false},"example":{"hash":"0x0000000000000000000000000000000000000000000000000000000000000000"}}}},"responses":{"200":{"description":"Successful read-only chain response.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"network":{"type":"string","const":"eip155:8453"},"hash":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$","description":"Base Mainnet transaction hash."},"found":{"type":"boolean"},"transaction":{"oneOf":[{"type":"null"},{"type":"object","properties":{"hash":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$","description":"Base Mainnet transaction hash."},"from":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Transaction sender."},"to":{"oneOf":[{"type":"null"},{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Transaction recipient."}]},"value_wei":{"type":"string","pattern":"^[0-9]+$"},"nonce":{"type":"string","pattern":"^[0-9]+$"},"block_number":{"oneOf":[{"type":"null"},{"type":"string","pattern":"^[0-9]+$"}]},"transaction_index":{"oneOf":[{"type":"null"},{"type":"string","pattern":"^[0-9]+$"}]},"gas":{"type":"string","pattern":"^[0-9]+$"},"gas_price":{"type":"string","pattern":"^[0-9]+$"},"max_fee_per_gas":{"type":"string","pattern":"^[0-9]+$"},"max_priority_fee_per_gas":{"type":"string","pattern":"^[0-9]+$"},"input":{"type":"string","pattern":"^0x(?:[0-9a-fA-F]{2})*$"}},"required":["hash","from","to","value_wei","nonce","block_number","transaction_index","gas","input"],"additionalProperties":false}]}},"required":["ok","network","hash","found","transaction"],"additionalProperties":false},"example":{"ok":true,"network":"eip155:8453","hash":"0x0000000000000000000000000000000000000000000000000000000000000000","found":false,"transaction":null}}}},"400":{"description":"Invalid JSON or request input.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"402":{"description":"Payment Required. The PAYMENT-REQUIRED response header contains the authoritative x402 V2 challenge."},"502":{"description":"Base RPC returned an invalid response.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"503":{"description":"Payment configuration or an upstream dependency is unavailable.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"504":{"description":"Base RPC request timed out.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}}}}},"/chain/transaction-receipt-status":{"post":{"operationId":"transaction_receipt_status","summary":"Check Base transaction receipt status by transaction hash. Determine whether the transaction is pending, confirmed successful, or confirmed reverted, with receipt, block, and gas details.","description":"Check Base transaction receipt status by transaction hash. Determine whether the transaction is pending, confirmed successful, or confirmed reverted, with receipt, block, and gas details. This read-only Base Mainnet endpoint requires x402 payment.","tags":["transaction","receipt","status","confirmation","base"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"hash":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$","description":"Base Mainnet transaction hash."}},"required":["hash"],"additionalProperties":false},"example":{"hash":"0x0000000000000000000000000000000000000000000000000000000000000000"}}}},"responses":{"200":{"description":"Successful read-only chain response.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"network":{"type":"string","const":"eip155:8453"},"hash":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$","description":"Base Mainnet transaction hash."},"receipt_found":{"type":"boolean"},"confirmed":{"type":"boolean"},"success":{"type":["boolean","null"]},"receipt":{"oneOf":[{"type":"null"},{"type":"object","properties":{"transaction_hash":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$","description":"Base Mainnet transaction hash."},"block_number":{"type":"string","pattern":"^[0-9]+$"},"transaction_index":{"type":"string","pattern":"^[0-9]+$"},"from":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Transaction sender."},"to":{"oneOf":[{"type":"null"},{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Transaction recipient."}]},"contract_address":{"oneOf":[{"type":"null"},{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Created contract address."}]},"gas_used":{"type":"string","pattern":"^[0-9]+$"},"cumulative_gas_used":{"type":"string","pattern":"^[0-9]+$"},"effective_gas_price":{"type":"string","pattern":"^[0-9]+$"},"status":{"enum":["0x0","0x1",null]}},"required":["transaction_hash","block_number","transaction_index","from","to","contract_address","gas_used","cumulative_gas_used","status"],"additionalProperties":false}]}},"required":["ok","network","hash","receipt_found","confirmed","success","receipt"],"additionalProperties":false},"example":{"ok":true,"network":"eip155:8453","hash":"0x0000000000000000000000000000000000000000000000000000000000000000","receipt_found":false,"confirmed":false,"success":null,"receipt":null}}}},"400":{"description":"Invalid JSON or request input.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"402":{"description":"Payment Required. The PAYMENT-REQUIRED response header contains the authoritative x402 V2 challenge."},"502":{"description":"Base RPC returned an invalid response.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"503":{"description":"Payment configuration or an upstream dependency is unavailable.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"504":{"description":"Base RPC request timed out.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}}}}},"/chain/wallet-preflight":{"post":{"operationId":"wallet_preflight","summary":"Wallet preflight: check wallet readiness before token spend on Base. Verify native ETH gas balance, ERC20 token balance, allowance, spender contract status, and whether the requested amount can be spent.","description":"Wallet preflight: check wallet readiness before token spend on Base. Verify native ETH gas balance, ERC20 token balance, allowance, spender contract status, and whether the requested amount can be spent. This read-only Base Mainnet endpoint requires x402 payment.","tags":["x402","base","ai-agents","wallet","erc20"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"wallet":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Base wallet address."},"token":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"ERC-20 token contract address on Base."},"spender":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Planned spender address."},"amount":{"type":"string","pattern":"^[0-9]+(?:\\.[0-9]+)?$","description":"Positive decimal string without scientific notation. Exact fractional precision depends on the token decimals() response."}},"required":["wallet","token","spender","amount"],"additionalProperties":false},"example":{"wallet":"0x0000000000000000000000000000000000000001","token":"0x0000000000000000000000000000000000000002","spender":"0x0000000000000000000000000000000000000003","amount":"10.5"}}}},"responses":{"200":{"description":"Successful read-only chain response.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"network":{"type":"string","const":"eip155:8453"},"wallet":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Wallet address."},"token":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Token contract address."},"spender":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"Spender address."},"requested_amount":{"type":"object","properties":{"formatted":{"type":"string","pattern":"^[0-9]+(?:\\.[0-9]+)?$"},"raw":{"type":"string","pattern":"^[0-9]+$"},"decimals":{"type":"integer","minimum":0,"maximum":255}},"required":["formatted","raw","decimals"],"additionalProperties":false},"native_balance":{"type":"object","properties":{"wei":{"type":"string","pattern":"^[0-9]+$"},"eth":{"type":"string","pattern":"^[0-9]+(?:\\.[0-9]+)?$"},"has_native_gas_balance":{"type":"boolean"}},"required":["wei","eth","has_native_gas_balance"],"additionalProperties":false},"token_balance":{"type":"object","properties":{"raw":{"type":"string","pattern":"^[0-9]+$"},"formatted":{"type":"string","pattern":"^[0-9]+(?:\\.[0-9]+)?$"},"sufficient":{"type":"boolean"}},"required":["raw","formatted","sufficient"],"additionalProperties":false},"allowance":{"type":"object","properties":{"raw":{"type":"string","pattern":"^[0-9]+$"},"formatted":{"type":"string","pattern":"^[0-9]+(?:\\.[0-9]+)?$"},"unlimited":{"type":"boolean"},"sufficient":{"type":"boolean"}},"required":["raw","formatted","unlimited","sufficient"],"additionalProperties":false},"spender_is_contract":{"type":"boolean"},"ready":{"type":"boolean"},"issues":{"type":"array","items":{"enum":["NO_NATIVE_GAS_BALANCE","INSUFFICIENT_TOKEN_BALANCE","INSUFFICIENT_ALLOWANCE","SPENDER_NOT_CONTRACT"]}},"limitations":{"type":"array","prefixItems":[{"const":"native gas check only verifies a non-zero ETH balance"},{"const":"transaction execution is not simulated"}],"minItems":2,"maxItems":2}},"required":["ok","network","wallet","token","spender","requested_amount","native_balance","token_balance","allowance","spender_is_contract","ready","issues","limitations"],"additionalProperties":false},"example":{"ok":true,"network":"eip155:8453","wallet":"0x0000000000000000000000000000000000000001","token":"0x0000000000000000000000000000000000000002","spender":"0x0000000000000000000000000000000000000003","requested_amount":{"formatted":"10.5","raw":"10500000","decimals":6},"native_balance":{"wei":"0","eth":"0","has_native_gas_balance":false},"token_balance":{"raw":"0","formatted":"0","sufficient":false},"allowance":{"raw":"0","formatted":"0","unlimited":false,"sufficient":false},"spender_is_contract":true,"ready":false,"issues":["NO_NATIVE_GAS_BALANCE","INSUFFICIENT_TOKEN_BALANCE"],"limitations":["native gas check only verifies a non-zero ETH balance","transaction execution is not simulated"]}}}},"400":{"description":"Invalid JSON or request input.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"402":{"description":"Payment Required. The PAYMENT-REQUIRED response header contains the authoritative x402 V2 challenge."},"502":{"description":"Base RPC returned an invalid response.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"503":{"description":"Payment configuration or an upstream dependency is unavailable.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}},"504":{"description":"Base RPC request timed out.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["ok","error"],"additionalProperties":false}}}}}}}}}