export type AmountUnit = 'usd' | 'token'; /** * The next input value reformatted like checkout's amount field (leading zeros * dropped, group separators, decimals capped), or `null` when it holds * anything but digits and separators (the caller keeps the previous value). */ export declare function sanitizeAmountInput(next: string, locale: Intl.LocalesArgument): string | null; /** Floats, not base units: fine for display and quotes, not for an exact Max. */ export interface AmountInUnits { /** `undefined` when the input is empty, or in token mode without a price. */ usdAmount: number | undefined; /** `undefined` when the input is empty, or in USD mode without a price. */ tokenAmount: number | undefined; } export declare function getAmountInUnits(inputValue: string, unit: AmountUnit, unitPriceUsd: number | undefined, locale: Intl.LocalesArgument): AmountInUnits; /** * The input value re-expressed in `nextUnit`, rounded the way checkout's * reducer does (USD floors so it never exceeds what the tokens are worth). */ export declare function convertInputValue(inputValue: string, nextUnit: AmountUnit, unitPriceUsd: number, locale: Intl.LocalesArgument): string; export interface AmountUnitToggleState extends AmountInUnits { /** * Locale-formatted text for the field ("1,000.50"). Display only: pass * `tokenAmount`/`usdAmount` on, since this breaks `parseUnits` and quotes. */ inputValue: string; unit: AmountUnit; /** Ignores input that isn't digits and separators. */ setInputValue: (next: string) => void; /** `undefined` while the token price is unknown, so there's nothing to convert with. */ toggleUnit: (() => void) | undefined; } /** * Amount entry that can be typed in either USD or token units, converting the * typed value when the unit flips. * - Placeholder until checkout's exact-in amount logic is shared: no frozen * price, no base-unit amount, no balance cap. * - `initialUnit`/`initialInputValue` are read on mount only; the caller must * reset or convert the value when the token changes (picker or direction swap). */ export declare function useAmountUnitToggle({ unitPriceUsd, initialUnit, initialInputValue, locale, }: { unitPriceUsd: number | undefined; initialUnit?: AmountUnit; initialInputValue?: string; locale?: Intl.LocalesArgument; }): AmountUnitToggleState;