fix: wait for bundle settlement before returning from submitBundle#17
Merged
Conversation
Previously, PrivacyProviderClient.submitBundle returned immediately when the provider responded with status: "PENDING". The popup would navigate home before the executor settled the bundle on chain, and the home view's balance polling raced the executor — leading to stale balances and confusing flows for deposit / send / withdraw. submitBundle now polls /api/v1/bundle/:id every 5s for up to 180s, only returning on COMPLETED and throwing on FAILED / EXPIRED. This mirrors the e2e suite's waitForBundle helper. Popup-side timeouts on the three flows (deposit / send / withdraw) bumped to 240s so the page wait outlives the polling window. Three new ids on the Execute Transaction buttons (#deposit-execute-btn, #send-execute-btn, #withdraw-execute-btn) — disambiguates them for tests when the review page lingers in the DOM. No runtime behavior change.
1d94d08 to
46228f8
Compare
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
PrivacyProviderClient.submitBundlewas returning early onstatus: "PENDING", so the wallet's popup navigated home before the executor settled the bundle on chain. Balance polling on the home view then raced the executor.waitForBundlepolling (/api/v1/bundle/:idevery 5s, 180s timeout) sosubmitBundleonly resolves onCOMPLETEDand throws onFAILED/EXPIRED.popup/api/{deposit,send,withdraw}.tsto 240s so the page wait outlives the polling window.#deposit-execute-btn,#send-execute-btn,#withdraw-execute-btn) — disambiguates them when the review page lingers in the DOM. No runtime behavior change.Test plan
deno fmt --checkanddeno lintpass.