libauth
libauth copied to clipboard
Expand cash address utilities
Some good developer experience observations from @rkalis:
Why is there a
decodeCashAddress
anddecodeCashAddressFormat
, but onlydecodeCashAddressFormatWithoutPrefix
and nodecodeCashAddressWithoutPrefix
? And why are their return types not compatible withAddressContents
so I cannot use them inaddressContentsToLockingBytecode
? In any case, this is my goal: I'm usingcashAddressToLockingBytecode
but that only works if you pass in a a prefixed address, I also want to support using an unprefixed address (don't think the prefix matters for the locking bytecode), but it throws an error if there's no prefix.
Originally, I’d thought you wouldn’t need decodeCashAddressWithoutPrefix
if you already knew it was a cash address (since you simply need to add the prefix, no testing loop needed), but I think it would be valuable to have it just as a convenience method to "complete the set".
It would also be valuable to figure out how to make the results of decoding compatible with the AddressContents
type – either by adjusting the types or by adding a couple more to/from utility methods.
So, TODO:
- add
decodeCashAddressWithoutPrefix
- either:
- make decoded cash address and
AddressContents
types compatible, or - add utility methods for converting between them
- make decoded cash address and