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

Add utils for persisted state migration from old extension #1771

Merged
merged 4 commits into from
Nov 27, 2023

Conversation

lukaw3d
Copy link
Member

@lukaw3d lukaw3d commented Nov 24, 2023

Copy link

github-actions bot commented Nov 24, 2023

Deployed to Cloudflare Pages

Latest commit: 67f44825c41472fb48e32f7a9edc92bb2309b28e
Status:✅ Deploy successful!
Preview URL: https://ddcf58f4.oasis-wallet.pages.dev

@lukaw3d lukaw3d changed the title Add utils for migration from V0 encrypted state to RootState Add utils for persisted state migration from old extension Nov 24, 2023
@lukaw3d lukaw3d force-pushed the lw/migration-utils branch 2 times, most recently from 8c39296 to a4a1fc5 Compare November 24, 2023 11:51
Copy link

codecov bot commented Nov 24, 2023

Codecov Report

Merging #1771 (a4a1fc5) into master (0f0b432) will increase coverage by 0.36%.
The diff coverage is 90.54%.

❗ Current head a4a1fc5 differs from pull request most recent head 67f4482. Consider uploading reports for the commit 67f4482 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            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     
Flag Coverage Δ
cypress 47.53% <100.00%> (-0.04%) ⬇️
jest 78.15% <90.54%> (+0.42%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/app/components/LanguageSelect/index.tsx 72.72% <100.00%> (-1.19%) ⬇️
src/locales/i18n.ts 100.00% <100.00%> (ø)
src/utils/__fixtures__/test-inputs.ts 100.00% <100.00%> (+100.00%) ⬆️
src/utils/walletExtensionV0.ts 89.70% <89.70%> (ø)

... and 5 files with indirect coverage changes

Copy link
Collaborator

@lubej lubej left a 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
Copy link
Collaborator

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.

Copy link
Member Author

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,
          }
        }

@lukaw3d lukaw3d merged commit dfda26a into master Nov 27, 2023
10 checks passed
@lukaw3d lukaw3d deleted the lw/migration-utils branch November 27, 2023 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants