Skip to content

[SDK] fix hiddenWallets prop #7183

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

joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented May 28, 2025

Fixes TOOL-4607

Summary

  • fix passing hiddenWallets prop down to ConnectEmbedContent
  • include hiddenWallets in ConnectEmbedContent prop interface
  • mark hidden-wallets changeset as patch

Checklist

  • CI passes

PR-Codex overview

This PR introduces a new hiddenWallets prop across several components to allow specific wallets to be hidden from the wallet selection list, enhancing user experience by decluttering the options presented during wallet connection.

Detailed summary

  • Added hiddenWallets prop to ConnectEmbed, ConnectButton, and useConnectModal.
  • Updated ConnectEmbedProps and ConnectButtonProps to include hiddenWallets?: WalletId[].
  • Modified ConnectModal and ConnectEmbed to utilize the hiddenWallets prop for wallet selection.
  • Updated related components to pass and handle the hiddenWallets prop appropriately.

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

Summary by CodeRabbit

  • New Features
    • Added the ability to hide specific wallets from the wallet selection list in wallet connection components and modals. Now, you can specify which wallets should not appear when connecting via ConnectEmbed, ConnectButton, and related modals.

@joaquim-verges joaquim-verges requested review from a team as code owners May 28, 2025 08:10
Copy link

changeset-bot bot commented May 28, 2025

🦋 Changeset detected

Latest commit: a925fc1

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

This PR includes changesets to release 2 packages
Name Type
thirdweb 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 May 28, 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 May 28, 2025 8:33am
login ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 28, 2025 8:33am
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 28, 2025 8:33am
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 28, 2025 8:33am
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 28, 2025 8:33am

Copy link
Contributor

graphite-app bot commented May 28, 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

coderabbitai bot commented May 28, 2025

Walkthrough

A new hiddenWallets property was added to the ConnectEmbed, ConnectButton, and useConnectModal components/hooks. This property allows specifying wallet IDs to be hidden from wallet selection lists. The change updates type definitions and propagates the property through the relevant component hierarchies without altering underlying connection logic.

Changes

File(s) Change Summary
.changeset/hidden-wallets-prop.md Documents the addition of the hiddenWallets property to key wallet connection components and hooks.
.../ConnectButtonProps.ts, .../ConnectEmbedProps.ts, .../useConnectModal.tsx Add optional hiddenWallets property to type definitions for button, embed, and modal options.
.../ConnectWallet/ConnectButton.tsx Propagates hiddenWallets through the ConnectButton and its internal components for consistent filtering.
.../ConnectWallet/Modal/ConnectEmbed.tsx Adds and forwards hiddenWallets prop through ConnectEmbed and its content components.
.../ConnectWallet/Modal/ConnectModal.tsx Extends modal options and component signature to accept and forward hiddenWallets to modal content.

Sequence Diagram(s)

sequenceDiagram
    participant App
    participant ConnectButton
    participant ConnectModal
    participant ConnectModalContent

    App->>ConnectButton: Render with hiddenWallets
    ConnectButton->>ConnectModal: Pass hiddenWallets
    ConnectModal->>ConnectModalContent: Pass walletIdsToHide = hiddenWallets
    ConnectModalContent-->>App: Render wallet list (filtered)
Loading
sequenceDiagram
    participant App
    participant ConnectEmbed
    participant ConnectEmbedContent
    participant ConnectModalContent

    App->>ConnectEmbed: Render with hiddenWallets
    ConnectEmbed->>ConnectEmbedContent: Pass hiddenWallets
    ConnectEmbedContent->>ConnectModalContent: Pass walletIdsToHide = hiddenWallets
    ConnectModalContent-->>App: Render wallet list (filtered)
Loading

Suggested labels

Dashboard, Portal, packages, SDK


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7f1153d and a925fc1.

📒 Files selected for processing (1)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/ConnectButton.tsx (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/ConnectButton.tsx
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Unit Tests
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Build Packages
  • GitHub Check: Size
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
✨ 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

@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/ConnectWallet/ConnectButton.tsx (1)

303-304: LGTM! Good unification of hiddenWallets sources.

The logic correctly creates a unified hiddenWallets variable from multiple potential sources, giving priority to the direct prop over the details modal configuration.

Note: The || operator will treat an empty array [] as falsy, falling back to props.detailsModal?.hiddenWallets. If this behavior is unintended and an empty array should take precedence, consider using nullish coalescing:

-const hiddenWallets = props.hiddenWallets || props.detailsModal?.hiddenWallets;
+const hiddenWallets = props.hiddenWallets ?? props.detailsModal?.hiddenWallets;
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8ed5ef3 and 7f1153d.

📒 Files selected for processing (7)
  • .changeset/hidden-wallets-prop.md (1 hunks)
  • packages/thirdweb/src/react/core/hooks/connection/ConnectButtonProps.ts (1 hunks)
  • packages/thirdweb/src/react/core/hooks/connection/ConnectEmbedProps.ts (2 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/ConnectButton.tsx (4 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx (4 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModal.tsx (3 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx (3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (4)
packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx (1)
packages/thirdweb/src/exports/wallets.ts (1)
  • WalletId (54-54)
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModal.tsx (1)
packages/thirdweb/src/exports/wallets.ts (1)
  • WalletId (54-54)
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx (1)
packages/thirdweb/src/exports/wallets.ts (1)
  • WalletId (54-54)
packages/thirdweb/src/react/core/hooks/connection/ConnectButtonProps.ts (1)
packages/thirdweb/src/exports/wallets.ts (1)
  • WalletId (54-54)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Unit Tests
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Lint Packages
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (11)
packages/thirdweb/src/react/core/hooks/connection/ConnectButtonProps.ts (2)

15-15: LGTM: Proper import of WalletId type

The import statement correctly references the WalletId type from the wallet-types module, which is consistent with the other files in this PR.


984-987: LGTM: Clean implementation of hiddenWallets prop

The addition of the hiddenWallets property is well-implemented:

  • Properly typed as optional WalletId[]
  • Clear and descriptive JSDoc documentation
  • Maintains backward compatibility
  • Follows the existing code style patterns
packages/thirdweb/src/react/core/hooks/connection/ConnectEmbedProps.ts (2)

6-6: LGTM: Consistent import pattern

The WalletId import follows the same pattern as used in ConnectButtonProps.ts, maintaining consistency across the codebase.


276-279: LGTM: Consistent hiddenWallets implementation

The hiddenWallets property implementation is identical to the one in ConnectButtonProps, which ensures consistency across components. The documentation clearly explains the purpose and usage.

.changeset/hidden-wallets-prop.md (1)

1-6: LGTM: Properly formatted changeset

The changeset correctly:

  • Marks this as a "patch" change (appropriate for adding optional props)
  • Provides a clear description of the new feature
  • Follows standard changeset formatting conventions
packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx (3)

8-8: LGTM: Consistent import statement

The WalletId import maintains consistency with the other files in this PR.


369-372: LGTM: Well-documented hiddenWallets prop

The hiddenWallets property follows the same pattern as the other files, maintaining consistency across the codebase with clear documentation.


146-146: LGTM: Proper prop propagation

The hiddenWallets prop is correctly passed down to the ConnectModal component, ensuring the feature works throughout the component hierarchy. This demonstrates the fix mentioned in the PR objectives where the prop needs to be passed down properly.

packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx (1)

8-8: LGTM! Clean implementation of hiddenWallets prop.

The implementation correctly:

  • Imports the WalletId type
  • Adds the optional hiddenWallets prop to the ConnectEmbedContent interface
  • Passes the prop down the component hierarchy
  • Maps it to walletIdsToHide for the ConnectModalContent component

The typing and prop propagation are consistent and maintain backwards compatibility.

Also applies to: 342-342, 299-299, 421-421

packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModal.tsx (1)

7-7: LGTM! Consistent implementation of hiddenWallets in modal options.

The changes properly:

  • Import the WalletId type for consistency
  • Extend the ConnectModalOptions type with the optional hiddenWallets property
  • Pass the prop to ConnectModalContent as walletIdsToHide

The implementation follows the same pattern as other components in the PR.

Also applies to: 46-46, 156-156

packages/thirdweb/src/react/web/ui/ConnectWallet/ConnectButton.tsx (1)

398-398: Excellent prop propagation throughout the component hierarchy.

The hiddenWallets prop is correctly passed to all relevant components:

  • ConnectModal for wallet selection filtering
  • ConnectedWalletDetails via the detailsModal prop
  • The connectOptions object for consistency

This ensures the hidden wallets configuration is consistently applied across all parts of the connect button UI.

Also applies to: 563-566, 591-591

Copy link

linear bot commented May 28, 2025

Copy link
Contributor

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 61.75 KB (0%) 1.3 s (0%) 204 ms (+156.07% 🔺) 1.5 s
thirdweb (cjs) 344.4 KB (0%) 6.9 s (0%) 659 ms (+6.67% 🔺) 7.6 s
thirdweb (minimal + tree-shaking) 5.69 KB (0%) 114 ms (0%) 62 ms (+1085.76% 🔺) 175 ms
thirdweb/chains (tree-shaking) 531 B (0%) 11 ms (0%) 26 ms (+1754.86% 🔺) 36 ms
thirdweb/react (minimal + tree-shaking) 19.54 KB (0%) 391 ms (0%) 66 ms (+313.25% 🔺) 457 ms

Copy link

codecov bot commented May 28, 2025

Codecov Report

Attention: Patch coverage is 53.84615% with 6 lines in your changes missing coverage. Please review.

Project coverage is 55.66%. Comparing base (e14a134) to head (a925fc1).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...b/src/react/web/ui/ConnectWallet/ConnectButton.tsx 60.00% 4 Missing ⚠️
.../react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx 0.00% 2 Missing ⚠️

❌ Your patch status has failed because the patch coverage (53.84%) 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    #7183   +/-   ##
=======================================
  Coverage   55.66%   55.66%           
=======================================
  Files         904      904           
  Lines       58391    58400    +9     
  Branches     4114     4116    +2     
=======================================
+ Hits        32504    32510    +6     
- Misses      25781    25784    +3     
  Partials      106      106           
Flag Coverage Δ
packages 55.66% <53.84%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
.../react/web/ui/ConnectWallet/Modal/ConnectModal.tsx 79.20% <100.00%> (ø)
.../react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx 19.65% <0.00%> (-0.09%) ⬇️
...b/src/react/web/ui/ConnectWallet/ConnectButton.tsx 54.98% <60.00%> (+0.56%) ⬆️
🚀 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.

@joaquim-verges joaquim-verges merged commit 655df03 into main May 28, 2025
22 of 23 checks passed
@joaquim-verges joaquim-verges deleted the yfkmnp-codex/add-hiddenwallets-prop-to-filter-wallets branch May 28, 2025 08:46
@joaquim-verges joaquim-verges mentioned this pull request May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codex packages SDK Involves changes to the thirdweb SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant