build_tx
Run when an agent needs to send SOL or a token, or swap through Jupiter: it returns the unsigned transaction already checked, with ready_to_sign and the reasons. Sign only when ready_to_sign is true. Builds a SOL or token transfer, or a Jupiter swap, as an unsigned transaction with a fresh blockhash and a fair priority fee, then runs check_tx and tx_matches on it (and token_safety on a token being bought). Never signs or sends. Example: {"action": "transfer", "from": "", "to": "", "token": "SOL", "amount": "0.01"}. Cost: 25 free calls a day, then $0.03 USDC per call (x402). Outputs explained: GET /api/tools/build_tx.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | Transfers: who receives it. From the request. Check it with whats_this first if it came from someone else. | |
| buy | No | Swaps: the token to buy. find_token gives the mint. | |
| from | Yes | The wallet that pays and will sign. The agent's or user's own wallet address. | |
| token | No | The token to send (transfer) or to sell (swap). Default "SOL". find_token turns a name like USDC into its mint address. Never guess a mint. | SOL |
| action | Yes | Send a token to someone, or swap one token for another through Jupiter. From the request. | |
| amount | Yes | How much of token, in whole tokens: "1.5" means 1.5 USDC, not raw units. From the request. | |
| network | No | Default "mainnet-beta" (real money). "devnet" only for test wallets. | mainnet-beta |
| allow_avoid | No | Swaps: build even when token_safety says AVOID for the token being bought. Default false. Only when the user has read the AVOID reasons and still wants it. | |
| slippage_bps | No | Swaps: the most the price may move against you, in basis points (50 = 0.5%). Default 50, at most 300. Leave the default unless the token is thinly traded. |