Skip to content

feat(bridge): guide funds in from an exchange (Phase 8) - #134

Closed
Vasanthdev2004 wants to merge 1 commit into
feat/bridge-hypefrom
feat/bridge-exchange
Closed

Vasanthdev2004 wants to merge 1 commit into
feat/bridge-hypefrom
feat/bridge-exchange

Conversation

@Vasanthdev2004

Copy link
Copy Markdown
Collaborator

Stacked on #132. Phase 8 of the bridge update.

What it does

The bridge panel (header dialog and /bridge) gains a "Funds on an exchange?" link under the amount. It swaps the form for a four-step guide that uses only routes the bridge already checks:

  1. Address. The connected wallet's full address with a copy button. If the clipboard is refused, the button selects the text instead. Without a wallet, the step offers Connect wallet.
  2. Network. Withdraw ETH or USDC to Base, Ethereum, Arbitrum or Optimism. Base is marked "No bridge needed" when Base is the destination. The step says to choose native USDC (not USDC.e) and to withdraw a little ETH beside USDC for gas. It makes no claim about which exchange supports which network.
  3. Watch. Reads ETH and Circle's USDC on those four networks every 15 seconds. The reads are read-only and pause while the tab is hidden. Arrivals are measured from the lowest balance seen since the watch began, so funds already in the wallet never count. Rises below the existing dust floors ($1 USDC, 0.0005 ETH) are ignored.
  4. Bridge. Each arrival gets a "Bridge … from …" button. It sets the origin network, the asset and, for a token, the amount, using the same guarded setters the pickers use. You then quote and confirm as usual. A token that landed with no ETH on its network gets a gas warning. Funds that land on the destination itself are reported as ready to use.

The watch and the open guide are kept in this tab's session storage for two hours. Closing the panel, or connecting a wallet from the guide, resumes the guide without taking focus.

Why not Relay deposit addresses

These were evaluated first. Relay can attach a one-time deposit address to a quote, but in production these addresses are Lit-derived EOAs. They are built from derivation inputs the quote does not return plus an unpublished root key, so an address cannot be tied to its order. On Base, fresh accounts were seen sweeping into the depository at nonce 0 and 1. Tracking also needs an API key, and an Ethereum USDC route quoted about 3.3% at $25. docs/bridge.md records the findings and the tx hashes. relay.ts never requests a deposit address, and validation.ts still refuses any quote that carries one.

Code

  • lib/bridge/exchange.ts: networks, baseline, arrivals, gas check, the route an arrival opens, and session persistence (all pure).
  • components/bridge/useExchangeWatch.ts: the polling hook.
  • fund.ts: readHoldingsOn now holds the shared read code; readBridgeHoldings calls it.
  • BridgeDialog.tsx: the ExchangeGuide view, the link, and focus handling. Opening moves focus to the guide title. Back and Bridge return focus to the link or the amount.
  • /ui-review-bridge: six guide states, and the review dialog's guide wired to a synthetic arrival.
  • /bridge "Good to know" bullet, and a docs section.

Verification

  • exchange.test.ts (8 tests) and a UI guard in bridge-ui.test.ts. The guard checks that the guide only reads, opens the bridge through the guarded setters, calls out missing gas, and keeps deposit addresses off.
  • Full suite: 1548 tests, 28 failures, the same 28 as the baseline. No new failures.
  • tsc (app and tests) and eslint on the bridge paths are clean.
  • Browser checks:
    • every guide state on /ui-review-bridge;
    • the review dialog's arrival opens Arbitrum USDC to Arc with 25 filled in;
    • /bridge without a wallet;
    • a reload resumes the guide;
    • 375px width with no overflow.
  • No wallet signed anything. No real exchange withdrawal has been watched yet.

The bridge panel gains a "Funds on an exchange?" link that swaps the form
for a four-step guide: the wallet's address with a copy button, the four
networks to withdraw to (Base, Ethereum, Arbitrum, Optimism), a read-only
watch for the funds to land, and a button that opens the bridge on that
route with the token amount filled in. A token that lands with no ETH
beside it gets a gas warning. Funds that land on the destination itself
are reported as ready.

The watch reads ETH and Circle's USDC on those networks every 15 seconds,
paused while the tab is hidden, and measures arrivals from the lowest
balance seen since it began, so funds already there never count. The
watch and the open guide are kept in session storage for two hours, so
closing the panel or connecting a wallet resumes it without taking focus.

Relay deposit addresses were evaluated for this and stay off: production
addresses are Lit-derived accounts whose derivation inputs are not
returned, so an address cannot be tied to its order. docs/bridge.md
records the findings and the on-chain evidence.
@coderabbitai

coderabbitai Bot commented Nov 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 986a56f4-2f5a-4ede-814b-4d6d845211ea

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@Vasanthdev2004

Copy link
Copy Markdown
Collaborator Author

Closed in favour of #135, which holds the whole bridge update in one PR. The commits from this PR are in it unchanged.

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