-
-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace NetworksChainId
constant with ChainId
#1354
Conversation
d4daa70
to
7c32737
Compare
c5f2464
to
23e4122
Compare
controller.setProviderType(NetworkType.rpc), | ||
).rejects.toThrow( | ||
'rpcUrl must be provided for custom RPC endpoints', | ||
'chainId must be provided for custom RPC endpoints', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changed because NetworksChainId
had an empty string for the RPC network type, causing it to pass chain ID validation but fail rpcUrl validation. Now it fails chain ID validation instead because that entry wasn't brought along to the ChainId
constant.
23e4122
to
f1e9d69
Compare
The constant `NetworksChainId` was ambiguous in whether it referred to network or chain Ids, and it didn't match our enum naming conventions. It was also undocumented, and unclear in which networks it was intended to contain. It has been replaced with a `ChainId` constant with documentation and a clear scope (built-in networks). A `BuiltInNetworks` enum has been added as well to make that more clear. Relates to #1209
f1e9d69
to
397220a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One suggestion but looks good to me otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One suggestion but looks good to me otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
* Replace `NetworksChainId` constant with `ChainId` The constant `NetworksChainId` was ambiguous in whether it referred to network or chain Ids, and it didn't match our enum naming conventions. It was also undocumented, and unclear in which networks it was intended to contain. It has been replaced with a `ChainId` constant with documentation and a clear scope (built-in networks). A `BuiltInNetworks` enum has been added as well to make that more clear. Relates to #1209 * Rename BuiltInNetwork to BuiltInNetworkName
* Replace `NetworksChainId` constant with `ChainId` The constant `NetworksChainId` was ambiguous in whether it referred to network or chain Ids, and it didn't match our enum naming conventions. It was also undocumented, and unclear in which networks it was intended to contain. It has been replaced with a `ChainId` constant with documentation and a clear scope (built-in networks). A `BuiltInNetworks` enum has been added as well to make that more clear. Relates to #1209 * Rename BuiltInNetwork to BuiltInNetworkName
Description
The constant
NetworksChainId
was ambiguous in whether it referred to network or chain Ids, and it didn't match our enum naming conventions. It was also undocumented, and unclear in which networks it was intended to contain.It has been replaced with a
ChainId
constant with documentation and a clear scope (built-in networks). ABuiltInNetworks
enum has been added as well to make that more clear.Changes
@metamask/controller-utils
NetworksChainId
constant withChainId
BuiltInNetwork
andChainId
References
Relates to #1209
Checklist