Skip to content

feat: account tag enhancement & uppercase for OneKey labels #29999

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

Merged
merged 10 commits into from
Mar 21, 2025

Conversation

Akaryatrh
Copy link
Contributor

@Akaryatrh Akaryatrh commented Jan 30, 2025

Description

This PR adds support for a dedicated OneKey keyring (until now it was sharing the same keyring instance than Trezor) so it's considered as a standalone device and could get its own tag inside account list.

There are two others PRs:

Open in GitHub Codespaces

Related issues

Fixes: https://github.com/MetaMask/accounts-planning/issues/793

Manual testing steps

You need both OneKey and Trezor devices to test. Trezor device can be replaced by this simulator.
⚠️ Simulator takes over other devices, you need to disconnect first it if you import a OneKey account.

  1. Import one account from Trezor device.
  2. Check that it gets the "Trezor" tag below account name in account list
  3. Import one account from OneKey device
  4. Check that it gets the "OneKey" tag below account name in account list and that account name matches the pattern "OneKey x"

Screenshots/Recordings

Before

onekey-before.mp4

After

onekey-after.mp4

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 Jan 30, 2025

No dependency changes detected. Learn more about Socket for GitHub ↗︎

👍 No dependency changes detected in pull request

@@ -50,7 +50,7 @@ class AccountList extends Component {
<div className="hw-connect__hdPath">
<Dropdown
className="hw-connect__hdPath__select"
options={hdPaths[device.toLowerCase()]}
options={hdPaths[device]}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Setting device name to lowercase would fail checking hdPaths for device with camel case naming. So far, there's apparently no need to do so for other devices.

keyringBridge?.minorVersion === ONE_KEY_VIA_TREZOR_MINOR_VERSION
? HardwareKeyringType.oneKey
: HardwareKeyringType[keyringType],
({ type }) => HardwareKeyringType[type],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need anymore to rely on ONE_KEY_VIA_TREZOR_MINOR_VERSION as OneKey gets its own keyring type.

github-merge-queue bot pushed a commit to MetaMask/accounts that referenced this pull request Feb 11, 2025
This PR adds support for a dedicated OneKey keyring (until now it was
sharing the same keyring instance than Trezor) so it's considered as a
standalone device and could get its own tag inside account list.

There are two others PRs:

- metamask-extension:
MetaMask/metamask-extension#29999
- core (accounts and keyring controllers):
MetaMask/core#5216


Fixes: MetaMask/accounts-planning#793
Akaryatrh added a commit to MetaMask/core that referenced this pull request Feb 12, 2025
## Explanation

This PR adds support for a dedicated OneKey keyring (until now it was
sharing the same keyring instance than Trezor) so it's considered as a
standalone device and could get its own tag inside account list.

There are two others PRs:
- metamask-extension:
MetaMask/metamask-extension#29999
- eth-trezor-keyring: MetaMask/accounts#175

## References

Fixes: MetaMask/accounts-planning#793

## Changelog

<!--
If you're making any consumer-facing changes, list those changes here as
if you were updating a changelog, using the template below as a guide.

(CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or
FIXED. For security-related issues, follow the Security Advisory
process.)

Please take care to name the exact pieces of the API you've added or
changed (e.g. types, interfaces, functions, or methods).

If there are any breaking changes, make sure to offer a solution for
consumers to follow once they upgrade to the changes.

Finally, if you're only making changes to development scripts or tests,
you may replace the template below with "None".
-->

### `@metamask/accounts-controller`

- **utils**: add OneKey keyring type
- **tests**: update accounts controller unit test with OneKey keyring
type

### `@metamask/keyring-controller`

- **controller**: add OneKey keyring type

## Checklist

- [x] 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
- [x] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
@Akaryatrh Akaryatrh force-pushed the feat/793-oneKey-dedicated-keyring branch 2 times, most recently from 8989dc1 to 0c19260 Compare February 12, 2025 15:24
@Akaryatrh
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated.
👀 Please review the diff for suspicious new powers.

🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff

@metamaskbot
Copy link
Collaborator

Builds ready [0519154]
Page Load Metrics (1677 ± 61 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint14602016167913163
domContentLoaded14502002166012761
load14622014167712761
domInteractive23108412311
backgroundConnect115619115
firstReactRender16107382813
getState568222411
initialActions01000
loadScripts10351437119410551
setupStore872252311
uiStartup172127081987238114
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.13 KiB (0.02%)
  • ui: 75 Bytes (0.00%)
  • common: 1.17 KiB (0.01%)

@Akaryatrh Akaryatrh marked this pull request as ready for review February 13, 2025 12:31
@metamaskbot
Copy link
Collaborator

Builds ready [0a6bdec]
Page Load Metrics (1872 ± 88 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint15932274187318187
domContentLoaded15482215184618187
load15952280187218388
domInteractive257537147
backgroundConnect1067312110
firstReactRender1672312211
getState56916199
initialActions01000
loadScripts10901687133915675
setupStore85819188
uiStartup176225792143221106
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.13 KiB (0.02%)
  • ui: 75 Bytes (0.00%)
  • common: 1.37 KiB (0.01%)

@Akaryatrh Akaryatrh force-pushed the feat/793-oneKey-dedicated-keyring branch from 0a6bdec to e6a980d Compare February 19, 2025 15:05
@metamaskbot
Copy link
Collaborator

Builds ready [71aeb1c]
Page Load Metrics (2081 ± 136 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint47426291999448215
domContentLoaded149826062052277133
load150926372081284136
domInteractive17122503316
backgroundConnect9106362613
firstReactRender1583422612
getState55322188
initialActions01000
loadScripts109119921547227109
setupStore66920199
uiStartup191331472418336161
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 599 Bytes (0.01%)
  • ui: 75 Bytes (0.00%)
  • common: 44 Bytes (0.00%)

@Akaryatrh Akaryatrh force-pushed the feat/793-oneKey-dedicated-keyring branch from e3791ae to 3b41bf8 Compare February 19, 2025 21:50
@metamaskbot
Copy link
Collaborator

Builds ready [3b41bf8]
Page Load Metrics (1685 ± 53 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint28419811618327157
domContentLoaded15091916165810249
load15301978168511153
domInteractive2493382211
backgroundConnect879322010
firstReactRender1491312512
getState566212110
initialActions01000
loadScripts1089139511978742
setupStore771272412
uiStartup17232342192916479
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 526 Bytes (0.01%)
  • ui: 75 Bytes (0.00%)
  • common: 44 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [64da565]
Page Load Metrics (1522 ± 64 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint50016351447227109
domContentLoaded13862022150113264
load14062026152213364
domInteractive219733199
backgroundConnect87523199
firstReactRender1393312512
getState45212157
initialActions01000
loadScripts9701643108213967
setupStore67714188
uiStartup15742248174814972
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 526 Bytes (0.01%)
  • ui: 75 Bytes (0.00%)
  • common: 44 Bytes (0.00%)

Copy link
Member

@mikesposito mikesposito left a comment

Choose a reason for hiding this comment

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

Since we use the same Keyring as Trezor (and even the same bridge), do you think we can take advantage of Trezor e2e tests as well?

@vivek-consensys vivek-consensys added the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Feb 21, 2025
@Akaryatrh
Copy link
Contributor Author

Akaryatrh commented Mar 4, 2025

Since we use the same Keyring as Trezor (and even the same bridge), do you think we can take advantage of Trezor e2e tests as well?

@mikesposito Yep definitely, we need to plan it on a separate pull request 👍

@metamaskbot
Copy link
Collaborator

Builds ready [48cae93]
Page Load Metrics (1667 ± 59 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint14881906166012660
domContentLoaded14351896162112359
load14931907166712359
domInteractive178535178
backgroundConnect15178523919
firstReactRender1467312110
getState66320168
initialActions01000
loadScripts1043137011999445
setupStore85414126
uiStartup16962140189614369
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 526 Bytes (0.01%)
  • ui: 75 Bytes (0.00%)
  • common: 44 Bytes (0.00%)

@Akaryatrh Akaryatrh requested a review from mikesposito March 12, 2025 09:37
@Akaryatrh Akaryatrh force-pushed the feat/793-oneKey-dedicated-keyring branch from 48cae93 to 3bdbc76 Compare March 12, 2025 11:42
@Akaryatrh Akaryatrh force-pushed the feat/793-oneKey-dedicated-keyring branch from 11194aa to a55dbcc Compare March 12, 2025 11:46
@metamaskbot
Copy link
Collaborator

Builds ready [c828db9]
Page Load Metrics (2310 ± 252 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint174736632261407196
domContentLoaded173126132125233112
load174841582310525252
domInteractive26173453115
backgroundConnect161361174304146
firstReactRender17221545526
getState64567911857
initialActions00000
loadScripts12941872160116077
setupStore8170374622
uiStartup1996869030491520730
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 203 Bytes (0.00%)
  • ui: 75 Bytes (0.00%)
  • common: 44 Bytes (0.00%)

@Akaryatrh Akaryatrh force-pushed the feat/793-oneKey-dedicated-keyring branch from af5b03c to 9549f08 Compare March 14, 2025 14:33
@metamaskbot
Copy link
Collaborator

Builds ready [9549f08]
Page Load Metrics (6499 ± 3971 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint37931661533676433670
domContentLoaded166931617608983674018
load174231667649982693971
domInteractive271258209335161
backgroundConnect591428384387186
firstReactRender21383838139
getState161383224321154
initialActions01000
loadScripts125331185549183844026
setupStore95859813766
uiStartup193331839815081033891
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 203 Bytes (0.00%)
  • ui: 68 Bytes (0.00%)
  • common: 44 Bytes (0.00%)

@Akaryatrh Akaryatrh force-pushed the feat/793-oneKey-dedicated-keyring branch from 38feb39 to 9bc12b1 Compare March 14, 2025 19:08
@metamaskbot
Copy link
Collaborator

Builds ready [9bc12b1]
Page Load Metrics (6304 ± 3477 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint47324248615773123511
domContentLoaded172724161605872083461
load180724254630472423477
domInteractive271742236404194
backgroundConnect21980264254122
firstReactRender23164593718
getState14347938440
initialActions01000
loadScripts129123727542470853402
setupStore7142373617
uiStartup208224503725969973360
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 203 Bytes (0.00%)
  • ui: 35 Bytes (0.00%)
  • common: 44 Bytes (0.00%)

ccharly
ccharly previously approved these changes Mar 17, 2025
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.

Code LGTM, haven't tested since I don't have neither devices. Also, assuming the removal of .toLowerCase won't have undesired side-effects 😄 (but I'd say no)

@Akaryatrh Akaryatrh force-pushed the feat/793-oneKey-dedicated-keyring branch from 9bc12b1 to 1cb2ae5 Compare March 17, 2025 10:57
@Akaryatrh
Copy link
Contributor Author

Code LGTM, haven't tested since I don't have neither devices. Also, assuming the removal of .toLowerCase won't have undesired side-effects 😄 (but I'd say no)

Thanks! I just tested ledger, Trezor, OneKey and Lattice devices and could not see any regression.

@metamaskbot
Copy link
Collaborator

Builds ready [b599f0b]
Page Load Metrics (2409 ± 1280 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint141414314241427791335
domContentLoaded136113678229226541274
load137013797240926661280
domInteractive257608416479
backgroundConnect1063012816881
firstReactRender15127493215
getState5299628340
initialActions01000
loadScripts99212066179924001152
setupStore8198425225
uiStartup162014747289028651376
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 203 Bytes (0.00%)
  • ui: 35 Bytes (0.00%)
  • common: 44 Bytes (0.00%)

Copy link
Member

@gantunesr gantunesr left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Contributor

@dawnseeker8 dawnseeker8 left a comment

Choose a reason for hiding this comment

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

LGTM after Gustova and Charly review

@github-project-automation github-project-automation bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Mar 21, 2025
@Akaryatrh Akaryatrh added this pull request to the merge queue Mar 21, 2025
Merged via the queue into main with commit 0fcdd45 Mar 21, 2025
76 checks passed
@Akaryatrh Akaryatrh deleted the feat/793-oneKey-dedicated-keyring branch March 21, 2025 11:02
@github-actions github-actions bot locked and limited conversation to collaborators Mar 21, 2025
@github-actions github-actions bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Mar 21, 2025
@metamaskbot metamaskbot added the release-12.16.0 Issue or pull request that will be included in release 12.16.0 label Mar 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.16.0 Issue or pull request that will be included in release 12.16.0 team-hardware-wallets
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants