import { type CheckoutHistoryItem, type CheckoutRefundState, CheckoutState, type DirectExecution } from '@funkit/api-base';
import { type ApiFunkitCheckoutQuoteResult, type CheckoutQuoteResponse } from '@funkit/utils';
import type { Dnum } from 'dnum';
import { type Address, type Hex } from 'viem';
import type { ServerCheckoutConfig } from '../domains/clientMetadata';
import type { FunkitCheckoutQuoteResult } from '../domains/quote';
import type { Config, UseConfigReturnType } from '../wagmi/hooks';
import { type FunkitCheckoutActionParams, type FunkitCheckoutConfig } from '../providers/FunkitCheckoutContext';
export declare const MOONPAY_TIME_ESTIMATE_MS = 120000;
export declare const BROKERAGE_TIME_ESTIMATE_MS = 0;
export declare const BANK_TIME_ESTIMATE_MS = 0;
export declare const DUMMY_TRANSFER_PARAMS: {
    toAddress: "0x000000000000000000000000000000000000dEaD";
    tokenAmount: number;
};
type ValidateCheckoutConfigReturn = Promise<{
    config: FunkitCheckoutConfig;
    isValid: true;
    message: string;
} | {
    isValid: false;
    message: string;
}>;
/**
 * Validates the checkout configuration.
 * @param config - The checkout configuration to validate.
 * @returns An object indicating whether the configuration is valid and a message if it is not.
 */
export declare function validateCheckoutConfig(config: Partial<FunkitCheckoutConfig>, apiKey: string): ValidateCheckoutConfigReturn;
export declare const hasSufficientBalance: (wagmiConfig: UseConfigReturnType, walletAddress: string, tokenAddress: string, tokenChainId: string, requiredAssetAmount: number) => Promise<{
    balance: number;
    result: boolean;
    tokenTicker: string;
} | {
    balance: number;
    result: boolean;
    tokenTicker: null;
}>;
export declare const hasGasToken: (wagmiConfig: UseConfigReturnType, walletAddress: string, chainId: string) => Promise<boolean>;
export type TokenInfo = {
    symbol: string;
    tokenAddress: null | Address;
    tokenUnitPriceUsd: null | number;
    pickedChainId: string;
};
export declare function getTimeFromNowSeconds(startTimeMs: number, durationMs: number): number;
export declare function getCheckoutReceivedAmount({ config, quote, }: {
    config: FunkitCheckoutConfig | ServerCheckoutConfig;
    quote: ApiFunkitCheckoutQuoteResult | null;
}): number;
export declare function getCheckoutReceivedAmountFormatted({ config, quote, }: {
    config: FunkitCheckoutConfig | ServerCheckoutConfig;
    quote: ApiFunkitCheckoutQuoteResult | null;
}): string;
export declare function getCheckoutSentAmount({ quote, }: {
    quote: ApiFunkitCheckoutQuoteResult | null;
}): number;
export declare function getCheckoutSentAmountFormatted({ quote, }: {
    quote: ApiFunkitCheckoutQuoteResult | null;
}): string;
/**
 * Given a checkout config, returns the display string for the checkout item.
 * Arbitrary action checkouts: Display the targetAssetAmount
 * - not 100% accurate since userOp will consume some tokens, but FINE now.
 * - e.g. "2.1234 aArbUSDCn" or "Staked VRTX"
 * Basic buy checkouts: Display the targetAssetAmount with the targetAssetTicker.
 * - e.g. "0.12345 ETH"
 * Ideally, should be used via the hook `useCheckoutItemDisplay` to handle the customer cutomization check.
 */
export declare function getCheckoutItemDisplay({ checkoutConfig, hideAmount, overrideAmount, }: {
    checkoutConfig: FunkitCheckoutConfig | ServerCheckoutConfig;
    hideAmount?: boolean;
    overrideAmount?: number;
}): string;
/**
 * Given the result of a quote, calculate the effective fees (in source asset).
 *
 * _These are only the fees from our base quote, **not** including the initial transfer / brokerage / card processing fees._
 */
export declare function getBaseQuoteTotalFeesFromAmount(baseQuote: CheckoutQuoteResponse): number;
/**
 * Given the result of a quote, calculate the effective exchange rate (target asset / source asset).
 */
export declare function getQuoteExchangeRate(config: FunkitCheckoutConfig, baseQuote: CheckoutQuoteResponse): number;
/**
 * Given the result of a quote, estimate the maximum targetAssetAmount for which the checkout should succeed.
 * The result is then reduced by 1% to further reduce the risk of insufficient funds.
 *
 * NOTE: This assumes fees are (roughly) constant, at least when the target amount does not change much.
 * Only the API could give us a true number here.
 *
 * @param sourceAssetBalance - Total source asset balance
 * @param config - Checkout config
 * @param quoteResult - Failed quote results
 */
export declare function getMaxTargetAssetAmountEstimate(sourceAssetBalance: number, config: FunkitCheckoutConfig, quoteResult: FunkitCheckoutQuoteResult, targetAssetDecimals: number): Dnum;
export declare function getTokenDecimals(wagmiConfig: Config, chainId: string, tokenAddress: Address): Promise<number>;
export declare function evaluateCheckoutGenerateActionsParams(config: FunkitCheckoutConfig): Promise<FunkitCheckoutActionParams[]>;
export declare function isCheckoutCrFlow(config: FunkitCheckoutConfig): boolean;
/**
 * @param config can be either be a config from live checkoutItem OR from checkout history's clientMetadata
 */
export declare function isCheckoutPostActionRequired(config: FunkitCheckoutConfig | ServerCheckoutConfig): boolean;
/**
 * @returns whether we should show the checkout to the user (ie. supported in current sdk version & not cancelled)
 */
export declare const isCheckoutValid: (checkout: CheckoutHistoryItem | MergedCheckoutHistoryItem) => boolean;
export declare const isCheckoutHistoryDirectExecution: (checkoutId: string) => boolean;
export type MergedCheckoutHistoryItem = {
    directExecution: boolean;
    /** For direction execution this is the tx hash, for checkouts it is the deposit address */
    id: Hex;
    refundState?: CheckoutRefundState;
    state: CheckoutState;
} & ((CheckoutHistoryItem & {
    directExecution: false;
}) | (DirectExecution & {
    directExecution: true;
}));
export declare function toMergedCheckoutHistoryItem(item: CheckoutHistoryItem | DirectExecution): MergedCheckoutHistoryItem;
export declare function isVaultDepositCheckout(checkoutConfig: FunkitCheckoutConfig, sourceHolding: {
    chainId: string;
    tokenAddress: string;
}): boolean;
/** some additional finalized token will be performed after swap. We need to calculate the final destination token amount */
export declare function computeDisplayDestinationToken(checkoutConfig: FunkitCheckoutConfig | ServerCheckoutConfig | undefined, displayAssetAmount: number): {
    finalizedTokenAmount: number;
    finalizedTokenSymbol: string;
    finalizedTokenIcon: string;
};
export {};
