-
Notifications
You must be signed in to change notification settings - Fork 45
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
Add utils for persisted state migration from old extension #1771
Conversation
Deployed to Cloudflare Pages
|
8c39296
to
a4a1fc5
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #1771 +/- ##
==========================================
+ Coverage 82.02% 82.39% +0.36%
==========================================
Files 187 187
Lines 4885 4953 +68
Branches 897 912 +15
==========================================
+ Hits 4007 4081 +74
+ Misses 878 872 -6
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Overall looks good to me, would wait for @buberdds approval, as he is more familiar with the codebase.
currentAddress: string | ||
accounts: Array< | ||
| { | ||
type: 'WALLET_INSIDE' // Mnemonic |
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.
Would be nice to have type as an enum, as it can easily be mistyped.
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.
The string literal also forces correct spelling everywhere, similar to an enum
and correctly narrows down the type later, so account fields specific to WALLET_INSIDE become available:
if (acc.type === 'WALLET_INSIDE') {
return {
publicKey: acc.publicKey,
address: acc.address,
type: WalletType.Mnemonic,
path: [44, 474, acc.hdPath],
pathDisplay: `m/44'/474'/${acc.hdPath}'`,
privateKey: acc.privateKey,
balance: {
available: null,
debonding: null,
delegations: null,
total: null,
},
name: acc.accountName,
}
}
a4a1fc5
to
67f4482
Compare
Functions for migrating state from https://github.com/oasisprotocol/oasis-wallet-ext