/**
 * clientMetadata is a type for FE to store historical state of a checkoutItem
 * It should be mostly derived by backend data but currently we don't have capacity to do it.
 *
 * Make sure it is SERIALIZABLE and BACKWARD COMPATIBLE!!
 */
import type { DynamicTargetAssetCandidate } from '@funkit/connect-core';
import type { ApiCheckoutClientMetadata } from '@funkit/utils';
import type { FunkitActiveCheckoutItem, FunkitCheckoutActionParams, FunkitCheckoutConfig } from '../providers/FunkitCheckoutContext';
import type { FunkitCheckoutQuoteResult } from './quote';
type Serialize<T> = T extends (...args: never[]) => unknown ? DeepSerialize<ReturnType<T>> : T extends object ? DeepSerialize<T> : T;
type DeepSerialize<T> = {
    [K in keyof T]: Serialize<T[K]>;
};
type SerializedCandidate = Omit<DynamicTargetAssetCandidate, 'generateActionsParams'>;
/**
 * Historical Checkout Configuration stored in the server
 * This is similar to FunkitCheckoutConfig but with some fields changed to serializable types
 * */
export type ServerCheckoutConfig = Omit<DeepSerialize<FunkitCheckoutConfig>, 'dynamicTargetAssetCandidates'> & {
    dynamicTargetAssetCandidates?: SerializedCandidate[];
};
type HistoricalCheckoutItemKey = 'id' | 'startTimestampMs' | 'finalDollarValue' | 'latestQuote' | 'depositAddress' | 'selectedSourceAssetInfo' | 'selectedPaymentMethodInfo';
/**
 * HistoricalCheckoutItem stored in the server
 *
 * Make sure it is SERIALIZABLE and BACKWARD COMPATIBLE!!
 **/
export interface HistoricalCheckoutItem extends Pick<FunkitActiveCheckoutItem, HistoricalCheckoutItemKey> {
    initSettings: {
        config: ServerCheckoutConfig;
    };
    isWithdrawal?: boolean;
}
/**
 * Build the checkout config for a deposit re-started from history (the
 * "New deposit" CTA). Serialized history can't carry closures, so every
 * function-valued field is only restorable from the live config:
 * - candidates' per-route `generateActionsParams` are
 *   stripped on serialize, so the still-active checkout takes the
 *   function-bearing candidates from `liveConfig` — otherwise a destination
 *   switch would re-bind `dynamicRoutingId` without its post-action; a
 *   non-active historical checkout has no live closures, so it keeps the
 *   stripped candidates;
 * - `modalTitle` is restored whenever a live config exists (falling back to the
 *   serializable value) so validation passes;
 * - the remaining live-only closures (`getMinDepositUSD`,
 *   `generateActionsParams`, `polymarketPerpsTransfer`, `resolveHealthFactor`)
 *   are carried forward only when re-starting the still-active checkout.
 */
export declare function createNewCheckoutConfig({ serializedConfig, liveConfig, isActiveCheckout, }: {
    serializedConfig: ServerCheckoutConfig;
    liveConfig: FunkitCheckoutConfig | undefined;
    isActiveCheckout: boolean;
}): FunkitCheckoutConfig;
/**
 * Sanitizes checkoutItem to generate a clientMetadata object to be saved in backend.
 * Ensures that no react components get sent to backend and the object isn't too big as well.
 */
export declare function generateClientMetadataForBackend({ checkoutItem, latestQuote, actionsParams, isWithdrawal, }: {
    checkoutItem: FunkitActiveCheckoutItem;
    latestQuote: FunkitCheckoutQuoteResult;
    actionsParams?: FunkitCheckoutActionParams[];
    isWithdrawal?: boolean;
}): ApiCheckoutClientMetadata;
export declare function generateClientMetadataForTokenTransfer(): HistoricalCheckoutItem;
export {};
