Swap Quote
Get a token swap quote based on an input or output value.
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 Output Quote from Exact Input Amount
Get the output amount from a given exact input amount and a swap route.
Function name: quoteExactInput ⛽ No gas cost
bytes path
Route path containing pair swap fees
uint256 amountIn
Exact input amount in token's smallest unit
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.
Code Overview
Get Input Quote from Exact Output Amount
Get the input amount from a given exact output amount and a swap route.
Function name: quoteExactOutput ⛽ No gas cost
bytes path
Route path containing pair swap fees, reversed
uint256 amountOut
Exact output amount in token's smallest unit
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.
Code Overview
Last updated