[Cashtab] [BCH deprecation] Pt 1/2 - Implement local toHash160 logic
Summary:
T2730
As a prerequisite to deprecating BCH.Address.toHash160(), this diff implements a local swiss army knife version of toHash160() that converts ecash, etoken, bitcoincash and simpleledger addresses to hash160.
Relies on the bs58 library (6KB).
Test Plan:
- npm install or npm i bs58
- npm test and ensure all toHash160 unit tests pass
- npm start
- send a private message to another address and observe the 'getRecipientPublicKey(): recipientAddressHash160 matches localRecipientAddressHash160' console log message
- create a new wallet and observe the 'deriveAccount(): hash160 matches localhash160' console log message'
- send a private message using the new wallet and observe the 'getRecipientPublicKey(): recipientAddressHash160 matches localRecipientAddressHash160' console log message
Reviewers: bytesofman, #bitcoin_abc
Reviewed By: bytesofman, #bitcoin_abc
Differential Revision: https://reviews.bitcoinabc.org/D12395