HomePhabricator

[Cashtab] More ts implementation as prep for wallet upgrade

Description

[Cashtab] More ts implementation as prep for wallet upgrade

Summary:
Convert useWallet and dependencies to ts. Patch bugs discovered in ts implementation.

Ended up being quite a large diff.

I don't think there is much point in splitting it up, since everything is interdependent, and the integration tests confirm expected behavior. If something goes wrong, we can revert it all.

Summary of changes

  • New types for legacy wallets. Complicated implementation as these overlap in various ways.
  • Update wallet migration and storage functions to work with the types.
  • Patch some bugs discovered during ts implementation, for example parseInt() being used on something that was already a number in useWallet.js.
  • Some cleanup on wallet loading and migration in useWallet.js brought on by issues discovered in ts implementation
  • Major update of mocked wallets -- all tx history is now ChronikClient and type checked; all legacy wallets are appropriate legacy types.

Impact

  • Makes future wallet upgrades easier, esp if we want to support other cryptocurrencies like Doge
  • We need to add publickey into the wallet as it is needed for agora methods, cumbersome to always calculate it with Ecc every time we need it.
  • Now that ChronikClient has stable types, important to get Cashtab fully converted to ts

Test Plan:
npm test

this diff is live at https://cashtab-local-dev.netlify.app/

Reviewers: #bitcoin_abc, emack

Reviewed By: #bitcoin_abc, emack

Subscribers: emack

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

Details

Provenance
bytesofmanAuthored on Nov 15 2024, 00:21
bytesofmanPushed on Nov 16 2024, 14:22
Reviewer
Restricted Project
Differential Revision
D17140: [Cashtab] More ts implementation as prep for wallet upgrade
Parents
rABC6aa479fa6861: Add checkpoints after the November 2024 upgrade
Branches
Unknown
Tags
Unknown