Provides functionality to fetch quotes for trade amounts over specified routes.

const quoteProvider = new QuoteProvider();

Constructors

Methods

  • Core method to fetch quotes for specified amounts and routes, based on the trade type (exact input or exact output).

    Parameters

    • amounts: CurrencyAmount[]

      An array of amounts for which quotes are requested.

    • routes: V2Route[]

      The routes over which to fetch quotes.

    • tradeType: TradeType

      The type of trade, determining the direction of quote calculation.

    • protocol: Protocol = Protocol.SOROSWAP

    Returns Promise<{
        routesWithQuotes: V2RouteWithQuotes[];
    }>

    A promise that resolves to an object containing routes along with their associated quotes for the specified amounts.

  • Fetches quotes for multiple exact input amounts across specified routes.

    Parameters

    • amountIns: CurrencyAmount[]

      An array of input amounts for which quotes are requested.

    • routes: V2Route[]

      The routes over which to fetch quotes.

    • protocol: Protocol = Protocol.SOROSWAP

    Returns Promise<{
        routesWithQuotes: V2RouteWithQuotes[];
    }>

    A promise that resolves to an array of routes with their associated quotes for the given input amounts.

  • Fetches quotes for multiple exact output amounts across specified routes.

    Parameters

    • amountOuts: CurrencyAmount[]

      An array of output amounts for which quotes are requested.

    • routes: V2Route[]

      The routes over which to fetch quotes.

    • protocol: Protocol = Protocol.SOROSWAP

    Returns Promise<{
        routesWithQuotes: V2RouteWithQuotes[];
    }>

    A promise that resolves to an array of routes with their associated quotes for the given output amounts.