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

chore(431-1): multichain list preparation #12293

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

vinnyhoward
Copy link
Contributor

@vinnyhoward vinnyhoward commented Nov 14, 2024

Description

This pull request is preparatory work for the upcoming multi-chain feature, here is the pull request. It introduces utility functions and type improvements to support multi-chain asset management. The improvements for chain id's mapping is also an attempt to mirror what we have in extension

Key Changes

  1. Added new utility functions:

    • enableAllNetworksFilter: Creates a mapping of chain IDs to boolean values for network filtering
    • filterAssets: Generic asset filtering utility that supports chain ID and balance filtering
  2. Enhanced network type definitions:

    • Updated NETWORK_CHAIN_ID to use readonly properties for better type safety
    • Improved type integration with @metamask/transaction-controller's CHAIN_IDS
  3. Added test coverage:

    • Tests for enableAllNetworksFilter covering basic functionality and edge cases
    • Tests for filterAssets demonstrating chain ID and balance filtering capabilities

Technical Details

  • enableAllNetworksFilter: Converts network configurations into a boolean map for filtering
  • filterAssets: Implements flexible filtering with support for:
    • Inclusive filtering (e.g., specific chain IDs)
    • Range filtering (e.g., token balances)
    • Extensible filter callback system

Purpose

This PR aims to:

  1. Reduce the complexity of the main multi-chain feature branch
  2. Introduce necessary utilities for multi-chain asset management
  3. Improve type safety for network-related operations

Related issues

Fixes: NA

Manual testing steps

  1. None

Screenshots/Recordings

NA

Before

NA

After

NA

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@vinnyhoward vinnyhoward requested review from a team as code owners November 14, 2024 19:41
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@vinnyhoward vinnyhoward added the Run Smoke E2E Triggers smoke e2e on Bitrise label Nov 14, 2024
Copy link
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: 0066034
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/5454a801-3fbc-4457-83dd-e30b3e5c48c4

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@vinnyhoward vinnyhoward changed the title chore(431): multichain list preparation chore(431-1): multichain list preparation Nov 14, 2024
gambinish
gambinish previously approved these changes Nov 14, 2024
Copy link
Contributor

@gambinish gambinish left a comment

Choose a reason for hiding this comment

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

Only nit I would add is to add a comment link to the extension networks, but nbd

…hub.com:MetaMask/metamask-mobile into chore-431-1-prepare-multi-chain-network-filters
@vinnyhoward vinnyhoward added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Nov 14, 2024
Copy link
Contributor

github-actions bot commented Nov 14, 2024

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 894743a
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/f378274b-77ed-4939-9cf3-14669b420b6e

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

Copy link

sonarcloud bot commented Nov 14, 2024

'0x8157': require('../../images/ape-network.png'), // ApeChain testnet
'0x8173': require('../../images/ape-network.png'), // ApeChain mainnet
'0x659': require('../../images/gravity.png'), // Gravity Alpha Mainnet
export const NETWORK_CHAIN_ID: {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mirror what we have in extension. See here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Run Smoke E2E Triggers smoke e2e on Bitrise team-wallet-ux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants