@funkit/connect
Version:
Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.
50 lines (49 loc) • 2.41 kB
TypeScript
import type { ErrorNotification } from '~/components/FunNotification/FunNotification';
import type { useFunkitTranslation } from '~/hooks/useFunkitTranslation';
import type { AmountInputError } from './state';
type TFunction = ReturnType<typeof useFunkitTranslation>['t'];
export declare const ASSET_DECIMALS = 5;
export declare const USD_DECIMALS = 2;
export declare const USD_INITIAL_AMOUNT = 100;
export declare function getDefaultAmountFromQuickOptions(quickOptions: number[] | undefined): number | undefined;
export declare function getUsdMaxAmount(maxUsd: number): number | null;
export declare function getUsdMinAmount(minUsd?: number): number;
export interface InputAmountSuggestion {
autoConfirm: boolean;
buttonLabel: string;
usdAmount: number;
}
/**
* Get suggested amount from error
* Allow recovery actions to user in the CTA Continue button
*/
export declare const getInputAmountSuggestion: (error: AmountInputError | null, t: TFunction) => InputAmountSuggestion | undefined;
export declare const getInputErrorNotification: (error: AmountInputError | null, t: TFunction) => ErrorNotification | undefined;
export type NumberSeparators = {
decimalSeparator: string;
groupSeparator: RegExp;
};
export declare function getNumberSeparators(locale: Intl.LocalesArgument): NumberSeparators;
export declare function parseNumberInputValue(inputValue: string, separators: NumberSeparators): {
amount: number | undefined;
amountString: string;
amountStringNormalized: string;
decimalPart: string | null;
integerPart: string;
};
export declare function getCurrencyFormattingOptions(fiatCurrency: string, locale: Intl.LocalesArgument): {
currencySymbol: string;
currencySymbolWithSpacing: string;
decimals: number;
};
export declare function formatAssetAmountWithLocale(value: number, options: {
locale: Intl.LocalesArgument;
}): string;
export declare function formatCurrencyAmountWithLocale(value: number, options: {
fiatCurrency: string;
locale: Intl.LocalesArgument;
}): string;
export declare function replaceStringRange(original: string, replacement: string, start: number, end: number): string;
export declare function reformatDecimalPart(decimalPart: string, decimals: number): string;
export declare function reformatIntegerPart(integerPart: string, locale: Intl.LocalesArgument, preserveLeadingZeroes: boolean): string;
export {};