HomePhabricator

[Cashtab] [BCH deprecation] Pt 1/2 - Implement local toHash160 logic

Description

[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

Details

Provenance
emackAuthored on Oct 30 2022, 04:45
emackPushed on Nov 1 2022, 03:58
Reviewer
Restricted Project
Differential Revision
D12395: [Cashtab] [BCH deprecation] Pt 1/2 - Implement local toHash160 logic
Parents
rABC17c2034b0547: [Cashtab] Patch balance toggle initializing hidden
Branches
Unknown
Tags
Unknown