Class: Quoting
gSwap SDK 2.0.0-rc.4 / Quoting
Class: Quoting
Defined in: packages/gswap-sdk/dist/index.d.ts:3134
Read-only quote service backed by the v2 offline quote engine.
Constructors
Constructor
new Quoting(
gateway,symbols):Quoting
Defined in: packages/gswap-sdk/dist/index.d.ts:3145
Creates a quote service.
Parameters
gateway
QuoteGateway
symbols
Returns
Quoting
Example
const quoting = new Quoting(gateway, symbols); // a ChainGateway, or any { dexBackendBaseUrl, httpRequestor }
Methods
quoteExactInput()
quoteExactInput(
tokenIn,tokenOut,amountIn,fee?):Promise<QuoteResult>
Defined in: packages/gswap-sdk/dist/index.d.ts:3156
Quotes the output for a positive exact-input amount.
Parameters
tokenIn
tokenOut
amountIn
fee?
Returns
Promise<QuoteResult>
Example
const quote = await quoting.quoteExactInput('GALA', 'GUSDC', '100');
console.log(quote.amountOut);
quoteExactOutput()
quoteExactOutput(
tokenIn,tokenOut,amountOut,fee?):Promise<QuoteResult>
Defined in: packages/gswap-sdk/dist/index.d.ts:3166
Quotes the input for a positive exact-output amount.
Parameters
tokenIn
tokenOut
amountOut
fee?
Returns
Promise<QuoteResult>
Example
const quote = await quoting.quoteExactOutput('GALA', 'GUSDC', '10', 3000);
console.log(quote.amountIn);