Skip to content

Add Stellar address validation and formatting utility functions #394

Description

@Kingsman-99

Overview

Apps using the SDK need to validate and format Stellar public keys repeatedly. Consolidate these utilities into the SDK so callers don't import stellar-sdk just for address handling.

Acceptance Criteria

  • isValidStellarAddress(address: string): boolean — validates G... public key format
  • truncateAddress(address: string, chars?: number): string — returns GABCD...WXYZ (default 4 chars each side)
  • addressesEqual(a: string, b: string): boolean — case-insensitive comparison
  • toMuxedAddress(address: string, id: bigint): string — converts G address + id to M address
  • fromMuxedAddress(muxed: string): { address: string, id: bigint } — inverse of above
  • All functions pure with no side effects; no RPC calls
  • TypeScript overloads where relevant (e.g. truncateAddress with/without chars)
  • Exported from @stellar-split/sdk/utils sub-path
  • Full unit test coverage including edge cases (empty string, wrong prefix, too short)

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programcomplexity: highdxDeveloper experience and tooling

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions