Documentation Index
Fetch the complete documentation index at: https://docs.fuse.io/llms.txt
Use this file to discover all available pages before exploring further.
Swap Tokens
To exchange one token for another, use theswapTokens() method. This method swaps the token with the contract address specified in the inputToken parameter for the token with the contract address specified in the outputToken parameter at the current market price.
Additionally, this method relays the transaction and covers the gas fees for the user, so they don’t need to worry about those fees.
The method requires a TradeRequest parameter with the following properties:
| Parameter | Type | Description |
|---|---|---|
| inputToken | address | The contract address of the token to be swapped. |
| outputToken | address | The contract address of the token to swap for. |
| inputAmount | number | The amount of the input token to be traded. |
| exactIn | boolean | Determines the type of trade (exact input or exact output). |