Skip to content

fix: wait for bundle settlement before returning from submitBundle#17

Merged
AquiGorka merged 1 commit into
mainfrom
fix/wait-for-bundle-settlement
May 22, 2026
Merged

fix: wait for bundle settlement before returning from submitBundle#17
AquiGorka merged 1 commit into
mainfrom
fix/wait-for-bundle-settlement

Conversation

@AquiGorka

Copy link
Copy Markdown
Contributor

Summary

  • PrivacyProviderClient.submitBundle was returning early on status: "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.
  • Adds waitForBundle polling (/api/v1/bundle/:id every 5s, 180s timeout) so submitBundle only resolves on COMPLETED and throws on FAILED / EXPIRED.
  • Bumps the page-side timeouts in popup/api/{deposit,send,withdraw}.ts to 240s so the page wait outlives the polling window.
  • Adds three distinct ids on the Execute Transaction buttons (#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

  • Manual deposit on local-dev: popup stays on review screen until executor settles, navigates home afterwards.
  • Manual deposit on testnet: same behavior; 240s timeout covers worst-case settlement latency.
  • Send + withdraw flows: same.
  • deno fmt --check and deno lint pass.

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.
@AquiGorka AquiGorka force-pushed the fix/wait-for-bundle-settlement branch from 1d94d08 to 46228f8 Compare May 22, 2026 20:14
@AquiGorka AquiGorka merged commit 8685350 into main May 22, 2026
2 checks passed
@AquiGorka AquiGorka deleted the fix/wait-for-bundle-settlement branch May 22, 2026 20:17
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.

1 participant