Skip to content

feat(bridge): show approximate bridging time while order is pending#7803

Open
tenderdeve wants to merge 1 commit into
cowprotocol:developfrom
tenderdeve:fix/6459-bridging-eta
Open

feat(bridge): show approximate bridging time while order is pending#7803
tenderdeve wants to merge 1 commit into
cowprotocol:developfrom
tenderdeve:fix/6459-bridging-eta

Conversation

@tenderdeve

@tenderdeve tenderdeve commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #6459.

When a swap+bridge order is in the Bridging state there was no indication of how long bridging might take (it can be 18–20 min). The UI already has an "Est. bridge time" row (QuoteBridgeContent), but it stayed hidden during pending because estimatedTime was hardcoded to null when building the pending context — the quote's expectedFillTimeSeconds was never persisted with the order.

Changes

  • Add optional expectedFillTimeSeconds to BridgeQuoteAmounts and capture it in useBridgeQuoteAmounts from the bridge quote. It then rides along with every persisted bridge order (all addBridgeOrder call sites already store quoteAmounts), so no per-flow plumbing is needed.
  • Persist it through the bridge-orders serializer.
  • In useSwapAndBridgeContext, set the pending estimatedTime from the persisted quote ETA, falling back to the live statusResult.fillTimeInSeconds when present.

The rendering component is unchanged — it already displays the row once estimatedTime is non-null.

Testing steps

  1. Do a swap+bridge order to a slower destination chain.
  2. While the order is in the Bridging state, open the order progress details.
  3. The "Est. bridge time" row now shows ~ X min instead of being hidden.

Summary by CodeRabbit

  • New Features
    • Bridge quotes now include an estimated fill time, which can be shown during swap-and-bridge flows.
    • The estimated bridge time is now carried through to the bridge context so timing details stay up to date.
  • Bug Fixes
    • Improved timing updates so changes to quote-derived fill estimates are reflected correctly in the app.

The 'Est. bridge time' row was suppressed during the pending Bridging state
because the quote's estimated fill time was never persisted and estimatedTime
was hardcoded to null. Carry expectedFillTimeSeconds on the persisted bridge
quote amounts and surface it in the pending context, falling back to the live
bridge status estimate when available.

Closes cowprotocol#6459
@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

@tenderdeve is attempting to deploy a commit to the cow-dev Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: de0b4414-bbae-4924-b974-829d05655ef1

📥 Commits

Reviewing files that changed from the base of the PR and between 6bfd063 and 1f14f1d.

📒 Files selected for processing (4)
  • apps/cowswap-frontend/src/common/hooks/useSwapAndBridgeContext.ts
  • apps/cowswap-frontend/src/entities/bridgeOrders/state/bridgeOrdersStateSerializer.ts
  • apps/cowswap-frontend/src/modules/bridge/hooks/useBridgeQuoteAmounts.ts
  • libs/types/src/bridge.ts

Walkthrough

Adds an optional expectedFillTimeSeconds field to the BridgeQuoteAmounts type, populates it from the bridge quote, persists it through serialization/deserialization, and uses it as the primary source for estimated bridging time in swap/bridge context, falling back to the existing status result value.

Changes

Bridge ETA propagation

Layer / File(s) Summary
BridgeQuoteAmounts contract and source population
libs/types/src/bridge.ts, apps/cowswap-frontend/src/modules/bridge/hooks/useBridgeQuoteAmounts.ts
Adds optional expectedFillTimeSeconds?: number to BridgeQuoteAmounts and populates it from bridgeQuote.expectedFillTimeSeconds in the hook's returned object.
Serialization of expectedFillTimeSeconds
apps/cowswap-frontend/src/entities/bridgeOrders/state/bridgeOrdersStateSerializer.ts
serializeQuoteAmounts and deserializeQuoteAmounts now preserve expectedFillTimeSeconds when converting between in-memory and wire/storage shapes.
Swap and bridge context ETA derivation
apps/cowswap-frontend/src/common/hooks/useSwapAndBridgeContext.ts
quoteBridgeContext.estimatedTime now prefers bridgeQuoteAmounts?.expectedFillTimeSeconds over crossChainOrder.statusResult.fillTimeInSeconds, and bridgeQuoteAmounts is added to the memo dependency array.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
    participant BridgeQuote
    participant useBridgeQuoteAmounts
    participant Serializer as bridgeOrdersStateSerializer
    participant useSwapAndBridgeContext

    BridgeQuote->>useBridgeQuoteAmounts: expectedFillTimeSeconds
    useBridgeQuoteAmounts->>Serializer: serializeQuoteAmounts(expectedFillTimeSeconds)
    Serializer->>Serializer: deserializeQuoteAmounts(expectedFillTimeSeconds)
    Serializer->>useSwapAndBridgeContext: bridgeQuoteAmounts.expectedFillTimeSeconds
    useSwapAndBridgeContext->>useSwapAndBridgeContext: estimatedTime = expectedFillTimeSeconds || fillTimeInSeconds || null
Loading

Suggested reviewers: elena-zh, fairlighteth, limitofzero

Poem

A hop, a skip, through bridges wide,
Now with a clock ticking by our side. 🐇⏱️
No more guessing "when's it done?"
ETA whispers, "almost won!"
Carrots counted, seconds too—
Bridging time, now clear and true!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: surfacing an approximate bridge time during pending orders.
Description check ✅ Passed The description includes the issue link, summary, implementation details, and testing steps, which is mostly complete.
Linked Issues check ✅ Passed The changes persist and reuse bridge ETA data so pending Bridging orders can show an approximate time, satisfying #6459.
Out of Scope Changes check ✅ Passed All modified files are directly related to persisting and displaying bridge ETA, with no clear unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
swap-dev Ready Ready Preview Jul 2, 2026 2:34pm

Request Review

@elena-zh elena-zh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you, looks good

@elena-zh
elena-zh requested a review from alfetopito July 2, 2026 15:50
@elena-zh
elena-zh requested a review from shoom3301 July 10, 2026 10:03
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.

Show an apprx.bridging time when order is pending

2 participants