Skip to main content
Below are the two methods to get a quote for a swap from a given route using JSON-RPC or REST-API:
When providing HBAR in the path array, use the wrapped HBAR token ID (WHBAR).

Get Output Quote from Input Amount

No gas cost Get the output amounts from a given input amount and a swap route. Function name: getAmountsOut

Code Overview

Resources:
Typescript

Get Input Quote from Output Amount

No gas cost Get the input amounts from a given output amount and a swap route. Function name: getAmountsIn

Code Overview

Resources:
Typescript