Skip to content

[WIP] Fix missing/unbalanced bracket in wizard.js#4

Draft
Copilot wants to merge 5 commits into
mainfrom
copilot/fix-wizard-js-bracket-issue
Draft

[WIP] Fix missing/unbalanced bracket in wizard.js#4
Copilot wants to merge 5 commits into
mainfrom
copilot/fix-wizard-js-bracket-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 2, 2026

  • Diagnose: sendTx did const txReceipt = await txPromise; on the PromiEvent returned by .send() / sendTransaction(). In web3.js v1.x that promise resolves only when web3's internal receipt poller succeeds — default transactionPollingTimeout is 750s — so execution sat there and the manual 120s receipt-poll loop (with its try/catch around getTransactionReceipt) never ran. Matches the user's symptoms exactly: "Transaction was not mined within 750 seconds", no console output from the receipt try/catch, never broke past sendTx.
  • Fix: read the tx hash off the PromiEvent's transactionHash event (fires immediately after the node returns the broadcast hash), don't await the PromiEvent itself, and silence its later 750s rejection so it doesn't surface as an unhandled rejection. Manual 120s receipt poll now runs as designed. Two fallback showResult(txReceipt) paths updated to use { transactionHash: txHash } since txReceipt is no longer fetched up front.
  • Validate (Code Review ✅, CodeQL ✅; addressed redundant nullish-check feedback)
Original prompt

There is a missing/unbalanced bracket somewhere in assets/js/bridge-tools/wizard.js (the Automation Wizard script). The file currently fails to parse cleanly as JavaScript, which breaks the wizard at runtime in the browser.

What to do

  1. Run a JavaScript parser against assets/js/bridge-tools/wizard.js to locate the exact syntax error. For example:

    • node --check assets/js/bridge-tools/wizard.js
    • or parse with acorn/esprima in script form
      The parser will pinpoint the line and column where the bracket mismatch occurs ((, ), {, }, [, or ]).
  2. Inspect the surrounding code and determine which bracket is missing or extra. Common likely locations to double-check given the file's structure:

    • The big accordionHTML assignment built from chained buildAccordionItem(...) calls (around lines ~261–290), where each item's extraHTML argument is a multi-line string concatenation followed by ) to close buildAccordionItem and + to chain to the next.
    • The Swal.fire({ ... }) blocks (e.g. launchAutomationWizard, ensureWalletUnlocked, openAutomationStatusDialog, the deposit dialog).
    • The preConfirm: and didOpen: callback function bodies inside those Swal.fire calls.
    • The IIFE wrapping the whole file: (function() { ... })(); at line 3 / line 1314.
  3. Add the single missing bracket (or remove the extra one) so that node --check assets/js/bridge-tools/wizard.js passes with no errors. Do not make any other behavioral changes — this is purely a syntax fix.

  4. Verify the fix:

    • node --check assets/js/bridge-tools/wizard.js exits 0.
    • Optionally, load the page in a browser (or just confirm launchAutomationWizard is defined on window) to make sure the wizard script no longer throws a SyntaxError in the console.

Acceptance criteria

  • assets/js/bridge-tools/wizard.js parses successfully (no SyntaxError).
  • The diff is minimal — ideally a single character (one bracket) added or removed, plus possibly trivial whitespace.
  • No other files modified, no logic changes.
  • PR description should call out the exact line and which bracket was missing/extra, so the author can sanity-check.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: missing a bracket somewhere in wizard

Assistant: I've reviewed assets/js/bridge-tools/wizard.js. The file is large (1314 lines) and has several truncated long lines in my preview, so I can't reliably visual-audit every bracket. Rather than guess, let me have the coding agent open a PR that runs a parser against the file, locates the unmatched bracket, and fixes it.

Assistant: Waiting on your confirmation of the dialog before I can dispatch the coding agent to fix the bracket in wizard.js.

This pull request was created from Copilot chat.

Agent-Logs-Url: https://github.com/bitbaymarket/bridge/sessions/36c225a7-88d8-4acb-bc3a-6f3608163996

Co-authored-by: dzimbeck <7565265+dzimbeck@users.noreply.github.com>
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.

2 participants