import { type CheckoutHistoryItem, type CheckoutRefundState, CheckoutState, type DirectExecution } from '@funkit/api-base';
import { type CheckoutQuoteResponse } from '@funkit/utils';
import { type Config } from '@wagmi/core';
import { type Address, type Hex } from 'viem';
import type { UseConfigReturnType } from 'wagmi';
import type { ServerCheckoutConfig } from '~/domains/clientMetadata';
import type { FunkitCheckoutQuoteResult } from '~/domains/quote';
import type { FunkitCheckoutActionParams, FunkitCheckoutConfig } from '../providers/FunkitCheckoutContext';
export declare const MOONPAY_TIME_ESTIMATE_MS = 120000;
export declare const MESH_TIME_ESTIMATE_MS = 300000;
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>): 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;
}>;
/**
 * Generates an env config for checkout estimation
 * So that batch operation creation will not fail even if FW has insufficient funds to pass the estimation.
 */
export declare function getFunkitEnvForCheckoutEstimation({ chainId, bypassWalletInit, }: {
    chainId: string;
    bypassWalletInit: boolean;
}): {
    chain: string;
    gasSponsor: {
        useCheckoutSponsor: boolean;
        sponsorAddress: any;
        token?: string;
        usePermit?: boolean;
    };
    bypassInit: boolean;
    apiKey?: string;
    nonce?: bigint | undefined;
    fee?: {
        token?: string;
        amount?: number;
        gasPercent?: number;
        recipient: Address;
    } | undefined;
    skipDBAction?: boolean | undefined;
    logger?: import("@funkit/api-base").Logger | undefined;
};
export type TokenInfo = {
    symbol: string;
    tokenAddress: null | Address;
    tokenUnitPriceUsd: null | number;
    pickedChainId: string;
};
/**
 * Decorates a list of token strings with their chainId-specific tokenAddress and pickedChainId
 * @param tokensChainMap Map of token strings e.g. ['ETH', 'MATIC', ...]
 * @param targetChainId The targetChain identifier of the checkout
 * @returns List of tokenItem objects
 */
export declare function decorateTokenList(tokensChainMap: Record<string, Set<string>>, targetChainId: string, apiKey: string): Promise<TokenInfo[]>;
export declare function formatTokenAmountForMoonpay(amount: number, mpCurrencyCode: string): string;
export declare function getTimeFromNowSeconds(startTimeMs: number, durationMs: number): number;
/**
 * 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, }: {
    checkoutConfig: FunkitCheckoutConfig | ServerCheckoutConfig;
    hideAmount?: boolean;
}): 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 fees (in source asset).
 *
 * _These also including the initial transfer / brokerage / card processing fees._
 */
export declare function getQuoteTotalFeesFromAmount(finalQuote: FunkitCheckoutQuoteResult): 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): number;
export declare function getTokenDecimals(wagmiConfig: Config, chainId: string, tokenAddress: Address): Promise<number>;
export declare function evaluateCheckoutGenerateActionsParams(config: FunkitCheckoutConfig | ServerCheckoutConfig): 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 {};
