Skip to content
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

feat: add removeNetwork to multichain-network-controller #5516

Merged
merged 13 commits into from
Mar 27, 2025

Conversation

gantunesr
Copy link
Member

@gantunesr gantunesr commented Mar 20, 2025

Explanation

References

Changelog

@metamask/multichain-network-controller

  • ADDED: removeNetwork method. The new added method handles two cases,
    • EVM: The request is re-directed to the network-controller if certain conditions are met
    • Non-EVM: It is not possible to remove non-EVM network

@metamask/network-controller

  • ADDED: New action to get the selected chain ID

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@gantunesr gantunesr changed the title Gar/feat/mnc remove network feat: add removeNetwork to multichain-network-controller Mar 20, 2025
@gantunesr gantunesr marked this pull request as ready for review March 21, 2025 13:11
@gantunesr gantunesr requested review from a team as code owners March 21, 2025 13:11
@@ -53,6 +66,23 @@ export function checkIfSupportedCaipChainId(
export const toEvmCaipChainId = (chainId: Hex): CaipChainId =>
toCaipChainId(KnownCaipNamespace.Eip155, hexToNumber(chainId).toString());

/**
* Convert an eip155 CAIP chain ID to a hex chain ID.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: I wonder if we should check for the special case for EOA? cause eip155:0 would give a chain ID of 0, which is not really valid for that context. (It is valid for us regarding the scopes and CAIP, but not here IMO). Having said that, we should never end up using eip155:0 either (not in the "network management" context at least)

WDYT?

Copy link
Member Author

@gantunesr gantunesr Mar 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with both points, guarding against eip155:0 would add a layer of error management and it should apply to multiple methods on this class but as you said it shouldn't be part of this context. Will think about it in the meanwhile

Copy link
Contributor

@ccharly ccharly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@cryptodev-2s cryptodev-2s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gantunesr gantunesr enabled auto-merge (squash) March 27, 2025 23:26
@gantunesr gantunesr merged commit 7da5bd7 into main Mar 27, 2025
193 checks passed
@gantunesr gantunesr deleted the gar/feat/mnc-remove-network branch March 27, 2025 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants