Skip to content

feat: add /utils/validate-hash and /utils/network-passphrase endpoints (#216, #219)#381

Merged
Sulex45 merged 3 commits into
stellarkit-lab-devtools:mainfrom
3m1n3nc3:feat/issues-216-219-validate-hash-and-network-passphrase
Jun 29, 2026
Merged

feat: add /utils/validate-hash and /utils/network-passphrase endpoints (#216, #219)#381
Sulex45 merged 3 commits into
stellarkit-lab-devtools:mainfrom
3m1n3nc3:feat/issues-216-219-validate-hash-and-network-passphrase

Conversation

@3m1n3nc3

@3m1n3nc3 3m1n3nc3 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Closes #216
Closes #219


Summary

Adds two local (no Horizon call) developer-utility endpoints under /utils:

  • GET /utils/validate-hash?hash=... (Transaction Hash Format Validator Endpoint #216) — validates whether a string is a
    correctly formatted Stellar transaction hash. Valid = exactly 64 lowercase
    hexadecimal characters. Returns { input, isValid, reason }, with reason
    explaining wrong length or invalid characters (uppercase hex is rejected).
  • GET /utils/network-passphrase (Network Passphrase Resolver Endpoint #219) — returns the network passphrase for
    the currently configured network. Returns { network, passphrase }, resolving
    STELLAR_NETWORK=mainnetNetworks.PUBLIC and otherwise → Networks.TESTNET
    (default testnet).

Both follow the existing validate-account convention and are registered in the
root API endpoint listing.

Example responses

// GET /utils/validate-hash?hash=3389e9f0...c8889
{ "success": true, "data": { "input": "3389e9f0...c8889", "isValid": true, "reason": null } }

// GET /utils/network-passphrase  (testnet)
{ "success": true, "data": { "network": "testnet", "passphrase": "Test SDF Network ; September 2015" } }

Acceptance criteria

#216

  • GET /utils/validate-hash?hash=... returns { input, isValid, reason }
  • Valid hash is exactly 64 lowercase hexadecimal characters
  • Returns reason for wrong length / invalid characters
  • Tests added

#219

  • GET /utils/network-passphrase returns { network, passphrase }
  • Correct passphrase for both testnet and mainnet based on STELLAR_NETWORK
  • Tests added

Testing

  • tests/utils.validateHash.test.js (7 tests) and
    tests/utils.networkPassphrase.test.js (3 tests) — all 10 pass.
  • ESLint clean on changed files.

3m1n3nc3 added 2 commits June 28, 2026 14:53
…ools#219)

Returns { network, passphrase } for the currently configured Stellar
network, resolving the correct passphrase for testnet and mainnet based
on the STELLAR_NETWORK env var. Useful for building and signing
transactions. Includes tests.
)

Validates whether a string is a correctly formatted Stellar transaction
hash (exactly 64 lowercase hexadecimal characters) without hitting
Horizon. Returns { input, isValid, reason }, with reason explaining
wrong length or invalid characters. Includes tests.
@Sulex45

Sulex45 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Link issues to PR

@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@3m1n3nc3 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@3m1n3nc3

Copy link
Copy Markdown
Contributor Author

Link issues to PR

Done

@Sulex45 Sulex45 merged commit e55ea42 into stellarkit-lab-devtools:main Jun 29, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Network Passphrase Resolver Endpoint Transaction Hash Format Validator Endpoint

2 participants