-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
refactor: Update ENS utils to accept chain ID #7150
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #7150 +/- ##
==========================================
+ Coverage 32.94% 32.97% +0.02%
==========================================
Files 1005 1005
Lines 32638 32649 +11
Branches 8383 8384 +1
==========================================
+ Hits 10753 10765 +12
+ Misses 21885 21884 -1
☔ View full report in Codecov by Sentry. |
91215d2
to
b8d439d
Compare
4069161
to
ffe0248
Compare
Passing E2E smoke test run: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/c43d4b77-534d-47f0-9fed-008e4be16058 |
This is ready for review, but I am moving it back into draft temporarily because there is one more related change that I'm planning to add. |
422fb94
to
4d51b55
Compare
03b69cf
to
65c1152
Compare
The ENS utility functions now accept chain ID instead of network ID. Chain ID is easier for us to access because we know the chain ID for all configured networks at all times, as it's a required property. The network ID has to be looked up dynamically at runtime, meaning that we don't know what it is until after the network has loaded. The network ID is still used internally by the ENS utility functions because the library we use for ENS support still expects network ID rather than chain ID. This was done to simplify the upcoming network controller update. The new update replaces `network` with `networkId` and `networkStatus`, where the ID is `null` while the network is loading. This forces us to handle that loading state anywhere the network ID had been used. Reducing the usages of network ID means avoiding that work. This relates to MetaMask/mobile-planning#1226
The new `getCachedENSName` function will retrieve a cached name from the cache, ensuring that we don't need to reference the cache directly from elsewhere in the codebase. This removes another reference to the network ID. The testing setup was a bit awkward because `ENSCache.cache` is a property, which Jest offers no way to mock out at the moment. But this is resolved in jest v29 with the `replaceProperty` method. A workaround using hooks has been used as an interim solution.
65c1152
to
ea9e94d
Compare
Kudos, SonarCloud Quality Gate passed! |
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
Development & PR Process
release-xx
label to identify the PR slated for a upcoming release (will be used in release discussion)needs-dev-review
label when work is completedneeds-qa
: PR requires manual QA.No QA/E2E only
: PR does not require any manual QA effort. Prior to merging, ensure that you have successful end-to-end test runs in Bitrise.Spot check on release build
: PR does not require feature QA but needs non-automated verification. In the description section, provide test scenarios. Add screenshots, and or recordings of what was tested.QA Passed
label when QA has signed off (Only required if the PR was labeled withneeds-qa
)team-
(orexternal-contributor
label if your not a MetaMask employee)Description
The ENS utility functions now accept chain ID instead of network ID. Chain ID is easier for us to access because we know the chain ID for all configured networks at all times, as it's a required property. The network ID has to be looked up dynamically at runtime, meaning that we don't know what it is until after the network has loaded.
The network ID is still used internally by the ENS utility functions because the library we use for ENS support still expects network ID rather than chain ID.
This was done to simplify the upcoming network controller update. The new update replaces
network
withnetworkId
andnetworkStatus
, where the ID isnull
while the network is loading. This forces us to handle that loading state anywhere the network ID had been used. Reducing the usages of network ID means avoiding that work.Issue
This relates to https://github.com/MetaMask/mobile-planning/issues/1226
Checklist