@metamask-previews/network-enablement-controller 5.0.0-preview-a0caca0c0 → 5.0.0-preview-afe010990
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NetworkEnablementController-method-action-types.cjs +1 -1
- package/dist/NetworkEnablementController-method-action-types.cjs.map +1 -1
- package/dist/NetworkEnablementController-method-action-types.d.cts +1 -1
- package/dist/NetworkEnablementController-method-action-types.d.mts +1 -1
- package/dist/NetworkEnablementController-method-action-types.mjs +1 -1
- package/dist/NetworkEnablementController-method-action-types.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkEnablementController-method-action-types.cjs","sourceRoot":"","sources":["../src/NetworkEnablementController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated
|
|
1
|
+
{"version":3,"file":"NetworkEnablementController-method-action-types.cjs","sourceRoot":"","sources":["../src/NetworkEnablementController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { NetworkEnablementController } from './NetworkEnablementController';\n\n/**\n * Enables or disables a network for the user.\n *\n * This method accepts either a Hex chain ID (for EVM networks) or a CAIP-2 chain ID\n * (for any blockchain network). The method will automatically convert Hex chain IDs\n * to CAIP-2 format internally. This dual parameter support allows for backward\n * compatibility with existing EVM chain ID formats while supporting newer\n * multi-chain standards.\n *\n * When enabling a non-popular network, this method will disable all other networks\n * to ensure only one network is active at a time (exclusive mode).\n *\n * @param chainId - The chain ID of the network to enable or disable. Can be either:\n * - A Hex string (e.g., '0x1' for Ethereum mainnet) for EVM networks\n * - A CAIP-2 chain ID (e.g., 'eip155:1' for Ethereum mainnet, 'solana:mainnet' for Solana)\n */\nexport type NetworkEnablementControllerEnableNetworkAction = {\n type: `NetworkEnablementController:enableNetwork`;\n handler: NetworkEnablementController['enableNetwork'];\n};\n\n/**\n * Enables a network for the user within a specific namespace.\n *\n * This method accepts either a Hex chain ID (for EVM networks) or a CAIP-2 chain ID\n * (for any blockchain network) and enables it within the specified namespace.\n * The method validates that the chainId belongs to the specified namespace for safety.\n *\n * Before enabling the target network, this method disables all other networks\n * in the same namespace to ensure exclusive behavior within the namespace.\n *\n * @param chainId - The chain ID of the network to enable. Can be either:\n * - A Hex string (e.g., '0x1' for Ethereum mainnet) for EVM networks\n * - A CAIP-2 chain ID (e.g., 'eip155:1' for Ethereum mainnet, 'solana:mainnet' for Solana)\n * @param namespace - The CAIP namespace where the network should be enabled\n * @throws Error if the chainId's derived namespace doesn't match the provided namespace\n */\nexport type NetworkEnablementControllerEnableNetworkInNamespaceAction = {\n type: `NetworkEnablementController:enableNetworkInNamespace`;\n handler: NetworkEnablementController['enableNetworkInNamespace'];\n};\n\n/**\n * Enables all popular networks and Solana mainnet.\n *\n * This method first disables all networks across all namespaces, then enables\n * all networks defined in POPULAR_NETWORKS (EVM networks), Solana mainnet, and\n * Bitcoin mainnet. This provides exclusive behavior - only popular networks will\n * be enabled after calling this method.\n *\n * Popular networks that don't exist in NetworkController or MultichainNetworkController configurations will be skipped silently.\n */\nexport type NetworkEnablementControllerEnableAllPopularNetworksAction = {\n type: `NetworkEnablementController:enableAllPopularNetworks`;\n handler: NetworkEnablementController['enableAllPopularNetworks'];\n};\n\n/**\n * Initializes the network enablement state from network controller configurations.\n *\n * This method reads the current network configurations from both NetworkController\n * and MultichainNetworkController and syncs the enabled network map and nativeAssetIdentifiers accordingly.\n * It ensures proper namespace buckets exist for all configured networks and only\n * adds missing networks with a default value of false, preserving existing user settings.\n *\n * This method should be called after the NetworkController and MultichainNetworkController\n * have been initialized and their configurations are available.\n */\nexport type NetworkEnablementControllerInitAction = {\n type: `NetworkEnablementController:init`;\n handler: NetworkEnablementController['init'];\n};\n\n/**\n * Initializes the native asset identifiers from network configurations.\n * This method should be called from the client during controller initialization\n * to populate the nativeAssetIdentifiers state based on actual network configurations.\n *\n * @param networks - Array of network configurations with chainId and nativeCurrency\n * @example\n * ```typescript\n * const evmNetworks = Object.values(networkControllerState.networkConfigurationsByChainId)\n * .map(config => ({\n * chainId: toEvmCaipChainId(config.chainId),\n * nativeCurrency: config.nativeCurrency,\n * }));\n *\n * const multichainNetworks = Object.values(multichainState.multichainNetworkConfigurationsByChainId)\n * .map(config => ({\n * chainId: config.chainId,\n * nativeCurrency: config.nativeCurrency,\n * }));\n *\n * await controller.initNativeAssetIdentifiers([...evmNetworks, ...multichainNetworks]);\n * ```\n */\nexport type NetworkEnablementControllerInitNativeAssetIdentifiersAction = {\n type: `NetworkEnablementController:initNativeAssetIdentifiers`;\n handler: NetworkEnablementController['initNativeAssetIdentifiers'];\n};\n\n/**\n * Disables a network for the user.\n *\n * This method accepts either a Hex chain ID (for EVM networks) or a CAIP-2 chain ID\n * (for any blockchain network). The method will automatically convert Hex chain IDs\n * to CAIP-2 format internally.\n *\n * Note: This method will prevent disabling the last remaining enabled network\n * to ensure at least one network is always available.\n *\n * @param chainId - The chain ID of the network to disable. Can be either:\n * - A Hex string (e.g., '0x1' for Ethereum mainnet) for EVM networks\n * - A CAIP-2 chain ID (e.g., 'eip155:1' for Ethereum mainnet, 'solana:mainnet' for Solana)\n */\nexport type NetworkEnablementControllerDisableNetworkAction = {\n type: `NetworkEnablementController:disableNetwork`;\n handler: NetworkEnablementController['disableNetwork'];\n};\n\n/**\n * Checks if a network is enabled.\n *\n * @param chainId - The chain ID of the network to check. Can be either:\n * - A Hex string (e.g., '0x1' for Ethereum mainnet) for EVM networks\n * - A CAIP-2 chain ID (e.g., 'eip155:1' for Ethereum mainnet, 'solana:mainnet' for Solana)\n * @returns True if the network is enabled, false otherwise\n */\nexport type NetworkEnablementControllerIsNetworkEnabledAction = {\n type: `NetworkEnablementController:isNetworkEnabled`;\n handler: NetworkEnablementController['isNetworkEnabled'];\n};\n\n/**\n * Returns popular EVM network chain IDs in hex form, restricted to networks\n * that exist in NetworkController (networkConfigurationsByChainId). Source list\n * is POPULAR_NETWORKS.\n *\n * @returns Hex chain IDs for popular EVM networks that are configured.\n */\nexport type NetworkEnablementControllerListPopularEvmNetworksAction = {\n type: `NetworkEnablementController:listPopularEvmNetworks`;\n handler: NetworkEnablementController['listPopularEvmNetworks'];\n};\n\n/**\n * Returns popular multichain (Bitcoin, Solana, Tron) mainnet chain IDs in\n * CAIP-2 form, restricted to networks that exist in MultichainNetworkController\n * (multichainNetworkConfigurationsByChainId).\n *\n * @returns CAIP-2 chain IDs for Bitcoin, Solana, and Tron mainnets that are configured.\n */\nexport type NetworkEnablementControllerListPopularMultichainNetworksAction = {\n type: `NetworkEnablementController:listPopularMultichainNetworks`;\n handler: NetworkEnablementController['listPopularMultichainNetworks'];\n};\n\n/**\n * Returns the list of popular network chain IDs in CAIP-2 form, restricted to\n * networks that exist in NetworkController (networkConfigurationsByChainId) and\n * MultichainNetworkController (multichainNetworkConfigurationsByChainId). EVM\n * popular networks come from POPULAR_NETWORKS; multichain popular are Bitcoin,\n * Solana, and Tron mainnets.\n *\n * @returns CAIP-2 chain IDs for popular EVM networks and multichain mainnets that are configured.\n */\nexport type NetworkEnablementControllerListPopularNetworksAction = {\n type: `NetworkEnablementController:listPopularNetworks`;\n handler: NetworkEnablementController['listPopularNetworks'];\n};\n\n/**\n * Union of all NetworkEnablementController action types.\n */\nexport type NetworkEnablementControllerMethodActions =\n | NetworkEnablementControllerEnableNetworkAction\n | NetworkEnablementControllerEnableNetworkInNamespaceAction\n | NetworkEnablementControllerEnableAllPopularNetworksAction\n | NetworkEnablementControllerInitAction\n | NetworkEnablementControllerInitNativeAssetIdentifiersAction\n | NetworkEnablementControllerDisableNetworkAction\n | NetworkEnablementControllerIsNetworkEnabledAction\n | NetworkEnablementControllerListPopularEvmNetworksAction\n | NetworkEnablementControllerListPopularMultichainNetworksAction\n | NetworkEnablementControllerListPopularNetworksAction;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkEnablementController-method-action-types.mjs","sourceRoot":"","sources":["../src/NetworkEnablementController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated
|
|
1
|
+
{"version":3,"file":"NetworkEnablementController-method-action-types.mjs","sourceRoot":"","sources":["../src/NetworkEnablementController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { NetworkEnablementController } from './NetworkEnablementController';\n\n/**\n * Enables or disables a network for the user.\n *\n * This method accepts either a Hex chain ID (for EVM networks) or a CAIP-2 chain ID\n * (for any blockchain network). The method will automatically convert Hex chain IDs\n * to CAIP-2 format internally. This dual parameter support allows for backward\n * compatibility with existing EVM chain ID formats while supporting newer\n * multi-chain standards.\n *\n * When enabling a non-popular network, this method will disable all other networks\n * to ensure only one network is active at a time (exclusive mode).\n *\n * @param chainId - The chain ID of the network to enable or disable. Can be either:\n * - A Hex string (e.g., '0x1' for Ethereum mainnet) for EVM networks\n * - A CAIP-2 chain ID (e.g., 'eip155:1' for Ethereum mainnet, 'solana:mainnet' for Solana)\n */\nexport type NetworkEnablementControllerEnableNetworkAction = {\n type: `NetworkEnablementController:enableNetwork`;\n handler: NetworkEnablementController['enableNetwork'];\n};\n\n/**\n * Enables a network for the user within a specific namespace.\n *\n * This method accepts either a Hex chain ID (for EVM networks) or a CAIP-2 chain ID\n * (for any blockchain network) and enables it within the specified namespace.\n * The method validates that the chainId belongs to the specified namespace for safety.\n *\n * Before enabling the target network, this method disables all other networks\n * in the same namespace to ensure exclusive behavior within the namespace.\n *\n * @param chainId - The chain ID of the network to enable. Can be either:\n * - A Hex string (e.g., '0x1' for Ethereum mainnet) for EVM networks\n * - A CAIP-2 chain ID (e.g., 'eip155:1' for Ethereum mainnet, 'solana:mainnet' for Solana)\n * @param namespace - The CAIP namespace where the network should be enabled\n * @throws Error if the chainId's derived namespace doesn't match the provided namespace\n */\nexport type NetworkEnablementControllerEnableNetworkInNamespaceAction = {\n type: `NetworkEnablementController:enableNetworkInNamespace`;\n handler: NetworkEnablementController['enableNetworkInNamespace'];\n};\n\n/**\n * Enables all popular networks and Solana mainnet.\n *\n * This method first disables all networks across all namespaces, then enables\n * all networks defined in POPULAR_NETWORKS (EVM networks), Solana mainnet, and\n * Bitcoin mainnet. This provides exclusive behavior - only popular networks will\n * be enabled after calling this method.\n *\n * Popular networks that don't exist in NetworkController or MultichainNetworkController configurations will be skipped silently.\n */\nexport type NetworkEnablementControllerEnableAllPopularNetworksAction = {\n type: `NetworkEnablementController:enableAllPopularNetworks`;\n handler: NetworkEnablementController['enableAllPopularNetworks'];\n};\n\n/**\n * Initializes the network enablement state from network controller configurations.\n *\n * This method reads the current network configurations from both NetworkController\n * and MultichainNetworkController and syncs the enabled network map and nativeAssetIdentifiers accordingly.\n * It ensures proper namespace buckets exist for all configured networks and only\n * adds missing networks with a default value of false, preserving existing user settings.\n *\n * This method should be called after the NetworkController and MultichainNetworkController\n * have been initialized and their configurations are available.\n */\nexport type NetworkEnablementControllerInitAction = {\n type: `NetworkEnablementController:init`;\n handler: NetworkEnablementController['init'];\n};\n\n/**\n * Initializes the native asset identifiers from network configurations.\n * This method should be called from the client during controller initialization\n * to populate the nativeAssetIdentifiers state based on actual network configurations.\n *\n * @param networks - Array of network configurations with chainId and nativeCurrency\n * @example\n * ```typescript\n * const evmNetworks = Object.values(networkControllerState.networkConfigurationsByChainId)\n * .map(config => ({\n * chainId: toEvmCaipChainId(config.chainId),\n * nativeCurrency: config.nativeCurrency,\n * }));\n *\n * const multichainNetworks = Object.values(multichainState.multichainNetworkConfigurationsByChainId)\n * .map(config => ({\n * chainId: config.chainId,\n * nativeCurrency: config.nativeCurrency,\n * }));\n *\n * await controller.initNativeAssetIdentifiers([...evmNetworks, ...multichainNetworks]);\n * ```\n */\nexport type NetworkEnablementControllerInitNativeAssetIdentifiersAction = {\n type: `NetworkEnablementController:initNativeAssetIdentifiers`;\n handler: NetworkEnablementController['initNativeAssetIdentifiers'];\n};\n\n/**\n * Disables a network for the user.\n *\n * This method accepts either a Hex chain ID (for EVM networks) or a CAIP-2 chain ID\n * (for any blockchain network). The method will automatically convert Hex chain IDs\n * to CAIP-2 format internally.\n *\n * Note: This method will prevent disabling the last remaining enabled network\n * to ensure at least one network is always available.\n *\n * @param chainId - The chain ID of the network to disable. Can be either:\n * - A Hex string (e.g., '0x1' for Ethereum mainnet) for EVM networks\n * - A CAIP-2 chain ID (e.g., 'eip155:1' for Ethereum mainnet, 'solana:mainnet' for Solana)\n */\nexport type NetworkEnablementControllerDisableNetworkAction = {\n type: `NetworkEnablementController:disableNetwork`;\n handler: NetworkEnablementController['disableNetwork'];\n};\n\n/**\n * Checks if a network is enabled.\n *\n * @param chainId - The chain ID of the network to check. Can be either:\n * - A Hex string (e.g., '0x1' for Ethereum mainnet) for EVM networks\n * - A CAIP-2 chain ID (e.g., 'eip155:1' for Ethereum mainnet, 'solana:mainnet' for Solana)\n * @returns True if the network is enabled, false otherwise\n */\nexport type NetworkEnablementControllerIsNetworkEnabledAction = {\n type: `NetworkEnablementController:isNetworkEnabled`;\n handler: NetworkEnablementController['isNetworkEnabled'];\n};\n\n/**\n * Returns popular EVM network chain IDs in hex form, restricted to networks\n * that exist in NetworkController (networkConfigurationsByChainId). Source list\n * is POPULAR_NETWORKS.\n *\n * @returns Hex chain IDs for popular EVM networks that are configured.\n */\nexport type NetworkEnablementControllerListPopularEvmNetworksAction = {\n type: `NetworkEnablementController:listPopularEvmNetworks`;\n handler: NetworkEnablementController['listPopularEvmNetworks'];\n};\n\n/**\n * Returns popular multichain (Bitcoin, Solana, Tron) mainnet chain IDs in\n * CAIP-2 form, restricted to networks that exist in MultichainNetworkController\n * (multichainNetworkConfigurationsByChainId).\n *\n * @returns CAIP-2 chain IDs for Bitcoin, Solana, and Tron mainnets that are configured.\n */\nexport type NetworkEnablementControllerListPopularMultichainNetworksAction = {\n type: `NetworkEnablementController:listPopularMultichainNetworks`;\n handler: NetworkEnablementController['listPopularMultichainNetworks'];\n};\n\n/**\n * Returns the list of popular network chain IDs in CAIP-2 form, restricted to\n * networks that exist in NetworkController (networkConfigurationsByChainId) and\n * MultichainNetworkController (multichainNetworkConfigurationsByChainId). EVM\n * popular networks come from POPULAR_NETWORKS; multichain popular are Bitcoin,\n * Solana, and Tron mainnets.\n *\n * @returns CAIP-2 chain IDs for popular EVM networks and multichain mainnets that are configured.\n */\nexport type NetworkEnablementControllerListPopularNetworksAction = {\n type: `NetworkEnablementController:listPopularNetworks`;\n handler: NetworkEnablementController['listPopularNetworks'];\n};\n\n/**\n * Union of all NetworkEnablementController action types.\n */\nexport type NetworkEnablementControllerMethodActions =\n | NetworkEnablementControllerEnableNetworkAction\n | NetworkEnablementControllerEnableNetworkInNamespaceAction\n | NetworkEnablementControllerEnableAllPopularNetworksAction\n | NetworkEnablementControllerInitAction\n | NetworkEnablementControllerInitNativeAssetIdentifiersAction\n | NetworkEnablementControllerDisableNetworkAction\n | NetworkEnablementControllerIsNetworkEnabledAction\n | NetworkEnablementControllerListPopularEvmNetworksAction\n | NetworkEnablementControllerListPopularMultichainNetworksAction\n | NetworkEnablementControllerListPopularNetworksAction;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/network-enablement-controller",
|
|
3
|
-
"version": "5.0.0-preview-
|
|
3
|
+
"version": "5.0.0-preview-afe010990",
|
|
4
4
|
"description": "Provides an interface to the currently enabled network using a MetaMask-compatible provider object",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|