-
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove
networkId
from NetworkController (#1633)
## Explanation Wallets shouldn't be directly concerned about the network ID as this is more of a node concept for gossip. What wallets really care about is chain ID as that is the correct value to use to identify a chain, build transactions, etc. Although these two values usually match (ignoring hex/dec formatting), there are [exceptions](https://medium.com/@pedrouid/chainid-vs-networkid-how-do-they-differ-on-ethereum-eec2ed41635b). We want to remove `networkId` from the NetworkController state to encourage the replacement of networkId with chainId in any usage downstream (extension, mobile, etc). It will still be possible to get networkId using the rpc client to make a call to the `net_version` method for cases that truly still rely on it. ## References * Fixes [mmp-1068](MetaMask/MetaMask-planning#1068) ## Changelog ### `@metamask/controller-utils` - **BREAKING**: `NETWORK_ID_TO_ETHERS_NETWORK_NAME_MAP` renamed to `CHAIN_ID_TO_ETHERS_NETWORK_NAME_MAP ` and is now a mapping of `Hex` chain ID to `BuiltInNetworkName` - **REMOVED**: `NetworkId` constant and type ### `@metamask/ens-controller` - **CHANGED**: From Network state, uses `providerConfig.chainId` instead of `networkId` to determine ENS compatability ### `@metamask/network-controller` - **REMOVED**: `NetworkId` type - **REMOVED**: From `NetworkState` removed `networkId` field - **CHANGED**: No longer calls `net_version` to determine network status (only relies on `eth_getBlockByNumber` now) - **CHANGED**: For Built-in Infura Networks, `net_version` is no longer locally resolved by the scaffold middleware ### `@metamask/transaction-controller` - **BREAKING**: Uses `chainId` and `txParams.chainId` to determine if a `TransactionMeta` object belongs to the current chain. No longer considers `networkID` - **BREAKING**: `TransactionMeta.chainId` is now a required field - **REMOVED**: From `RemoteTransactionSourceRequest` removed `currentNetworkId` field - **CHANGED**: From `RemoteTransactionSource` updated `isSupportedNetwork()` params to exclude networkId - **DEPRECATED**: `TransactionMeta.networkID` is deprecated and marked readonly
- Loading branch information
Showing
23 changed files
with
3,501 additions
and
6,052 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.