Description
Stellar public keys are 56 characters long. Throughout the SDK, addresses are passed as raw strings with no helper to produce a display-friendly truncated form (e.g. GABCD...WXYZ). This issue adds a formatAddress utility to src/utils.ts.
Acceptance Criteria
Context
- Target files:
src/utils.ts, src/index.ts
- Uses
SdkError from src/errors.ts
- No new dependencies
Description
Stellar public keys are 56 characters long. Throughout the SDK, addresses are passed as raw strings with no helper to produce a display-friendly truncated form (e.g.
GABCD...WXYZ). This issue adds aformatAddressutility tosrc/utils.ts.Acceptance Criteria
formatAddress(address: string, opts?: { leading?: number, trailing?: number }): stringexported fromsrc/utils.ts...+ last 4 characters →"GABCD...WXYZ"leadingandtrailingoptions override the defaultsSdkErrorwith codeINVALID_RECIPIENTif the address is shorter thanleading + trailing + 3formatAddressexported fromsrc/index.tsContext
src/utils.ts,src/index.tsSdkErrorfromsrc/errors.ts