Page MenuHomePhabricator

[ecash-lib] Better behavior of withPrefix() method in Address class
ClosedPublic

Authored by bytesofman on Fri, Jan 31, 23:45.

Details

Summary

We could expect a user to call withPrefix("ecash:") on, say, every address in an array of ecash: addresses to ensure they all have the same prefix. Better to return unchanged if no prefix change than to throw an error. Do it that way.

Test Plan

npm test, CI

Event Timeline

modules/ecash-lib/src/address/address.test.ts
592

this test description is copypasta, tho the test is right. we also fix this.

tobias_ruck added inline comments.
modules/ecash-lib/src/address/address.ts
324–327

how about

bytesofman marked an inline comment as done.

take suggestion, return this instead of new construction

modules/ecash-lib/src/address/address.ts
324–327

much better, done

bytesofman published this revision for review.Sat, Feb 1, 00:00
This revision is now accepted and ready to land.Mon, Feb 3, 08:15