Skip to content

Remove third duplicate STELLAR_ADDRESS_RE definition in src/schemas.ts #131

Description

@meshackyaro

Description

The Stellar-address regex /^G[A-Z2-7]{55}$/ is now independently defined in three places: src/utils/validate.ts (as STELLAR_ADDRESS_RE, dead code per a companion issue), src/utils/validation.ts (also as STELLAR_ADDRESS_RE, the one actually used internally), and src/schemas.ts (also as a module-local STELLAR_ADDRESS_RE, backing StellarAddressSchema, alongside its own separately-defined CONTRACT_ID_RE). All three copies happen to be byte-identical today, but nothing enforces that — a future change to the address format (e.g. supporting muxed M... accounts) would need to be applied in three unrelated files to stay consistent, and it's easy to miss one.

Component

SDK

Difficulty

🟢 Easy

Tasks

  • Export STELLAR_ADDRESS_RE/CONTRACT_ID_RE from a single module (likely utils/validation.ts, once utils/validate.ts is removed per the companion issue)
  • Import that shared constant from src/schemas.ts instead of redefining it
  • Add a test asserting StellarAddressSchema and isValidStellarAddress agree on the same inputs

Acceptance Criteria

  • The Stellar-address and contract-ID regexes are each defined exactly once and imported everywhere else they're needed

Estimated Time

<1 day

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions