Skip to content

feat(#282): add VeriTixClient.healthCheck() — verify RPC connectivity and contract existence - #359

Closed
Userhorlie wants to merge 3 commits into
Lead-Studios:mainfrom
Userhorlie:feat/issue-282-health-check
Closed

feat(#282): add VeriTixClient.healthCheck() — verify RPC connectivity and contract existence#359
Userhorlie wants to merge 3 commits into
Lead-Studios:mainfrom
Userhorlie:feat/issue-282-health-check

Conversation

@Userhorlie

Copy link
Copy Markdown
Contributor

Summary

Adds VeriTixClient.healthCheck() — a method that probes the Soroban RPC and the target contract to verify that the SDK is configured correctly. It never throws; all failures are captured in the returned errors[] array.

Changes

New

  • HealthStatus interface in src/types/index.ts: { rpcReachable, contractFound, latencyMs, latestLedger, errors }
  • healthCheck(): Promise<HealthStatus> on VeriTixClient
    • Probes server.getLatestLedger() for RPC reachability
    • Probes server.getLedgerEntries(contractKey) for contract existence
    • Measures wall-clock latencyMs
    • Returns without throwing even if all checks fail
  • HealthStatus exported from src/index.ts

Pre-existing fixes (required for compilation)

  • Duplicate VeriTixErrorCode enum entries removed from errors.ts
  • estimateFee referenced tx/sourceAccount before declaration — fixed
  • ledgerToApproxDate missing closing brace in network.ts — fixed
  • Duplicate freezeBatch implementations in batch.ts — fixed

Tests

Added 7 tests in tests/client.test.ts:

  • Returns rpcReachable=true and contractFound=true on full success
  • Returns rpcReachable=false with error when RPC throws
  • Returns contractFound=false when getLedgerEntries returns empty
  • Returns contractFound=false with error when getLedgerEntries throws
  • Never throws — always resolves even on complete failure
  • latencyMs is a non-negative number
  • HealthStatus shape has all required fields

Closes #282

@drips-wave

drips-wave Bot commented Jul 25, 2026

Copy link
Copy Markdown

@Userhorlie 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

…tudios#281)

- Expose maxRetries (default 3) and retryDelayMs (default 1000) as
  SubmitTransactionOptions fields on submitTransaction()
- Apply ±20% random jitter to each retry delay to spread concurrent
  submissions and reduce Horizon 429 collisions
- Support legacy numeric maxAttempts arg for backwards compatibility
- Fix broken estimateFee (missing sourceAccount/variable ordering)
- Fix pre-existing duplicate enum identifiers in errors.ts
- Fix missing closing brace in network.ts ledgerToApproxDate
- Add tests: SubmitTransactionOptions, rate-limit retry, jitter, exhaustion

Closes Lead-Studios#281
…ce (Lead-Studios#282)

- Add HealthStatus type to src/types/index.ts:
    { rpcReachable, contractFound, latencyMs, latestLedger, errors[] }
- Implement healthCheck() on VeriTixClient:
  - Calls server.getLatestLedger() to test RPC reachability and measure latencyMs
  - Calls server.getLedgerEntries() with the contract instance key to test
    contract existence
  - Never throws — all errors are captured in errors[]
  - Returns early with rpcReachable=false when server is not set
- Export HealthStatus from src/index.ts public API barrel
- Fix pre-existing: remove duplicate WatchOptions interface in client.ts
- Fix pre-existing: remove duplicate freezeBatch implementations in batch.ts
- Add 6 unit tests covering all success/failure/edge-case paths

Closes Lead-Studios#282
@Userhorlie
Userhorlie force-pushed the feat/issue-282-health-check branch from 7bb3c72 to 87df6c3 Compare July 25, 2026 18:36
@BigBen-7

Copy link
Copy Markdown
Collaborator

This PR currently has merge conflicts with main and was skipped during the batch merge pass. Please rebase/resolve conflicts and it can be merged.

@Userhorlie Userhorlie closed this Jul 26, 2026
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.

dx: add VeriTixClient.healthCheck() — verify RPC connectivity and contract existence

2 participants