Skip to main content

Class: Quoting

gSwap SDK 2.0.0-rc.4


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​

TokenResolver

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​

TokenRef

tokenOut​

TokenRef

amountIn​

NumericAmount

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>

Defined in: packages/gswap-sdk/dist/index.d.ts:3166

Quotes the input for a positive exact-output amount.

Parameters​

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);