import { type WithdrawalAmountValidation } from '@funkit/connect-core'; import type { WithdrawalFlowConfig, WithdrawalToken } from '../flow/withdrawalFlowConfig'; /** * The one thing the user has left to fix, named so the submit button can say it. * * Nothing left to fix is `undefined`, not a `ready` member: these are what the * typed form is missing, and that is not the same as being submittable — the * async verdicts (risk screening, a settled quote) decide that. */ export type WithdrawCtaBlocker = 'enter-recipient' | 'unsupported-recipient' | 'recipient-same-as-source' | 'max-exceeded' | 'enter-amount' | 'select-destination' | 'invalid-for-chain'; /** * Amount limits, resolved from the host's callbacks. * * `sourceTokenUsdPrice` of 0 means unknown, not free: the core validator reads * it as "no price" and leaves the USD floor and ceiling inert, while the * per-token minimum and the balance check still apply. Sources whose price the * API cannot resolve (Lighter's index-addressed L2 assets) run that way. */ export declare function validateAmount({ config, sourceToken, sourceTokenUsdPrice, sourceTokenDecimals, amount, balance, }: { config: Pick; sourceToken: WithdrawalToken; /** Spot USD price of one source token; 0 when unknown. */ sourceTokenUsdPrice?: number; /** Fraction digits the source carries; caps how fine the USD floor gets. */ sourceTokenDecimals?: number; amount: string; balance: string | undefined; }): WithdrawalAmountValidation; /** * A same-chain, same-token transfer back to the sending wallet. Relay rejects * these with a generic error, so name the reason before quoting. * * Relay rail only: on a venue rail the balance sits in the venue's account, not * the wallet, so the same combination is a real withdrawal. */ export declare function isNoOpSelfWithdrawal({ recipientAddress, walletAddress, sourceToken, destinationToken, isVenueRail, }: { recipientAddress: string; walletAddress: string; sourceToken: WithdrawalToken; destinationToken: WithdrawalToken | undefined; isVenueRail: boolean; }): boolean; /** * Order is a faithful port of web's `getWithdrawButtonText`: the most specific * blocker wins, so the user is told the one thing to fix next rather than the * first thing that happens to fail. */ export declare function getWithdrawCtaBlocker({ recipientAddress, isRecipientBlacklisted, isRecipientSameAsSource, amount, amountValidation, destinationToken, }: { recipientAddress: string; isRecipientBlacklisted: boolean; isRecipientSameAsSource: boolean; amount: string; amountValidation: WithdrawalAmountValidation; destinationToken: WithdrawalToken | undefined; }): WithdrawCtaBlocker | undefined; /** * Whether the venue's flat fee leaves nothing for the quote to price. * * - Two ways to leave nothing: the fee meets or exceeds the amount, or the * remainder is under one base unit of the source token — `parseUnits` trims * the extra digits, so a positive remainder still reaches the quote as 0. * - Undefined `decimals` means the read hasn't landed. The quote can't run * without it either, so the fee-only verdict stands until it does. */ export declare function isAmountBelowQuoteFee({ amount, feeTokenAmount, decimals, }: { amount: string; feeTokenAmount: number; decimals: number | undefined; }): boolean; //# sourceMappingURL=validation.d.ts.map