HomePhabricator

[Cashtab] Remove legacy prefix validation functions

Description

[Cashtab] Remove legacy prefix validation functions

Summary:
T2099

Cashtab address validation developed incrementally supporting use cases specific to the migration from bitcoincash: address formats to ecash: address formats.

After improved address validation was added in D10687, some legacy validation functions that worked by checking prefixes were no longer relevant.

This diff removes these functions.

In ScanQR.js, these functions are replaced by their successor functions that validate the full address, prefix or not.

QRCode.js should have never used these functions. It has been refactored to accept address type as a prop. The switch in Wallet.js has also been refactored to work as a boolean instead of different string types.

Test Plan:
npm start

  1. Scan a valid XEC address and see that it populates the address field
  2. Scan a valid eToken address and see that it populates the address field
  3. Scan a valid prefixless XEC address and see that it populates the address field
  4. Scan a valid prefixless eToken address and see that it populates the address field
  5. Scan any QR code that is not a valid address and note that form is not populated
  6. Toggle quickly between 'XEC' and 'eToken' switch below QR code on main page. Test that it switches. Test copy pasting is functional.

Reviewers: #bitcoin_abc, emack

Reviewed By: #bitcoin_abc, emack

Subscribers: emack

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

Details

Provenance
Joey King <joseph.roy.king@gmail.com>Authored on Dec 30 2021, 13:17
bytesofmanPushed on Jan 4 2022, 12:14
Reviewer
Restricted Project
Differential Revision
D10745: [Cashtab] Remove legacy prefix validation functions
Parents
rABC7617f55d6116: [Cashtab] Increase Transaction History to 10 transactions
Branches
Unknown
Tags
Unknown