Skip to content

Consolidate poxAddress type #1508

Open
Open
@friedger

Description

@friedger

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 for version, therefore PoxAddress should adopt type number as well. PoXAddressVersion uses number as well.

Metadata

Metadata

Assignees

Labels

featureBrand new functionality. New pages, workflows, endpoints, etc.

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions