UNPKG

@funkit/connect

Version:

Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.

23 lines (22 loc) 1.44 kB
import { type MeldQuote } from '@funkit/api-base'; /** * Auto-pick the best quote for the user. * 1. If a quote has a customerScore >= 30, pick it * 2. If no quote has customerScore >= 30, pick either Coinbase or Binance * 2a. If both are available and they are at least 96% of the highest destinationAmount, pick the one with the best customerScore * 2aa. If they're have the same customerScore, pick the one with the highest destinationAmount * 2b. If both are available and they are less than 96% of the highest destinationAmount, pick the one with the highest destinationAmount * 3. If no quote has customerScore >= 30 and no Coinbase or Binance is available, pick the quote with the highest destinationAmount * @param quotes - the quotes to pick from * @returns the best quote based on the criteria */ export declare function autoPickBestQuote(quotes: MeldQuote[]): MeldQuote | undefined; /** * Check if the quote is the best price quote. * @param sourceQuotes - the quotes to check * @param targetQuote - the quote to check * @returns true if the quote is the best price quote, false otherwise */ export declare function isBestPriceQuote(sourceQuotes: MeldQuote[] | undefined, targetQuote: MeldQuote | undefined): boolean; export declare function createMoonpayMeldQuote(quote: MeldQuote): MeldQuote; export declare function withMoonpayMeldQuote(quotes: MeldQuote[] | undefined): MeldQuote[] | undefined;