HomePhabricator

[ecashaddrjs] Add isValidCashAddress function

Description

[ecashaddrjs] Add isValidCashAddress function

Summary:
T3115

Add new function to validate cash addresses.

  • Returns false for a legacy address
  • Returns true for a cashaddress
  • Optional: specify prefix, so return true for a valid ecash: address with ecash: prefix, but false for valid cashaddress with bitcoincash: prefix

This is done by a couple of functions in Cashtab. Should be one function in this library. Would be useful for other developers looking to have validation by cashaddress type.

Test Plan:
Review new function and unit tests.
npm test

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
bytesofmanAuthored on Apr 12 2023, 23:13
bytesofmanPushed on Apr 13 2023, 11:49
Reviewer
Restricted Project
Differential Revision
D13695: [ecashaddrjs] Add isValidCashAddress function
Parents
rABCfe33935e527d: [herald] patch bug in file renaming
Branches
Unknown
Tags
Unknown