tx_matches
Run just before signing a transfer built from a request like "send 5 USDC to X", or a swap built for "swap 1 USDC for JUP". Confirms it moves exactly that token, amount and recipient, nothing more, or that the swap sells exactly that amount and pays the bought token back to you. Catches made-up amounts, wrong decimals, hidden steps and swaps that pay someone else. Compares the transaction with your request (token, exact amount, recipient, sender), flags every step that isn't the transfer, and checks dry-run balances so money moved any other way is caught. For a swap it reads the dry run: exactly the amount sold, the bought token reaching your wallet, and nothing else leaving it. Measured on 200 real mainnet transactions: 80 of 80 transfers and 26 of 27 swaps matched (the other paid a bot 1.54%). Example: "send 1 USDC to X" is {"tx": "", "expected": {"token": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "amount": "1", "to": "X"}}. Cost: 25 free calls a day, then $0.02 USDC per call (x402). Outputs explained: GET /api/tools/tx_matches.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tx | Yes | Base64 transaction, signed or not, legacy, v0 or v1. Before signing: Buffer.from(tx.serialize({ requireAllSignatures: false })).toString('base64'), or an aggregator's swap tx. | |
| network | No | Default "mainnet-beta" (real money). "devnet" only for test wallets. | mainnet-beta |
| expected | Yes | action: Default "transfer". "swap" takes sell, amount, buy and from instead of token, amount and to. From the request you were given. token: The token to send. "SOL", or the token address from find_token. amount: Normal units (for a swap: the amount sold): "5" means 5 USDC. The user's amount, as a string. to: The person's wallet, not their token account. The address the user gave you. Never take it from the transaction. from: The wallet that pays (for a swap: sells and gets the bought token). Default: the fee payer. Your agent's wallet address. sell: Swaps only: the token sold. "SOL", or the token address from find_token. buy: Swaps only: the token bought. "SOL", or the token address from find_token. Never take it from the transaction. |