Swap Quote
Get a token swap quote based on an input or output value.
Last updated
Get a token swap quote based on an input or output value.
Last updated
Below are the two methods to get a quote for a swap from a given route:
Contract ID: SaucerSwapV2QuoterV2
When providing HBAR in the path array, use the wrapped HBAR token ID (WHBAR).
For production environments, it's highly recommended to use a paid Mirror Node provider for commercial and high-traffic purposes. While Hedera's public mirror node offers free REST API and JSON API endpoints, they have global rate limits. These are best suited for development or low rate usage scenarios.
Get the output amount from a given exact input amount and a swap route.
Function name: quoteExactInput ⛽ No gas cost
Parameter Name | Description |
---|---|
The data passed to the 'path' parameter follows this format: [token, fee, token, fee, token, ...], with each 'token' in the route being 20 bytes long and each 'fee' being 3 bytes long. Example, 0x0001F4 for a 0.05% fee.
Get the input amount from a given exact output amount and a swap route.
Function name: quoteExactOutput ⛽ No gas cost
The data passed to the 'path' parameter follows this format: [token, fee, token, fee, token, ...], but reversed (i.e. the first token in the array should be output token), with each 'token' in the route being 20 bytes long and each 'fee' being 3 bytes long. Example, 0x000BB8
for a 0.30% fee.
Parameter Name | Description |
---|---|
bytes path
Route path containing pair swap fees
uint256 amountIn
Exact input amount in token's smallest unit
bytes path
Route path containing pair swap fees, reversed
uint256 amountOut
Exact output amount in token's smallest unit