Build a swap transaction
build_swapBuild an unsigned, simulated swap transaction for the user's own Stellar account, ready to sign. Returns the XDR, the expected and minimum amounts, the network fee, warnings, and sign links: sign.web opens a skyhitz.io page where the user signs with their own wallet and the swap is submitted; sign.sep7 is a SEP-7 link for wallets that support it. Nothing moves until the user signs. Show the user the amounts and warnings first.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"account": "<account>",
"sell": "<sell>",
"buy": "<buy>",
"amount": "<amount>"
},
"name": "build_swap"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | Optional recipient (G… or C…) instead of account. | |
| buy | Yes | HITZ, XLM, USDC (any case), or a token contract address (C…). | |
| sell | Yes | HITZ, XLM, USDC (any case), or a token contract address (C…). | |
| amount | Yes | Exact amount of sell to trade. | |
| account | Yes | The user's account: it pays, signs and (unless to is set) receives. | |
| valid_for | No | Seconds the transaction stays valid. | |
| slippage_bps | No | How far below the quote the output may land, in basis points (100 = 1%). |