@enclavemoney/enclave-wallet-sdk
Version:
A simple enclave wallet SDK for React applications
48 lines (47 loc) • 1.98 kB
TypeScript
/// <reference types="react" />
export declare const NETWORK_NAME_TO_CHAIN_ID: Record<string, number>;
export declare function getNetworkName(chainId: string | number): string;
export declare const NETWORK_LOGO_URLS: Record<string, string>;
export declare function formatAmount(amount: string): string;
export declare const debounce: <T extends (...args: any[]) => any>(func: T, wait: number) => (...args: Parameters<T>) => void;
/**
* Validates and sanitizes numeric input to prevent invalid formats
* @param value The input value to validate
* @param maxDecimals Maximum number of decimal places allowed (optional)
* @returns The sanitized value or empty string if invalid
*/
export declare function validateNumericInput(value: string, maxDecimals?: number): string;
/**
* Handles keydown events to prevent invalid characters from being typed
* @param e The keyboard event
* @param currentValue The current input value
* @param maxDecimals Maximum number of decimal places allowed (optional)
*/
export declare function handleNumericKeyDown(e: React.KeyboardEvent<HTMLInputElement>, currentValue: string, maxDecimals?: number): void;
export declare const availableNetworks: {
name: string;
icon: string;
}[];
export declare enum ProtocolProvider {
LIFI = "LIFI",
RELAY = "RELAY",
BUNGEE = "BUNGEE",
GARDEN = "GARDEN",
ONEINCH = "1INCH",
INCOMING = "INCOMING",
CCTP_V1 = "CCTP_V1",
CCTP_V2_FAST = "CCTP_V2_FAST",
CCTP_V2_STANDARD = "CCTP_V2_SLOW"
}
/**
* Gets the appropriate icon URL for a protocol provider
* @param provider The protocol provider
* @returns The icon URL for the provider
*/
export declare function getProviderIcon(provider: ProtocolProvider | string): string | null;
/**
* Gets the human-readable name for a protocol provider
* @param provider The protocol provider
* @returns The display name for the provider
*/
export declare function getProviderName(provider: ProtocolProvider | string): string;