UNPKG

@metamask/multichain-network-controller

Version:
62 lines 2.66 kB
import type { NetworkConfiguration } from "@metamask/network-controller"; import { type Hex, type CaipChainId, KnownCaipNamespace } from "@metamask/utils"; import type { SupportedCaipChainId, MultichainNetworkConfiguration } from "./types.mjs"; /** * Checks if the chain ID is EVM. * * @param chainId - The account type to check. * @returns Whether the network is EVM. */ export declare function isEvmCaipChainId(chainId: CaipChainId): boolean; /** * Returns the chain id of the non-EVM network based on the account address. * * @param address - The address to check. * @returns The caip chain id of the non-EVM network. */ export declare function getChainIdForNonEvmAddress(address: string): SupportedCaipChainId; /** * Checks if the Caip chain ID is supported. * * @param id - The Caip chain IDto check. * @returns Whether the chain ID is supported. */ export declare function checkIfSupportedCaipChainId(id: CaipChainId): id is SupportedCaipChainId; /** * Converts a hex chain ID to a Caip chain ID. * * @param chainId - The hex chain ID to convert. * @returns The Caip chain ID. */ export declare const toEvmCaipChainId: (chainId: Hex) => CaipChainId; /** * Convert an eip155 CAIP chain ID to a hex chain ID. * * @param chainId - The CAIP chain ID to convert. * @returns The hex chain ID. */ export declare function convertEvmCaipToHexChainId(chainId: CaipChainId): Hex; /** * Updates a network configuration to the format used by the MultichainNetworkController. * This method is exclusive for EVM networks with hex identifiers from the NetworkController. * * @param network - The network configuration to update. * @returns The updated network configuration. */ export declare const toMultichainNetworkConfiguration: (network: NetworkConfiguration) => MultichainNetworkConfiguration; /** * Updates a record of network configurations to the format used by the MultichainNetworkController. * This method is exclusive for EVM networks with hex identifiers from the NetworkController. * * @param networkConfigurationsByChainId - The network configurations to update. * @returns The updated network configurations. */ export declare const toMultichainNetworkConfigurationsByChainId: (networkConfigurationsByChainId: Record<string, NetworkConfiguration>) => Record<CaipChainId, MultichainNetworkConfiguration>; /** * Type guard to check if a namespace is a known CAIP namespace. * * @param namespace - The namespace to check * @returns Whether the namespace is a known CAIP namespace */ export declare function isKnownCaipNamespace(namespace: string): namespace is KnownCaipNamespace; //# sourceMappingURL=utils.d.mts.map