import type { TFunction } from 'i18next'; import type { Address } from 'viem'; import type { FunkitCheckoutQuoteResult } from '../../domains/quote'; import type { CustomWithdrawalConfig, SourceTokenOption, TokenInfo, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext'; type FunkitWithdrawalConfig = WalletWithdrawalConfig | CustomWithdrawalConfig; /** Where a withdrawal is sending funds: the token, its chain, and its address. */ export interface SelectedTargetAsset { selectedToken: string | undefined; selectedChainId: number | undefined; selectedChainName: string | undefined; targetAssetAddress: Address | undefined; } /** * The receive target, resolved once for every consumer below it. These switch as * one unit — a direct-transfer-only source pins all four to the option itself, * otherwise all four are the dropdown's live selection. `isLocked` saves callers * from re-deciding, so this is the only place the lock is evaluated. */ export declare function resolveTargetAsset(sourceTokenOption: SourceTokenOption | undefined, selectedTargetAsset: SelectedTargetAsset): SelectedTargetAsset & { isLocked: boolean; }; export declare function getWithdrawButtonText({ isWithdrawing, hasNoUsableRecipient, isValidAddress, isRecipientBlacklisted, isRecipientSameAsSource, withdrawalInputAmount, isWithdrawAmountValid, isWithdrawAmountTooHigh, isValidAddressAndChain, selectedToken, selectedChainId, selectedChainName, t, }: { isWithdrawing: boolean; /** The allowlist has no address to pick, so there's no recipient field. */ hasNoUsableRecipient: boolean; isValidAddress: boolean; isRecipientBlacklisted: boolean; isRecipientSameAsSource: boolean; withdrawalInputAmount: string; isWithdrawAmountValid: boolean; isWithdrawAmountTooHigh: boolean; isValidAddressAndChain: boolean; selectedToken: string | undefined; selectedChainId: number | undefined; selectedChainName: string | undefined; t: TFunction; }): string; /** * The asset being withdrawn: the selected option's own asset, else the asset a * client resolves for the selection, else the config's default source token. */ export declare function resolveWithdrawalSourceAsset({ selectedOption, clientSourceAsset, config, }: { selectedOption: SourceTokenOption | undefined; clientSourceAsset: TokenInfo | undefined; config: Pick; }): TokenInfo; /** * The asset whose live price values the withdrawal. An option without its own * asset is only the config's token when it names it; any other option stays * unpriced rather than borrowing the config token's price. */ export declare function resolvePricedSourceAsset({ selectedOption, selectedSourceToken, config, }: { selectedOption: SourceTokenOption | undefined; selectedSourceToken: string; config: Pick; }): TokenInfo | undefined; export declare function isValidWithdrawal({ config, sourceAsset, withdrawalInputAmount, sourceTokenUsdPrice, recipientAddress, selectedChainId, sourceTokenBalance, selectedSourceToken, }: { config: FunkitWithdrawalConfig; /** Passed to the config's USD limit callbacks. */ sourceAsset: TokenInfo; /** User-entered amount in source-token units (e.g. "0.5" for 0.5 ETH). */ withdrawalInputAmount: string; /** * USD price per unit of the source token. `undefined` while a live price * loads: the USD limits are then skipped rather than failed, and * `isSourcePricePending` tells the caller not to proceed. */ sourceTokenUsdPrice: number | undefined; sourceTokenBalance: string; recipientAddress: string; selectedChainId: number | undefined; selectedSourceToken: string | undefined; }): { isWithdrawAmountTooLow: boolean; isWithdrawAmountTooHigh: boolean; isWithdrawAmountAboveBalance: boolean; isWithdrawAmountValid: boolean; minWithdrawalDisplayValue: number; isValidAddress: boolean; isValidAddressAndChain: boolean; isSourcePricePending: boolean; }; /** * Converts a source-token amount string to its USD value using the given unit * price. Returns `undefined` when the price is not yet loaded so callers can * differentiate "still loading" from "actually $0". * * Exported for testing. */ export declare function toUsdValue(sourceAmount: string, sourceTokenUsdPrice: number | undefined): number | undefined; export declare function getRelayOutputCurrencyAmount(quote: FunkitCheckoutQuoteResult, fallback: number | undefined): number; export {};