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: enable ledger hardware wallet implementation. #7757

Merged
merged 114 commits into from
Nov 29, 2023
Merged

Conversation

dawnseeker8
Copy link
Contributor

@dawnseeker8 dawnseeker8 commented Nov 10, 2023

Description

The PR enable ledger hardware wallet support in Metamask mobiles.

Ledger pre-requisite:

  • Patch keyring controller to allow exposing EthKeyringController to support ledger keyring operation
  • Adding ledger keyring utils app/core/Ledger/Ledger.ts to support ledger operation, such as add ledger, remove ledger, unlock ledger account, get ledger, connect ledger, open ledger app and close ledger app
  • Add Permission-BluetoothPeripheral in IOS pod
  • Add self develop ledger keyring library @consensys/ledgerhq-metamask-keyring
  • Add ledger offi package @ledgerhq/react-native-hw-transport-ble and react-native-ble-plx

Enable ledger features:

  • Pair with Ledger devices via bluetooth, and import ledger accounts into metamask mobile.
  • Swap token with ledger account.
  • Sending web3 transaction with ledger account. (contract deployment, transfer, authorise etc.)
  • Connect Dapp with ledger account and execute rpc operation.
  • Sign message with ledger account, supported message type:
    • eth_sign
    • personal_sign
    • eth_signTypedDataV4
  • Dispatch sign message event on different stages [REQUEST_SEND, COMPLETE, ERROR] in RPCMethodMiddleware to support ledger sign modal interaction
  • Implement required ledger metrics to ledger related screens
  • Adding account_type metrics for swap operation and account connect component
  • Implementing ExtendedKeyringTypes to consolidate the keyring type from keyring controller and ledger
  • Replace fontSize and fontWeight with TextVariant on account label tag related components to adopt theme design

Related issues

Fixes: #1237

Manual testing steps

Need a full regression tests to test all ledger relative feature using https://metamask.github.io/test-dapp/

Screenshots/Recordings

For detailed of screenshot, please refer to our internal Figma design. we will only list out some screenshot below:

Scan devices
Screenshot 2023-11-08 at 12 18 48

Pair with ledger
Screenshot 2023-11-08 at 12 22 36

Transfer
Screenshot 2023-11-08 at 13 14 58

Sign message:
Screenshot 2023-11-08 at 13 16 26

Before

After

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

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.

stanleyyconsensys and others added 30 commits October 30, 2023 15:14
context will not able to pass in to defaultProps, hence default translation should apply into the component itself
This commit didnt contain the unit tests code.
 also remove duplicate unit tests.
Copy link

sonarcloud bot commented Nov 29, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug C 5 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 85 Code Smells

12.4% 12.4% Coverage
0.8% 0.8% Duplication

@dawnseeker8
Copy link
Contributor Author

@dawnseeker8
Copy link
Contributor Author

This is the latest regression e2e tests result: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/4553befb-80f7-4c38-883b-7e9a95d6943a

@gantunesr gantunesr mentioned this pull request Nov 29, 2023
14 tasks
.detoxrc.js Show resolved Hide resolved
.detoxrc.js Show resolved Hide resolved
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.

I've manually tested the PR and verified the test cases

@Akaryatrh
Copy link
Contributor

I've manually tested the PR and verified the test cases

Copy link
Contributor

@georgewrmarshall georgewrmarshall left a comment

Choose a reason for hiding this comment

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

Approving as @brianacnguyen previously mentioned no updates to component-library folder

@gantunesr gantunesr merged commit 78988bc into main Nov 29, 2023
26 checks passed
@gantunesr gantunesr deleted the feat/ledger-enable branch November 29, 2023 23:20
@github-actions github-actions bot locked and limited conversation to collaborators Nov 29, 2023
@metamaskbot metamaskbot added the release-7.13.0 Issue or pull request that will be included in release 7.13.0 label Nov 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ledger Ledger hardware wallet related issue or development release-7.13.0 Issue or pull request that will be included in release 7.13.0 team-accounts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request: Add support for Ledger Nano X