Skip to main content

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​

ParameterType
gatewayQuoteGateway
symbolsTokenResolver

Returns​

Quoting

Example​

const quoting = new Quoting(gateway, symbols); // a ChainGateway, or any { dexBackendBaseUrl, httpRequestor }

Methods​

quoteExactInput()​

quoteExactInput(tokenIn, tokenOut, amountIn, fee?): Promise<QuoteResult>

Quotes the output for a positive exact-input amount.

Parameters​

ParameterType
tokenInTokenRef
tokenOutTokenRef
amountInNumericAmount
fee?FEE_TIER

Returns​

Promise<QuoteResult>

Example​

const quote = await quoting.quoteExactInput('GALA', 'GUSDC', '100');
console.log(quote.amountOut);

quoteExactOutput()​

quoteExactOutput(tokenIn, tokenOut, amountOut, fee?): Promise<QuoteResult>

Quotes the input for a positive exact-output amount.

Parameters​

ParameterType
tokenInTokenRef
tokenOutTokenRef
amountOutNumericAmount
fee?FEE_TIER

Returns​

Promise<QuoteResult>

Example​

const quote = await quoting.quoteExactOutput('GALA', 'GUSDC', '10', 3000);
console.log(quote.amountIn);