HomePhabricator

[ecashaddrjs] Support use of lowercase types for encoding addresses

Description

[ecashaddrjs] Support use of lowercase types for encoding addresses

Summary:
T3215

There isn't really any kind of standard for whether or not ecash address types should be uppercase or lowercase. This library used the standard of always uppercase, e.g. P2PKH. However, chronik-client requires input to be lowercase, i.e. p2pkh.

This has caused a good deal of ambiguity when working with both libraries.

I don't see a significant risk in supporting mixed case for the only two supported types, since this does not make them ambiguous with each other.

This diff preserves original functionality of the encode function but also allows it to accept lowercase or mixed case inputs for address type.

Test Plan: npm test

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

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

Details

Provenance
bytesofmanAuthored on Jun 30 2023, 16:57
bytesofmanPushed on Jul 1 2023, 05:23
Reviewer
Restricted Project
Differential Revision
D14172: [ecashaddrjs] Support use of lowercase types for encoding addresses
Parents
rABC139e346bcae5: [ecash-herald] Handle error if getTokenInfoMap is provided with a non-tokenId…
Branches
Unknown
Tags
Unknown