Skip to content

[SDK] Feature: Hide the TransactionWidget contract label if unknown #7642

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
Jul 17, 2025

Conversation

gregfromstl
Copy link
Member

@gregfromstl gregfromstl commented Jul 17, 2025


PR-Codex overview

This PR updates the TransactionWidget component to hide the "UnknownContract" label when the contract name is either "UnknownContract", "Unknown Contract", or undefined.

Detailed summary

  • Modified the rendering logic of the contract information in TransactionPayment.tsx.
  • Added conditional rendering to prevent displaying the contract details if the contractName is "UnknownContract", "Unknown Contract", or undefined.

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

Summary by CodeRabbit

  • Bug Fixes
    • The "UnknownContract" label is no longer displayed in the contract information section of the transaction interface, providing a cleaner user experience.

@gregfromstl gregfromstl requested review from a team as code owners July 17, 2025 23:01
Copy link

changeset-bot bot commented Jul 17, 2025

🦋 Changeset detected

Latest commit: e86968a

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 Jul 17, 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 Jul 17, 2025 11:19pm
nebula ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 17, 2025 11:19pm
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 17, 2025 11:19pm
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 17, 2025 11:19pm
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 17, 2025 11:19pm

Copy link
Contributor

coderabbitai bot commented Jul 17, 2025

Walkthrough

A changeset entry was added documenting a UI update in the TransactionWidget component. The main code change updates the "Contract Info" section in the transaction payment UI to only display the contract name if it is neither "UnknownContract", "Unknown Contract", nor undefined.

Changes

File(s) Change Summary
.changeset/whole-bottles-wait.md Added changeset entry describing the UI update to hide "UnknownContract" in the contract label.
packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx Updated rendering logic to conditionally show contract name only if it is a valid, known value.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TransactionWidget
    participant UI

    User->>TransactionWidget: Initiate transaction
    TransactionWidget->>UI: Render "Contract Info" section
    alt contractName is valid and known
        UI-->>User: Display contract name
    else contractName is "UnknownContract", "Unknown Contract", or undefined
        UI-->>User: Hide contract name section
    end
Loading

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 Jul 17, 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.

@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Jul 17, 2025
@gregfromstl gregfromstl force-pushed the greg/hide-unknown-contract-label branch from 653f049 to e86968a Compare July 17, 2025 23:01
@gregfromstl gregfromstl added the merge-queue Adds the pull request to Graphite's merge queue. label Jul 17, 2025
Copy link
Member Author

Merge activity

  • Jul 17, 11:02 PM UTC: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.

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/TransactionPayment.tsx (1)

215-236: Consider using a more maintainable approach for the conditional rendering.

The conditional logic correctly implements the feature requirement, but it could be more maintainable and readable.

Consider using an array of invalid contract names for better maintainability:

+const invalidContractNames = ["UnknownContract", "Unknown Contract"];
+
 {/* Contract Info */}
-{contractName !== "UnknownContract" &&
-  contractName !== undefined &&
-  contractName !== "Unknown Contract" && (
+{contractName && !invalidContractNames.includes(contractName) && (
   <>
     <Container
       flex="row"
       style={{
         alignItems: "center",
         justifyContent: "space-between",
       }}
     >
       <Text color="secondaryText" size="sm">
         Contract
       </Text>
       <Text color="primaryText" size="sm">
         {contractName}
       </Text>
     </Container>

     <Spacer y="xs" />
   </>
 )}

This approach makes it easier to add new invalid contract names in the future and is more readable.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 61bfebf and e86968a.

📒 Files selected for processing (2)
  • .changeset/whole-bottles-wait.md (1 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • CLAUDE.md
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.488Z
Learning: Surface breaking changes prominently in PR descriptions
.changeset/whole-bottles-wait.md (3)
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.488Z
Learning: Surface breaking changes prominently in PR descriptions
Learnt from: MananTank
PR: thirdweb-dev/js#7332
File: apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/nft/overview/nft-drop-claim.tsx:82-90
Timestamp: 2025-06-13T13:03:41.732Z
Learning: The thirdweb `contract` object is serializable and can safely be used in contexts (e.g., React-Query keys) that require serializable values.
Learnt from: MananTank
PR: thirdweb-dev/js#7227
File: apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components/OpenEditionMetadata.tsx:26-26
Timestamp: 2025-05-30T17:14:25.332Z
Learning: The ModuleCardUIProps interface already includes a client prop of type ThirdwebClient, so when components use `Omit<ModuleCardUIProps, "children" | "updateButton">`, they inherit the client prop without needing to add it explicitly.
packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx (11)
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/extensions/**/*.{ts,tsx} : Auto-generated contracts from ABI definitions in extensions
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Unified `Wallet` and `Account` interfaces in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Smart wallets with account abstraction in wallet architecture
Learnt from: MananTank
PR: thirdweb-dev/js#7152
File: apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/shared-page.tsx:41-48
Timestamp: 2025-05-26T16:28:50.772Z
Learning: The `projectMeta` prop is not required for the server-rendered `ContractTokensPage` component in the tokens shared page, unlike some other shared pages where it's needed for consistency.
Learnt from: MananTank
PR: thirdweb-dev/js#7434
File: apps/dashboard/src/app/(app)/team/~/~/contract/[chain]/[contractAddress]/components/project-selector.tsx:62-76
Timestamp: 2025-06-24T21:38:03.155Z
Learning: In the project-selector.tsx component for contract imports, the addToProject.mutate() call is intentionally not awaited (fire-and-forget pattern) to allow immediate navigation to the contract page while the import happens in the background. This is a deliberate design choice to prioritize user experience.
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Support EIP-1193, EIP-5792, EIP-7702 standards in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-06-30T10:26:04.389Z
Learning: Applies to dashboard/**/components/*.client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Support for in-app wallets (social/email login) in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/exports/react.native.ts : React Native specific exports are in `src/exports/react.native.ts`
Learnt from: MananTank
PR: thirdweb-dev/js#7356
File: apps/nebula/src/app/not-found.tsx:1-1
Timestamp: 2025-06-17T18:30:52.976Z
Learning: In the thirdweb/js project, the React namespace is available for type annotations (like React.FC) without needing to explicitly import React. This is project-specific configuration that differs from typical TypeScript/React setups.
Learnt from: jnsdls
PR: thirdweb-dev/js#7188
File: apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/accounts/components/accounts-count.tsx:15-15
Timestamp: 2025-05-29T00:46:09.063Z
Learning: In the accounts component at apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/accounts/components/accounts-count.tsx, the 3-column grid layout (md:grid-cols-3) is intentionally maintained even when rendering only one StatCard, as part of the design structure for this component.
🧬 Code Graph Analysis (1)
packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx (1)
packages/thirdweb/src/react/web/ui/components/text.tsx (1)
  • Text (17-32)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Size
  • GitHub Check: Unit Tests
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx (1)

109-110: Clarify the contract name fallback logic.

The fallback value "Unknown Contract" is immediately filtered out by the conditional rendering below, which means the contract info section will never display when contract metadata is missing.

This could be intentional behavior, but please verify:

  1. Is it correct that the contract section should be completely hidden when no contract metadata is available?
  2. The contractName !== undefined check in the conditional (line 216) is redundant since the fallback ensures contractName is never undefined.

Consider either:

  • Removing the undefined check: contractName !== "UnknownContract" && contractName !== "Unknown Contract"
  • Or changing the fallback to undefined if you want to preserve the undefined check: transactionDataQuery.data?.contractMetadata?.name
.changeset/whole-bottles-wait.md (1)

1-6: Changeset correctly documents the UI improvement.

The changeset appropriately categorizes this as a patch-level change and provides a clear, concise description of the modification.

The change improves user experience by hiding placeholder contract labels. Consider if any integration tests or accessibility features might be affected by this UI change, but this appears to be a non-breaking improvement.

Copy link
Contributor

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 63.25 KB (0%) 1.3 s (0%) 295 ms (+48.26% 🔺) 1.6 s
thirdweb (cjs) 353.31 KB (0%) 7.1 s (0%) 1.5 s (-1.94% 🔽) 8.6 s
thirdweb (minimal + tree-shaking) 5.7 KB (0%) 114 ms (0%) 87 ms (+696.15% 🔺) 201 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 11 ms (+146.59% 🔺) 21 ms
thirdweb/react (minimal + tree-shaking) 19.59 KB (0%) 392 ms (0%) 57 ms (+111.95% 🔺) 449 ms

Copy link

codecov bot commented Jul 17, 2025

Codecov Report

Attention: Patch coverage is 0% with 18 lines in your changes missing coverage. Please review.

Project coverage is 56.43%. Comparing base (4cbf671) to head (e86968a).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...web/src/react/web/ui/Bridge/TransactionPayment.tsx 0.00% 18 Missing ⚠️

❌ Your patch status has failed because the patch coverage (0.00%) 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    #7642      +/-   ##
==========================================
- Coverage   56.46%   56.43%   -0.03%     
==========================================
  Files         908      908              
  Lines       58159    58193      +34     
  Branches     4225     4227       +2     
==========================================
+ Hits        32840    32844       +4     
- Misses      25211    25239      +28     
- Partials      108      110       +2     
Flag Coverage Δ
packages 56.43% <0.00%> (-0.03%) ⬇️
Files with missing lines Coverage Δ
...web/src/react/web/ui/Bridge/TransactionPayment.tsx 6.80% <0.00%> (-0.11%) ⬇️

... and 3 files with indirect coverage changes

🚀 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.

@gregfromstl gregfromstl merged commit 0f38a12 into main Jul 17, 2025
23 of 24 checks passed
@gregfromstl gregfromstl deleted the greg/hide-unknown-contract-label branch July 17, 2025 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-queue Adds the pull request to Graphite's merge queue. packages SDK Involves changes to the thirdweb SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants