Page MenuHomePhabricator

[Cashtab] More clarity and tests for address parsing
ClosedPublic

Authored by bytesofman on Jan 18 2021, 17:36.

Details

Reviewers
PiRK
Group Reviewers
Restricted Project
Commits
rABC616dff33486e: [Cashtab] More clarity and tests for address parsing
Summary

Adding support for approved address prefixes beyond the BCH standard creates complications with legacy validation libraries which only work with bitcoincash: prefix addresses (or prefix-less addresses that are checksum valid for the bitcoincash: prefix). This diff better organizes the methods needed to support this interface.

Changes

  • Make the bitcoincash legacy prefix a constant as it is used in multiple places
  • Rename isCash and isToken functions to be more descriptive about their functionality
  • Accept no prefix as a valid prefix for cash addresses (but not token addresses)
  • Remove : from approved prefix strings in input array as it applies to all prefixes
  • Add unit tests
Test Plan

npm test

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable