Skip to content

[SDK] Chore: Remove onrampTokenAddress set to ETH #7441

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

Conversation

gregfromstl
Copy link
Member

@gregfromstl gregfromstl commented Jun 25, 2025

We no longer need to force onramping to ETH with the new native fee abstractions. Apps that might need to onramp to a multi-hop route with IAWs should use gas sponsorship.


PR-Codex overview

This PR focuses on enhancing the payment widgets in the thirdweb library by implementing various fixes, improving user experience, and refining the handling of onramp and bridge transactions.

Detailed summary

  • Added an extra second delay for RPC in useStepExecutor.ts.
  • Updated text rendering in StepRunner.tsx to capitalize the onramp request.
  • Handled no quotes available scenario in FiatProviderSelection.tsx.
  • Removed default NATIVE_TOKEN_ADDRESS in getQuote.ts.
  • Defined chain in transaction mapping in Onramp.ts.
  • Adjusted QuoteLoader.tsx to remove unused NATIVE_TOKEN_ADDRESS.
  • Introduced chainsQuery and chainsMetadata in PaymentDetails.tsx to enhance data handling.
  • Improved display logic for token swaps and bridge transactions in PaymentDetails.tsx.

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

Summary by CodeRabbit

  • New Features
    • Improved onramp step display with dynamic, formatted text replacing placeholder labels.
    • Added user notification when no fiat payment quotes are available.
  • Bug Fixes
    • Fixed payment widget issues with important patches.
    • Added delay to improve transaction state updates after approvals.
  • Enhancements
    • Enhanced transaction data with detailed chain and client information.
    • Removed default token fallback for onramp payments to ensure accurate token handling.
    • Updated payment step details to clearly differentiate between swap and bridge actions with chain context.

@gregfromstl gregfromstl requested review from a team as code owners June 25, 2025 20:04
Copy link

linear bot commented Jun 25, 2025

Copy link

changeset-bot bot commented Jun 25, 2025

🦋 Changeset detected

Latest commit: e9a7773

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
thirdweb Patch
@thirdweb-dev/nebula Patch
@thirdweb-dev/wagmi-adapter Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link

vercel bot commented Jun 25, 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 25, 2025 9:21pm
nebula ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 25, 2025 9:21pm
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 25, 2025 9:21pm
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 25, 2025 9:21pm
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 25, 2025 9:21pm

Copy link
Contributor

coderabbitai bot commented Jun 25, 2025

## Walkthrough

This change removes the automatic fallback to `NATIVE_TOKEN_ADDRESS` for the `onrampTokenAddress` parameter in both the backend logic and UI layer. Now, `onrampTokenAddress` is passed as-is, without substituting a default value when undefined or null. Additionally, the StepRunner component's onramp step text was updated to dynamically capitalize the onramp identifier. The onramp transactions are enriched with chain details and client reference, and a delay was added after transaction approval to allow RPC state update. A new UI message was added for when all quote queries fail.

## Changes

| Files                                                                 | Change Summary                                                                                  |
|-----------------------------------------------------------------------|-------------------------------------------------------------------------------------------------|
| packages/thirdweb/src/pay/buyWithFiat/getQuote.ts                     | Removed fallback to `NATIVE_TOKEN_ADDRESS` for `onrampTokenAddress` in `prepareOnramp` call.    |
| packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx             | Removed import and usage of `NATIVE_TOKEN_ADDRESS` for `onrampTokenAddress` in bridge params.   |
| packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx              | Changed onramp step text from static "TEST" to dynamic capitalized `request.onramp` string.     |
| packages/thirdweb/src/bridge/Onramp.ts                                | Added `chain` and `client` properties to each onramp transaction by using `defineChain`.       |
| packages/thirdweb/src/react/core/hooks/useStepExecutor.ts             | Added 1-second delay after approval/fee tx receipt to allow RPC node state update.              |
| packages/thirdweb/src/react/web/ui/Bridge/payment-selection/FiatProviderSelection.tsx | Added UI message "No quotes available" when all quote queries error out.                        |
| packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx | Enhanced step token and chain name display to distinguish bridging vs swapping steps.          |
| .changeset/old-bats-love.md                                           | Added patch changeset describing fixes to payment widgets.                                     |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant UI as QuoteLoader.tsx
    participant Logic as getQuote.ts
    participant Onramp as prepareOnramp
    participant ChainUtil as defineChain
    participant Executor as useStepExecutor

    UI->>Logic: getQuote({ onrampTokenAddress })
    Logic->>Onramp: prepareOnramp({ onrampTokenAddress })
    Onramp->>ChainUtil: defineChain(chainId)
    Onramp->>Onramp: enrich tx with chain and client
    Executor->>Executor: await approval/fee tx receipt
    Executor->>Executor: delay 1 second for RPC update

Possibly related PRs

Suggested reviewers

  • jnsdls

<!-- walkthrough_end -->
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIAbQBlABEAaQBdSABhWHx/LhsSZnwpfgwqZm5ofABrMgBBWlp/RGREElCCSABRaAAJaMgAdzQW7AFmdRp6OTDYD2xWviJ/IgAzChZECPRkW0gMRwFKSAB2ABZTgEYNGFnGWExSFAwJfC8pZH9CiXgMIhmPFY5BhRVq4cS/fgrf6QAAG+FKaHKlRqGHqjWkiBhYXwXV61zgqGw3Fo1A8qDIKkiU3kuFuP1w61o2DE8HhkL2JAGe2okgBJA8Kk2VBZ8MQABpBggGLBICQvPBxhhSdDyFEOkoVmhvKF4WVuD8/h1uj1rgBJDCbEhoWgStDcbjyhg80Uzah+QLYeD+Ep6g0zdbYIgytCQZja+BgbLcPz4PBk56vb4Q021ADqyAAFOaaBQwLVmm1IKmqPbKIgAJ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bIr0bQ0oUQHFMO8EDZpJdR92ZBM4AldlPwh+Wui1vKNcAg7OfofuvlNcQg8w7Q4mXcNl11RlNqiAk1PcCRgUWZLGaqrI8wpBjctpSA8U7IGVWAWVK2OVAlRlyAWsCy/VeJwZmgQxCBq5oxYS4xamSB25WBGx+5eBixhBfRqxNBO5pO+m5N4QyyOxSBuarBHU/2yA7lKwJ5MCNCj8QsL8W0vm6JWCv8uC+CQuRCICigZCEClC0CsCD8384wuAd4pEiAd4uZkcu8tAd4rkssit/N6AVoiZiZpwAArFaAIKcGgGgMcCsMcBcMmccMmQABynArCnACAABshwpwtAKwAAnBcD7cmbQAAMxoAkCnBG1wKQA+0XB+G0Bu0MArAW1u1KCnBp1oBB0W0+20CnA+1B0rCJnHAR0MA+3Aie0+1oAW0MBKAhh3zx2HDJ0R3JlF2J0XC0BB1F3m1p0R2Jlu2l2HAR2nDHAkBW0rDJkl0XCnCJlx3K0R0p1u3F3R3FJm0XAx0W0R1B2JkCAXAMACAMAB1u271B1u3l3HAH0XACCR2L0QCQB73JkMAT0d3H7FJB20AW2h0XB/1u1B3l313l0+2JlJkMDD0R3HD10XAP2PxB323HDl3Jnm3Z090kAR0+0rC12nBu0AOV1YNB0MBB0+0W0720AXA/30DULx1YLqDq20Ca3a2ch0B3hPyK1AA== -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---



<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=thirdweb-dev/js&utm_content=7441):

- 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](https://www.coderabbit.ai/contact-us/support) 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](https://docs.coderabbit.ai/finishing-touches/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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

Copy link
Contributor

graphite-app bot commented Jun 25, 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
Contributor

github-actions bot commented Jun 25, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 62.75 KB (+0.05% 🔺) 1.3 s (+0.05% 🔺) 2.1 s (-17.64% 🔽) 3.3 s
thirdweb (cjs) 351.77 KB (+0.08% 🔺) 7.1 s (+0.08% 🔺) 16.5 s (+5.28% 🔺) 23.5 s
thirdweb (minimal + tree-shaking) 5.72 KB (0%) 115 ms (0%) 228 ms (+69.26% 🔺) 342 ms
thirdweb/chains (tree-shaking) 530 B (0%) 11 ms (0%) 56 ms (-24.04% 🔽) 67 ms
thirdweb/react (minimal + tree-shaking) 19.61 KB (0%) 393 ms (0%) 416 ms (+20.12% 🔺) 808 ms

Fixes TOOL-4871
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: 0

🧹 Nitpick comments (1)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)

325-326: Good improvement! Consider adding safety checks for robustness.

The dynamic capitalization of the onramp identifier is a nice improvement over static text and aligns well with the PR's goal of making the onramp logic more flexible.

However, consider adding safety checks to handle edge cases:

- {request.onramp.slice(0, 1).toUpperCase() +
-   request.onramp.slice(1)}
+ {request.onramp?.slice(0, 1).toUpperCase() + 
+   request.onramp?.slice(1) || 'Onramp'}

Alternatively, you could create a utility function for better maintainability:

const capitalizeFirst = (str: string) => 
  str ? str.charAt(0).toUpperCase() + str.slice(1) : 'Onramp';

// Usage:
{capitalizeFirst(request.onramp)}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between aea2245 and 61fed8c.

📒 Files selected for processing (1)
  • packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.@(ts|tsx)`: Accept a typed 'props' object and export a named function (e.g...

**/*.@(ts|tsx): Accept a typed 'props' object and export a named function (e.g., export function MyComponent()).
Combine class names via 'cn', expose 'className' prop if useful.
Reuse core UI primitives; avoid re-implementing buttons, cards, modals.
Local state or effects live inside; data fetching happens in hooks.
Merge class names with 'cn' from '@/lib/utils' to keep conditional logic readable.
Stick to design-tokens: background ('bg-card'), borders ('border-border'), muted text ('text-muted-foreground') etc.
Use the 'container' class with a 'max-w-7xl' cap for page width consistency.
Spacing utilities ('px-', 'py-', 'gap-*') are preferred over custom margins.
Responsive helpers follow mobile-first ('max-sm', 'md', 'lg', 'xl').
Never hard-code colors – always go through Tailwind variables.
Tailwind CSS is the styling system – avoid inline styles or CSS modules.
Prefix files with 'import "server-only";' so they never end up in the client bundle (for server-only code).

📄 Source: CodeRabbit Inference Engine (.cursor/rules/dashboard.mdc)

List of files the instruction was applied to:

  • packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Unit Tests
  • GitHub Check: Size
  • GitHub Check: Build Packages
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Lint Packages
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Analyze (javascript)

Copy link

codecov bot commented Jun 25, 2025

Codecov Report

Attention: Patch coverage is 5.45455% with 52 lines in your changes missing coverage. Please review.

Project coverage is 51.92%. Comparing base (1387337) to head (e9a7773).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...t/web/ui/Bridge/payment-details/PaymentDetails.tsx 4.87% 39 Missing ⚠️
...Bridge/payment-selection/FiatProviderSelection.tsx 0.00% 7 Missing ⚠️
packages/thirdweb/src/bridge/Onramp.ts 33.33% 2 Missing ⚠️
...es/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx 0.00% 2 Missing ⚠️
packages/thirdweb/src/pay/buyWithFiat/getQuote.ts 0.00% 1 Missing ⚠️
...s/thirdweb/src/react/core/hooks/useStepExecutor.ts 0.00% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (5.45%) 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    #7441      +/-   ##
==========================================
- Coverage   51.96%   51.92%   -0.04%     
==========================================
  Files         947      947              
  Lines       63823    63871      +48     
  Branches     4217     4216       -1     
==========================================
+ Hits        33163    33165       +2     
- Misses      30554    30600      +46     
  Partials      106      106              
Flag Coverage Δ
packages 51.92% <5.45%> (-0.04%) ⬇️
Files with missing lines Coverage Δ
...s/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx 7.14% <ø> (-0.61%) ⬇️
packages/thirdweb/src/pay/buyWithFiat/getQuote.ts 3.89% <0.00%> (ø)
...s/thirdweb/src/react/core/hooks/useStepExecutor.ts 1.90% <0.00%> (-0.01%) ⬇️
packages/thirdweb/src/bridge/Onramp.ts 60.37% <33.33%> (-0.79%) ⬇️
...es/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx 3.90% <0.00%> (-0.03%) ⬇️
...Bridge/payment-selection/FiatProviderSelection.tsx 21.01% <0.00%> (-0.99%) ⬇️
...t/web/ui/Bridge/payment-details/PaymentDetails.tsx 4.20% <4.87%> (+0.16%) ⬆️
🚀 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: 2

🧹 Nitpick comments (1)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)

335-349: Improve readability of Bridge/Swap logic.

The conditional logic for displaying Bridge vs Swap operations could be more readable and maintainable.

Consider extracting this logic into a helper function:

const getStepLabel = (step: typeof preparedQuote.steps[0]) => {
  const isBridge = step.destinationToken.chainId !== step.originToken.chainId;
  
  if (isBridge) {
    const tokensAreSame = step.originToken.symbol === step.destinationToken.symbol;
    return `Bridge ${tokensAreSame ? step.originToken.symbol : `${step.originToken.symbol} to ${step.destinationToken.symbol}`}`;
  }
  
  return `Swap ${step.originToken.symbol} to ${step.destinationToken.symbol}`;
};

Then use it in the JSX:

- {step.destinationToken.chainId !==
- step.originToken.chainId ? (
-   <>
-     Bridge{" "}
-     {step.originToken.symbol ===
-     step.destinationToken.symbol
-       ? step.originToken.symbol
-       : `${step.originToken.symbol} to ${step.destinationToken.symbol}`}
-   </>
- ) : (
-   <>
-     Swap {step.originToken.symbol} to{" "}
-     {step.destinationToken.symbol}
-   </>
- )}
+ {getStepLabel(step)}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 920c7e0 and e9a7773.

📒 Files selected for processing (1)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.@(ts|tsx)`: Accept a typed 'props' object and export a named function (e.g...

**/*.@(ts|tsx): Accept a typed 'props' object and export a named function (e.g., export function MyComponent()).
Combine class names via 'cn', expose 'className' prop if useful.
Reuse core UI primitives; avoid re-implementing buttons, cards, modals.
Local state or effects live inside; data fetching happens in hooks.
Merge class names with 'cn' from '@/lib/utils' to keep conditional logic readable.
Stick to design-tokens: background ('bg-card'), borders ('border-border'), muted text ('text-muted-foreground') etc.
Use the 'container' class with a 'max-w-7xl' cap for page width consistency.
Spacing utilities ('px-', 'py-', 'gap-*') are preferred over custom margins.
Responsive helpers follow mobile-first ('max-sm', 'md', 'lg', 'xl').
Never hard-code colors – always go through Tailwind variables.
Tailwind CSS is the styling system – avoid inline styles or CSS modules.
Prefix files with 'import "server-only";' so they never end up in the client bundle (for server-only code).

📄 Source: CodeRabbit Inference Engine (.cursor/rules/dashboard.mdc)

List of files the instruction was applied to:

  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx
🧬 Code Graph Analysis (1)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
packages/thirdweb/src/react/core/hooks/others/useChainQuery.ts (1)
  • useChainsQuery (182-196)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Size
  • GitHub Check: Build Packages
  • GitHub Check: Lint Packages
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Unit Tests
  • GitHub Check: Analyze (javascript)

Comment on lines +335 to +376
{step.destinationToken.chainId !==
step.originToken.chainId ? (
<>
Bridge{" "}
{step.originToken.symbol ===
step.destinationToken.symbol
? step.originToken.symbol
: `${step.originToken.symbol} to ${step.destinationToken.symbol}`}
</>
) : (
<>
Swap {step.originToken.symbol} to{" "}
{step.destinationToken.symbol}
</>
)}
</Text>
<Text color="secondaryText" size="xs">
{step.originToken.name} to{" "}
{step.destinationToken.name}
{step.originToken.chainId !==
step.destinationToken.chainId ? (
<>
{
chainsMetadata.find(
(c) => c.chainId === step.originToken.chainId,
)?.name
}{" "}
to{" "}
{
chainsMetadata.find(
(c) =>
c.chainId === step.destinationToken.chainId,
)?.name
}
</>
) : (
<>
{
chainsMetadata.find(
(c) => c.chainId === step.originToken.chainId,
)?.name
}
</>
)}
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

Add fallback handling for missing chain metadata.

The code assumes chain metadata will always be available when rendering, but during loading or error states, chainsMetadata.find() might return undefined, causing the chain names to not display.

Apply this diff to add fallback handling:

                            <>
                              {
-                               chainsMetadata.find(
-                                 (c) => c.chainId === step.originToken.chainId,
-                               )?.name
+                               chainsMetadata.find(
+                                 (c) => c.chainId === step.originToken.chainId,
+                               )?.name ?? `Chain ${step.originToken.chainId}`
                              }{" "}
                              to{" "}
                              {
-                               chainsMetadata.find(
-                                 (c) =>
-                                   c.chainId === step.destinationToken.chainId,
-                               )?.name
+                               chainsMetadata.find(
+                                 (c) =>
+                                   c.chainId === step.destinationToken.chainId,
+                               )?.name ?? `Chain ${step.destinationToken.chainId}`
                              }
                            </>
                          ) : (
                            <>
                              {
-                               chainsMetadata.find(
-                                 (c) => c.chainId === step.originToken.chainId,
-                               )?.name
+                               chainsMetadata.find(
+                                 (c) => c.chainId === step.originToken.chainId,
+                               )?.name ?? `Chain ${step.originToken.chainId}`
                              }
                            </>
                          )}

This ensures users see meaningful information even when chain metadata is still loading or failed to load.

📝 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
{step.destinationToken.chainId !==
step.originToken.chainId ? (
<>
Bridge{" "}
{step.originToken.symbol ===
step.destinationToken.symbol
? step.originToken.symbol
: `${step.originToken.symbol} to ${step.destinationToken.symbol}`}
</>
) : (
<>
Swap {step.originToken.symbol} to{" "}
{step.destinationToken.symbol}
</>
)}
</Text>
<Text color="secondaryText" size="xs">
{step.originToken.name} to{" "}
{step.destinationToken.name}
{step.originToken.chainId !==
step.destinationToken.chainId ? (
<>
{
chainsMetadata.find(
(c) => c.chainId === step.originToken.chainId,
)?.name
}{" "}
to{" "}
{
chainsMetadata.find(
(c) =>
c.chainId === step.destinationToken.chainId,
)?.name
}
</>
) : (
<>
{
chainsMetadata.find(
(c) => c.chainId === step.originToken.chainId,
)?.name
}
</>
)}
<Text color="secondaryText" size="xs">
{step.originToken.chainId !==
step.destinationToken.chainId ? (
<>
{
chainsMetadata.find(
(c) => c.chainId === step.originToken.chainId,
)?.name ?? `Chain ${step.originToken.chainId}`
}{" "}
to{" "}
{
chainsMetadata.find(
(c) =>
c.chainId === step.destinationToken.chainId,
)?.name ?? `Chain ${step.destinationToken.chainId}`
}
</>
) : (
<>
{
chainsMetadata.find(
(c) => c.chainId === step.originToken.chainId,
)?.name ?? `Chain ${step.originToken.chainId}`
}
</>
)}
</Text>
🤖 Prompt for AI Agents
In packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx
between lines 335 and 376, the code assumes chainsMetadata.find() always returns
a valid object, but it can be undefined during loading or error states, causing
chain names not to display. To fix this, add fallback values such as a
placeholder string like "Unknown Chain" or the chainId itself when the find
returns undefined, ensuring meaningful information is shown even if metadata is
missing.

Comment on lines +107 to +114
const chainsQuery = useChainsQuery(
preparedQuote.steps.flatMap((s) => s.transactions.map((t) => t.chain)),
10,
);
const chainsMetadata = useMemo(
() => chainsQuery.map((c) => c.data),
[chainsQuery],
).filter((c) => !!c);
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

Optimize chain extraction and improve error handling.

The chain extraction logic runs on every render, which could impact performance. Additionally, there's no error handling for failed chain queries, and the memoization dependency could be improved.

Apply this diff to optimize performance and add error handling:

+ const chainList = useMemo(
+   () => preparedQuote.steps.flatMap((s) => s.transactions.map((t) => t.chain)),
+   [preparedQuote.steps],
+ );
+ 
- const chainsQuery = useChainsQuery(
-   preparedQuote.steps.flatMap((s) => s.transactions.map((t) => t.chain)),
-   10,
- );
+ const chainsQuery = useChainsQuery(chainList, 10);
+ 
  const chainsMetadata = useMemo(
-   () => chainsQuery.map((c) => c.data),
-   [chainsQuery],
+ () => chainsQuery.map((c) => c.data).filter((c) => !!c),
+ [chainsQuery.map(q => q.data)],
- ).filter((c) => !!c);
+ );
+ 
+ const hasChainErrors = chainsQuery.some((q) => q.error);
+ const isLoadingChains = chainsQuery.some((q) => q.isLoading);

Consider adding error handling or fallback behavior when hasChainErrors is true.

📝 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
const chainsQuery = useChainsQuery(
preparedQuote.steps.flatMap((s) => s.transactions.map((t) => t.chain)),
10,
);
const chainsMetadata = useMemo(
() => chainsQuery.map((c) => c.data),
[chainsQuery],
).filter((c) => !!c);
const chainList = useMemo(
() => preparedQuote.steps.flatMap((s) => s.transactions.map((t) => t.chain)),
[preparedQuote.steps],
);
const chainsQuery = useChainsQuery(chainList, 10);
const chainsMetadata = useMemo(
() => chainsQuery.map((c) => c.data).filter((c) => !!c),
[chainsQuery.map((q) => q.data)],
);
const hasChainErrors = chainsQuery.some((q) => q.error);
const isLoadingChains = chainsQuery.some((q) => q.isLoading);
🤖 Prompt for AI Agents
In packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx
around lines 107 to 114, the chain extraction logic runs on every render causing
potential performance issues, and there is no error handling for failed chain
queries. To fix this, memoize the array of chains extracted from
preparedQuote.steps to avoid recalculating on each render, improve the useMemo
dependency to depend on this memoized array, and add error handling logic to
detect if any chain queries have errors (e.g., a hasChainErrors flag) and
provide fallback behavior or error messages accordingly.

@gregfromstl gregfromstl merged commit 6712911 into main Jun 25, 2025
23 of 24 checks passed
@gregfromstl gregfromstl deleted the greg/tool-4872-remove-eth-onramptokenaddress-from-sdk branch June 25, 2025 21:22
@joaquim-verges joaquim-verges mentioned this pull request Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages SDK Involves changes to the thirdweb SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant