Buy a token
trnch_buyBuild a ready-to-sign buy transaction by quoting six routers and selecting the best route, with the 0.5% fee already deducted. Returns approval and tx for the key's wallet to submit.
Instructions
Build a buy in one call: quotes six routers and returns the best route as a transaction for the key's wallet to sign. Give tokenId or token, and amountUsd (paid in USDG) or amountIn with tokenIn. The TRNCH fee (0.5%) is already deducted from the quote. Returns { router, quote, approval, tx, chainId, from }: if approval is not null, send it first, then sign and send tx from the same wallet (chainId 4663). Nothing is sent by TRNCH. Errors: 409 token not tradable through TRNCH (kept out by TIA), 429 rate or build limit (retry-after). Requires the API key from trnch_register, sent as Authorization: Bearer .
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | No | Token to buy, as an address. Use this or tokenId. | |
| tokenId | No | Opaque token id from trnch_heat (field id). Use this or token. | |
| tokenIn | No | Token paid with amountIn. Default USDG. | |
| amountIn | No | Amount of tokenIn to spend, smallest unit. Use this or amountUsd. | |
| amountUsd | No | Amount to spend in US dollars, paid in USDG. Use this or amountIn. | |
| slippageBps | No | Max slippage in basis points (100 = 1%). Default 100. |