@metamask-previews/network-enablement-controller 6.0.5-preview-3866c0ff1 → 6.0.5-preview-e3275932a

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.
Files changed (85) hide show
  1. package/CHANGELOG.md +0 -1
  2. package/dist/NetworkEnablementController-method-action-types.cjs +7 -0
  3. package/dist/NetworkEnablementController-method-action-types.cjs.map +1 -0
  4. package/dist/{NetworkEnablementController-method-action-types.d.ts → NetworkEnablementController-method-action-types.d.cts} +2 -2
  5. package/dist/NetworkEnablementController-method-action-types.d.cts.map +1 -0
  6. package/dist/NetworkEnablementController-method-action-types.d.mts +185 -0
  7. package/dist/NetworkEnablementController-method-action-types.d.mts.map +1 -0
  8. package/dist/{NetworkEnablementController-method-action-types.js → NetworkEnablementController-method-action-types.mjs} +1 -1
  9. package/dist/NetworkEnablementController-method-action-types.mjs.map +1 -0
  10. package/dist/NetworkEnablementController.cjs +590 -0
  11. package/dist/NetworkEnablementController.cjs.map +1 -0
  12. package/dist/{NetworkEnablementController.d.ts → NetworkEnablementController.d.cts} +10 -10
  13. package/dist/NetworkEnablementController.d.cts.map +1 -0
  14. package/dist/NetworkEnablementController.d.mts +234 -0
  15. package/dist/NetworkEnablementController.d.mts.map +1 -0
  16. package/dist/{NetworkEnablementController.js → NetworkEnablementController.mjs} +131 -167
  17. package/dist/NetworkEnablementController.mjs.map +1 -0
  18. package/dist/constants.cjs +22 -0
  19. package/dist/constants.cjs.map +1 -0
  20. package/dist/constants.d.cts +3 -0
  21. package/dist/constants.d.cts.map +1 -0
  22. package/dist/constants.d.mts +3 -0
  23. package/dist/constants.d.mts.map +1 -0
  24. package/dist/{constants.js → constants.mjs} +1 -1
  25. package/dist/constants.mjs.map +1 -0
  26. package/dist/index.cjs +18 -0
  27. package/dist/index.cjs.map +1 -0
  28. package/dist/{index.d.ts → index.d.cts} +6 -6
  29. package/dist/index.d.cts.map +1 -0
  30. package/dist/index.d.mts +6 -0
  31. package/dist/index.d.mts.map +1 -0
  32. package/dist/index.mjs +4 -0
  33. package/dist/index.mjs.map +1 -0
  34. package/dist/selectors.cjs +87 -0
  35. package/dist/selectors.cjs.map +1 -0
  36. package/dist/{selectors.d.ts → selectors.d.cts} +30 -18
  37. package/dist/selectors.d.cts.map +1 -0
  38. package/dist/selectors.d.mts +280 -0
  39. package/dist/selectors.d.mts.map +1 -0
  40. package/dist/{selectors.js → selectors.mjs} +4 -4
  41. package/dist/selectors.mjs.map +1 -0
  42. package/dist/services/Slip44Service.cjs +182 -0
  43. package/dist/services/Slip44Service.cjs.map +1 -0
  44. package/dist/services/{Slip44Service.d.ts → Slip44Service.d.cts} +1 -1
  45. package/dist/services/Slip44Service.d.cts.map +1 -0
  46. package/dist/services/Slip44Service.d.mts +63 -0
  47. package/dist/services/Slip44Service.d.mts.map +1 -0
  48. package/dist/services/Slip44Service.mjs +175 -0
  49. package/dist/services/Slip44Service.mjs.map +1 -0
  50. package/dist/services/index.cjs +11 -0
  51. package/dist/services/index.cjs.map +1 -0
  52. package/dist/services/{index.d.ts → index.d.cts} +2 -2
  53. package/dist/services/index.d.cts.map +1 -0
  54. package/dist/services/index.d.mts +5 -0
  55. package/dist/services/index.d.mts.map +1 -0
  56. package/dist/services/{index.js → index.mjs} +2 -2
  57. package/dist/services/index.mjs.map +1 -0
  58. package/dist/utils.cjs +62 -0
  59. package/dist/utils.cjs.map +1 -0
  60. package/dist/{utils.d.ts → utils.d.cts} +3 -3
  61. package/dist/utils.d.cts.map +1 -0
  62. package/dist/utils.d.mts +36 -0
  63. package/dist/utils.d.mts.map +1 -0
  64. package/dist/{utils.js → utils.mjs} +4 -4
  65. package/dist/utils.mjs.map +1 -0
  66. package/package.json +16 -12
  67. package/dist/NetworkEnablementController-method-action-types.d.ts.map +0 -1
  68. package/dist/NetworkEnablementController-method-action-types.js.map +0 -1
  69. package/dist/NetworkEnablementController.d.ts.map +0 -1
  70. package/dist/NetworkEnablementController.js.map +0 -1
  71. package/dist/constants.d.ts +0 -3
  72. package/dist/constants.d.ts.map +0 -1
  73. package/dist/constants.js.map +0 -1
  74. package/dist/index.d.ts.map +0 -1
  75. package/dist/index.js +0 -4
  76. package/dist/index.js.map +0 -1
  77. package/dist/selectors.d.ts.map +0 -1
  78. package/dist/selectors.js.map +0 -1
  79. package/dist/services/Slip44Service.d.ts.map +0 -1
  80. package/dist/services/Slip44Service.js +0 -167
  81. package/dist/services/Slip44Service.js.map +0 -1
  82. package/dist/services/index.d.ts.map +0 -1
  83. package/dist/services/index.js.map +0 -1
  84. package/dist/utils.d.ts.map +0 -1
  85. package/dist/utils.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -20,7 +20,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
20
20
 
21
21
  ### Changed
22
22
 
23
- - **BREAKING:** Bump minimum Node.js version to 22 ([#9168](https://github.com/MetaMask/core/pull/9168))
24
23
  - Bump `@metamask/transaction-controller` from `^69.5.0` to `^69.5.2` ([#9798](https://github.com/MetaMask/core/pull/9798), [#9823](https://github.com/MetaMask/core/pull/9823))
25
24
  - Bump `@metamask/config-registry-controller` from `^2.0.1` to `^3.0.0` ([#9923](https://github.com/MetaMask/core/pull/9923))
26
25
 
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * This file is auto generated.
4
+ * Do not edit manually.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=NetworkEnablementController-method-action-types.cjs.map
@@ -0,0 +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.\n * Do not edit manually.\n */\n\nimport type { NetworkEnablementController } from './NetworkEnablementController.js';\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 * Restores the enabled network map to a previously snapshotted state.\n *\n * Not a general merge API: only updates keys already present in the current\n * map. Missing snapshot values default to `false`. Intended for callers with\n * direct controller access (e.g. extension) to undo `#onAddNetwork` filter\n * switches when adding a network without changing the active selection.\n *\n * @param enabledNetworkMap - Previously snapshotted enabledNetworkMap.\n */\nexport type NetworkEnablementControllerRestoreEnabledNetworkMapAction = {\n type: `NetworkEnablementController:restoreEnabledNetworkMap`;\n handler: NetworkEnablementController['restoreEnabledNetworkMap'];\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 is\n * the bundled `POPULAR_NETWORKS` unioned with registry-featured EVM chains.\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, Stellar) 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, Tron, and Stellar 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, Tron, and Stellar 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 | NetworkEnablementControllerRestoreEnabledNetworkMapAction\n | NetworkEnablementControllerIsNetworkEnabledAction\n | NetworkEnablementControllerListPopularEvmNetworksAction\n | NetworkEnablementControllerListPopularMultichainNetworksAction\n | NetworkEnablementControllerListPopularNetworksAction;\n"]}
@@ -2,7 +2,7 @@
2
2
  * This file is auto generated.
3
3
  * Do not edit manually.
4
4
  */
5
- import type { NetworkEnablementController } from './NetworkEnablementController.js';
5
+ import type { NetworkEnablementController } from "./NetworkEnablementController.cjs";
6
6
  /**
7
7
  * Enables or disables a network for the user.
8
8
  *
@@ -182,4 +182,4 @@ export type NetworkEnablementControllerListPopularNetworksAction = {
182
182
  * Union of all NetworkEnablementController action types.
183
183
  */
184
184
  export type NetworkEnablementControllerMethodActions = NetworkEnablementControllerEnableNetworkAction | NetworkEnablementControllerEnableNetworkInNamespaceAction | NetworkEnablementControllerEnableAllPopularNetworksAction | NetworkEnablementControllerInitAction | NetworkEnablementControllerInitNativeAssetIdentifiersAction | NetworkEnablementControllerDisableNetworkAction | NetworkEnablementControllerRestoreEnabledNetworkMapAction | NetworkEnablementControllerIsNetworkEnabledAction | NetworkEnablementControllerListPopularEvmNetworksAction | NetworkEnablementControllerListPopularMultichainNetworksAction | NetworkEnablementControllerListPopularNetworksAction;
185
- //# sourceMappingURL=NetworkEnablementController-method-action-types.d.ts.map
185
+ //# sourceMappingURL=NetworkEnablementController-method-action-types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NetworkEnablementController-method-action-types.d.cts","sourceRoot":"","sources":["../src/NetworkEnablementController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,2BAA2B,EAAE,0CAAyC;AAEpF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,2BAA2B,CAAC,eAAe,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,sDAAsD,CAAC;IAC7D,OAAO,EAAE,2BAA2B,CAAC,0BAA0B,CAAC,CAAC;CAClE,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,sDAAsD,CAAC;IAC7D,OAAO,EAAE,2BAA2B,CAAC,0BAA0B,CAAC,CAAC;CAClE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,2BAA2B,CAAC,MAAM,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,2DAA2D,GAAG;IACxE,IAAI,EAAE,wDAAwD,CAAC;IAC/D,OAAO,EAAE,2BAA2B,CAAC,4BAA4B,CAAC,CAAC;CACpE,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,4CAA4C,CAAC;IACnD,OAAO,EAAE,2BAA2B,CAAC,gBAAgB,CAAC,CAAC;CACxD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,sDAAsD,CAAC;IAC7D,OAAO,EAAE,2BAA2B,CAAC,0BAA0B,CAAC,CAAC;CAClE,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,iDAAiD,GAAG;IAC9D,IAAI,EAAE,8CAA8C,CAAC;IACrD,OAAO,EAAE,2BAA2B,CAAC,kBAAkB,CAAC,CAAC;CAC1D,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,uDAAuD,GAAG;IACpE,IAAI,EAAE,oDAAoD,CAAC;IAC3D,OAAO,EAAE,2BAA2B,CAAC,wBAAwB,CAAC,CAAC;CAChE,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,8DAA8D,GAAG;IAC3E,IAAI,EAAE,2DAA2D,CAAC;IAClE,OAAO,EAAE,2BAA2B,CAAC,+BAA+B,CAAC,CAAC;CACvE,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,oDAAoD,GAAG;IACjE,IAAI,EAAE,iDAAiD,CAAC;IACxD,OAAO,EAAE,2BAA2B,CAAC,qBAAqB,CAAC,CAAC;CAC7D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,wCAAwC,GAChD,8CAA8C,GAC9C,yDAAyD,GACzD,yDAAyD,GACzD,qCAAqC,GACrC,2DAA2D,GAC3D,+CAA+C,GAC/C,yDAAyD,GACzD,iDAAiD,GACjD,uDAAuD,GACvD,8DAA8D,GAC9D,oDAAoD,CAAC"}
@@ -0,0 +1,185 @@
1
+ /**
2
+ * This file is auto generated.
3
+ * Do not edit manually.
4
+ */
5
+ import type { NetworkEnablementController } from "./NetworkEnablementController.mjs";
6
+ /**
7
+ * Enables or disables a network for the user.
8
+ *
9
+ * This method accepts either a Hex chain ID (for EVM networks) or a CAIP-2 chain ID
10
+ * (for any blockchain network). The method will automatically convert Hex chain IDs
11
+ * to CAIP-2 format internally. This dual parameter support allows for backward
12
+ * compatibility with existing EVM chain ID formats while supporting newer
13
+ * multi-chain standards.
14
+ *
15
+ * When enabling a non-popular network, this method will disable all other networks
16
+ * to ensure only one network is active at a time (exclusive mode).
17
+ *
18
+ * @param chainId - The chain ID of the network to enable or disable. Can be either:
19
+ * - A Hex string (e.g., '0x1' for Ethereum mainnet) for EVM networks
20
+ * - A CAIP-2 chain ID (e.g., 'eip155:1' for Ethereum mainnet, 'solana:mainnet' for Solana)
21
+ */
22
+ export type NetworkEnablementControllerEnableNetworkAction = {
23
+ type: `NetworkEnablementController:enableNetwork`;
24
+ handler: NetworkEnablementController['enableNetwork'];
25
+ };
26
+ /**
27
+ * Enables a network for the user within a specific namespace.
28
+ *
29
+ * This method accepts either a Hex chain ID (for EVM networks) or a CAIP-2 chain ID
30
+ * (for any blockchain network) and enables it within the specified namespace.
31
+ * The method validates that the chainId belongs to the specified namespace for safety.
32
+ *
33
+ * Before enabling the target network, this method disables all other networks
34
+ * in the same namespace to ensure exclusive behavior within the namespace.
35
+ *
36
+ * @param chainId - The chain ID of the network to enable. Can be either:
37
+ * - A Hex string (e.g., '0x1' for Ethereum mainnet) for EVM networks
38
+ * - A CAIP-2 chain ID (e.g., 'eip155:1' for Ethereum mainnet, 'solana:mainnet' for Solana)
39
+ * @param namespace - The CAIP namespace where the network should be enabled
40
+ * @throws Error if the chainId's derived namespace doesn't match the provided namespace
41
+ */
42
+ export type NetworkEnablementControllerEnableNetworkInNamespaceAction = {
43
+ type: `NetworkEnablementController:enableNetworkInNamespace`;
44
+ handler: NetworkEnablementController['enableNetworkInNamespace'];
45
+ };
46
+ /**
47
+ * Enables all popular networks and Solana mainnet.
48
+ *
49
+ * This method first disables all networks across all namespaces, then enables
50
+ * all networks defined in POPULAR_NETWORKS (EVM networks), Solana mainnet, and
51
+ * Bitcoin mainnet. This provides exclusive behavior - only popular networks will
52
+ * be enabled after calling this method.
53
+ *
54
+ * Popular networks that don't exist in NetworkController or MultichainNetworkController configurations will be skipped silently.
55
+ */
56
+ export type NetworkEnablementControllerEnableAllPopularNetworksAction = {
57
+ type: `NetworkEnablementController:enableAllPopularNetworks`;
58
+ handler: NetworkEnablementController['enableAllPopularNetworks'];
59
+ };
60
+ /**
61
+ * Initializes the network enablement state from network controller configurations.
62
+ *
63
+ * This method reads the current network configurations from both NetworkController
64
+ * and MultichainNetworkController and syncs the enabled network map and nativeAssetIdentifiers accordingly.
65
+ * It ensures proper namespace buckets exist for all configured networks and only
66
+ * adds missing networks with a default value of false, preserving existing user settings.
67
+ *
68
+ * This method should be called after the NetworkController and MultichainNetworkController
69
+ * have been initialized and their configurations are available.
70
+ */
71
+ export type NetworkEnablementControllerInitAction = {
72
+ type: `NetworkEnablementController:init`;
73
+ handler: NetworkEnablementController['init'];
74
+ };
75
+ /**
76
+ * Initializes the native asset identifiers from network configurations.
77
+ * This method should be called from the client during controller initialization
78
+ * to populate the nativeAssetIdentifiers state based on actual network configurations.
79
+ *
80
+ * @param networks - Array of network configurations with chainId and nativeCurrency
81
+ * @example
82
+ * ```typescript
83
+ * const evmNetworks = Object.values(networkControllerState.networkConfigurationsByChainId)
84
+ * .map(config => ({
85
+ * chainId: toEvmCaipChainId(config.chainId),
86
+ * nativeCurrency: config.nativeCurrency,
87
+ * }));
88
+ *
89
+ * const multichainNetworks = Object.values(multichainState.multichainNetworkConfigurationsByChainId)
90
+ * .map(config => ({
91
+ * chainId: config.chainId,
92
+ * nativeCurrency: config.nativeCurrency,
93
+ * }));
94
+ *
95
+ * await controller.initNativeAssetIdentifiers([...evmNetworks, ...multichainNetworks]);
96
+ * ```
97
+ */
98
+ export type NetworkEnablementControllerInitNativeAssetIdentifiersAction = {
99
+ type: `NetworkEnablementController:initNativeAssetIdentifiers`;
100
+ handler: NetworkEnablementController['initNativeAssetIdentifiers'];
101
+ };
102
+ /**
103
+ * Disables a network for the user.
104
+ *
105
+ * This method accepts either a Hex chain ID (for EVM networks) or a CAIP-2 chain ID
106
+ * (for any blockchain network). The method will automatically convert Hex chain IDs
107
+ * to CAIP-2 format internally.
108
+ *
109
+ * Note: This method will prevent disabling the last remaining enabled network
110
+ * to ensure at least one network is always available.
111
+ *
112
+ * @param chainId - The chain ID of the network to disable. Can be either:
113
+ * - A Hex string (e.g., '0x1' for Ethereum mainnet) for EVM networks
114
+ * - A CAIP-2 chain ID (e.g., 'eip155:1' for Ethereum mainnet, 'solana:mainnet' for Solana)
115
+ */
116
+ export type NetworkEnablementControllerDisableNetworkAction = {
117
+ type: `NetworkEnablementController:disableNetwork`;
118
+ handler: NetworkEnablementController['disableNetwork'];
119
+ };
120
+ /**
121
+ * Restores the enabled network map to a previously snapshotted state.
122
+ *
123
+ * Not a general merge API: only updates keys already present in the current
124
+ * map. Missing snapshot values default to `false`. Intended for callers with
125
+ * direct controller access (e.g. extension) to undo `#onAddNetwork` filter
126
+ * switches when adding a network without changing the active selection.
127
+ *
128
+ * @param enabledNetworkMap - Previously snapshotted enabledNetworkMap.
129
+ */
130
+ export type NetworkEnablementControllerRestoreEnabledNetworkMapAction = {
131
+ type: `NetworkEnablementController:restoreEnabledNetworkMap`;
132
+ handler: NetworkEnablementController['restoreEnabledNetworkMap'];
133
+ };
134
+ /**
135
+ * Checks if a network is enabled.
136
+ *
137
+ * @param chainId - The chain ID of the network to check. Can be either:
138
+ * - A Hex string (e.g., '0x1' for Ethereum mainnet) for EVM networks
139
+ * - A CAIP-2 chain ID (e.g., 'eip155:1' for Ethereum mainnet, 'solana:mainnet' for Solana)
140
+ * @returns True if the network is enabled, false otherwise
141
+ */
142
+ export type NetworkEnablementControllerIsNetworkEnabledAction = {
143
+ type: `NetworkEnablementController:isNetworkEnabled`;
144
+ handler: NetworkEnablementController['isNetworkEnabled'];
145
+ };
146
+ /**
147
+ * Returns popular EVM network chain IDs in hex form, restricted to networks
148
+ * that exist in NetworkController (networkConfigurationsByChainId). Source is
149
+ * the bundled `POPULAR_NETWORKS` unioned with registry-featured EVM chains.
150
+ *
151
+ * @returns Hex chain IDs for popular EVM networks that are configured.
152
+ */
153
+ export type NetworkEnablementControllerListPopularEvmNetworksAction = {
154
+ type: `NetworkEnablementController:listPopularEvmNetworks`;
155
+ handler: NetworkEnablementController['listPopularEvmNetworks'];
156
+ };
157
+ /**
158
+ * Returns popular multichain (Bitcoin, Solana, Tron, Stellar) mainnet chain IDs in
159
+ * CAIP-2 form, restricted to networks that exist in MultichainNetworkController
160
+ * (multichainNetworkConfigurationsByChainId).
161
+ *
162
+ * @returns CAIP-2 chain IDs for Bitcoin, Solana, Tron, and Stellar mainnets that are configured.
163
+ */
164
+ export type NetworkEnablementControllerListPopularMultichainNetworksAction = {
165
+ type: `NetworkEnablementController:listPopularMultichainNetworks`;
166
+ handler: NetworkEnablementController['listPopularMultichainNetworks'];
167
+ };
168
+ /**
169
+ * Returns the list of popular network chain IDs in CAIP-2 form, restricted to
170
+ * networks that exist in NetworkController (networkConfigurationsByChainId) and
171
+ * MultichainNetworkController (multichainNetworkConfigurationsByChainId). EVM
172
+ * popular networks come from POPULAR_NETWORKS; multichain popular are Bitcoin,
173
+ * Solana, Tron, and Stellar mainnets.
174
+ *
175
+ * @returns CAIP-2 chain IDs for popular EVM networks and multichain mainnets that are configured.
176
+ */
177
+ export type NetworkEnablementControllerListPopularNetworksAction = {
178
+ type: `NetworkEnablementController:listPopularNetworks`;
179
+ handler: NetworkEnablementController['listPopularNetworks'];
180
+ };
181
+ /**
182
+ * Union of all NetworkEnablementController action types.
183
+ */
184
+ export type NetworkEnablementControllerMethodActions = NetworkEnablementControllerEnableNetworkAction | NetworkEnablementControllerEnableNetworkInNamespaceAction | NetworkEnablementControllerEnableAllPopularNetworksAction | NetworkEnablementControllerInitAction | NetworkEnablementControllerInitNativeAssetIdentifiersAction | NetworkEnablementControllerDisableNetworkAction | NetworkEnablementControllerRestoreEnabledNetworkMapAction | NetworkEnablementControllerIsNetworkEnabledAction | NetworkEnablementControllerListPopularEvmNetworksAction | NetworkEnablementControllerListPopularMultichainNetworksAction | NetworkEnablementControllerListPopularNetworksAction;
185
+ //# sourceMappingURL=NetworkEnablementController-method-action-types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NetworkEnablementController-method-action-types.d.mts","sourceRoot":"","sources":["../src/NetworkEnablementController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,2BAA2B,EAAE,0CAAyC;AAEpF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,2BAA2B,CAAC,eAAe,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,sDAAsD,CAAC;IAC7D,OAAO,EAAE,2BAA2B,CAAC,0BAA0B,CAAC,CAAC;CAClE,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,sDAAsD,CAAC;IAC7D,OAAO,EAAE,2BAA2B,CAAC,0BAA0B,CAAC,CAAC;CAClE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,2BAA2B,CAAC,MAAM,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,2DAA2D,GAAG;IACxE,IAAI,EAAE,wDAAwD,CAAC;IAC/D,OAAO,EAAE,2BAA2B,CAAC,4BAA4B,CAAC,CAAC;CACpE,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,4CAA4C,CAAC;IACnD,OAAO,EAAE,2BAA2B,CAAC,gBAAgB,CAAC,CAAC;CACxD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,sDAAsD,CAAC;IAC7D,OAAO,EAAE,2BAA2B,CAAC,0BAA0B,CAAC,CAAC;CAClE,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,iDAAiD,GAAG;IAC9D,IAAI,EAAE,8CAA8C,CAAC;IACrD,OAAO,EAAE,2BAA2B,CAAC,kBAAkB,CAAC,CAAC;CAC1D,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,uDAAuD,GAAG;IACpE,IAAI,EAAE,oDAAoD,CAAC;IAC3D,OAAO,EAAE,2BAA2B,CAAC,wBAAwB,CAAC,CAAC;CAChE,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,8DAA8D,GAAG;IAC3E,IAAI,EAAE,2DAA2D,CAAC;IAClE,OAAO,EAAE,2BAA2B,CAAC,+BAA+B,CAAC,CAAC;CACvE,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,oDAAoD,GAAG;IACjE,IAAI,EAAE,iDAAiD,CAAC;IACxD,OAAO,EAAE,2BAA2B,CAAC,qBAAqB,CAAC,CAAC;CAC7D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,wCAAwC,GAChD,8CAA8C,GAC9C,yDAAyD,GACzD,yDAAyD,GACzD,qCAAqC,GACrC,2DAA2D,GAC3D,+CAA+C,GAC/C,yDAAyD,GACzD,iDAAiD,GACjD,uDAAuD,GACvD,8DAA8D,GAC9D,oDAAoD,CAAC"}
@@ -3,4 +3,4 @@
3
3
  * Do not edit manually.
4
4
  */
5
5
  export {};
6
- //# sourceMappingURL=NetworkEnablementController-method-action-types.js.map
6
+ //# sourceMappingURL=NetworkEnablementController-method-action-types.mjs.map
@@ -0,0 +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.\n * Do not edit manually.\n */\n\nimport type { NetworkEnablementController } from './NetworkEnablementController.js';\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 * Restores the enabled network map to a previously snapshotted state.\n *\n * Not a general merge API: only updates keys already present in the current\n * map. Missing snapshot values default to `false`. Intended for callers with\n * direct controller access (e.g. extension) to undo `#onAddNetwork` filter\n * switches when adding a network without changing the active selection.\n *\n * @param enabledNetworkMap - Previously snapshotted enabledNetworkMap.\n */\nexport type NetworkEnablementControllerRestoreEnabledNetworkMapAction = {\n type: `NetworkEnablementController:restoreEnabledNetworkMap`;\n handler: NetworkEnablementController['restoreEnabledNetworkMap'];\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 is\n * the bundled `POPULAR_NETWORKS` unioned with registry-featured EVM chains.\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, Stellar) 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, Tron, and Stellar 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, Tron, and Stellar 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 | NetworkEnablementControllerRestoreEnabledNetworkMapAction\n | NetworkEnablementControllerIsNetworkEnabledAction\n | NetworkEnablementControllerListPopularEvmNetworksAction\n | NetworkEnablementControllerListPopularMultichainNetworksAction\n | NetworkEnablementControllerListPopularNetworksAction;\n"]}