Repository navigation
feat: extract standalone waitForConfirmation from inline poll logic - #888
Merged
Jaydbrown merged 2 commits intoOct 1, 2026
Merged
Conversation
|
@Yerimahjr 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an exported
waitForConfirmation(rpcUrl, txHash, options?)for callers who submit a transaction outsideStreamsModuleand still want the SDK's poll-until-confirmed behavior, and removes the duplicated poll loop by havinginvokeContractandStreamsModuleshare one implementation.Closes #799
Changes
waitForConfirmation(insrc/soroban.ts, exported from the package root): resolves with{ hash, returnValue }once the transaction succeeds. Rejects with anErrorif it fails,ConfirmationTimeoutErrorif it doesn't confirm withinmaxAttempts, anAbortErrorifsignalaborts, andRateLimitError(or the underlying error) on RPC failure. Options:pollIntervalMs,maxAttempts,signal.pollForConfirmation(internal): the single poll loop. It reports the outcome (success/failed/timeout/poll-error) instead of deciding what to throw, so each caller keeps its own policy.invokeContractandStreamsModule._sendAndPollnow call it and map outcomes exactly as before (invokeContractstill resolves a pending hash unlessstrict;_sendAndPollstill throws). The now-unusedsleepinstreams.tsis removed.docs/api.md) andCHANGELOG.md.Notes
signalnow throws before the first wait rather than after it (sameAbortError).src/batch-tx.tshas a third poll loop that records per-transaction outcome objects rather than throwing; I left it alone since folding it in needs a different refactor.waitForConfirmation(txHash, signal?)while its suggested approach shows(rpcUrl, txHash, options?); this follows the latter, withsignalinsideoptions.Testing
src/tests/wait-for-confirmation.test.ts(10 tests): success with return value, polling throughNOT_FOUND, default and custom intervals, failure, timeout, abort mid-wait and pre-aborted, RPC error passthrough, and 429 mapped toRateLimitError.tsc --noEmitis clean.factory,governor,relayer-stress) that fail identically on a cleanupstream/main; eslint's one error (anyinstreams.ts) also exists there.