Replace network/isCustomNetwork with networkStatus#1073
Replace network/isCustomNetwork with networkStatus#1073cryptodev-2s wants to merge 2 commits intomainfrom
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
packages/transaction-controller/src/TransactionController.test.ts
Outdated
Show resolved
Hide resolved
The network controller contains two related state properties: `network` and `isCustomNetwork`. The first property is strange: it can either be a number, which represents the version of the network as obtained via `net_version`, or "loading", which is a sort of null state that either means we don't have a network to connect to, or we do but it's not accessible. In any case, the `net_version` RPC method, much less the idea of a network version, is no longer standard, so we don't need to store it. The second property is unnecessary, as we can already obtain whether a network is "custom" (i.e. not one of the ones we know about by default) by looking at the `type` within the provider config object. Therefore, we can remove these state properties and replace them with a simple property that merely tracks whether we have an accessible network or not. Co-authored-by: Salah <salah-eddine.saakoun@consensys.net>
2db91e4 to
f98e942
Compare
| * created for the currently selected network and the network is provably | ||
| * accessible. | ||
| * @property loading - Represents the state in which a provider object does not | ||
| * exist for the currently selected network, or it does exist but the network is | ||
| * provably inaccessible. |
There was a problem hiding this comment.
Nit: Maybe better to use softer language here since we only check periodically, and since the way we check today is a bit questionable and might not be a guarantee that the network is accessible (e.g. if a network doesn't implement net_version, or uses a cache for static methods like this, it might not reflect whether the network is accessible or not).
| * created for the currently selected network and the network is provably | |
| * accessible. | |
| * @property loading - Represents the state in which a provider object does not | |
| * exist for the currently selected network, or it does exist but the network is | |
| * provably inaccessible. | |
| * created for the currently selected network and the network is seems | |
| * accessible. | |
| * @property loading - Represents the state in which a provider object does not | |
| * exist for the currently selected network, or it does exist but the network is | |
| * seems inaccessible. |
Gudahtt
left a comment
There was a problem hiding this comment.
Looks great! There seems to be a conflict to resolve though.
Also, could we compile a list of all of the breaking changes? Lots on the transaction controller here too.
|
I need to revisit this. I'll try to focus on this after my current task on the extension side. |
|
Placing this back in draft until MetaMask/metamask-extension#17556 is merged. |
The network controller contains two related state properties:
networkand
isCustomNetwork.The first property is strange: it can either be a number, which
represents the version of the network as obtained via
net_version, or"loading", which is a sort of null state that either means we don't have
a network to connect to, or we do but it's not accessible. In any case,
the
net_versionRPC method, much less the idea of a network version,is no longer standard, so we don't need to store it.
The second property is unnecessary, as we can already obtain whether a
network is "custom" (i.e. not one of the ones we know about by default)
by looking at the
typewithin the provider config object.Therefore, we can remove these state properties and replace them with a
simple property that merely tracks whether we have an accessible network
or not.
Fixes #1020.