build_swap
Create unsigned swap transactions for token exchanges on the Casper Network. Specify input/output tokens, amounts, and slippage to generate deploy JSON for external signing.
Instructions
Build an unsigned swap transaction. Returns the deploy JSON for external signing, plus a human-readable summary.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token_in | Yes | Input token: symbol (e.g., "CSPR"), name, or contract hash | |
| token_out | Yes | Output token: symbol (e.g., "USDT"), name, or contract hash | |
| amount | Yes | Human-readable amount (e.g., "100") | |
| type | Yes | "exact_in" or "exact_out" | |
| slippage_bps | No | Slippage tolerance in basis points (default 300 = 3%) | |
| deadline_minutes | No | Transaction deadline in minutes (default 20) | |
| sender_public_key | Yes | Sender hex public key (e.g., "01abc...") | |
| token_in_balance | No | Raw input token balance for one-time approval (e.g., from wallet). If omitted, approves exact swap amount only. |