Class: Quoting
Read-only quote service backed by the v2 offline quote engine.
Constructors
Constructor
new Quoting(
gateway,symbols):Quoting
Creates a quote service.
Parameters
| Parameter | Type |
|---|---|
gateway | QuoteGateway |
symbols | TokenResolver |
Returns
Quoting
Example
const quoting = new Quoting(gateway, symbols); // a ChainGateway, or any { dexBackendBaseUrl, httpRequestor }
quote gateway token resolver
Methods
quoteExactInput()
quoteExactInput(
tokenIn,tokenOut,amountIn,fee?):Promise<QuoteResult>
Quotes the output for a positive exact-input amount.
Parameters
| Parameter | Type |
|---|---|
tokenIn | TokenRef |
tokenOut | TokenRef |
amountIn | NumericAmount |
fee? | FEE_TIER |
Returns
Promise<QuoteResult>
Example
const quote = await quoting.quoteExactInput('GALA', 'GUSDC', '100');
console.log(quote.amountOut);
quote exact input token in out amount result ref numeric fee tier
quoteExactOutput()
quoteExactOutput(
tokenIn,tokenOut,amountOut,fee?):Promise<QuoteResult>
Quotes the input for a positive exact-output amount.
Parameters
| Parameter | Type |
|---|---|
tokenIn | TokenRef |
tokenOut | TokenRef |
amountOut | NumericAmount |
fee? | FEE_TIER |
Returns
Promise<QuoteResult>
Example
const quote = await quoting.quoteExactOutput('GALA', 'GUSDC', '10', 3000);
console.log(quote.amountIn);
quote exact output token in out amount result ref numeric fee tier