Skip to content

Allow formatting AccountId32 with an SS58 network prefix - #2304

Open
kunal171 wants to merge 1 commit into
paritytech:masterfrom
kunal-archive:feat/accountid32-ss58-prefix
Open

kunal171 wants to merge 1 commit into
paritytech:masterfrom
kunal-archive:feat/accountid32-ss58-prefix

Conversation

@kunal171

Copy link
Copy Markdown

Problem

AccountId32 formats SS58 addresses with prefix 42. Applications displaying chain-specific addresses currently need another encoder or a dependency on sp-core.

Changes

  • Add to_ss58check_with_prefix(u16), returning an error for reserved or out-of-range prefixes.
  • Support one-byte and two-byte prefixes; keep Display and serde at prefix 42.
  • Compare output and round trips against sp-core across prefix boundaries.

Validation

Using Rust 1.97.1:

  • cargo test -p subxt-utils-accountid32 --features sp-core/std,sp-keyring/std --locked — 3 tests and 1 doc test passed.
  • Clippy with all targets and the same features passed.
  • Library check with --no-default-features, formatting, and rustdoc with warnings denied passed.

The test features enable the existing Substrate dev dependencies on the host.

This branch has not been deployed

No deployments
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.

1 participant