-
Notifications
You must be signed in to change notification settings - Fork 5
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
[LW-9499] New wallet manager migration #833
base: main
Are you sure you want to change the base?
Conversation
refactor: use internal wallet address discovery
In order to support multi-wallet/account & shared wallets, walletManager was completely redesigned in SDK. There are a couple new components: - WalletRepository stores key agent data, used accounts, as well as any additional metadata such as 'name'. Lace should use it to get an array of all users wallets. - SignerManager is an abstraction over KeyAgent. Lace now longer needs to maintain the lifecycle of a KeyAgent. Instead, it should use this component to sign transactions.
Allure report
smokeTests: ❌ test report for 1c0b289d
|
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.
Looks good! Just a question below
apps/browser-extension-wallet/src/lib/scripts/migrations/versions/v1_8_2.ts
Outdated
Show resolved
Hide resolved
rootPrivateKeyBytes: HexBlob.fromBytes(Buffer.from(data.encryptedRootPrivateKeyBytes)), | ||
keyMaterial: HexBlob.fromBytes(Buffer.from(JSON.parse(mnemonic).data)) | ||
}, | ||
metadata: { |
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.
@mkazlauskas @DominikGuzei is this aligned with input-output-hk/cardano-js-sdk#1050?
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.
Looks good to me
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.
yeah looks correct 👍
|
||
await walletRepository.addAccount({ | ||
accountIndex: keyAgentData.accountIndex, | ||
metadata: { name: 'Account #0', lockValue }, |
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.
@mkazlauskas now that the wallet will have metadata, does it make sense to add lockValue
to the wallet level?
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.
I think so. Depends whether we're locking wallet, account or entire Lace. Product question 🤔
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.
So actually I think it makes more sense to only have it per wallet (not account), because it is encrypted with a passphrase that applies to all accounts
removeItemFromLocalStorage(LOCK_STORAGE); | ||
} | ||
|
||
removeItemFromLocalStorage(KEY_AGENT_DATA_STORAGE); |
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.
This should also be obsolete
removeItemFromLocalStorage(KEY_AGENT_DATA_STORAGE); | |
removeItemFromLocalStorage(KEY_AGENT_DATA_STORAGE); | |
removeItemFromLocalStorage('wallet'); |
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.
Updated fe614f5
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
Changes unknown |
@lucas-barros the migration seems to be working for me now 👍 for me the wallet is getting locked after the migration (even if i never locked the wallet before), is this intentional? Btw. it's not locked anymore after closing the popup and re-opening it, so it doesn't seem to be enforced either. |
@DominikGuzei did you update the manifest file version to a higher then your current version? If not, likely the migration didnt run, the new build was loaded once (which will "lock" the wallet), then the older version would be reload due to the version being higher. What does your local storage look like after the migration? |
88123d3
to
c68437d
Compare
ccda020
to
1266abb
Compare
55b223d
to
d8e3ead
Compare
Checklist
Proposed solution
Creates migration for newwallet manager
Testing
Unlocked wallet test
Locked wallet test
Screenshots
Attach screenshots here if implementation involves some UI changes