Class: Quoting
Handles quote operations for token swaps.
Constructors
Constructor
new Quoting(
gatewayBaseUrl,
dexContractBasePath,
httpClient?): Quoting;
Parameters
Parameter | Type |
---|---|
gatewayBaseUrl | string |
dexContractBasePath | string |
httpClient? | HttpClient |
Returns
Quoting
Methods
quoteExactInput()
quoteExactInput(
tokenIn,
tokenOut,
amountIn,
fee?): Promise<GetQuoteResult>;
Gets a quote for an exact amount of token being sold.
Parameters
Parameter | Type | Description |
---|---|---|
tokenIn | | string | GalaChainTokenClassKey | The input token to sell. |
tokenOut | | string | GalaChainTokenClassKey | The output token to buy. |
amountIn | NumericAmount | The exact amount of input tokens you want to sell. |
fee? | FEE_TIER | The pool fee tier. If not specified, will check all available fee tiers and return the best quote. |
Returns
Promise
<GetQuoteResult
>
The expected number of tokens you will receive (buy) when/if you execute the swap.
quoteExactOutput()
quoteExactOutput(
tokenIn,
tokenOut,
amountOut,
fee?): Promise<GetQuoteResult>;
Gets a quote for an exact amount of tokens being bought.
Parameters
Parameter | Type | Description |
---|---|---|
tokenIn | | string | GalaChainTokenClassKey | The input token sell. |
tokenOut | | string | GalaChainTokenClassKey | The output token to buy. |
amountOut | string | number | BigNumber | The exact amount of output tokens you want to buy. |
fee? | FEE_TIER | The pool fee tier. If not specified, will check all available fee tiers and return the best quote. |
Returns
Promise
<GetQuoteResult
>
The expected number of tokens you will need to sell (input) to receive the specified amount of output tokens.