UNPKG

web3-error-helper

Version:

> 🛠️ Turn confusing Web3 errors into clear, human-friendly messages for developers and users alike.

53 lines (52 loc) 1.75 kB
/** * Chain management facade * * Provides a unified interface for managing blockchain networks. * This module acts as a facade that delegates to specialized modules * for built-in chains, custom chains, validation, and statistics. */ import { ChainType } from './types'; export { getBuiltInChains, isBuiltInChain } from './built-in-chain-manager'; export type { ChainMetadata } from './data/chain-registry'; export { getCustomChain, getAllCustomChains, hasCustomChain, } from './chain-registry'; export { isValidChain, isValidChainFormat } from './chain-validator'; export { getChainStats } from './chain-stats'; /** * Get all available blockchain networks * * Returns a list of all supported blockchain networks that have error mappings available. * This includes both EVM-compatible chains and other supported networks. * * @returns Array of supported chain identifiers * * @example * ```typescript * const chains = getAvailableChains(); * console.log(chains); // ['ethereum', 'polygon', 'arbitrum', 'optimism', ...] * * // Use in a dropdown or selection UI * chains.forEach(chain => { * console.log(`Supported chain: ${chain}`); * }); * ``` */ export declare function getAvailableChains(): string[]; /** * Get unified chain information * * @param chain - The chain identifier * @returns Chain information object or null if not found * * @example * ```typescript * const info = getChainInfo('ethereum'); * console.log(info); // { type: 'built-in', name: 'Ethereum' } * * const customInfo = getChainInfo('my-custom-chain'); * console.log(customInfo); // { type: 'custom', name: 'My Custom Chain' } * ``` */ export declare function getChainInfo(chain: string): { type: ChainType; name?: string; } | null;