Skip to content

fix(bridge): live quotes and clear fee-limit feedback - #52

Merged
kevincodex1 merged 4 commits into
mainfrom
codex/bridge-live-quotes
Sep 16, 2026
Merged

kevincodex1 merged 4 commits into
mainfrom
codex/bridge-live-quotes

Conversation

@Vasanthdev2004

@Vasanthdev2004 Vasanthdev2004 commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Why

Follow-up to the already-merged #50. Getting a quote should not require another click after every amount edit, and the 5% warning should explain the actual cost.

Changes

  • Fetch an unsigned quote after a 700 ms pause in valid amount/route edits while the panel is open. Keep the controls editable during loading.
  • Cancel superseded requests and ignore stale responses across amount, wallet, network and dialog changes. Balance polling does not re-quote, and errors do not create retry loops.
  • Show the actual Relay fee and percentage when a quote fails the fee limit, with source gas clearly separate. Diagnostic responses contain no executable transaction or approval data.
  • Keep both 5% safety limits unchanged. Approval and deposit still need separate explicit wallet actions; approval confirmation loads a fresh quote for review. Expired quotes retain the refresh action.
  • Preserve a ready quote when reselecting the current network/token. Add loading/high-fee preview states and document the behavior.

Verification

  • Full suite: 658 passed, 10 opt-in live tests skipped, 0 failed.
  • TypeScript and changed-file ESLint passed.
  • Production build passed with the existing three imageStore tracing warnings.
  • Real local form: automatic quote retrieval, rapid edits using the latest amount, editable controls during loading, same-network reselection and quote expiry checked in the browser.
  • Live rejected Arc quote displayed its fee percentage and native gas separately. Synthetic high-fee layout also checked.
  • Separate code review covered effect dependencies, cancellation, wallet changes and approval gating. No wallet signing or bridge transaction was performed in this verification.

No dependency, contract, fee-policy or unrelated lockfile changes.

Summary by CodeRabbit

  • New Features

    • Bridge quotes now refresh automatically after valid changes, with cancellation when details, wallet, or dialog state changes.
    • Fee-limit errors show relay fees, gas costs, impact details, and formatted percentages when available.
    • Quote statuses and errors provide clearer guidance during loading, wallet connection, approval, and confirmation.
  • Bug Fixes

    • Prevented outdated quote results from replacing newer requests.
    • Improved handling of unavailable relay services and quotes exceeding fee or impact limits.
    • Zero-amount inputs no longer produce misleading rejection details.

Debounce unsigned quotes without locking amount or route edits.
Cancel stale requests and show verified fee-limit diagnostics.
Keep both 5% limits and all wallet approvals/deposits explicit.

Refs #50
@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Essentials

Run ID: 66070b8b-8cd1-4684-9f4d-986f7f5dc17b

📥 Commits

Reviewing files that changed from the base of the PR and between be99f6b and 977f14c.

📒 Files selected for processing (18)
  • app/src/app/ui-review-bridge/BridgeReview.tsx
  • app/src/components/bridge/BridgeDialog.module.css
  • app/src/components/bridge/BridgeDialog.tsx
  • app/src/components/bridge/bridge-ui.test.ts
  • app/src/components/bridge/useBridge.ts
  • app/src/lib/bridge/client.test.ts
  • app/src/lib/bridge/client.ts
  • app/src/lib/bridge/fee-display.test.ts
  • app/src/lib/bridge/fee-display.ts
  • app/src/lib/bridge/quote-session.test.ts
  • app/src/lib/bridge/quote-session.ts
  • app/src/lib/bridge/relay.test.ts
  • app/src/lib/bridge/relay.ts
  • app/src/lib/bridge/types.test.ts
  • app/src/lib/bridge/types.ts
  • app/src/lib/bridge/validation.ts
  • app/src/lib/chainKeys.test.ts
  • docs/bridge.md

Included review availability: 1 review is currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

The bridge now refreshes quotes after valid edits, cancels stale requests, validates fee-limit diagnostics, and displays quote loading, expiry, errors, and rejection details.

Changes

Bridge quote flow

Layer / File(s) Summary
Quote rejection contracts and validation
app/src/lib/bridge/types.ts, app/src/lib/bridge/validation.ts, app/src/lib/bridge/client.ts, app/src/lib/bridge/relay.ts, app/src/lib/bridge/*test.ts
Fee and total-impact limits now produce validated BridgeQuoteRejection data. Relay responses expose diagnostics only for verified 422 failures.
Debounced quote session
app/src/lib/bridge/quote-session.ts, app/src/lib/bridge/quote-session.test.ts
Quote scheduling waits 700 ms, replaces pending work, aborts active requests, and suppresses stale results.
Hook-managed quote lifecycle
app/src/components/bridge/useBridge.ts, app/src/components/bridge/bridge-ui.test.ts
useBridge now accepts dialog visibility and manages automatic quoting, cancellation, wallet-chain checks, loading state, and rejection data.
Dialog states and review fixture
app/src/components/bridge/BridgeDialog.tsx, app/src/components/bridge/BridgeDialog.module.css, app/src/app/ui-review-bridge/BridgeReview.tsx, app/src/lib/bridge/fee-display.ts, docs/bridge.md
The dialog and fixture now show quote loading, expiry, errors, fee-limit details, and new quoting and high-fee states.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant BridgeDialog
  participant useBridge
  participant QuoteSession
  participant Relay
  User->>BridgeDialog: Edit amount or route
  BridgeDialog->>useBridge: Update quote request
  useBridge->>QuoteSession: Schedule quote
  QuoteSession->>Relay: Request quote after 700 ms
  Relay-->>useBridge: Return quote or rejection diagnostics
  useBridge-->>BridgeDialog: Update quote, loading, or error state
Loading

Suggested reviewers: kevincodex1

Merge Risk: ⚪ Minimal · up to 977f1

The bridge keeps inputs editable while refreshing quotes and correctly replaces quotes after valid route changes. No actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 16 files. (2 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the two main changes: live bridge quotes and improved fee-limit feedback.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 30.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 16 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/bridge-live-quotes

Comment @coderabbitai help to get the list of available commands.

Separate fees from gas and keep exact limits readable without changing bridge safety checks.
Sync Kevin's Arc launch support and shared chain registry before merging the bridge quote UX.
The registry guard uses POSIX path allowlists and line-end anchored comment removal. Normalize path separators and CRLF so Windows checkouts enforce the same guard as Linux.

@kevincodex1 kevincodex1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kevincodex1
kevincodex1 merged commit a4d01f3 into main Sep 16, 2026
7 checks passed
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