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(26921): bump @metamask/address-book-controller to 6.0.0 #27107

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

DDDDDanica
Copy link
Contributor

@DDDDDanica DDDDDanica commented Sep 12, 2024

Description

Address-book is refactored to baseControllerV2, see more details in Changelog

Open in GitHub Codespaces

Related issues

Fixes: #26921

Manual testing steps

  1. Go to settings/contacts
  2. Add/modify a new contact
  3. Send a transaction to the contact

Screenshots/Recordings

Before

After

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.

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.

Copy link

socket-security bot commented Sep 12, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@metamask/[email protected] None 0 102 kB metamaskbot

🚮 Removed packages: npm/@metamask/[email protected]

View full report↗︎

@DDDDDanica DDDDDanica changed the title chore(26921): bump @metamask/address-book-controller to 6.0.0 Draft: chore(26921): bump @metamask/address-book-controller to 6.0.0 Sep 12, 2024
@DDDDDanica DDDDDanica force-pushed the feature/26921 branch 5 times, most recently from 6ffe4c0 to fea045f Compare September 13, 2024 20:19
@DDDDDanica DDDDDanica requested a review from a team as a code owner September 13, 2024 20:19
@DDDDDanica
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated

@DDDDDanica DDDDDanica changed the title Draft: chore(26921): bump @metamask/address-book-controller to 6.0.0 chore(26921): bump @metamask/address-book-controller to 6.0.0 Sep 13, 2024
@DDDDDanica
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated

Copy link

sonarcloud bot commented Sep 17, 2024

Copy link

codecov bot commented Sep 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.02%. Comparing base (c462fb8) to head (a79d0b0).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #27107   +/-   ##
========================================
  Coverage    70.02%   70.02%           
========================================
  Files         1443     1443           
  Lines        50162    50165    +3     
  Branches     14039    14039           
========================================
+ Hits         35124    35127    +3     
  Misses       15038    15038           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@metamaskbot
Copy link
Collaborator

Builds ready [a79d0b0]
Page Load Metrics (1700 ± 96 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint22822151614371178
domContentLoaded13912170167819594
load13992220170020096
domInteractive167439199
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -12.3 KiB (-0.35%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

vthomas13
vthomas13 previously approved these changes Sep 18, 2024
Copy link
Contributor

@vthomas13 vthomas13 left a comment

Choose a reason for hiding this comment

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

LGTM

  • Manually tested using steps in PR description

Copy link
Contributor

@NiranjanaBinoy NiranjanaBinoy left a comment

Choose a reason for hiding this comment

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

It seems that we can update the as any type assertion with Hex in app/scripts/lib/AddressBookPetnamesBridge.ts.

@DDDDDanica
Copy link
Contributor Author

It seems that we can update the as any type assertion with Hex in app/scripts/lib/AddressBookPetnamesBridge.ts.

@NiranjanaBinoy thanks for reviewing ! good catch !! The fix can be found here

@DDDDDanica
Copy link
Contributor Author

@metamaskbot update-policies

@DDDDDanica DDDDDanica closed this Sep 18, 2024
@DDDDDanica DDDDDanica reopened this Sep 18, 2024
@DDDDDanica
Copy link
Contributor Author

@metamaskbot update-policies

@github-actions github-actions bot locked and limited conversation to collaborators Sep 18, 2024
@metamaskbot
Copy link
Collaborator

No policy changes

1 similar comment
@metamaskbot
Copy link
Collaborator

No policy changes

@NiranjanaBinoy
Copy link
Contributor

It seems that we can update the as any type assertion with Hex in app/scripts/lib/AddressBookPetnamesBridge.ts.

@NiranjanaBinoy thanks for reviewing ! good catch !! The fix can be found here

@DDDDDanica, there are a couple more locations where the type assertion with any is used with delete and set method from addressBookController

@DDDDDanica
Copy link
Contributor Author

It seems that we can update the as any type assertion with Hex in app/scripts/lib/AddressBookPetnamesBridge.ts.

@NiranjanaBinoy thanks for reviewing ! good catch !! The fix can be found here

@DDDDDanica, there are a couple more locations where the type assertion with any is used with delete and set method from addressBookController

@NiranjanaBinoy Hey good call ! fixed here

@metamaskbot
Copy link
Collaborator

Builds ready [f1411ab]
Page Load Metrics (1682 ± 60 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint25618991541413198
domContentLoaded14371883165512058
load14681906168212560
domInteractive13121462813
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -12.3 KiB (-0.35%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

app/scripts/lib/AddressBookPetnamesBridge.ts Outdated Show resolved Hide resolved
// TODO: Replace `any` with type
// eslint-disable-next-line @typescript-eslint/no-explicit-any
entry.variation as any,
entry.value as string,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
entry.value as string,
entry.value,

same as above

// eslint-disable-next-line @typescript-eslint/no-explicit-any
entry.variation as any,
entry.value as string,
entry.name as string,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
entry.name as string,
entry.name,

Type of entry.name is already narrowed to string in the type PetnameEntry

// TODO: Replace `any` with type
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const chainEntries = state.addressBook[chainId as any];
const chainEntries = state.addressBook[chainId as Hex];
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const chainEntries = state.addressBook[chainId as Hex];
if(!isStrictHexString(chainId)){
continue
}
const chainEntries = state.addressBook[chainId];

We can avoid the type assertions if we add a type guarding check for chainId as Hex.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, captured here c1fe3e

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const chainEntries = state.addressBook[chainId as Hex];
const chainEntries = state.addressBook[chainId];

we don't need remove this type assertion after adding the type guarding

app/scripts/lib/AddressBookPetnamesBridge.ts Outdated Show resolved Hide resolved
// TODO: Replace `any` with type
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const entry = state.addressBook[chainId as any][address];
if (!isStrictHexString(chainId)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to add this type guarding outside this for loop.
We need to call it above const chainEntries = state.addressBook[chainId];

@DDDDDanica
Copy link
Contributor Author

hi @NiranjanaBinoy thanks for reviewing, the types should all be fixed by now 🙏🏻

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

AddressBookController upgrade from v5 to v6
4 participants