execute_swap
Execute a token swap on Sera: get a quote, approve tokens if needed, sign and submit the transaction.
Instructions
Execute a swap transaction. Gets a quote, handles token approval if needed (sends on-chain approve tx for non-permit tokens like USDT), signs the EIP-712 intent, and submits. Requires WALLET_PRIVATE_KEY.
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": {
"from_token": "<from_token>",
"to_token": "<to_token>",
"amount": "<amount>"
},
"name": "execute_swap"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | Yes | Amount to swap (in token units, e.g., '100' for 100 tokens) | |
| to_token | Yes | Address of token to buy | |
| from_token | Yes | Address of token to sell |