[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