swap
Construct a base64-encoded Solana transaction to buy or sell tokens via a bonding curve, specifying a minimum output amount for slippage protection.
Instructions
Create a swap transaction (returns base64 transaction)
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": {
"bondingCurveBucket": "<bondingCurveBucket>",
"amountIn": "<amountIn>",
"minAmountOut": "<minAmountOut>",
"direction": "<direction>",
"authority": "<authority>"
},
"name": "swap"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amountIn | Yes | The input amount as a string (in lamports/base units) | |
| authority | Yes | The public key of the authority (user wallet) | |
| direction | Yes | Swap direction: 'Buy' (SOL to tokens) or 'Sell' (tokens to SOL) | |
| minAmountOut | Yes | The minimum output amount as a string (for slippage protection) | |
| bondingCurveBucket | Yes | The public key of the bonding curve bucket |