Merged
Conversation
|
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/@metamask/network-controller@19.0.0 |
src/SmartTransactionsController.ts
Outdated
Comment on lines
192
to
204
| onNetworkStateChange((networkState) => { | ||
| const { selectedNetworkClientId } = networkState; | ||
| const networkClient = this.getNetworkClientById(selectedNetworkClientId); | ||
| const { chainId } = networkClient.configuration; | ||
| const isNewChainId = chainId !== this.config.chainId; | ||
| this.configure({ chainId }); | ||
| this.initializeSmartTransactionsForChainId(); | ||
| if (isNewChainId) { | ||
| this.#ensureUniqueSmartTransactions(); | ||
| } | ||
| this.checkPoll(this.state); | ||
| this.ethQuery = new EthQuery(provider); | ||
| this.ethQuery = new EthQuery(networkClient.provider); | ||
| }); |
Contributor
There was a problem hiding this comment.
Nit: Could we do it this way instead? The only difference is fewer rows and earlier deconstruction ?
Suggested change
| onNetworkStateChange((networkState) => { | |
| const { selectedNetworkClientId } = networkState; | |
| const networkClient = this.getNetworkClientById(selectedNetworkClientId); | |
| const { chainId } = networkClient.configuration; | |
| const isNewChainId = chainId !== this.config.chainId; | |
| this.configure({ chainId }); | |
| this.initializeSmartTransactionsForChainId(); | |
| if (isNewChainId) { | |
| this.#ensureUniqueSmartTransactions(); | |
| } | |
| this.checkPoll(this.state); | |
| this.ethQuery = new EthQuery(provider); | |
| this.ethQuery = new EthQuery(networkClient.provider); | |
| }); | |
| onNetworkStateChange(({ selectedNetworkClientId }) => { | |
| const { | |
| configuration: { chainId }, | |
| provider, | |
| } = this.getNetworkClientById(selectedNetworkClientId); | |
| const isNewChainId = chainId !== this.config.chainId; | |
| this.configure({ chainId }); | |
| this.initializeSmartTransactionsForChainId(); | |
| if (isNewChainId) { | |
| this.#ensureUniqueSmartTransactions(); | |
| } | |
| this.checkPoll(this.state); | |
| this.ethQuery = new EthQuery(provider); | |
| }); |
Contributor
cryptodev-2s
left a comment
There was a problem hiding this comment.
Looks good to me, there's just one minor change proposed
7 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrade the @metamask/network-controller to v20. @metamask/network-controller 20.0.0 removed providerConfig from state, which means that we now need to use selectedNetworkClientId to access the chain ID for the currently selected network. And we no longer need to take provider, instead get this from the network client object.
@metamask/network-controllerfrom v19 to v20 #391