Skip to content

Revert "brige embed (#7222)" #7345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2025
Merged

Revert "brige embed (#7222)" #7345

merged 1 commit into from
Jun 16, 2025

Conversation

gregfromstl
Copy link
Member

@gregfromstl gregfromstl commented Jun 16, 2025

This reverts commit 35a909a.


PR-Codex overview

This PR focuses on significant deletions and updates in the thirdweb codebase, including the removal of various files related to UI components, hooks, and tests, as well as modifications in type definitions and UI behavior for payment processing.

Detailed summary

  • Deleted numerous files related to UI components, hooks, tests, and documentation.
  • Updated Action type in packages/thirdweb/src/bridge/types/BridgeAction.ts.
  • Modified onPurchaseSuccess callback to require info parameter.
  • Changed modalMaxWidthCompact value from "400px" to "360px".
  • Updated payment provider names to uppercase in FiatProviders.
  • Adjusted layout and styles in multiple UI components for better responsiveness.
  • Refactored logic in PayEmbed to streamline purchase flow and integrate AutoConnect.
  • Enhanced error handling and transaction success screens in ExecutingTxScreen.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • Removed Features

    • The multi-step bridge payment and cross-chain transaction UI, including wallet funding, direct payment, and transaction flows, has been removed from the user interface.
    • The ability to select payment methods, view payment details, execute multi-step transactions, and see payment receipts or success screens is no longer available.
    • Storybook examples and visual documentation for these payment and bridge features have been deleted.
  • User Interface

    • Several UI components and screens related to payment, transaction, and wallet selection have been removed.
    • Visual elements such as payment method selection, error banners, progress indicators, and transaction receipts are no longer present.
  • Documentation

    • Documentation and product specifications for the removed payment and bridge features have been deleted.
  • Style

    • Minor visual adjustments were made to remaining buttons and components, including hover effects and layout tweaks.
  • Bug Fixes

    • Adjustments to type handling and prop requirements in some remaining components for improved reliability.
  • Chores

    • Internal code clean-up, including removal of unused files, tests, and configuration entries.

@gregfromstl gregfromstl requested review from a team as code owners June 16, 2025 17:29
Copy link

changeset-bot bot commented Jun 16, 2025

⚠️ No Changeset found

Latest commit: f26c56d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jun 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 16, 2025 5:37pm
login ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 16, 2025 5:37pm
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 16, 2025 5:37pm
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 16, 2025 5:37pm
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 16, 2025 5:37pm

Copy link
Contributor

coderabbitai bot commented Jun 16, 2025

Walkthrough

This change removes the entire BridgeEmbed 2.0 UI, state machine, hooks, and related documentation from the codebase, including all bridge payment orchestration, step execution, error handling, and Storybook stories. It also updates various types and components to remove references to bridge-specific logic, simplifies payment and token handling, and removes unused files, tests, and documentation. Some UI and type definitions are refactored for consistency with the new structure.

Changes

File(s) / Group Change Summary
.changeset/icy-eyes-show.md, packages/thirdweb/src/react/PRODUCT.md, packages/thirdweb/src/react/TASK_LIST.md, packages/thirdweb/src/react/TECH_SPEC.md, packages/thirdweb/src/react/components.md Deleted changeset and multiple markdown documentation/specification files related to BridgeEmbed 2.0.
packages/thirdweb/src/react/core/adapters/.keep, packages/thirdweb/src/react/core/adapters/WindowAdapter.ts, packages/thirdweb/src/react/core/errors/.keep, packages/thirdweb/src/react/core/errors/mapBridgeError.test.ts, packages/thirdweb/src/react/core/errors/mapBridgeError.ts, packages/thirdweb/src/react/core/hooks/useBridgeError.test.ts, packages/thirdweb/src/react/core/hooks/useBridgeError.ts, packages/thirdweb/src/react/core/hooks/useBridgePrepare.test.ts, packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts, packages/thirdweb/src/react/core/hooks/useBridgeQuote.ts, packages/thirdweb/src/react/core/hooks/useBridgeRoutes.test.ts, packages/thirdweb/src/react/core/hooks/useBridgeRoutes.ts, packages/thirdweb/src/react/core/hooks/usePaymentMethods.test.ts, packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts, packages/thirdweb/src/react/core/hooks/useStepExecutor.test.ts, packages/thirdweb/src/react/core/hooks/useStepExecutor.ts, packages/thirdweb/src/react/core/hooks/useTransactionDetails.ts, packages/thirdweb/src/react/core/hooks/useBuyWithFiatQuotesForProviders.ts, packages/thirdweb/src/react/core/machines/.keep, packages/thirdweb/src/react/core/machines/paymentMachine.test.ts, packages/thirdweb/src/react/core/machines/paymentMachine.ts, packages/thirdweb/src/react/core/types/.keep Deleted all bridge-related React hooks, adapters, state machines, error mapping utilities, and placeholder files.
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts, packages/thirdweb/src/react/web/adapters/adapters.test.ts Deleted web-specific window adapter and its tests.
packages/thirdweb/src/react/web/flows/.keep, packages/thirdweb/src/react/native/flows/.keep Deleted placeholder files for flow directories.
packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx, packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx, packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx, packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx, packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx, packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx, packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx, packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx, packages/thirdweb/src/react/web/ui/Bridge/common/TokenAndChain.tsx, packages/thirdweb/src/react/web/ui/Bridge/common/TokenBalanceRow.tsx, packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx, packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx, packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx, packages/thirdweb/src/react/web/ui/Bridge/payment-selection/FiatProviderSelection.tsx, packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx, packages/thirdweb/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx, packages/thirdweb/src/react/web/ui/Bridge/payment-selection/WalletFiatSelection.tsx, packages/thirdweb/src/react/web/ui/Bridge/payment-success/PaymentReceipt.tsx, packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx Deleted all bridge UI components, payment flows, step runners, payment selection, payment details, and related helpers.
packages/thirdweb/src/react/web/ui/PayEmbed.tsx Refactored to remove all bridge orchestration logic and async token/mode resolution; now uses connection manager hooks and local state.
packages/thirdweb/src/react/web/ui/TransactionButton/ExecutingScreen.tsx Simplified success UI, removed custom animation/styles, changed explorer link to anchor, removed window adapter prop.
packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx Replaced bridge orchestrator with lazy-loaded buy screen, adjusted props and removed window adapter.
packages/thirdweb/src/react/web/ui/ConnectWallet/icons/CreditCardIcon.tsx Deleted credit card icon component.
packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.tsx Removed getFiatCurrencyIcon function.
packages/thirdweb/src/react/web/ui/ConnectWallet/screens/formatTokenBalance.ts Removed formatTokenAmount and formatCurrencyAmount utilities.
packages/thirdweb/src/react/web/ui/components/ChainName.tsx Removed color and style props from ChainName and made shorterChainName local.
packages/thirdweb/src/react/web/ui/components/TokenIcon.tsx Refactored to use useChainIconUrl instead of useChainMetadata.
packages/thirdweb/src/react/web/ui/components/buttons.tsx Added scale transform on hover for several button variants.
packages/thirdweb/src/react/web/ui/ConnectWallet/constants.ts Changed modalMaxWidthCompact from "400px" to "360px".
packages/thirdweb/src/react/web/ui/ConnectWallet/WalletSelector.tsx Increased size of ShowAllWalletsIcon.
packages/thirdweb/src/react/web/ui/ConnectWallet/Details.test.tsx Changed test prop to log screen parameter.
packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.tsx Simplified token object construction, removed fallbacks.
packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx, packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.ts Removed type assertions and unused imports.
packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/FiatValue.tsx Simplified fiat value formatting.
packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.tsx Removed explicit color prop from container.
packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.tsx Adjusted spacing and simplified text styling.
apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/PayModal.tsx, apps/dashboard/src/components/buttons/MismatchButton.tsx, apps/dashboard/src/app/pay/components/client/PayPageEmbed.client.tsx Removed optional chaining for info in onPurchaseSuccess callbacks, making parameter required.
apps/playground-web/src/app/connect/pay/commerce/page.tsx, apps/playground-web/src/app/connect/pay/components/types.ts, apps/playground-web/src/app/connect/pay/embed/LeftSection.tsx, apps/playground-web/src/app/connect/pay/embed/RightSection.tsx, apps/playground-web/src/app/connect/pay/embed/page.tsx, apps/playground-web/src/components/pay/direct-payment.tsx Removed description from product metadata and related types/UI.
AGENTS.md Updated documentation to remove build instructions and change test runner from Vitest to Jest.
packages/thirdweb/knip.json Removed reference to useBridgeRoutes.ts from entry array.
packages/thirdweb/package.json Removed @storybook/react dependency.
packages/thirdweb/src/bridge/Routes.ts Removed includePrices option from routes function and namespace.
packages/thirdweb/src/bridge/Token.ts Removed add function and its namespace/types.
packages/thirdweb/src/bridge/types/BridgeAction.ts Removed "fee" from Action type union.
packages/thirdweb/src/bridge/types/Errors.ts Removed stringify import and toString override in ApiError.
packages/thirdweb/src/pay/buyWithFiat/getQuote.ts Changed fiat provider string matching to use uppercase.
packages/thirdweb/src/pay/convert/cryptoToFiat.ts, packages/thirdweb/src/pay/convert/fiatToCrypto.ts, packages/thirdweb/src/pay/convert/get-token.ts Replaced getToken with getTokenPrice, simplified price fetching and removed error handling for missing tokens.
packages/thirdweb/src/pay/utils/commonTypes.ts Changed fiat provider names to uppercase in FiatProviders constant.
packages/thirdweb/src/react/core/hooks/connection/ConnectButtonProps.ts Simplified types: removed Prettify, made onPurchaseSuccess parameter required, removed partial token types and description from metadata, removed presetOptions from fund wallet options.
packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts Made onPurchaseSuccess callback parameter required.
packages/thirdweb/src/react/core/hooks/others/useChainQuery.ts Changed query key to use full chain object instead of chain?.id.
packages/thirdweb/src/react/web/ui/TransactionButton/DepositScreen.tsx Adjusted border radius, background, and text styling for wallet and address containers.
packages/thirdweb/src/stories/Bridge/BridgeOrchestrator.stories.tsx, packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx, packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx, packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx, packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx, packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx, packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx, packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx, packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx, packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx, packages/thirdweb/src/stories/Bridge/fixtures.ts, packages/thirdweb/src/stories/TokenBalanceRow.stories.tsx, packages/thirdweb/src/stories/WalletRow.stories.tsx, packages/thirdweb/src/stories/utils.tsx Deleted all Storybook stories, fixtures, and theming utilities for bridge/payment UI components.
packages/thirdweb/src/wallets/connection/autoConnectCore.test.ts, packages/thirdweb/src/react/core/hooks/wallets/useAutoConnectCore.test.tsx Changed test onTimeout callback to log a message.

Sequence Diagram(s)

Omitted due to the extensive and varied nature of the deletions and refactors; no single new feature or control flow is introduced that warrants a sequence diagram.

Suggested labels

SDK

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

graphite-app bot commented Jun 16, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

Copy link

codecov bot commented Jun 16, 2025

Codecov Report

Attention: Patch coverage is 28.30189% with 114 lines in your changes missing coverage. Please review.

Project coverage is 55.58%. Comparing base (9f6c1a4) to head (f26c56d).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
packages/thirdweb/src/react/web/ui/PayEmbed.tsx 28.04% 59 Missing ⚠️
...react/web/ui/TransactionButton/ExecutingScreen.tsx 8.33% 22 Missing ⚠️
...eact/web/ui/TransactionButton/TransactionModal.tsx 10.00% 9 Missing ⚠️
...c/react/web/ui/TransactionButton/DepositScreen.tsx 0.00% 5 Missing ⚠️
...eb/ui/ConnectWallet/screens/Buy/swap/WalletRow.tsx 0.00% 3 Missing ⚠️
packages/thirdweb/src/pay/buyWithFiat/getQuote.ts 0.00% 2 Missing ⚠️
.../src/react/web/ui/ConnectWallet/WalletSelector.tsx 0.00% 2 Missing ⚠️
...ectWallet/screens/Buy/main/useUISelectionStates.ts 0.00% 2 Missing ⚠️
...thirdweb/src/react/web/ui/components/ChainName.tsx 0.00% 2 Missing ⚠️
...s/thirdweb/src/react/web/ui/components/buttons.tsx 60.00% 2 Missing ⚠️
... and 6 more

❌ Your patch status has failed because the patch coverage (28.30%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7345   +/-   ##
=======================================
  Coverage   55.58%   55.58%           
=======================================
  Files         909      909           
  Lines       58683    58683           
  Branches     4158     4158           
=======================================
  Hits        32617    32617           
  Misses      25959    25959           
  Partials      107      107           
Flag Coverage Δ
packages 55.58% <28.30%> (ø)
Files with missing lines Coverage Δ
packages/thirdweb/src/bridge/Routes.ts 85.18% <ø> (ø)
packages/thirdweb/src/bridge/Token.ts 61.53% <ø> (ø)
packages/thirdweb/src/bridge/types/Errors.ts 100.00% <ø> (ø)
packages/thirdweb/src/pay/convert/get-token.ts 100.00% <100.00%> (ø)
packages/thirdweb/src/pay/utils/commonTypes.ts 100.00% <100.00%> (ø)
...react/core/hooks/transaction/useSendTransaction.ts 11.04% <ø> (ø)
...react/web/hooks/transaction/useSendTransaction.tsx 36.84% <ø> (ø)
...irdweb/src/react/web/ui/ConnectWallet/constants.ts 100.00% <100.00%> (ø)
...b/ui/ConnectWallet/screens/Buy/fiat/currencies.tsx 83.72% <ø> (ø)
...i/ConnectWallet/screens/Buy/swap/StepConnector.tsx 13.33% <ø> (ø)
... and 18 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🔭 Outside diff range comments (5)
packages/thirdweb/src/react/core/hooks/wallets/useAutoConnectCore.test.tsx (1)

111-153: console.info spy is never restored & relying on console side-effects weakens the test

  1. infoSpy is created (lines 112-113) but never restored.
    • This leaves console.info mocked for the remainder of the test suite, potentially breaking unrelated tests that rely on real logging.
  2. The test asserts timeout behaviour by calling console.info inside the callback and then spying on it.
    • This couples the test to an implementation detail (that the callback logs to the console) rather than to the contract “onTimeout is invoked”.
    • A much cleaner pattern is to pass a vi.fn() as onTimeout and assert that this mock was called.
@@
-const infoSpy = vi.spyOn(console, "info").mockImplementation(() => {});
+const onTimeout = vi.fn();
@@
-            onTimeout: () => console.info("TIMEOUTTED"),
+            onTimeout,
@@
-        expect(infoSpy).toHaveBeenCalled();
-        expect(infoSpy).toHaveBeenCalledWith("TIMEOUTTED");
-        warnSpy.mockRestore();
+        expect(onTimeout).toHaveBeenCalled();
+        warnSpy.mockRestore();
+        infoSpy.mockRestore(); // only needed if the spy is kept for other reasons

This removes the unnecessary console spying and guarantees the spy cleanup.
If you prefer to keep the console approach, at minimum add infoSpy.mockRestore() after the assertions.

packages/thirdweb/src/react/web/ui/components/ChainName.tsx (1)

30-38: shorterChainName can return an empty string; guard & trim once

Edge case: "Mainnet Chain""", causing an empty <Text> node.
Also, splitting on " " leaves empty tokens for multiple spaces.

-function shorterChainName(name: string) {
-  const split = name.split(" ");
-  const wordsToRemove = new Set(["mainnet", "testnet", "chain"]);
-  return split
-    .filter((s) => {
-      return !wordsToRemove.has(s.toLowerCase());
-    })
-    .join(" ");
+function shorterChainName(name: string) {
+  const wordsToRemove = new Set(["mainnet", "testnet", "chain"]);
+  const shorter = name
+    .split(/\s+/)              // collapse multiple spaces
+    .filter(Boolean)           // eliminate empty tokens
+    .filter((w) => !wordsToRemove.has(w.toLowerCase()));
+
+  // Fallback to original name if everything was stripped
+  return shorter.length ? shorter.join(" ") : name;
 }

This keeps UX intact while still providing the abbreviated variant.

packages/thirdweb/src/react/core/hooks/others/useChainQuery.ts (1)

138-144: Inconsistent queryKey strategy can break cache sharing

getQueryOptions now uses ["chain", chain], while the helper hooks above (useChainName, useChainIconUrl, …) still query with ["chain", chain?.id].
React-Query will therefore create two separate cache entries for the same chain, triggering duplicate network requests and stale data.

-  queryKey: ["chain", chain],
+  // Keep it consistent with the rest of the file
+  queryKey: ["chain", chain?.id],

…or update every other occurrence (lines 18, 41, 70, 93, 119) to also pass the full chain object – but do it everywhere, not just here.

packages/thirdweb/src/pay/utils/commonTypes.ts (1)

22-23: Capitalisation change breaks the FiatProvider literal type

FiatProviders was switched to uppercase literals, but many call-sites (e.g. buyWithFiat/getQuote.tscase "stripe":) still emit lowercase strings.
This will now violate the FiatProvider type and fail compilation / runtime checks.

Options:

-export const FiatProviders = ["COINBASE", "STRIPE", "TRANSAK"] as const;
+// keep previous casing to avoid a breaking change
+export const FiatProviders = ["coinbase", "stripe", "transak"] as const;

…or update every downstream comparison/return value to uppercase.

apps/dashboard/src/components/buttons/MismatchButton.tsx (1)

294-324: Re-adding the null-safety you just removed may prevent runtime crashes

onPurchaseSuccess(info) now assumes info is always defined. If any upstream change calls the callback with undefined (e.g. network error, user abort), the button explodes at runtime (Cannot read properties of undefined (reading 'type')).

Either keep optional chaining or early-return when !info.

-                  onPurchaseSuccess(info) {
-                    if (
-                      info.type === "crypto" &&
+                  onPurchaseSuccess(info) {
+                    if (!info) {
+                      return;
+                    }
+                    if (
+                      info.type === "crypto" &&

Same safeguard applies to the fiat branch below.

🧹 Nitpick comments (17)
packages/thirdweb/src/wallets/connection/autoConnectCore.test.ts (1)

121-123: Use a mock instead of relying on console.info side-effects

Using console.info purely to assert that onTimeout was invoked couples the test to a global side-effect and forces you to stub/restore another console method.
A cleaner pattern is to pass a vi.fn() spy directly and assert its invocation, keeping the test self-contained and avoiding unnecessary console stubbing.

-        onTimeout: () => console.info("TIMEOUTTED"),
+        onTimeout: infoSpy,

You can then drop lines 105-106 & 141-142 that deal with console.info.

AGENTS.md (1)

42-42: Verify Jest configuration and add a test command example.

The doc now states “Jest is pre-configured” but omits how to actually run the tests. Please confirm the Jest setup in CI and consider adding a sample command (e.g., pnpm test or npm test) for contributors.

- 42- Keep tests deterministic and side-effect free; Jest is pre-configured.
+ 42- Keep tests deterministic and side-effect free; Jest is pre-configured.
+ 43- Run tests with `pnpm test` or `npm test` to execute the Jest suite.
packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx (1)

542-543: fromToken may be undefined – confirm receiving component handles it

SwapScreenContent now receives fromToken directly (previous cast removed). When the user lands on “buy-with-crypto” without having selected a source token yet, fromToken can be undefined. Make sure the prop type allows it or guard before passing:

- fromToken={fromToken}
+ fromToken={fromToken ?? null}

(or treat the zero-state inside SwapScreenContent).

packages/thirdweb/src/pay/buyWithFiat/getQuote.ts (1)

294-297: Add explicit handling for “COINBASE” for clarity

The switch now covers STRIPE and TRANSAK, with COINBASE falling through the default. It works, but an explicit case improves readability and prevents accidental regressions:

-        case "STRIPE":
+        case "STRIPE":
           return "stripe";
-        case "TRANSAK":
+        case "TRANSAK":
           return "transak";
-        default: // default to coinbase when undefined or any other value
+        case "COINBASE":
+        default: // undefined or anything else → coinbase
           return "coinbase";
packages/thirdweb/src/react/web/ui/ConnectWallet/Details.test.tsx (2)

594-595: Avoid console.log in test helpers

setScreen={(scr) => console.log(scr)} will spam CI output. Use a noop or vi.fn() instead:

- setScreen={(scr) => console.log(scr)}
+ setScreen(() => {})

619-620: Same logging issue in second instance

Apply the same quiet noop / mock here.

apps/dashboard/src/app/pay/components/client/PayPageEmbed.client.tsx (1)

66-77: Remove residual null-checks or keep defensive coding?

result is now treated as always defined (optional chaining removed), which aligns with the new non-optional onPurchaseSuccess contract.
However, other parts of the codebase (or 3rd-party integrators) that still pass undefined will now fail at runtime before TypeScript can warn (e.g. JS callers). Consider leaving a fast-fail guard:

- switch (result.type) {
+ if (!result) {
+   console.error("onPurchaseSuccess called without a result object");
+   return;
+ }
+ switch (result.type) {

Up to you, but a 1-line guard avoids a potential hard crash while still surfacing the misuse.

packages/thirdweb/src/bridge/types/BridgeAction.ts (1)

1-1: Dropping "fee" is a breaking API change – double-check downstream usages

Action previously allowed "fee". Removing it will make any existing bridge orchestration code that relied on that literal stop compiling. Please:

  1. Search the repo (and docs) for "\"fee\"" usages.
  2. Publish this removal in release notes / changelog.

If any runtime (JS) extensions emit "fee", they will now fall through type-guards and potentially produce undefined behaviour.

packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts (1)

72-87: info made mandatory – ensure all external consumers are updated

The callback signature change is correct for safety, but it silently breaks any TypeScript projects pinned to an older minor version that still mark info optional.
Recommend bumping the package major or minor with a clear CHANGELOG note, and adding an overload that accepts the old signature (deprecated) for a smoother migration path.

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.tsx (1)

51-69: Consider retaining monospaced styling for addresses

The monospace/weight props were dropped on the main address line (line 67).
For wallet addresses a monospace font markedly improves legibility and alignment with block-explorer UIs. If the intent was only to simplify styling, you can keep the lighter gap tweaks while still forcing a monospace font:

-          <Text size={props.textSize || "xs"} color="primaryText">
+          <Text
+            size={props.textSize || "xs"}
+            color="primaryText"
+            style={{ fontFamily: "monospace", fontWeight: 500 }}
+          >
packages/thirdweb/src/react/web/ui/components/buttons.tsx (1)

90-138: Repeated transform: scale(1.01) may clash with the :active translate

All variants now set transform: scale(1.01) on :hover, while :active still applies transform: translateY(1px).
Because both rules target the same CSS property, the :active rule fully overrides the hover scale on click, causing a perceptible jump.

Consider composing transforms instead:

-&:active { transform: translateY(1px); }
+&:active { transform: scale(0.99) translateY(1px); }

…or use a separate property (e.g. box-shadow) for the pressed effect.

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/PayModal.tsx (1)

45-62: Minor DRY clean-up for success tracking

Both blocks test the same info.status.status !== "NOT_FOUND" condition.
You can merge them to avoid duplicated logic:

-if (info.type === "crypto" && info.status.status !== "NOT_FOUND") {
+if (info.status.status !== "NOT_FOUND") {
   trackEvent({
     category: "pay",
     action: "buy",
     label: "success",
     type: info.type,
     chainId: info.status.quote.toToken.chainId,
     tokenAddress: info.status.quote.toToken.tokenAddress,
-    amount: info.status.quote.toAmount,
+    amount:
+      info.type === "crypto"
+        ? info.status.quote.toAmount
+        : info.status.quote.estimatedToTokenAmount,
   });
 }

Not critical, but reduces branching and keeps the analytics payload in one spot.

packages/thirdweb/src/react/web/ui/components/TokenIcon.tsx (1)

30-40: useMemo adds negligible value here—consider inlining

tokenImage is derived from two primitives and is cheap to compute; memoization doesn’t buy much and makes the dependency array easy to get wrong. Inline expression improves readability and removes one React hook call.

-  const tokenImage = useMemo(() => {
-    if (
-      isNativeToken(props.token) ||
-      props.token.address === NATIVE_TOKEN_ADDRESS
-    ) {
-      return chainIconQuery.url;
-    }
-    return props.token.icon;
-  }, [props.token, chainIconQuery.url]);
+  const tokenImage =
+    isNativeToken(props.token) || props.token.address === NATIVE_TOKEN_ADDRESS
+      ? chainIconQuery.url
+      : props.token.icon;
apps/playground-web/src/app/connect/pay/embed/RightSection.tsx (1)

73-82: Hard-coded placeholder URL couples theme & asset; expose as helper?

The fallback placeholder is duplicated in a few places and embeds color logic directly in the component. Extracting a small getPlaceholderImage(themeType) utility (or passing it via props) centralises the knowledge of the URL format and prevents color mismatches if the theme palette changes.

packages/thirdweb/src/react/web/ui/TransactionButton/DepositScreen.tsx (2)

167-176: Minor style tweak introduces UX inconsistency

Adding marginBottom, borderRadius: spacing.md, and backgroundColor: theme.colors.tertiaryBg makes this wallet row look different from the same component used elsewhere (e.g. Buy-flow wallet picker).

Consider centralising the style (prop or styled-component) so the wallet row looks identical across screens; avoids visual drift over time.


226-228: Monospace removal hurts address legibility

shortenAddress output aligns better in a monospace font, especially when users compare multiple addresses.
Recommend re-adding fontFamily: "monospace" for the address string.

packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx (1)

116-129: Passing connectOptions={undefined} drops custom wallet-UI overrides

Previously BridgeOrchestrator accepted and forwarded connect options.
If integrators relied on e.g. walletConnect.deepLink, those props are now silently ignored. Consider forwarding props.payOptions.connectOptions ?? undefined instead.

-  connectOptions={undefined}
+  connectOptions={
+    "connectOptions" in props.payOptions
+      ? (props.payOptions as any).connectOptions
+      : undefined
+  }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 35a909a and f26c56d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (111)
  • .changeset/icy-eyes-show.md (0 hunks)
  • AGENTS.md (1 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/PayModal.tsx (2 hunks)
  • apps/dashboard/src/app/pay/components/client/PayPageEmbed.client.tsx (1 hunks)
  • apps/dashboard/src/components/buttons/MismatchButton.tsx (2 hunks)
  • apps/playground-web/src/app/connect/pay/commerce/page.tsx (1 hunks)
  • apps/playground-web/src/app/connect/pay/components/types.ts (0 hunks)
  • apps/playground-web/src/app/connect/pay/embed/LeftSection.tsx (0 hunks)
  • apps/playground-web/src/app/connect/pay/embed/RightSection.tsx (1 hunks)
  • apps/playground-web/src/app/connect/pay/embed/page.tsx (0 hunks)
  • apps/playground-web/src/components/pay/direct-payment.tsx (0 hunks)
  • packages/thirdweb/knip.json (1 hunks)
  • packages/thirdweb/package.json (0 hunks)
  • packages/thirdweb/src/bridge/Routes.ts (0 hunks)
  • packages/thirdweb/src/bridge/Token.ts (1 hunks)
  • packages/thirdweb/src/bridge/types/BridgeAction.ts (1 hunks)
  • packages/thirdweb/src/bridge/types/Errors.ts (0 hunks)
  • packages/thirdweb/src/pay/buyWithFiat/getQuote.ts (1 hunks)
  • packages/thirdweb/src/pay/convert/cryptoToFiat.ts (2 hunks)
  • packages/thirdweb/src/pay/convert/fiatToCrypto.ts (2 hunks)
  • packages/thirdweb/src/pay/convert/get-token.ts (1 hunks)
  • packages/thirdweb/src/pay/utils/commonTypes.ts (1 hunks)
  • packages/thirdweb/src/react/PRODUCT.md (0 hunks)
  • packages/thirdweb/src/react/TASK_LIST.md (0 hunks)
  • packages/thirdweb/src/react/TECH_SPEC.md (0 hunks)
  • packages/thirdweb/src/react/components.md (0 hunks)
  • packages/thirdweb/src/react/core/adapters/.keep (0 hunks)
  • packages/thirdweb/src/react/core/adapters/WindowAdapter.ts (0 hunks)
  • packages/thirdweb/src/react/core/errors/.keep (0 hunks)
  • packages/thirdweb/src/react/core/errors/mapBridgeError.test.ts (0 hunks)
  • packages/thirdweb/src/react/core/errors/mapBridgeError.ts (0 hunks)
  • packages/thirdweb/src/react/core/hooks/connection/ConnectButtonProps.ts (4 hunks)
  • packages/thirdweb/src/react/core/hooks/others/useChainQuery.ts (1 hunks)
  • packages/thirdweb/src/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.ts (0 hunks)
  • packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts (1 hunks)
  • packages/thirdweb/src/react/core/hooks/useBridgeError.test.ts (0 hunks)
  • packages/thirdweb/src/react/core/hooks/useBridgeError.ts (0 hunks)
  • packages/thirdweb/src/react/core/hooks/useBridgePrepare.test.ts (0 hunks)
  • packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (0 hunks)
  • packages/thirdweb/src/react/core/hooks/useBridgeQuote.ts (0 hunks)
  • packages/thirdweb/src/react/core/hooks/useBridgeRoutes.test.ts (0 hunks)
  • packages/thirdweb/src/react/core/hooks/useBridgeRoutes.ts (0 hunks)
  • packages/thirdweb/src/react/core/hooks/usePaymentMethods.test.ts (0 hunks)
  • packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts (0 hunks)
  • packages/thirdweb/src/react/core/hooks/useStepExecutor.test.ts (0 hunks)
  • packages/thirdweb/src/react/core/hooks/useStepExecutor.ts (0 hunks)
  • packages/thirdweb/src/react/core/hooks/useTransactionDetails.ts (0 hunks)
  • packages/thirdweb/src/react/core/hooks/wallets/useAutoConnectCore.test.tsx (1 hunks)
  • packages/thirdweb/src/react/core/machines/.keep (0 hunks)
  • packages/thirdweb/src/react/core/machines/paymentMachine.test.ts (0 hunks)
  • packages/thirdweb/src/react/core/machines/paymentMachine.ts (0 hunks)
  • packages/thirdweb/src/react/core/types/.keep (0 hunks)
  • packages/thirdweb/src/react/core/utils/wallet.test.ts (0 hunks)
  • packages/thirdweb/src/react/native/flows/.keep (0 hunks)
  • packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (0 hunks)
  • packages/thirdweb/src/react/web/adapters/adapters.test.ts (0 hunks)
  • packages/thirdweb/src/react/web/flows/.keep (0 hunks)
  • packages/thirdweb/src/react/web/hooks/transaction/useSendTransaction.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/common/TokenAndChain.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/common/TokenBalanceRow.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/FiatProviderSelection.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/WalletFiatSelection.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-success/PaymentReceipt.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Details.test.tsx (2 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/WalletSelector.tsx (1 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/constants.ts (1 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/icons/CreditCardIcon.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx (2 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.tsx (1 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.ts (2 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/FiatValue.tsx (1 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.tsx (2 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/screens/formatTokenBalance.ts (0 hunks)
  • packages/thirdweb/src/react/web/ui/PayEmbed.tsx (4 hunks)
  • packages/thirdweb/src/react/web/ui/TransactionButton/DepositScreen.tsx (3 hunks)
  • packages/thirdweb/src/react/web/ui/TransactionButton/ExecutingScreen.tsx (4 hunks)
  • packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx (2 hunks)
  • packages/thirdweb/src/react/web/ui/components/ChainName.tsx (2 hunks)
  • packages/thirdweb/src/react/web/ui/components/TokenIcon.tsx (2 hunks)
  • packages/thirdweb/src/react/web/ui/components/buttons.tsx (4 hunks)
  • packages/thirdweb/src/stories/Bridge/BridgeOrchestrator.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/Bridge/fixtures.ts (0 hunks)
  • packages/thirdweb/src/stories/TokenBalanceRow.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/WalletRow.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/utils.tsx (0 hunks)
  • packages/thirdweb/src/wallets/connection/autoConnectCore.test.ts (1 hunks)
💤 Files with no reviewable changes (77)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.tsx
  • apps/playground-web/src/app/connect/pay/embed/page.tsx
  • apps/playground-web/src/components/pay/direct-payment.tsx
  • packages/thirdweb/src/react/core/errors/.keep
  • packages/thirdweb/src/bridge/types/Errors.ts
  • packages/thirdweb/src/react/native/flows/.keep
  • packages/thirdweb/src/react/core/adapters/.keep
  • packages/thirdweb/package.json
  • .changeset/icy-eyes-show.md
  • packages/thirdweb/src/react/core/machines/.keep
  • packages/thirdweb/src/react/core/types/.keep
  • packages/thirdweb/src/react/web/hooks/transaction/useSendTransaction.tsx
  • packages/thirdweb/src/react/web/flows/.keep
  • apps/playground-web/src/app/connect/pay/components/types.ts
  • packages/thirdweb/src/react/core/adapters/WindowAdapter.ts
  • apps/playground-web/src/app/connect/pay/embed/LeftSection.tsx
  • packages/thirdweb/src/react/web/adapters/adapters.test.ts
  • packages/thirdweb/src/react/core/hooks/useBridgePrepare.test.ts
  • packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/common/TokenBalanceRow.tsx
  • packages/thirdweb/src/react/web/ui/ConnectWallet/icons/CreditCardIcon.tsx
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx
  • packages/thirdweb/src/react/core/errors/mapBridgeError.ts
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
  • packages/thirdweb/src/react/core/hooks/useBridgeError.ts
  • packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx
  • packages/thirdweb/src/react/core/hooks/useStepExecutor.test.ts
  • packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx
  • packages/thirdweb/src/bridge/Routes.ts
  • packages/thirdweb/src/stories/utils.tsx
  • packages/thirdweb/src/react/core/errors/mapBridgeError.test.ts
  • packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx
  • packages/thirdweb/src/react/core/hooks/useBridgeRoutes.test.ts
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx
  • packages/thirdweb/src/react/core/utils/wallet.test.ts
  • packages/thirdweb/src/react/components.md
  • packages/thirdweb/src/react/core/hooks/useBridgeQuote.ts
  • packages/thirdweb/src/stories/TokenBalanceRow.stories.tsx
  • packages/thirdweb/src/react/web/ui/ConnectWallet/screens/formatTokenBalance.ts
  • packages/thirdweb/src/stories/WalletRow.stories.tsx
  • packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx
  • packages/thirdweb/src/react/core/hooks/useBridgeError.test.ts
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/FiatProviderSelection.tsx
  • packages/thirdweb/src/react/core/machines/paymentMachine.test.ts
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx
  • packages/thirdweb/src/react/core/hooks/useBridgeRoutes.ts
  • packages/thirdweb/src/react/PRODUCT.md
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx
  • packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx
  • packages/thirdweb/src/react/core/hooks/useTransactionDetails.ts
  • packages/thirdweb/src/react/core/hooks/usePaymentMethods.test.ts
  • packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts
  • packages/thirdweb/src/react/TECH_SPEC.md
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
  • packages/thirdweb/src/stories/Bridge/BridgeOrchestrator.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/WalletFiatSelection.tsx
  • packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx
  • packages/thirdweb/src/react/core/hooks/pay/useBuyWithFiatQuotesForProviders.ts
  • packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx
  • packages/thirdweb/src/react/web/adapters/WindowAdapter.ts
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx
  • packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx
  • packages/thirdweb/src/react/core/hooks/useStepExecutor.ts
  • packages/thirdweb/src/stories/Bridge/fixtures.ts
  • packages/thirdweb/src/react/web/ui/Bridge/common/TokenAndChain.tsx
  • packages/thirdweb/src/react/core/machines/paymentMachine.ts
  • packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx
  • packages/thirdweb/src/react/TASK_LIST.md
  • packages/thirdweb/src/react/web/ui/Bridge/payment-success/PaymentReceipt.tsx
🧰 Additional context used
🧬 Code Graph Analysis (5)
packages/thirdweb/src/pay/convert/cryptoToFiat.ts (1)
packages/thirdweb/src/pay/convert/get-token.ts (1)
  • getTokenPrice (5-24)
packages/thirdweb/src/react/web/ui/components/TokenIcon.tsx (1)
packages/thirdweb/src/react/core/hooks/others/useChainQuery.ts (1)
  • useChainIconUrl (37-59)
packages/thirdweb/src/pay/convert/fiatToCrypto.ts (1)
packages/thirdweb/src/pay/convert/get-token.ts (1)
  • getTokenPrice (5-24)
packages/thirdweb/src/react/web/ui/TransactionButton/ExecutingScreen.tsx (1)
packages/thirdweb/src/react/web/ui/components/buttons.tsx (2)
  • Button (19-144)
  • ButtonLink (146-146)
packages/thirdweb/src/react/core/hooks/connection/ConnectButtonProps.ts (2)
packages/thirdweb/src/bridge/index.ts (1)
  • Chain (12-12)
packages/thirdweb/src/exports/react.ts (1)
  • TokenInfo (30-30)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Unit Tests
  • GitHub Check: Size
  • GitHub Check: Lint Packages
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (30)
packages/thirdweb/src/react/web/ui/ConnectWallet/WalletSelector.tsx (1)

702-703: Approve visual tweak to ShowAllWalletsIcon size.

Updating from iconSize.lg to iconSize.xl aligns with the new design emphasis and maintains consistency with the design system’s extra-large sizing. No further changes needed here.

packages/thirdweb/knip.json (1)

7-7: Verify updated entry list
Ensure that the added "src/transaction/actions/send-batch-transaction.ts" file exists and should be tracked by knip, and confirm that the "src/react/core/hooks/useBridgeRoutes.ts" entry was removed as intended.

#!/bin/bash
# Confirm the new entry file exists
fd send-batch-transaction.ts

# Ensure no lingering references to useBridgeRoutes
rg -l "useBridgeRoutes" .
packages/thirdweb/src/react/web/ui/components/ChainName.tsx (2)

21-24: Loss of color / style overrides may be a breaking change

<Text> previously accepted forwarded styling props; callers that relied on custom colors or inline styles will silently break. Verify all usages of <ChainName> across the app and docs before merging.


11-16: ```shell
#!/bin/bash

Search for the ChainName component definition and any usage of 'client' in it

rg -n "export const ChainName" packages/thirdweb/src/react/web/ui/components/ChainName.tsx
rg -n "client" packages/thirdweb/src/react/web/ui/components/ChainName.tsx


</details>
<details>
<summary>packages/thirdweb/src/react/web/ui/ConnectWallet/constants.ts (1)</summary>

`8-8`: **Verify downstream impact of shrinking the compact-modal width**

`modalMaxWidthCompact` drops from `400px` to `360px`. Check the more densely-packed screens (e.g. wallet lists, error states) on small break-points – a 10% reduction can push long labels/warnings to two lines or clip buttons.

If the new width is intentional, no action needed. Otherwise, consider keeping 400 px or auditing individual layouts before release.

</details>
<details>
<summary>apps/playground-web/src/app/connect/pay/commerce/page.tsx (1)</summary>

`66-68`: **Sample code still compiles – looks good**

Switching to `{ name, image }` mirrors the metadata type simplification, and the trailing comma is fine inside a TSX string literal.

</details>
<details>
<summary>packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx (1)</summary>

`27-27`: **Import path sanity-check**

`SupportedTokens` now comes from `core/utils/defaultTokens`.  Make sure the re-export exists after the bridge files were removed; otherwise the build will break silently with an unresolved module.

</details>
<details>
<summary>packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.ts (1)</summary>

`70-74`: **Initial state may still be `undefined`**

Same issue as above: the ternary chain can still yield `undefined` before falling back to `NATIVE_TOKEN` if *all* other branches are falsy. Verify this always resolves to a valid token.

</details>
<details>
<summary>packages/thirdweb/src/pay/convert/cryptoToFiat.ts (1)</summary>

`76-82`: ```shell
#!/bin/bash
set -e
# Find Token.* files under bridge directory and display their contents
echo "Searching for Token files in packages/thirdweb/src/bridge..."
find packages/thirdweb/src/bridge -maxdepth 1 -type f \( -iname "Token.ts" -o -iname "Token.js" \) -print -exec sed -n '1,200p' {} \;
packages/thirdweb/src/react/web/ui/components/TokenIcon.tsx (1)

7-7: Import switch looks good

Switching to useChainIconUrl mirrors the new hook name and keeps concerns local. No issues spotted.

packages/thirdweb/src/pay/convert/get-token.ts (1)

5-18: Add an explicit return type and fail fast when price is missing

getTokenPrice currently relies on type inference and silently returns undefined when the bridge API doesn’t have a price for the token.

  1. Explicitly annotating the return type improves DX and prevents implicit any/loose unknown leaks.
  2. Failing fast (throw or reject) makes downstream math (Number(price), comparisons, etc.) safer than propagating undefined.
-export async function getTokenPrice(
-  client: ThirdwebClient,
-  tokenAddress: string,
-  chainId: number,
-) {
+export async function getTokenPrice(
+  client: ThirdwebClient,
+  tokenAddress: string,
+  chainId: number,
+): Promise<number> {
   return withCache(
     async () => {
       const result = await tokens({
@@
-      return result[0]?.priceUsd;
+      const price = result[0]?.priceUsd;
+      if (price === undefined) {
+        throw new Error(
+          `Price for token ${tokenAddress} on chain ${chainId} not found`,
+        );
+      }
+      return price;
     },

Down-stream converters (convertCryptoToFiat, convertFiatToCrypto) will then operate on a guaranteed number.
[ suggest_essential_refactor ]

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.tsx (1)

91-109: ```shell
#!/bin/bash

Show the PaymentInfo type definition

sed -n '1,200p' packages/thirdweb/src/react/core/hooks/connection/ConnectButtonProps.ts

Locate and display the TokenInfo type definition

grep -R "export type TokenInfo" -n packages/thirdweb/src/react/core/utils/defaultTokens.ts
sed -n '1,200p' packages/thirdweb/src/react/core/utils/defaultTokens.ts


</details>
<details>
<summary>packages/thirdweb/src/react/web/ui/TransactionButton/DepositScreen.tsx (1)</summary>

`289-290`: **Radius change – verify clickable hit-area**

Increasing to `radius.lg` is fine, but double-check the resulting CSS doesn’t clip the inside QR code or overflow effects on hover.

</details>
<details>
<summary>packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx (1)</summary>

`16-17`: **`LazyBuyScreen` import path only resolved in web bundle**

Just a heads-up: if the same modal is reused in React-Native/Expo packages, the direct web path may break metro bundler resolution.

</details>
<details>
<summary>packages/thirdweb/src/bridge/Token.ts (1)</summary>

`161-161`: ```shell
#!/bin/bash
# Re-scan for any lingering `.add(` calls in TS/JS files using glob patterns
rg --pretty '\.add\(' --glob '*.{ts,tsx,js}'
packages/thirdweb/src/react/web/ui/TransactionButton/ExecutingScreen.tsx (5)

1-1: LGTM!

The icon import change aligns with the simplified success state UI.


14-14: LGTM!

Adding ButtonLink import is appropriate for the explorer link implementation.


69-76: LGTM!

The simplified success state UI maintains the visual feedback while reducing complexity.


78-78: LGTM!

The increased vertical spacing improves the visual hierarchy of the UI.

Also applies to: 90-90


100-102: LGTM!

Placing the primary "Done" action first follows UX best practices.

packages/thirdweb/src/react/web/ui/PayEmbed.tsx (7)

3-3: LGTM!

The updated imports reflect the simplified architecture using connection management hooks.

Also applies to: 12-24


311-321: LGTM!

The simplified state management and centralized connection handling improve maintainability.


323-340: LGTM!

The effects properly handle chain definitions and active wallet management with correct dependencies.


342-346: LGTM!

Safe metadata extraction with proper type checking.


347-360: LGTM!

Clean loading state implementation with proper styling.


361-410: LGTM!

The simplified payment flow with clear screen transitions improves code clarity and maintainability.


207-208: Minor formatting change

packages/thirdweb/src/react/core/hooks/connection/ConnectButtonProps.ts (3)

28-61: LGTM!

Using the full TokenInfo type improves type safety while maintaining backward compatibility.


81-81: LGTM!

The type changes improve type safety by:

  • Using full TokenInfo type instead of partial
  • Making the onPurchaseSuccess callback parameter required, enforcing proper handling

Also applies to: 117-132


163-163: LGTM!

Consistent use of TokenInfo type across all payment-related interfaces.

Comment on lines +52 to 53
setToToken(prefillBuy.token);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Type-safety regression in setToToken call

setToToken(prefillBuy.token) is executed unguarded.
If prefillBuy.token is undefined, the state setter receives undefined while the hook’s state is declared as ERC20OrNativeToken (non-nullable), producing a runtime type hole.

Quick guard:

-if (prefillBuy?.token) {
-  setToToken(prefillBuy.token);
-}
+if (prefillBuy?.token) {
+  setToToken(prefillBuy.token);
+}

(or widen the state type to include undefined).

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.ts
at lines 52-53, the call to setToToken(prefillBuy.token) is unguarded and may
pass undefined to a state declared as non-nullable ERC20OrNativeToken, causing a
runtime type error. Fix this by adding a guard to ensure prefillBuy.token is
defined before calling setToToken, or alternatively, update the state type to
allow undefined if that fits the logic.

Comment on lines +46 to 47
${formatNumber(cryptoToFiatQuery.data.result, 2).toFixed(2)}
</Text>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Potential runtime error: formatNumber(...).toFixed

formatNumber typically returns a string (naming + previous usages).
Calling .toFixed() on a string will throw. If formatNumber already returns a formatted string, just drop the extra call:

- ${formatNumber(cryptoToFiatQuery.data.result, 2).toFixed(2)}
+ ${formatNumber(cryptoToFiatQuery.data.result, 2)}

If it does return a number, keep toFixed and remove formatNumber. Please reconcile and add a unit test.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
${formatNumber(cryptoToFiatQuery.data.result, 2).toFixed(2)}
</Text>
${formatNumber(cryptoToFiatQuery.data.result, 2)}
</Text>
🤖 Prompt for AI Agents
In
packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/FiatValue.tsx
around lines 46 to 47, the code calls toFixed() on the result of formatNumber,
which likely returns a string, causing a runtime error. Verify the return type
of formatNumber; if it returns a string, remove the toFixed() call and use
formatNumber directly. If it returns a number, remove formatNumber and apply
toFixed(2) directly on the number. Update the code accordingly and add a unit
test to cover this formatting behavior.

Comment on lines +75 to +81
const price = await getTokenPrice(client, to, chain.id);
if (!price || price === 0) {
throw new Error(
`Error: Failed to fetch price for token ${to} on chainId: ${chain.id}`,
);
}
return { result: fromAmount / token.priceUsd };
return { result: fromAmount / price };
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Explicitly coerce price to a finite number before division

If getTokenPrice ever yields a string or non-finite value, fromAmount / price will explode with Infinity or NaN. Coercing & validating once keeps the math safe.

-  const price = await getTokenPrice(client, to, chain.id);
+  const rawPrice = await getTokenPrice(client, to, chain.id);
+  const price =
+    typeof rawPrice === "string" ? Number.parseFloat(rawPrice) : rawPrice;

Consider replacing the current !price || price === 0 guard with
if (!Number.isFinite(price) || price === 0) for robustness.

🤖 Prompt for AI Agents
In packages/thirdweb/src/pay/convert/fiatToCrypto.ts around lines 75 to 81, the
current check for price uses !price || price === 0, which does not guard against
non-finite values or strings. Update the condition to explicitly coerce price to
a number and check if it is finite using Number.isFinite(price) and also check
for zero. This ensures that the division fromAmount / price is safe and avoids
Infinity or NaN results.

Comment on lines +106 to +123
<ButtonLink
fullWidth
onClick={() => {
props.windowAdapter.open(
formatExplorerTxUrl(
chainExplorers.explorers[0]?.url ?? "",
txHash,
),
);
}}
variant="outline"
href={formatExplorerTxUrl(
chainExplorers.explorers[0]?.url ?? "",
txHash,
)}
target="_blank"
as="a"
gap="xs"
color="primaryText"
style={{
textDecoration: "none",
color: "inherit",
}}
>
View on Explorer
<ExternalLinkIcon width={iconSize.sm} height={iconSize.sm} />
</Button>
<Spacer y="sm" />
</ButtonLink>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add security attributes for external links

When using target="_blank", add rel="noopener noreferrer" to prevent potential security vulnerabilities.

Apply this diff to add the security attributes:

              <ButtonLink
                fullWidth
                variant="outline"
                href={formatExplorerTxUrl(
                  chainExplorers.explorers[0]?.url ?? "",
                  txHash,
                )}
                target="_blank"
+               rel="noopener noreferrer"
                as="a"
                gap="xs"
                style={{
                  textDecoration: "none",
                  color: "inherit",
                }}
              >
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<ButtonLink
fullWidth
onClick={() => {
props.windowAdapter.open(
formatExplorerTxUrl(
chainExplorers.explorers[0]?.url ?? "",
txHash,
),
);
}}
variant="outline"
href={formatExplorerTxUrl(
chainExplorers.explorers[0]?.url ?? "",
txHash,
)}
target="_blank"
as="a"
gap="xs"
color="primaryText"
style={{
textDecoration: "none",
color: "inherit",
}}
>
View on Explorer
<ExternalLinkIcon width={iconSize.sm} height={iconSize.sm} />
</Button>
<Spacer y="sm" />
</ButtonLink>
<ButtonLink
fullWidth
variant="outline"
href={formatExplorerTxUrl(
chainExplorers.explorers[0]?.url ?? "",
txHash,
)}
target="_blank"
rel="noopener noreferrer"
as="a"
gap="xs"
style={{
textDecoration: "none",
color: "inherit",
}}
>
View on Explorer
<ExternalLinkIcon width={iconSize.sm} height={iconSize.sm} />
</ButtonLink>
🤖 Prompt for AI Agents
In packages/thirdweb/src/react/web/ui/TransactionButton/ExecutingScreen.tsx
between lines 106 and 123, the ButtonLink component uses target="_blank" for
opening external links but lacks the rel="noopener noreferrer" attribute. To fix
this, add rel="noopener noreferrer" to the ButtonLink component to enhance
security by preventing the new page from accessing the window.opener property
and to avoid potential phishing attacks.

Copy link
Contributor

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 62.44 KB (-0.1% 🔽) 1.3 s (-0.1% 🔽) 231 ms (+182.68% 🔺) 1.5 s
thirdweb (cjs) 350.62 KB (-0.08% 🔽) 7.1 s (-0.08% 🔽) 693 ms (+10.44% 🔺) 7.8 s
thirdweb (minimal + tree-shaking) 5.7 KB (0%) 114 ms (0%) 102 ms (+2333.34% 🔺) 216 ms
thirdweb/chains (tree-shaking) 531 B (0%) 11 ms (0%) 60 ms (+4118.78% 🔺) 71 ms
thirdweb/react (minimal + tree-shaking) 19.59 KB (0%) 392 ms (0%) 112 ms (+872.66% 🔺) 504 ms

@gregfromstl gregfromstl merged commit 5ce8a56 into main Jun 16, 2025
24 of 25 checks passed
@gregfromstl gregfromstl deleted the greg/revert-new-pay-ui branch June 16, 2025 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dashboard Involves changes to the Dashboard. packages Playground Changes involving the Playground codebase. SDK Involves changes to the thirdweb SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant