p-sdk-wallet
Version:
A comprehensive wallet SDK for React Native (pwc), supporting multi-chain and multi-account features.
103 lines (102 loc) • 4.02 kB
TypeScript
/**
* Configuration constants for PWC Wallet SDK
*/
/**
* Configuration object for vanity wallet generation.
* Contains default settings and limits for generating wallets with specific address prefixes.
*/
export declare const VANITY_WALLET_CONFIG: {
/** Default prefix for vanity addresses (without '0x' for EVM chains) */
readonly DEFAULT_PREFIX: "aaa";
/** Maximum attempts for generating vanity wallet before giving up */
readonly DEFAULT_MAX_ATTEMPTS: 1000000;
/** Whether prefix matching should be case sensitive (false = ignore case) */
readonly DEFAULT_CASE_SENSITIVE: false;
/** Progress update interval in number of attempts (for progress callbacks) */
readonly PROGRESS_UPDATE_INTERVAL: 1000;
/** Non-blocking interval to allow event loop to breathe (prevents UI freezing) */
readonly NON_BLOCKING_INTERVAL: 10000;
/** Maximum prefix length allowed (for performance and security reasons) */
readonly MAX_PREFIX_LENGTH: 10;
/** Maximum attempts limit as a safety cap to prevent infinite loops */
readonly MAX_ATTEMPTS_LIMIT: 10000000;
/** Mobile-optimized prefix (much easier to find) */
readonly MOBILE_DEFAULT_PREFIX: "a";
/** Mobile-optimized max attempts (faster completion) */
readonly MOBILE_DEFAULT_MAX_ATTEMPTS: 50000;
/** Mobile-optimized progress update interval (more frequent updates) */
readonly MOBILE_PROGRESS_UPDATE_INTERVAL: 500;
/** Mobile-optimized non-blocking interval (more frequent yields) */
readonly MOBILE_NON_BLOCKING_INTERVAL: 1000;
/** Batch size for mobile processing (process multiple attempts in batches) */
readonly MOBILE_BATCH_SIZE: 100;
/** Mobile timeout in milliseconds (prevent infinite running) */
readonly MOBILE_TIMEOUT_MS: 30000;
};
/**
* Security configuration constants
*/
export declare const SECURITY_CONFIG: {
/** AES key size in bits */
readonly AES_KEY_SIZE: 256;
/** Salt length in bytes */
readonly SALT_LENGTH: 16;
/** IV length in bytes */
readonly IV_LENGTH: 12;
/** Minimum password length */
readonly MIN_PASSWORD_LENGTH: 8;
/** Maximum vault unlock attempts before lockout */
readonly MAX_UNLOCK_ATTEMPTS: 5;
/** Lockout duration in milliseconds */
readonly LOCKOUT_DURATION: 300000;
};
/**
* Get PBKDF2 iterations based on environment
* @returns Number of iterations (5000 for development, 10000 for production)
*/
export declare function getPBKDF2Iterations(): number;
/**
* Network configuration constants
*/
export declare const NETWORK_CONFIG: {
/** Default timeout for RPC calls in milliseconds */
readonly RPC_TIMEOUT: 30000;
/** Retry attempts for failed RPC calls */
readonly RPC_RETRY_ATTEMPTS: 3;
/** Delay between retry attempts in milliseconds */
readonly RPC_RETRY_DELAY: 1000;
/** Maximum batch size for multi-transfer operations */
readonly MAX_BATCH_SIZE: 50;
/** Delay between batches in milliseconds */
readonly BATCH_DELAY: 500;
};
/**
* Cache configuration constants
*/
export declare const CACHE_CONFIG: {
/** Default cache TTL in milliseconds */
readonly DEFAULT_TTL: 30000;
/** Balance cache TTL in milliseconds */
readonly BALANCE_TTL: 60000;
/** Token info cache TTL in milliseconds */
readonly TOKEN_INFO_TTL: 300000;
/** Transaction cache TTL in milliseconds */
readonly TRANSACTION_TTL: 600000;
/** Maximum cache size in number of entries */
readonly MAX_CACHE_SIZE: 1000;
};
/**
* Validation configuration constants
*/
export declare const VALIDATION_CONFIG: {
/** Minimum address length */
readonly MIN_ADDRESS_LENGTH: 26;
/** Maximum address length */
readonly MAX_ADDRESS_LENGTH: 44;
/** Minimum amount for transfers */
readonly MIN_TRANSFER_AMOUNT: "0.000001";
/** Maximum amount for transfers (safety limit) */
readonly MAX_TRANSFER_AMOUNT: "1000000";
/** Maximum decimal places for amounts */
readonly MAX_DECIMAL_PLACES: 18;
};