import type { ApiFunkitCheckoutQuoteResult, CheckoutQuoteResponse } from '@funkit/utils'; import type { Dnum } from 'dnum'; import { type Address } from 'viem'; import type { Config } from '../wagmi/hooks'; import type { FunkitDirectExecutionInfo } from '../hooks/useCheckoutDirectExecution'; import type { FunkitActiveCheckoutItem } from '../providers/FunkitCheckoutContext'; import type { LoginType } from '../providers/GeneralWalletProvider'; import type { CheckoutPayer } from '../providers/GeneralWalletProvider'; import { type CheckoutFees } from './fees'; import { type PaymentMethodInfo } from './paymentMethods'; import type { QuoteBuilder } from './quoteMode'; export interface FunkitCheckoutQuoteResult extends Omit { finalSpreadUsd: string; finalFeesBreakdown: CheckoutFees; } export declare function getCheckoutBaseQuote(checkoutItem: FunkitActiveCheckoutItem, payerWallets: CheckoutPayer, wagmiConfig: Config, directExecutionInfo: FunkitDirectExecutionInfo, senderAddress?: Address, isWithdrawal?: boolean, quoteBuilder?: QuoteBuilder, /** * User-driven preference for the source-side authorization step, forwarded * to `getDirectExecutionQuote` where Relay's `usePermit` flag actually * flows. On the Aave native fast path it drives `shouldUsePermitForSupply` * instead of flowing here. */ usePermit?: boolean): Promise; /** * In EXACT_IN/ONE_TO_ONE mode, the user's input is the source (from) amount. * When a canonical bigint is available, use formatUnits to produce the precise * human-readable string, avoiding precision loss from bigint->Number->string. */ export declare function resolveFromTokenAmount(checkoutItem: FunkitActiveCheckoutItem, isExactInViaBuilder: boolean, userInputAmount: number, fromTokenDecimals: number): string; /** * Derives estSubtotalToAmount from metadata.toAmountBaseUnit for EXACT_IN quotes. * Returns null when derivation isn't needed or isn't possible. **/ export declare function deriveEstSubtotalToAmountIfNeeded(baseQuote: CheckoutQuoteResponse, isExactIn: boolean, toTokenDecimals: number): string | null; export declare function getQuoteFinalEstimation(baseQuote: CheckoutQuoteResponse, checkoutItem: FunkitActiveCheckoutItem, newPaymentMethodInfo: PaymentMethodInfo, wagmiConfig: Config, apiKey: string, loginType: LoginType, isWithdrawal?: boolean): Promise<{ finalEstimation: FunkitCheckoutQuoteResult; }>; export interface CheckedAssetAmount { isAboveMaximum: boolean; isBelowMinimum: boolean; maxTargetAssetAmount?: Dnum; minTargetAssetAmount?: Dnum; } export declare function checkAssetAmount(checkoutItem: FunkitActiveCheckoutItem, finalEstimation: FunkitCheckoutQuoteResult, wagmiConfig: Config, walletAddress: Address): Promise; export type QuotePhaseResult = { phase: 'base'; quote: CheckoutQuoteResponse; status: 'success'; } | { phase: 'final'; quote: FunkitCheckoutQuoteResult; status: 'success'; } | { phase: 'base' | 'final'; status: 'failed'; }; export interface CheckoutQuoteParams { checkoutItem: FunkitActiveCheckoutItem; walletAddress: Address; apiKey: string; newPaymentMethodInfo: PaymentMethodInfo; wagmiConfig: Config; loginType: LoginType; directExecutionInfo: FunkitDirectExecutionInfo; /** when sender address is different from wallet address * this happens when withdrawing from a different wallet **/ senderAddress?: Address; isWithdrawal?: boolean; onQuotePhaseSettled?: (result: QuotePhaseResult) => void; } export declare function getQuoteAndEstimation({ checkoutItem, walletAddress, apiKey, newPaymentMethodInfo, wagmiConfig, loginType, directExecutionInfo, senderAddress, isWithdrawal, onQuotePhaseSettled, }: CheckoutQuoteParams): Promise<{ baseQuote: CheckoutQuoteResponse; checkedAssetAmount: CheckedAssetAmount; finalEstimation: FunkitCheckoutQuoteResult; }>;