@metamask-previews/multichain-network-controller
Version:
Multichain network controller
41 lines • 1.94 kB
text/typescript
import type { NetworkConfiguration } from "@metamask/network-controller";
import { type Hex, type CaipChainId } from "@metamask/utils";
import type { SupportedCaipChainId, MultichainNetworkConfiguration } from "./types.cjs";
/**
* 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;
/**
* 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>;
//# sourceMappingURL=utils.d.cts.map