Skip to content

feat(wasm-dot): change encodeSs58/validateAddress to accept number#205

Closed
bitgo-ai-agent-dev[bot] wants to merge 1 commit intomasterfrom
BTC-3127.encodess58-number-prefix
Closed

feat(wasm-dot): change encodeSs58/validateAddress to accept number#205
bitgo-ai-agent-dev[bot] wants to merge 1 commit intomasterfrom
BTC-3127.encodess58-number-prefix

Conversation

@bitgo-ai-agent-dev
Copy link

Summary

Change the parameter type of encodeSs58 and validateAddress in address.ts from AddressFormat (0 | 2 | 42) to number.

Why

PR #203 changed AddressFormat from a TypeScript enum to a union type (0 | 2 | 42), but left the wrapper function signatures as format: AddressFormat. This means callers passing a numeric enum like DotAddressFormat from sdk-core still get a type error — numeric enum values widen to number, which is not assignable to 0 | 2 | 42.

Changing the parameter to number fixes this. The AddressFormat constants (AddressFormat.Polkadot etc.) remain usable at call sites since their literal types (0, 2, 42) are assignable to number.

Existing callers

No changes needed anywhere. AddressFormat.Polkadot (type 0) is assignable to number. Callers in bgms can drop toWasmAddressFormat and pass DotAddressFormat directly once this publishes.

Ticket: T1-57
🤖 Generated with Claude Code

Parameter type changed from AddressFormat (0|2|42 union) to number,
so callers can pass any numeric SS58 prefix without a cast. Existing
callers using AddressFormat.Polkadot etc. continue to work unchanged.

Ticket: T1-57
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bitgo-ai-agent-dev bitgo-ai-agent-dev bot requested a review from a team as a code owner March 11, 2026 00:00
@lcovar lcovar closed this Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants