Skip to content

Validate SDK configuration at instantiation and surface clear errors #396

Description

@Kingsman-99

Overview

Invalid SDK configuration (missing contract ID, bad RPC URL format, conflicting options) is currently discovered at call time, leading to cryptic errors. Add upfront validation on new StellarSplitSDK(config).

Acceptance Criteria

  • Constructor validates all config fields synchronously on instantiation
  • Throws InvalidConfigError with a descriptive message for each failure case:
    • Missing or empty contractId
    • rpcUrl not a valid URL
    • network is not 'testnet' | 'mainnet' | a valid CustomNetwork object
    • rateLimit.requestsPerSecond ≤ 0
    • cache.ttl values are negative
    • rpcPoolSize outside the range 1–20
  • InvalidConfigError lists all violations at once (not just the first)
  • Config validation is synchronous — no async checks in the constructor
  • TypeScript types for config are strict enough to catch most errors at compile time
  • Unit tests cover every validation rule

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programcomplexity: highdxDeveloper experience and tooling

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions