Page MenuHomePhabricator

[ecashaddrjs] Support use of lowercase types for encoding addresses
ClosedPublic

Authored by bytesofman on Jun 30 2023, 16:59.

Details

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

Diff Detail

Repository
rABC Bitcoin ABC
Branch
accept-different-casing
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 24270
Build 48150: Build Diffecashaddrjs-tests
Build 48149: arc lint + arc unit