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
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
InvalidConfigErrorwith a descriptive message for each failure case:contractIdrpcUrlnot a valid URLnetworkis not'testnet'|'mainnet'| a validCustomNetworkobjectrateLimit.requestsPerSecond≤ 0cache.ttlvalues are negativerpcPoolSizeoutside the range 1–20InvalidConfigErrorlists all violations at once (not just the first)