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

Memoize HW Accounts in HWManager #4767

Closed
Tracked by #4041
soroushm opened this issue Jan 30, 2023 · 0 comments
Closed
Tracked by #4041

Memoize HW Accounts in HWManager #4767

soroushm opened this issue Jan 30, 2023 · 0 comments
Assignees
Milestone

Comments

@soroushm
Copy link
Contributor

soroushm commented Jan 30, 2023

Description

This allows for easy access to the accounts stored on a hardware wallet (HW) from within the application. It works in conjunction with the HW Manager, which is a singleton class that communicates with the HW.
The HW Manager has to memoize the account list in it, HW manager will fetch list of public address from HW then it will call the utility function utilityFunction(publicKey, accountIndex) in order to check account is initialised and generate the account object.
This utility function receives a publicKey and account Index, and uses HW info and returns the account information in the format defined below. Said utility should return account object if the account is initialized, otherwise return null.

Acceptance Criteria

  • Reading the accounts from the HW Manager and checking with utilityFunction for initialized
  • Storing the accounts in HWManager
  • By disconnecting the HW, account list should be erased
  • Merging the account names with existing names from redux, to keep user data compatible. It shouldn't have to change in redux structure
  • Create and merge account object
  • Add unit test

Additional information

The HW Provider should be used in combination with the HW Manager, which should be placed at the top level of the application as a bootstrap child. The HW Provider allows for easy access to the accounts stored on the HW, by storing the accounts in the context and providing them via the useContext hook. This allows the account manager to have continuous access to the list of HW accounts

{
  "hw": {
    deviceId: "",
    model: "",
    brand: "",
  },
  "metadata": {
    "name": "masoud123",
    "pubkey": "a07e06d3d21bfcbd6e6cb158a0adc18b6ccc92db66dc8a323c7462af9c539fab",
    "path": ",
    “isHW”: true,	
    "address": "lskdgtenb76rf93bzd56cqn6ova46wfvoesbk4hnd",
    "creationTime": "2022-12-08T15:30:39.979Z"
  },
  "version": 1
}
@sridharmeganathan sridharmeganathan added this to the Sprint 92 milestone Jan 30, 2023
@ikem-legend ikem-legend self-assigned this Jan 31, 2023
@reyraa reyraa mentioned this issue Feb 1, 2023
9 tasks
@reyraa reyraa changed the title Memoize HW Account in app Memoize HW Accounts in HWManager Feb 1, 2023
@github-project-automation github-project-automation bot moved this from Backlog to Done in Lisk Desktop Version 3.0.0 Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

3 participants