@metamask-previews/multichain-network-controller 0.1.0-preview-ea165590 → 0.1.1-preview-7a21cbc

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/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.1]
11
+
12
+ ### Fixed
13
+
14
+ - Add `MultichainNetworkController:stateChange` to list of subscribable `MultichainNetworkController` messenger events ([#5331](https://github.com/MetaMask/core.git/pull/5331))
15
+
10
16
  ## [0.1.0]
11
17
 
12
18
  ### Added
@@ -15,5 +21,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
15
21
  - Handle both EVM and non-EVM network and account switching for the associated network.
16
22
  - Act as a proxy for the `NetworkController` (for EVM network changes).
17
23
 
18
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/multichain-network-controller@0.1.0...HEAD
24
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/multichain-network-controller@0.1.1...HEAD
25
+ [0.1.1]: https://github.com/MetaMask/core/compare/@metamask/multichain-network-controller@0.1.0...@metamask/multichain-network-controller@0.1.1
19
26
  [0.1.0]: https://github.com/MetaMask/core/releases/tag/@metamask/multichain-network-controller@0.1.0
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAea,QAAA,kCAAkC,GAAG,6BAA6B,CAAC","sourcesContent":["import {\n type ControllerGetStateAction,\n type ControllerStateChangeEvent,\n type RestrictedMessenger,\n} from '@metamask/base-controller';\nimport type { BtcScope, CaipChainId, SolScope } from '@metamask/keyring-api';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport type {\n NetworkStatus,\n NetworkControllerSetActiveNetworkAction,\n NetworkControllerGetStateAction,\n NetworkClientId,\n} from '@metamask/network-controller';\nimport { type CaipAssetType } from '@metamask/utils';\n\nexport const MULTICHAIN_NETWORK_CONTROLLER_NAME = 'MultichainNetworkController';\n\nexport type MultichainNetworkMetadata = {\n features: string[];\n status: NetworkStatus;\n};\n\nexport type SupportedCaipChainId = SolScope.Mainnet | BtcScope.Mainnet;\n\nexport type CommonNetworkConfiguration = {\n /**\n * EVM network flag.\n */\n isEvm: boolean;\n /**\n * The chain ID of the network.\n */\n chainId: CaipChainId;\n /**\n * The name of the network.\n */\n name: string;\n};\n\nexport type NonEvmNetworkConfiguration = CommonNetworkConfiguration & {\n /**\n * EVM network flag.\n */\n isEvm: false;\n /**\n * The native asset type of the network.\n */\n nativeCurrency: CaipAssetType;\n};\n\n// TODO: The controller only supports non-EVM network configurations at the moment\n// Once we support Caip chain IDs for EVM networks, we can re-enable EVM network configurations\nexport type EvmNetworkConfiguration = CommonNetworkConfiguration & {\n /**\n * EVM network flag.\n */\n isEvm: true;\n /**\n * The native asset type of the network.\n * For EVM, this is the network ticker since there is no standard between\n * tickers and Caip IDs.\n */\n nativeCurrency: string;\n /**\n * The block explorers of the network.\n */\n blockExplorerUrls: string[];\n /**\n * The index of the default block explorer URL.\n */\n defaultBlockExplorerUrlIndex: number;\n};\n\nexport type MultichainNetworkConfiguration =\n | EvmNetworkConfiguration\n | NonEvmNetworkConfiguration;\n\n/**\n * State used by the {@link MultichainNetworkController} to cache network configurations.\n */\nexport type MultichainNetworkControllerState = {\n /**\n * The network configurations by chain ID.\n */\n multichainNetworkConfigurationsByChainId: Record<\n CaipChainId,\n MultichainNetworkConfiguration\n >;\n /**\n * The chain ID of the selected network.\n */\n selectedMultichainNetworkChainId: SupportedCaipChainId;\n /**\n * Whether EVM or non-EVM network is selected\n */\n isEvmSelected: boolean;\n};\n\n/**\n * Returns the state of the {@link MultichainNetworkController}.\n */\nexport type MultichainNetworkControllerGetStateAction =\n ControllerGetStateAction<\n typeof MULTICHAIN_NETWORK_CONTROLLER_NAME,\n MultichainNetworkControllerState\n >;\n\nexport type SetActiveNetworkMethod = (\n id: SupportedCaipChainId | NetworkClientId,\n) => Promise<void>;\n\nexport type MultichainNetworkControllerSetActiveNetworkAction = {\n type: `${typeof MULTICHAIN_NETWORK_CONTROLLER_NAME}:setActiveNetwork`;\n handler: SetActiveNetworkMethod;\n};\n\n/**\n * Event emitted when the state of the {@link MultichainNetworkController} changes.\n */\nexport type MultichainNetworkControllerStateChange = ControllerStateChangeEvent<\n typeof MULTICHAIN_NETWORK_CONTROLLER_NAME,\n MultichainNetworkControllerState\n>;\n\nexport type MultichainNetworkControllerNetworkDidChangeEvent = {\n type: `${typeof MULTICHAIN_NETWORK_CONTROLLER_NAME}:networkDidChange`;\n payload: [NetworkClientId | SupportedCaipChainId];\n};\n\n/**\n * Actions exposed by the {@link MultichainNetworkController}.\n */\nexport type MultichainNetworkControllerActions =\n | MultichainNetworkControllerGetStateAction\n | MultichainNetworkControllerSetActiveNetworkAction;\n\n/**\n * Events emitted by {@link MultichainNetworkController}.\n */\nexport type MultichainNetworkControllerEvents =\n MultichainNetworkControllerNetworkDidChangeEvent;\n\n/**\n * Actions that this controller is allowed to call.\n */\nexport type AllowedActions =\n | NetworkControllerGetStateAction\n | NetworkControllerSetActiveNetworkAction;\n\n// Re-define event here to avoid circular dependency with AccountsController\nexport type AccountsControllerSelectedAccountChangeEvent = {\n type: `AccountsController:selectedAccountChange`;\n payload: [InternalAccount];\n};\n\n/**\n * Events that this controller is allowed to subscribe.\n */\nexport type AllowedEvents = AccountsControllerSelectedAccountChangeEvent;\n\nexport type MultichainNetworkControllerAllowedActions =\n | MultichainNetworkControllerActions\n | AllowedActions;\n\nexport type MultichainNetworkControllerAllowedEvents =\n | MultichainNetworkControllerEvents\n | AllowedEvents;\n\n/**\n * Messenger type for the MultichainNetworkController.\n */\nexport type MultichainNetworkControllerMessenger = RestrictedMessenger<\n typeof MULTICHAIN_NETWORK_CONTROLLER_NAME,\n MultichainNetworkControllerAllowedActions,\n MultichainNetworkControllerAllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAea,QAAA,kCAAkC,GAAG,6BAA6B,CAAC","sourcesContent":["import {\n type ControllerGetStateAction,\n type ControllerStateChangeEvent,\n type RestrictedMessenger,\n} from '@metamask/base-controller';\nimport type { BtcScope, CaipChainId, SolScope } from '@metamask/keyring-api';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport type {\n NetworkStatus,\n NetworkControllerSetActiveNetworkAction,\n NetworkControllerGetStateAction,\n NetworkClientId,\n} from '@metamask/network-controller';\nimport { type CaipAssetType } from '@metamask/utils';\n\nexport const MULTICHAIN_NETWORK_CONTROLLER_NAME = 'MultichainNetworkController';\n\nexport type MultichainNetworkMetadata = {\n features: string[];\n status: NetworkStatus;\n};\n\nexport type SupportedCaipChainId = SolScope.Mainnet | BtcScope.Mainnet;\n\nexport type CommonNetworkConfiguration = {\n /**\n * EVM network flag.\n */\n isEvm: boolean;\n /**\n * The chain ID of the network.\n */\n chainId: CaipChainId;\n /**\n * The name of the network.\n */\n name: string;\n};\n\nexport type NonEvmNetworkConfiguration = CommonNetworkConfiguration & {\n /**\n * EVM network flag.\n */\n isEvm: false;\n /**\n * The native asset type of the network.\n */\n nativeCurrency: CaipAssetType;\n};\n\n// TODO: The controller only supports non-EVM network configurations at the moment\n// Once we support Caip chain IDs for EVM networks, we can re-enable EVM network configurations\nexport type EvmNetworkConfiguration = CommonNetworkConfiguration & {\n /**\n * EVM network flag.\n */\n isEvm: true;\n /**\n * The native asset type of the network.\n * For EVM, this is the network ticker since there is no standard between\n * tickers and Caip IDs.\n */\n nativeCurrency: string;\n /**\n * The block explorers of the network.\n */\n blockExplorerUrls: string[];\n /**\n * The index of the default block explorer URL.\n */\n defaultBlockExplorerUrlIndex: number;\n};\n\nexport type MultichainNetworkConfiguration =\n | EvmNetworkConfiguration\n | NonEvmNetworkConfiguration;\n\n/**\n * State used by the {@link MultichainNetworkController} to cache network configurations.\n */\nexport type MultichainNetworkControllerState = {\n /**\n * The network configurations by chain ID.\n */\n multichainNetworkConfigurationsByChainId: Record<\n CaipChainId,\n MultichainNetworkConfiguration\n >;\n /**\n * The chain ID of the selected network.\n */\n selectedMultichainNetworkChainId: SupportedCaipChainId;\n /**\n * Whether EVM or non-EVM network is selected\n */\n isEvmSelected: boolean;\n};\n\n/**\n * Returns the state of the {@link MultichainNetworkController}.\n */\nexport type MultichainNetworkControllerGetStateAction =\n ControllerGetStateAction<\n typeof MULTICHAIN_NETWORK_CONTROLLER_NAME,\n MultichainNetworkControllerState\n >;\n\nexport type SetActiveNetworkMethod = (\n id: SupportedCaipChainId | NetworkClientId,\n) => Promise<void>;\n\nexport type MultichainNetworkControllerSetActiveNetworkAction = {\n type: `${typeof MULTICHAIN_NETWORK_CONTROLLER_NAME}:setActiveNetwork`;\n handler: SetActiveNetworkMethod;\n};\n\n/**\n * Event emitted when the state of the {@link MultichainNetworkController} changes.\n */\nexport type MultichainNetworkControllerStateChange = ControllerStateChangeEvent<\n typeof MULTICHAIN_NETWORK_CONTROLLER_NAME,\n MultichainNetworkControllerState\n>;\n\nexport type MultichainNetworkControllerNetworkDidChangeEvent = {\n type: `${typeof MULTICHAIN_NETWORK_CONTROLLER_NAME}:networkDidChange`;\n payload: [NetworkClientId | SupportedCaipChainId];\n};\n\n/**\n * Actions exposed by the {@link MultichainNetworkController}.\n */\nexport type MultichainNetworkControllerActions =\n | MultichainNetworkControllerGetStateAction\n | MultichainNetworkControllerSetActiveNetworkAction;\n\n/**\n * Events emitted by {@link MultichainNetworkController}.\n */\nexport type MultichainNetworkControllerEvents =\n | MultichainNetworkControllerStateChange\n | MultichainNetworkControllerNetworkDidChangeEvent;\n\n/**\n * Actions that this controller is allowed to call.\n */\nexport type AllowedActions =\n | NetworkControllerGetStateAction\n | NetworkControllerSetActiveNetworkAction;\n\n// Re-define event here to avoid circular dependency with AccountsController\nexport type AccountsControllerSelectedAccountChangeEvent = {\n type: `AccountsController:selectedAccountChange`;\n payload: [InternalAccount];\n};\n\n/**\n * Events that this controller is allowed to subscribe.\n */\nexport type AllowedEvents = AccountsControllerSelectedAccountChangeEvent;\n\nexport type MultichainNetworkControllerAllowedActions =\n | MultichainNetworkControllerActions\n | AllowedActions;\n\nexport type MultichainNetworkControllerAllowedEvents =\n | MultichainNetworkControllerEvents\n | AllowedEvents;\n\n/**\n * Messenger type for the MultichainNetworkController.\n */\nexport type MultichainNetworkControllerMessenger = RestrictedMessenger<\n typeof MULTICHAIN_NETWORK_CONTROLLER_NAME,\n MultichainNetworkControllerAllowedActions,\n MultichainNetworkControllerAllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n"]}
package/dist/types.d.cts CHANGED
@@ -95,7 +95,7 @@ export type MultichainNetworkControllerActions = MultichainNetworkControllerGetS
95
95
  /**
96
96
  * Events emitted by {@link MultichainNetworkController}.
97
97
  */
98
- export type MultichainNetworkControllerEvents = MultichainNetworkControllerNetworkDidChangeEvent;
98
+ export type MultichainNetworkControllerEvents = MultichainNetworkControllerStateChange | MultichainNetworkControllerNetworkDidChangeEvent;
99
99
  /**
100
100
  * Actions that this controller is allowed to call.
101
101
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACzB,kCAAkC;AACnC,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,8BAA8B;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AACtE,OAAO,KAAK,EACV,aAAa,EACb,uCAAuC,EACvC,+BAA+B,EAC/B,eAAe,EAChB,qCAAqC;AACtC,OAAO,EAAE,KAAK,aAAa,EAAE,wBAAwB;AAErD,eAAO,MAAM,kCAAkC,gCAAgC,CAAC;AAEhF,MAAM,MAAM,yBAAyB,G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mBAAmB,CACpE,OAAO,kCAAkC,EACzC,yCAAyC,EACzC,wCAAwC,EACxC,cAAc,CAAC,MAAM,CAAC,EACtB,aAAa,CAAC,MAAM,CAAC,CACtB,CAAC"}
package/dist/types.d.mts CHANGED
@@ -95,7 +95,7 @@ export type MultichainNetworkControllerActions = MultichainNetworkControllerGetS
95
95
  /**
96
96
  * Events emitted by {@link MultichainNetworkController}.
97
97
  */
98
- export type MultichainNetworkControllerEvents = MultichainNetworkControllerNetworkDidChangeEvent;
98
+ export type MultichainNetworkControllerEvents = MultichainNetworkControllerStateChange | MultichainNetworkControllerNetworkDidChangeEvent;
99
99
  /**
100
100
  * Actions that this controller is allowed to call.
101
101
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACzB,kCAAkC;AACnC,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,8BAA8B;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AACtE,OAAO,KAAK,EACV,aAAa,EACb,uCAAuC,EACvC,+BAA+B,EAC/B,eAAe,EAChB,qCAAqC;AACtC,OAAO,EAAE,KAAK,aAAa,EAAE,wBAAwB;AAErD,eAAO,MAAM,kCAAkC,gCAAgC,CAAC;AAEhF,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,aAAa,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;AAEvE,MAAM,MAAM,0BAA0B,GAAG;IACvC;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,OAAO,EAAE,WAAW,CAAC;IACrB;;OAEG;IACH,IAAI,EAAE,MAA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D,IAAI,EAAE,GAAG,OAAO,kCAAkC,mBAAmB,CAAC;IACtE,OAAO,EAAE,sBAAsB,CAAC;CACjC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG,0BAA0B,CAC7E,OAAO,kCAAkC,EACzC,gCAAgC,CACjC,CAAC;AAEF,MAAM,MAAM,gDAAgD,GAAG;IAC7D,IAAI,EAAE,GAAG,OAAO,kCAAkC,mBAAmB,CAAC;IACtE,OAAO,EAAE,CAAC,eAAe,GAAG,oBAAoB,CAAC,CAAC;CACnD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAC1C,yCAAyC,GACzC,iDAAiD,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,iCAAiC,GACzC,sCAAsC,GACtC,gDAAgD,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,+BAA+B,GAC/B,uCAAuC,CAAC;AAG5C,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,CAAC,eAAe,CAAC,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,4CAA4C,CAAC;AAEzE,MAAM,MAAM,yCAAyC,GACjD,kCAAkC,GAClC,cAAc,CAAC;AAEnB,MAAM,MAAM,wCAAwC,GAChD,iCAAiC,GACjC,aAAa,CAAC;AAElB;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAAG,mBAAmB,CACpE,OAAO,kCAAkC,EACzC,yCAAyC,EACzC,wCAAwC,EACxC,cAAc,CAAC,MAAM,CAAC,EACtB,aAAa,CAAC,MAAM,CAAC,CACtB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,kCAAkC,GAAG,6BAA6B,CAAC","sourcesContent":["import {\n type ControllerGetStateAction,\n type ControllerStateChangeEvent,\n type RestrictedMessenger,\n} from '@metamask/base-controller';\nimport type { BtcScope, CaipChainId, SolScope } from '@metamask/keyring-api';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport type {\n NetworkStatus,\n NetworkControllerSetActiveNetworkAction,\n NetworkControllerGetStateAction,\n NetworkClientId,\n} from '@metamask/network-controller';\nimport { type CaipAssetType } from '@metamask/utils';\n\nexport const MULTICHAIN_NETWORK_CONTROLLER_NAME = 'MultichainNetworkController';\n\nexport type MultichainNetworkMetadata = {\n features: string[];\n status: NetworkStatus;\n};\n\nexport type SupportedCaipChainId = SolScope.Mainnet | BtcScope.Mainnet;\n\nexport type CommonNetworkConfiguration = {\n /**\n * EVM network flag.\n */\n isEvm: boolean;\n /**\n * The chain ID of the network.\n */\n chainId: CaipChainId;\n /**\n * The name of the network.\n */\n name: string;\n};\n\nexport type NonEvmNetworkConfiguration = CommonNetworkConfiguration & {\n /**\n * EVM network flag.\n */\n isEvm: false;\n /**\n * The native asset type of the network.\n */\n nativeCurrency: CaipAssetType;\n};\n\n// TODO: The controller only supports non-EVM network configurations at the moment\n// Once we support Caip chain IDs for EVM networks, we can re-enable EVM network configurations\nexport type EvmNetworkConfiguration = CommonNetworkConfiguration & {\n /**\n * EVM network flag.\n */\n isEvm: true;\n /**\n * The native asset type of the network.\n * For EVM, this is the network ticker since there is no standard between\n * tickers and Caip IDs.\n */\n nativeCurrency: string;\n /**\n * The block explorers of the network.\n */\n blockExplorerUrls: string[];\n /**\n * The index of the default block explorer URL.\n */\n defaultBlockExplorerUrlIndex: number;\n};\n\nexport type MultichainNetworkConfiguration =\n | EvmNetworkConfiguration\n | NonEvmNetworkConfiguration;\n\n/**\n * State used by the {@link MultichainNetworkController} to cache network configurations.\n */\nexport type MultichainNetworkControllerState = {\n /**\n * The network configurations by chain ID.\n */\n multichainNetworkConfigurationsByChainId: Record<\n CaipChainId,\n MultichainNetworkConfiguration\n >;\n /**\n * The chain ID of the selected network.\n */\n selectedMultichainNetworkChainId: SupportedCaipChainId;\n /**\n * Whether EVM or non-EVM network is selected\n */\n isEvmSelected: boolean;\n};\n\n/**\n * Returns the state of the {@link MultichainNetworkController}.\n */\nexport type MultichainNetworkControllerGetStateAction =\n ControllerGetStateAction<\n typeof MULTICHAIN_NETWORK_CONTROLLER_NAME,\n MultichainNetworkControllerState\n >;\n\nexport type SetActiveNetworkMethod = (\n id: SupportedCaipChainId | NetworkClientId,\n) => Promise<void>;\n\nexport type MultichainNetworkControllerSetActiveNetworkAction = {\n type: `${typeof MULTICHAIN_NETWORK_CONTROLLER_NAME}:setActiveNetwork`;\n handler: SetActiveNetworkMethod;\n};\n\n/**\n * Event emitted when the state of the {@link MultichainNetworkController} changes.\n */\nexport type MultichainNetworkControllerStateChange = ControllerStateChangeEvent<\n typeof MULTICHAIN_NETWORK_CONTROLLER_NAME,\n MultichainNetworkControllerState\n>;\n\nexport type MultichainNetworkControllerNetworkDidChangeEvent = {\n type: `${typeof MULTICHAIN_NETWORK_CONTROLLER_NAME}:networkDidChange`;\n payload: [NetworkClientId | SupportedCaipChainId];\n};\n\n/**\n * Actions exposed by the {@link MultichainNetworkController}.\n */\nexport type MultichainNetworkControllerActions =\n | MultichainNetworkControllerGetStateAction\n | MultichainNetworkControllerSetActiveNetworkAction;\n\n/**\n * Events emitted by {@link MultichainNetworkController}.\n */\nexport type MultichainNetworkControllerEvents =\n MultichainNetworkControllerNetworkDidChangeEvent;\n\n/**\n * Actions that this controller is allowed to call.\n */\nexport type AllowedActions =\n | NetworkControllerGetStateAction\n | NetworkControllerSetActiveNetworkAction;\n\n// Re-define event here to avoid circular dependency with AccountsController\nexport type AccountsControllerSelectedAccountChangeEvent = {\n type: `AccountsController:selectedAccountChange`;\n payload: [InternalAccount];\n};\n\n/**\n * Events that this controller is allowed to subscribe.\n */\nexport type AllowedEvents = AccountsControllerSelectedAccountChangeEvent;\n\nexport type MultichainNetworkControllerAllowedActions =\n | MultichainNetworkControllerActions\n | AllowedActions;\n\nexport type MultichainNetworkControllerAllowedEvents =\n | MultichainNetworkControllerEvents\n | AllowedEvents;\n\n/**\n * Messenger type for the MultichainNetworkController.\n */\nexport type MultichainNetworkControllerMessenger = RestrictedMessenger<\n typeof MULTICHAIN_NETWORK_CONTROLLER_NAME,\n MultichainNetworkControllerAllowedActions,\n MultichainNetworkControllerAllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,kCAAkC,GAAG,6BAA6B,CAAC","sourcesContent":["import {\n type ControllerGetStateAction,\n type ControllerStateChangeEvent,\n type RestrictedMessenger,\n} from '@metamask/base-controller';\nimport type { BtcScope, CaipChainId, SolScope } from '@metamask/keyring-api';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport type {\n NetworkStatus,\n NetworkControllerSetActiveNetworkAction,\n NetworkControllerGetStateAction,\n NetworkClientId,\n} from '@metamask/network-controller';\nimport { type CaipAssetType } from '@metamask/utils';\n\nexport const MULTICHAIN_NETWORK_CONTROLLER_NAME = 'MultichainNetworkController';\n\nexport type MultichainNetworkMetadata = {\n features: string[];\n status: NetworkStatus;\n};\n\nexport type SupportedCaipChainId = SolScope.Mainnet | BtcScope.Mainnet;\n\nexport type CommonNetworkConfiguration = {\n /**\n * EVM network flag.\n */\n isEvm: boolean;\n /**\n * The chain ID of the network.\n */\n chainId: CaipChainId;\n /**\n * The name of the network.\n */\n name: string;\n};\n\nexport type NonEvmNetworkConfiguration = CommonNetworkConfiguration & {\n /**\n * EVM network flag.\n */\n isEvm: false;\n /**\n * The native asset type of the network.\n */\n nativeCurrency: CaipAssetType;\n};\n\n// TODO: The controller only supports non-EVM network configurations at the moment\n// Once we support Caip chain IDs for EVM networks, we can re-enable EVM network configurations\nexport type EvmNetworkConfiguration = CommonNetworkConfiguration & {\n /**\n * EVM network flag.\n */\n isEvm: true;\n /**\n * The native asset type of the network.\n * For EVM, this is the network ticker since there is no standard between\n * tickers and Caip IDs.\n */\n nativeCurrency: string;\n /**\n * The block explorers of the network.\n */\n blockExplorerUrls: string[];\n /**\n * The index of the default block explorer URL.\n */\n defaultBlockExplorerUrlIndex: number;\n};\n\nexport type MultichainNetworkConfiguration =\n | EvmNetworkConfiguration\n | NonEvmNetworkConfiguration;\n\n/**\n * State used by the {@link MultichainNetworkController} to cache network configurations.\n */\nexport type MultichainNetworkControllerState = {\n /**\n * The network configurations by chain ID.\n */\n multichainNetworkConfigurationsByChainId: Record<\n CaipChainId,\n MultichainNetworkConfiguration\n >;\n /**\n * The chain ID of the selected network.\n */\n selectedMultichainNetworkChainId: SupportedCaipChainId;\n /**\n * Whether EVM or non-EVM network is selected\n */\n isEvmSelected: boolean;\n};\n\n/**\n * Returns the state of the {@link MultichainNetworkController}.\n */\nexport type MultichainNetworkControllerGetStateAction =\n ControllerGetStateAction<\n typeof MULTICHAIN_NETWORK_CONTROLLER_NAME,\n MultichainNetworkControllerState\n >;\n\nexport type SetActiveNetworkMethod = (\n id: SupportedCaipChainId | NetworkClientId,\n) => Promise<void>;\n\nexport type MultichainNetworkControllerSetActiveNetworkAction = {\n type: `${typeof MULTICHAIN_NETWORK_CONTROLLER_NAME}:setActiveNetwork`;\n handler: SetActiveNetworkMethod;\n};\n\n/**\n * Event emitted when the state of the {@link MultichainNetworkController} changes.\n */\nexport type MultichainNetworkControllerStateChange = ControllerStateChangeEvent<\n typeof MULTICHAIN_NETWORK_CONTROLLER_NAME,\n MultichainNetworkControllerState\n>;\n\nexport type MultichainNetworkControllerNetworkDidChangeEvent = {\n type: `${typeof MULTICHAIN_NETWORK_CONTROLLER_NAME}:networkDidChange`;\n payload: [NetworkClientId | SupportedCaipChainId];\n};\n\n/**\n * Actions exposed by the {@link MultichainNetworkController}.\n */\nexport type MultichainNetworkControllerActions =\n | MultichainNetworkControllerGetStateAction\n | MultichainNetworkControllerSetActiveNetworkAction;\n\n/**\n * Events emitted by {@link MultichainNetworkController}.\n */\nexport type MultichainNetworkControllerEvents =\n | MultichainNetworkControllerStateChange\n | MultichainNetworkControllerNetworkDidChangeEvent;\n\n/**\n * Actions that this controller is allowed to call.\n */\nexport type AllowedActions =\n | NetworkControllerGetStateAction\n | NetworkControllerSetActiveNetworkAction;\n\n// Re-define event here to avoid circular dependency with AccountsController\nexport type AccountsControllerSelectedAccountChangeEvent = {\n type: `AccountsController:selectedAccountChange`;\n payload: [InternalAccount];\n};\n\n/**\n * Events that this controller is allowed to subscribe.\n */\nexport type AllowedEvents = AccountsControllerSelectedAccountChangeEvent;\n\nexport type MultichainNetworkControllerAllowedActions =\n | MultichainNetworkControllerActions\n | AllowedActions;\n\nexport type MultichainNetworkControllerAllowedEvents =\n | MultichainNetworkControllerEvents\n | AllowedEvents;\n\n/**\n * Messenger type for the MultichainNetworkController.\n */\nexport type MultichainNetworkControllerMessenger = RestrictedMessenger<\n typeof MULTICHAIN_NETWORK_CONTROLLER_NAME,\n MultichainNetworkControllerAllowedActions,\n MultichainNetworkControllerAllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/multichain-network-controller",
3
- "version": "0.1.0-preview-ea165590",
3
+ "version": "0.1.1-preview-7a21cbc",
4
4
  "description": "Multichain network controller",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -49,7 +49,7 @@
49
49
  "dependencies": {
50
50
  "@metamask/base-controller": "^8.0.0",
51
51
  "@metamask/keyring-api": "^17.0.0",
52
- "@metamask/utils": "^11.1.0",
52
+ "@metamask/utils": "^11.2.0",
53
53
  "@solana/addresses": "^2.0.0"
54
54
  },
55
55
  "devDependencies": {