Skip to content

core: G-address regex duplicated 3x and validate-source-shape imports from deploy-recovery module #148

Description

@Dione-b

Summary

The Stellar public-key regex /^G[A-Z2-7]{55}$/ is defined three times:

  • contracts/resolve-method-args.ts:6 (STELLAR_ADDRESS_REGEX)
  • contracts/resolve-source-address.ts:6
  • stellar-cli/recover-deploy-contract-id.ts:28-30 (isLikelyPublicKeySource)

Additionally, contracts/validate-source-shape.ts:2 imports isLikelyPublicKeySource from the deploy-recovery module, coupling source validation to a recovery-specific file.

Why it matters

The strkey alphabet rule is already a documented footgun (#135); three copies invite divergence, and the cross-module import is a design smell.

Suggested fix

Centralize STELLAR_ADDRESS_REGEX/isLikelyPublicKeySource in a single module (e.g. stellar-cli/strkeys.ts) and re-export from there.

Priority: Medium | Release impact: Patch | Breaking: No

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programarea: validationRegex validation, input validationenhancementNew feature or requestpriority: mediumMedium priority fix - correctness or UX issues

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions