HomePhabricator

[Cashtab] Improve Cashtab wallet shape

Description

[Cashtab] Improve Cashtab wallet shape

Summary:
T3445

Create all new Cashtab wallets with only Path1899. Support legacy paths if you find them. Get rid of hardcoded paths at hardcoded keys.

Large diff. Most of the changes involve updates to mocks used by unit and integration tests.

We could have split this somewhat -- migrated from balances to balanceSats in one diff, and then from hardcoded Path1899 to paths array in another -- but imo it is better to limit the number of wallet migrations overall than to do more "smaller" wallet migrations.

The key changes in this diff

  • Update isValidCashtabWallet to accept new shape and reject old shape
  • Update createNewCashtabWallet to create new shape, importantly, new wallets are only created with Path1899 (not Path145 and Path245)
  • We support migrating Path145 and Path245 if we find a wallet with these paths. In practice, Cashtab has used Path1899 as the only change address for multiple years. Only a user with a still-in-localforage cashttab wallet that has not been used for 2 years would have money at these paths. We could consider deprecating them entirely, but, since it is not really more complicated to support multiple paths as we do it already, might as well keep doing it. Might come in useful later. Certainly makes it easier to implement HD wallets if we decide to do this.
  • Note the updates to migration integration tests in App.test.js. Since we are changing shape, now any wallet we find in legacy localforage keys wallet and savedWallets is expected to be invalid.
  • Changes to how wallets are migrated in loadCashtabState to account for the new paths key and support for legacy paths.

Test Plan:
npm test

This diff is built and deployed to prod test site at https://cashtab-local-dev.netlify.app/

Navigate there and confirm wallets migrate (you can check, in dev console, application --> indexedDb --> localforage)

Tests that I performed on the prod site

  • Confirmed multiple wallets migrated
  • Sent XEC
  • Received XEC
  • Sent token
  • Received token
  • Registed an alias
  • Signed & verified msg
  • Renamed a wallet
  • Deleted a wallet
  • Created a wallet and confirmed it only had Path1899
  • Sent and received txs with this wallet
  • Calculated and sent an airdrop tx

With the exception of the Airdrop, this is also all covered by existing integration tests. Airdrop integration tests are pending migration to in-node chronik-client and deprecation of SLPDB.

Reviewers: #bitcoin_abc, emack

Reviewed By: #bitcoin_abc, emack

Subscribers: emack

Differential Revision: https://reviews.bitcoinabc.org/D15679

Details

Provenance
bytesofmanAuthored on Mar 11 2024, 20:55
bytesofmanPushed on Mar 13 2024, 18:34
Reviewer
Restricted Project
Differential Revision
D15679: [Cashtab] Improve Cashtab wallet shape
Parents
rABCc251ec88f62e: [Cashtab] Create custom modal for version upgrades
Branches
Unknown
Tags
Unknown