Consolidate poxAddress type
Problem
extractPoxAddressFromClarityValue and DelegationInfo define different poxAddress types
Type error like the one below happen when using DelegationInfo and the result of extractPoxAddressFromClarityValue:
Type '{ version: number; hashBytes: Uint8Array; } | undefined' is not assignable to type '{ version: Uint8Array; hashbytes: Uint8Array; } | undefined'.
Solution
Define type PoxAddress as { version: number; hashBytes: Uint8Array; } and use it everywhere.
Alternatives
- write another extractPoxAddressFromClarityValue2 function that returns a different type - that will confuse developers even more
- define type PoxAddress as
{ version: Uint8Array; hashbytes: Uint8Array; }- Btc addresses use type number forversion, therefore PoxAddress should adopt type number as well. PoXAddressVersion uses number as well.
Will do. I wholeheartedly agree 🙏🏻
This work is complete. It will be released when we do a next major version release.
@janniks has this been released? if so lets close this issue