We have been calculating sk and pk from wif every time we need them for ecash-lib txs. This was not particularly complicated when we were still using `sendXec` for all txs in Cashtab. However, with advanced tx construction methods provided by `ecash-agora`, we now to to calculate sk and pk in many places throughout Cashtab.
These values should be calculated when Cashtab first loads its wallets, not recalculated for every tx.
Migrate wallets to include these values.
This ends up being a large diff. Here is a summary of the changes:
1. In wallet/index.ts, update type so that `sk` and `pk` are required ("the one change" of this diff)
2. Update `isValidCashtabWallet` so that only this newest type is valid
3. Update `cashtabWalletToJSON` and `cashtabWalletFromJSON` to deal with storing / reviving `Uint8Array`
4. Update wallet types (now we have a new legacy type, and a new stored type)
5. Update all wallets used by tests to be the valid format (only the migration tests should use invalid wallets)
6. Add tests to confirm migration
Now that we have monorepo-confirmed type stability with chronik in the node, CashtabWallet should really be a class. Perhaps even in a separate library so other developers could more easily work with chronik utxo sets and avoid burns.
We're getting there. But Cashtab is the place to get it right first.