Skip to content

[SDK] add hiddenWallets prop #7181

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

Closed

Conversation

joaquim-verges
Copy link
Member

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

Fixes TOOL-4607

Summary

  • allow hiding wallets across connection components
  • expose hiddenWallets prop in hook & components
  • document new hiddenWallets prop

Checklist

  • CI passes

PR-Codex overview

This PR introduces a new hiddenWallets prop across several components to allow specific wallets to be excluded from the wallet selection list.

Detailed summary

  • Added hiddenWallets prop to ConnectEmbed, ConnectButton, and useConnectModal.
  • Updated ConnectEmbedProps and ConnectButtonProps to include hiddenWallets.
  • Modified ConnectModal and ConnectButton to utilize the hiddenWallets prop.
  • Improved documentation for hiddenWallets in relevant files.

✨ 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 connection list using a new option in the wallet connection components and modal.
  • Documentation
    • Updated documentation to reflect the new option for hiding wallets in the user interface.

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

changeset-bot bot commented May 28, 2025

🦋 Changeset detected

Latest commit: ddcc0f3

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

This PR includes changesets to release 2 packages
Name Type
thirdweb Minor
@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
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

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 ❌ Failed (Inspect) May 28, 2025 7:49am
login ❌ Failed (Inspect) May 28, 2025 7:49am
thirdweb_playground ❌ Failed (Inspect) May 28, 2025 7:49am
thirdweb-www ❌ Failed (Inspect) May 28, 2025 7:49am
wallet-ui ❌ Failed (Inspect) May 28, 2025 7:49am

Copy link
Contributor

coderabbitai bot commented May 28, 2025

Walkthrough

A new optional hiddenWallets property was introduced to the ConnectEmbed, ConnectButton, and useConnectModal components and their associated types. This property allows developers to specify wallet IDs to be hidden from the wallet selection UI, with the value being consistently propagated through all relevant components and modal options.

Changes

File(s) Change Summary
.changeset/hidden-wallets-prop.md Documents the addition of the hiddenWallets prop to ConnectEmbed, ConnectButton, and useConnectModal.
packages/thirdweb/src/react/core/hooks/connection/ConnectButtonProps.ts Adds optional hiddenWallets?: WalletId[] to ConnectButtonProps type.
packages/thirdweb/src/react/core/hooks/connection/ConnectEmbedProps.ts Adds optional hiddenWallets?: WalletId[] to ConnectEmbedProps type.
packages/thirdweb/src/react/web/ui/ConnectWallet/ConnectButton.tsx Propagates hiddenWallets prop through ConnectButton to ConnectModal and ConnectedWalletDetails.
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx Passes props.hiddenWallets to ConnectModalContent as walletIdsToHide.
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModal.tsx Adds hiddenWallets?: WalletId[] to ConnectModalOptions and passes it to ConnectModalContent.
packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx Adds hiddenWallets?: WalletId[] to UseConnectModalOptions and propagates it to the modal component.

Sequence Diagram(s)

sequenceDiagram
    participant App
    participant ConnectButton
    participant ConnectModal
    participant ConnectModalContent

    App->>ConnectButton: Render with hiddenWallets
    ConnectButton->>ConnectModal: Pass hiddenWallets as prop
    ConnectModal->>ConnectModalContent: Pass hiddenWallets as walletIdsToHide
    ConnectModalContent-->>App: Renders wallet list (excluding hiddenWallets)
Loading
sequenceDiagram
    participant App
    participant useConnectModal
    participant ConnectModal

    App->>useConnectModal: Call with hiddenWallets
    useConnectModal->>ConnectModal: Render with hiddenWallets
    ConnectModal-->>App: Renders wallet list (excluding hiddenWallets)
Loading
sequenceDiagram
    participant App
    participant ConnectEmbed
    participant ConnectModalContent

    App->>ConnectEmbed: Render with hiddenWallets
    ConnectEmbed->>ConnectModalContent: Pass hiddenWallets as walletIdsToHide
    ConnectModalContent-->>App: Renders wallet list (excluding hiddenWallets)
Loading
✨ 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: 1

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

303-304: Consider the precedence logic for hiddenWallets.

The current logic uses || operator which gives precedence to props.hiddenWallets over props.detailsModal?.hiddenWallets. This means if both are provided, only props.hiddenWallets will be used.

Consider whether this is the intended behavior or if the arrays should be merged:

If merging is desired, consider this approach:

-  const hiddenWallets =
-    props.hiddenWallets || props.detailsModal?.hiddenWallets;
+  const hiddenWallets = [
+    ...(props.hiddenWallets || []),
+    ...(props.detailsModal?.hiddenWallets || [])
+  ];

Or if precedence is intended, consider adding a comment to clarify the behavior.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e14a134 and ddcc0f3.

📒 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 (1 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 (3)
packages/thirdweb/src/react/core/hooks/connection/ConnectEmbedProps.ts (1)
packages/thirdweb/src/exports/wallets.ts (1)
  • WalletId (54-54)
packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.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: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Unit Tests
  • GitHub Check: Build Packages
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (13)
.changeset/hidden-wallets-prop.md (1)

1-6: LGTM! Well-documented changeset.

The changeset properly documents the new hiddenWallets prop addition as a minor version change, which is appropriate for a new feature. The description clearly explains the functionality and lists the affected components.

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

984-987: LGTM! Well-defined type addition.

The hiddenWallets prop is properly typed as an optional WalletId[] array with clear documentation. The type import is correctly included and the JSDoc comment clearly explains the functionality.

packages/thirdweb/src/react/core/hooks/connection/ConnectEmbedProps.ts (2)

6-6: LGTM! Proper type import.

The WalletId import is correctly added to support the new hiddenWallets prop.


276-279: LGTM! Consistent type definition.

The hiddenWallets prop is properly defined with clear documentation that matches the ConnectButtonProps implementation. The type and documentation are consistent across components, which maintains a cohesive API.

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

7-7: LGTM! Clean import addition.

The import of WalletId type is correctly added to support the new hiddenWallets functionality.


46-46: LGTM! Type definition follows established patterns.

The hiddenWallets property is correctly defined with the appropriate type WalletId[] | undefined, maintaining consistency with other optional properties in the interface.


156-156: LGTM! Proper prop forwarding.

The change from passing undefined to props.hiddenWallets correctly forwards the new prop to the ConnectModalContent component as walletIdsToHide.

packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx (3)

8-8: LGTM! Consistent import addition.

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


146-146: LGTM! Correct prop forwarding.

The hiddenWallets prop is properly passed from the hook options to the underlying ConnectModal component.


369-372: LGTM! Excellent documentation and type definition.

The new hiddenWallets property is well-documented with a clear description of its purpose. The type definition is consistent with the other files in this PR.

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

398-398: LGTM! Correct prop forwarding to ConnectModal.

The hiddenWallets prop is properly passed to the ConnectModal component.


591-591: LGTM! hiddenWallets added to connectOptions.

The hiddenWallets property is correctly included in the connectOptions object passed to ConnectedWalletDetails.


563-566:

❓ Verification inconclusive

Review the prop spreading behavior.

The current implementation spreads props.detailsModal first and then adds hiddenWallets. This means if props.detailsModal contains a hiddenWallets property, it will be overridden by the computed hiddenWallets value.

Verify that this override behavior is intentional:

This behavior might be correct if the computed hiddenWallets should take precedence over the one in detailsModal.


🏁 Script executed:

#!/bin/bash
# Check if detailsModal props include hiddenWallets in type definitions
ast-grep --pattern 'detailsModal?: {
  $$$
  hiddenWallets$_
  $$$
}'

Length of output: 71


🏁 Script executed:

#!/bin/bash
# Locate where ConnectButtonProps is defined and check detailsModal usage
rg "ConnectButtonProps" -n packages/thirdweb/src/react/web/ui/ConnectWallet/ConnectButton.tsx

# Inspect all occurrences of detailsModal within this file
rg "detailsModal" -n packages/thirdweb/src/react/web/ui/ConnectWallet/ConnectButton.tsx

Length of output: 812


🏁 Script executed:

#!/bin/bash
# List files in the connection hooks directory
ls packages/thirdweb/src/core/hooks/connection

# Search for ConnectButtonProps type definition and detailsModal within it
rg -n "ConnectButtonProps" -n packages/thirdweb/src/core/hooks/connection/ConnectButtonProps*
rg -n "detailsModal" -n packages/thirdweb/src/core/hooks/connection/ConnectButtonProps*

Length of output: 533


#!/bin/bash
# Locate the connection hooks directory under src/react
echo "Searching for 'connection' directories under src/react..."
find packages/thirdweb/src/react -type d | rg "/connection$" || echo "No 'connection' dirs found under src/react"

# Find the ConnectButtonProps file anywhere in the repo
echo "Locating ConnectButtonProps file..."
props_file=$(find packages/thirdweb -type f | rg "ConnectButtonProps\.(js|ts)x?$")
if [ -z "$props_file" ]; then
  echo "ConnectButtonProps file not found"
  exit 1
fi
echo "Found ConnectButtonProps at: $props_file"

# Show first 200 lines of that file
echo "Printing first 200 lines of $props_file..."
sed -n '1,200p' "$props_file"

# Search for detailsModal in that file
echo "Searching for detailsModal in $props_file..."
rg -n "detailsModal" "$props_file" || echo "No detailsModal property in ConnectButtonProps"

#!/bin/bash
# Find all ConnectButtonProps definition files in the repo
files=$(find packages/thirdweb -type f | rg -i "ConnectButtonProps\.(ts|tsx|js|jsx)$")
echo "ConnectButtonProps files found:"
echo "$files"

# For each file, print surrounding context of the detailsModal property
for file in $files; do
  echo -e "\n---- Context in $file ----"
  rg -n "detailsModal" -A3 -B3 "$file" || echo "No detailsModal property in $file"
done

#!/bin/bash
# Search for ConnectButtonProps definition under src/react
echo "Locating ConnectButtonProps files under src/react..."
paths=$(find packages/thirdweb/src/react -type f | rg "ConnectButtonProps\.(ts|tsx|js|jsx)$")
if [ -z "$paths" ]; then
  echo "No ConnectButtonProps files found under src/react"
  exit 1
fi
echo "$paths"

# For each found file, display header, the top of the file, and any detailsModal occurrences
for file in $paths; do
  echo -e "\n=== File: $file ==="
  echo "First 200 lines of $file:"
  sed -n '1,200p' "$file"
  echo -e "\nOccurrences of detailsModal in $file:"
  rg -n "detailsModal" -A3 -B3 "$file" || echo "No detailsModal property found in $file"
done

Confirm hiddenWallets override in detailsModal

  • File: packages/thirdweb/src/react/web/ui/ConnectWallet/ConnectButton.tsx (lines 563–566)
  • Spreading ...props.detailsModal before hiddenWallets will always override any hiddenWallets passed in via props.

If you intend to let consumers control which wallets to hide, swap the spread order:

detailsModal={{
-  ...props.detailsModal,
-  hiddenWallets,
+  hiddenWallets,
+  ...props.detailsModal,
}}

@@ -415,7 +415,7 @@ const ConnectEmbedContent = (props: {
walletConnect={props.walletConnect}
wallets={props.wallets}
modalHeader={undefined}
walletIdsToHide={undefined}
walletIdsToHide={props.hiddenWallets}
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

Fix missing hiddenWallets prop in ConnectEmbedContent interface.

The code is accessing props.hiddenWallets but this prop is not defined in the ConnectEmbedContent props interface (lines 310-347) and is not being passed from the parent ConnectEmbed component (lines 278-298).

Apply these fixes:

  1. Add hiddenWallets to the ConnectEmbedContent props interface:
const ConnectEmbedContent = (props: {
  modalSize?: "compact" | "wide";
  className?: string;
  style?: React.CSSProperties;
+ hiddenWallets?: WalletId[];
  // ---
  accountAbstraction: SmartWalletOptions | undefined;
  1. Pass the prop from parent ConnectEmbed component around line 298:
      <WalletUIStatesProvider theme={props.theme} isOpen={true}>
        <ConnectEmbedContent
          auth={props.auth}
          accountAbstraction={props.accountAbstraction}
+         hiddenWallets={props.hiddenWallets}
          chain={preferredChain}
🤖 Prompt for AI Agents
In packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx
around lines 278-298 and 310-347, the prop hiddenWallets is used in
ConnectEmbedContent but is missing from its props interface and not passed from
the parent ConnectEmbed component. Fix this by adding hiddenWallets to the
ConnectEmbedContent props interface definition and then pass hiddenWallets as a
prop from the ConnectEmbed component to ConnectEmbedContent around line 298.

Copy link

linear bot commented 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