[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