prepare_swap
Prepares a swap transaction on Sera, returning transaction data to sign and send. Alerts if token allowance is insufficient and approval is needed.
Instructions
Prepare a swap transaction. Returns transaction data that needs to be signed and sent. May return approval_needed if token allowance is insufficient.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to_token | Yes | Destination token address | |
| amount_in | Yes | Amount to swap (human-readable) | |
| direction | Yes | Trade direction | |
| from_token | Yes | Source token address | |
| user_address | Yes | User's wallet address | |
| market_address | Yes | Market contract address |