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)
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-sdkjust for address handling.Acceptance Criteria
isValidStellarAddress(address: string): boolean— validates G... public key formattruncateAddress(address: string, chars?: number): string— returnsGABCD...WXYZ(default 4 chars each side)addressesEqual(a: string, b: string): boolean— case-insensitive comparisontoMuxedAddress(address: string, id: bigint): string— converts G address + id to M addressfromMuxedAddress(muxed: string): { address: string, id: bigint }— inverse of abovetruncateAddresswith/withoutchars)@stellar-split/sdk/utilssub-path