import { BigNumberish } from 'ethers'; import { QuoteOrFillableQuoteT } from '../entities'; import { BaseAPI } from './baseAPI'; /** * Represents a class for handling pricing comparison operations. * * @class PricingAPI * @extends {BaseAPI} */ export declare class PricingAPI extends BaseAPI { /** * Evaluates and returns the best quote from a set of quotes based on the provided size and other options. * * The function initially filters out null and undefined quotes. If all quotes are null or undefined, * it returns null. If the pool keys of the quotes are not identical, it emits a warning unless * `ignoreWarnings` is set to true. * * It then filters the quotes based on the minimum size and the deadline. Only RFQ quotes can be * filtered by deadline. The size of the quote should be greater or equal to the minimum size provided. * * It finally compares all the quotes and returns the one deemed the best using the `better` method. * * @param {(QuoteOrFillableQuoteT | null)[]} quotes - Array of quotes or fillable quotes to be compared. * @param {BigNumberish} size - The size to consider when comparing quotes. * @param {BigNumberish} [minimumSize] - The minimum size to filter quotes by. If not provided, `size` will be used. * @param {boolean} [ignoreWarnings=false] - Whether to ignore warnings if pool keys for quotes compared are not identical. * * @returns {QuoteOrFillableQuoteT | null} The best quote from the provided set, or null if no quotes pass the filtering conditions. */ best(quotes: (QuoteOrFillableQuoteT | null)[], size: BigNumberish, minimumSize?: BigNumberish, ignoreWarnings?: boolean): QuoteOrFillableQuoteT | null; /** * Compares two quotes and returns the better one based on multiple factors. * * The function considers various factors including deadline, size, price, origin and timestamp (for RFQs) * in determining which quote is better. If both quotes are essentially equivalent, quoteA is returned. * * @param {QuoteOrFillableQuoteT | null} quoteA - The first quote or fillable quote to be compared. * @param {QuoteOrFillableQuoteT | null} quoteB - The second quote or fillable quote to be compared. * @param {BigNumberish} size - The size to consider when comparing quotes. * @param {BigNumberish} [minimumSize] - The minimum size to filter quotes by. If not provided, `size` will be used. * @param {boolean} [ignoreWarnings=false] - Whether to ignore warnings if pool keys for quotes compared are not identical. * * @returns {QuoteOrFillableQuoteT | null} The better quote from the two provided, or null if neither quote passes the comparison conditions. * * @throws {Error} If minimum size is greater than size. * @throws {Error} If quotes have opposite directions. */ better(quoteA: QuoteOrFillableQuoteT | null, quoteB: QuoteOrFillableQuoteT | null, size: BigNumberish, minimumSize?: BigNumberish, ignoreWarnings?: boolean): QuoteOrFillableQuoteT | null; /** * Calculates the limit of a premium based on maximum slippage percentage. * * The function computes the limit for a premium considering a given maximum slippage percentage. * If the operation is a 'buy', the premium limit is increased by the slippage offset, otherwise, * for a 'sell', the premium limit is decreased by the slippage offset. * * @param {BigNumberish} premium - The premium value used as the base for limit calculation. * @param {Number} maxSlippagePercent - The maximum slippage percentage to calculate the offset. * @param {boolean} isBuy - A flag indicating whether the operation is a 'buy' or 'sell'. * * @returns {bigint} The calculated limit for the premium considering the slippage. */ premiumLimit(premium: BigNumberish, maxSlippagePercent: Number, isBuy: boolean): bigint; } export default PricingAPI;