Skip to content

Conversation

@joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented Nov 12, 2025


PR-Codex overview

This PR focuses on enhancing the wallet connection functionality by modifying the onConnect callbacks to include all connected wallets, improving the user experience during wallet connections.

Detailed summary

  • Updated OnConnectCallback type to accept activeWallet and allConnectedWallets.
  • Modified onConnect implementations across various components to log both active and connected wallets.
  • Adjusted tests to verify the inclusion of all connected wallets in onConnect calls.
  • Revised autoConnect logic to handle multiple connected wallets.

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

Summary by CodeRabbit

  • New Features

    • Expanded public types/exports for connection and payment options and improved connect/embed callback typing.
  • Breaking Changes

    • onConnect now receives two arguments: the active wallet and an array of all connected wallets (replaces prior single-wallet parameter).
  • Behavioral Fixes

    • onConnect is invoked after all connections are processed and callback errors are logged.
  • Tests

    • Updated tests to expect the new two-argument onConnect signature and adjusted connection assertions.

@changeset-bot
Copy link

changeset-bot bot commented Nov 12, 2025

🦋 Changeset detected

Latest commit: e3edd1b

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

This PR includes changesets to release 4 packages
Name Type
thirdweb Minor
@thirdweb-dev/nebula Patch
@thirdweb-dev/wagmi-adapter Patch
wagmi-inapp 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

@vercel
Copy link

vercel bot commented Nov 12, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs-v2 Ready Ready Preview Comment Nov 12, 2025 8:43pm
nebula Ready Ready Preview Comment Nov 12, 2025 8:43pm
thirdweb_playground Ready Ready Preview Comment Nov 12, 2025 8:43pm
thirdweb-www Ready Ready Preview Comment Nov 12, 2025 8:43pm
wallet-ui Ready Ready Preview Comment Nov 12, 2025 8:43pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 12, 2025

Walkthrough

Updated onConnect callbacks to receive both the active wallet and the array of all connected wallets; introduced exported OnConnectCallback type; updated related props, modals, auto-connect flow, wallet manager, exports, docs/examples, and tests to use the new signature.

Changes

Cohort / File(s) Summary
Changeset Release
/.changeset/fair-mails-divide.md
Adds a changeset marking a minor version bump and notes "Add all connected wallets in all onConnect callbacks."
Exports / Barrels
packages/thirdweb/src/exports/react.native.ts, packages/thirdweb/src/exports/react.ts
Added OnConnectCallback export (and ConnectEmbedProps); react.native.ts also exposes additional payment-related type exports (DirectPaymentOptions, FundWalletOptions, PaymentInfo, PayUIOptions, TransactionOptions).
Core Callback Type
packages/thirdweb/src/react/core/hooks/connection/types.ts
New exported type alias OnConnectCallback = (activeWallet: Wallet, allConnectedWallets: Wallet[]) => void.
Connection Props Types
packages/thirdweb/src/react/core/hooks/connection/ConnectButtonProps.ts, packages/thirdweb/src/react/core/hooks/connection/ConnectEmbedProps.ts
onConnect prop type changed from (wallet: Wallet) => void to OnConnectCallback; examples updated to show (activeWallet, allConnectedWallets).
React Modal Components
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx, packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModal.tsx, packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx, packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx
Prop types switched to OnConnectCallback; ConnectModalContent now invokes onConnect(activeWallet, allConnectedWallets) and modal wiring updated accordingly.
Auto-connect Flow
packages/thirdweb/src/wallets/connection/autoConnect.ts, packages/thirdweb/src/wallets/connection/autoConnectCore.ts
Documentation example updated; runtime now defers final onConnect invocation until after connections are finalized, then calls onConnect(connectedActiveWallet, allConnectedWallets) and logs errors from the callback.
Connection Types
packages/thirdweb/src/wallets/connection/types.ts
AutoConnectProps.onConnect signature updated to (activeWallet: Wallet, otherWallets: Wallet[]) => void.
Wallet Manager
packages/thirdweb/src/wallets/manager/index.ts
ConnectManagerOptions.onConnect type changed to OnConnectCallback; manager now calls onConnect(activeWallet, allConnectedWallets) in connection and account-change flows.
Playground Example
apps/playground-web/src/components/in-app-wallet/ecosystem.tsx
Added an onConnect handler to embedded Connect usage that logs activeWallet and allConnectedWallets.
Tests
packages/thirdweb/src/wallets/manager/connection-manager.test.ts, packages/thirdweb/src/wallets/connection/autoConnectCore.test.ts
Tests updated to expect onConnect to be called with two arguments (active wallet and array of connected wallets); some test setup refactoring and assertions adjusted.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ConnectUI as Connect Modal / Embed
    participant ConnectionManager
    participant WalletManager

    User->>ConnectUI: trigger connect
    ConnectUI->>ConnectionManager: request connect(wallet)
    ConnectionManager->>WalletManager: perform connection(s)
    WalletManager->>WalletManager: determine activeWallet\nand connectedWallets list
    WalletManager->>ConnectionManager: return connected state
    ConnectionManager->>ConnectUI: invoke onConnect(activeWallet, allConnectedWallets)
    note right of ConnectUI: Consumer receives both\nactive wallet and the full list
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Focus review on:
    • packages/thirdweb/src/wallets/connection/autoConnectCore.ts — correctness of active/all-connected selection and error handling when invoking onConnect.
    • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx — timing/state when reading connectionManager.connectedWallets.getValue().
    • packages/thirdweb/src/wallets/manager/index.ts — ensure all call sites consistently pass both parameters.
    • Scan the codebase for remaining single-argument onConnect usages and update barrels/exports accordingly.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive The description includes a PR-Codex overview with detailed summary and testing placeholder, but the template-required sections (issue tag, notes for reviewer, how to test) are largely empty or not explicitly filled. Fill in the template sections: provide the Linear issue tag (TEAM-0000 format), add reviewer notes clarifying important changes, and include specific testing instructions (unit tests, playground verification, etc.).
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding all connected wallets to onConnect callbacks, which aligns with the primary objective of the PR.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch _SDK_Add_all_connected_wallets_in_onConnect_callbacks

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.

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added Playground Changes involving the Playground codebase. packages SDK Involves changes to the thirdweb SDK labels Nov 12, 2025
Copy link
Member Author


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.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2025

size-limit report 📦

Path Size
@thirdweb-dev/nexus (esm) 104.88 KB (0%)
@thirdweb-dev/nexus (cjs) 316.6 KB (0%)

@joaquim-verges joaquim-verges force-pushed the _SDK_Add_all_connected_wallets_in_onConnect_callbacks branch from 40f0412 to 1822370 Compare November 12, 2025 19:57
@joaquim-verges joaquim-verges marked this pull request as ready for review November 12, 2025 19:57
@joaquim-verges joaquim-verges requested review from a team as code owners November 12, 2025 19:57
@joaquim-verges joaquim-verges force-pushed the _SDK_Add_all_connected_wallets_in_onConnect_callbacks branch from 1822370 to 66d2806 Compare November 12, 2025 19:59
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx (1)

72-76: Callback invoked with incorrect number of arguments.

The onConnect callback now expects two arguments (activeWallet: Wallet, allConnectedWallets: Wallet[]) per OnConnectCallback, but it's being invoked with only one argument. The second parameter will be undefined.

You need to access connectedWallets from the connection manager and pass it as the second argument:

+import { useConnectionManager } from "../../../../core/providers/connection-manager.js";
+
 export function useConnectModal() {
   const setRootEl = useContext(SetRootElementContext);
   const [isConnecting, setIsConnecting] = useState(false);
+  const connectionManager = useConnectionManager();

   const connect = useCallback(
     (props: UseConnectModalOptions) => {
       // ... existing code ...
             setRootEl(
               <Modal
                 {...props}
+                connectionManager={connectionManager}
                 connectLocale={locale}

Then in the Modal component, use it to invoke the callback:

 function Modal(
   props: UseConnectModalOptions & {
     onConnect: OnConnectCallback;
     onClose: () => void;
     connectLocale: ConnectLocale;
+    connectionManager: ReturnType<typeof useConnectionManager>;
   },
 ) {
   // ... existing code ...
                 onConnect={(w) => {
                   if (props.auth) return;
-                  resolve(w);
+                  props.onConnect(w, props.connectionManager.connectedWallets.getValue());
+                  resolve(w);
                   cleanup();
                 }}
🧹 Nitpick comments (1)
packages/thirdweb/src/wallets/connection/types.ts (1)

104-111: Consider aligning parameter name with OnConnectCallback.

The second parameter is named otherWallets here but allConnectedWallets in the OnConnectCallback type definition. While both are valid, using the same name would improve consistency across the codebase.

Optional diff for consistency:

  *  onConnect={(activeWallet, otherWallets) => {
  *    console.log("auto connected to", activeWallet)
- *    console.log("other wallets that were also connected", otherWallets)
+ *    console.log("all connected wallets", otherWallets)
  *  }}
  * />
  * ```
  */
- onConnect?: (activeWallet: Wallet, otherWallets: Wallet[]) => void;
+ onConnect?: (activeWallet: Wallet, allConnectedWallets: Wallet[]) => void;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e26d81c and 66d2806.

📒 Files selected for processing (14)
  • .changeset/fair-mails-divide.md (1 hunks)
  • packages/thirdweb/src/exports/react.native.ts (1 hunks)
  • packages/thirdweb/src/exports/react.ts (1 hunks)
  • packages/thirdweb/src/react/core/hooks/connection/ConnectButtonProps.ts (2 hunks)
  • packages/thirdweb/src/react/core/hooks/connection/ConnectEmbedProps.ts (2 hunks)
  • packages/thirdweb/src/react/core/hooks/connection/types.ts (1 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx (2 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModal.tsx (1 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx (3 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx (2 hunks)
  • packages/thirdweb/src/wallets/connection/autoConnect.ts (1 hunks)
  • packages/thirdweb/src/wallets/connection/autoConnectCore.ts (2 hunks)
  • packages/thirdweb/src/wallets/connection/types.ts (1 hunks)
  • packages/thirdweb/src/wallets/manager/index.ts (4 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

Files:

  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx
  • packages/thirdweb/src/react/core/hooks/connection/ConnectEmbedProps.ts
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModal.tsx
  • packages/thirdweb/src/exports/react.ts
  • packages/thirdweb/src/react/core/hooks/connection/types.ts
  • packages/thirdweb/src/wallets/manager/index.ts
  • packages/thirdweb/src/wallets/connection/autoConnectCore.ts
  • packages/thirdweb/src/wallets/connection/types.ts
  • packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx
  • packages/thirdweb/src/wallets/connection/autoConnect.ts
  • packages/thirdweb/src/react/core/hooks/connection/ConnectButtonProps.ts
  • packages/thirdweb/src/exports/react.native.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx
  • packages/thirdweb/src/react/core/hooks/connection/ConnectEmbedProps.ts
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModal.tsx
  • packages/thirdweb/src/exports/react.ts
  • packages/thirdweb/src/react/core/hooks/connection/types.ts
  • packages/thirdweb/src/wallets/manager/index.ts
  • packages/thirdweb/src/wallets/connection/autoConnectCore.ts
  • packages/thirdweb/src/wallets/connection/types.ts
  • packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx
  • packages/thirdweb/src/wallets/connection/autoConnect.ts
  • packages/thirdweb/src/react/core/hooks/connection/ConnectButtonProps.ts
  • packages/thirdweb/src/exports/react.native.ts
packages/thirdweb/src/exports/**

📄 CodeRabbit inference engine (CLAUDE.md)

packages/thirdweb/src/exports/**: Export everything via exports/ directory, grouped by feature in the SDK public API
Every public symbol must have comprehensive TSDoc with at least one @example block that compiles and custom annotation tags (@beta, @internal, @experimental)

Files:

  • packages/thirdweb/src/exports/react.ts
  • packages/thirdweb/src/exports/react.native.ts
packages/thirdweb/src/wallets/**

📄 CodeRabbit inference engine (CLAUDE.md)

packages/thirdweb/src/wallets/**: Unified Wallet and Account interfaces in wallet architecture
Support for in-app wallets (social/email login)
Smart wallets with account abstraction
EIP-1193, EIP-5792, EIP-7702 standard support in wallet modules

Files:

  • packages/thirdweb/src/wallets/manager/index.ts
  • packages/thirdweb/src/wallets/connection/autoConnectCore.ts
  • packages/thirdweb/src/wallets/connection/types.ts
  • packages/thirdweb/src/wallets/connection/autoConnect.ts
🧠 Learnings (18)
📓 Common learnings
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : Support for in-app wallets (social/email login)
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : EIP-1193, EIP-5792, EIP-7702 standard support in wallet modules
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : Unified `Wallet` and `Account` interfaces in wallet architecture
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : Smart wallets with account abstraction
📚 Learning: 2025-09-23T19:56:43.668Z
Learnt from: MananTank
Repo: thirdweb-dev/js PR: 8106
File: packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx:482-485
Timestamp: 2025-09-23T19:56:43.668Z
Learning: In packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx, the EmbedContainer uses width: "100vw" intentionally rather than "100%" - this is by design for the bridge widget embedding use case.

Applied to files:

  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx
  • packages/thirdweb/src/react/core/hooks/connection/ConnectEmbedProps.ts
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModal.tsx
  • packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : Unified `Wallet` and `Account` interfaces in wallet architecture

Applied to files:

  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx
  • packages/thirdweb/src/react/core/hooks/connection/types.ts
  • .changeset/fair-mails-divide.md
  • packages/thirdweb/src/wallets/manager/index.ts
  • packages/thirdweb/src/wallets/connection/autoConnectCore.ts
  • packages/thirdweb/src/wallets/connection/types.ts
  • packages/thirdweb/src/wallets/connection/autoConnect.ts
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).

Applied to files:

  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx
  • packages/thirdweb/src/react/core/hooks/connection/ConnectEmbedProps.ts
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModal.tsx
  • packages/thirdweb/src/react/core/hooks/connection/types.ts
  • packages/thirdweb/src/wallets/manager/index.ts
  • packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx
  • packages/thirdweb/src/wallets/connection/autoConnect.ts
  • packages/thirdweb/src/react/core/hooks/connection/ConnectButtonProps.ts
  • packages/thirdweb/src/exports/react.native.ts
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : Support for in-app wallets (social/email login)

Applied to files:

  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx
  • .changeset/fair-mails-divide.md
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to apps/{dashboard,playground-web}/**/*.{ts,tsx} : Import UI primitives from `@/components/ui/*` (Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator) in dashboard and playground apps

Applied to files:

  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*.{tsx,jsx} : Always import from the central UI library under `@/components/ui/*` – e.g. `import { Button } from "@/components/ui/button"`.

Applied to files:

  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*.{tsx,jsx} : Reuse core UI primitives; avoid re-implementing buttons, cards, modals.

Applied to files:

  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx
📚 Learning: 2025-05-30T17:14:25.332Z
Learnt from: MananTank
Repo: thirdweb-dev/js PR: 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.

Applied to files:

  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to src/exports/react.native.ts : React Native specific exports are in `src/exports/react.native.ts`

Applied to files:

  • packages/thirdweb/src/exports/react.ts
  • packages/thirdweb/src/exports/react.native.ts
📚 Learning: 2025-06-17T18:30:52.976Z
Learnt from: MananTank
Repo: thirdweb-dev/js PR: 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.

Applied to files:

  • packages/thirdweb/src/exports/react.ts
  • packages/thirdweb/src/wallets/manager/index.ts
  • packages/thirdweb/src/exports/react.native.ts
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Anything that consumes hooks from `tanstack/react-query` or thirdweb SDKs.

Applied to files:

  • packages/thirdweb/src/exports/react.ts
  • packages/thirdweb/src/wallets/manager/index.ts
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : EIP-1193, EIP-5792, EIP-7702 standard support in wallet modules

Applied to files:

  • .changeset/fair-mails-divide.md
  • packages/thirdweb/src/wallets/manager/index.ts
  • packages/thirdweb/src/wallets/connection/autoConnectCore.ts
  • packages/thirdweb/src/wallets/connection/types.ts
  • packages/thirdweb/src/wallets/connection/autoConnect.ts
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Surface breaking changes prominently in PR descriptions

Applied to files:

  • .changeset/fair-mails-divide.md
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : Smart wallets with account abstraction

Applied to files:

  • .changeset/fair-mails-divide.md
  • packages/thirdweb/src/wallets/manager/index.ts
  • packages/thirdweb/src/wallets/connection/autoConnectCore.ts
  • packages/thirdweb/src/wallets/connection/types.ts
📚 Learning: 2025-06-06T23:46:08.795Z
Learnt from: MananTank
Repo: thirdweb-dev/js PR: 7298
File: apps/dashboard/src/app/nebula-app/move-funds/move-funds.tsx:424-424
Timestamp: 2025-06-06T23:46:08.795Z
Learning: The thirdweb project has an ESLint rule that restricts direct usage of `defineChain`. When it's necessary to use `defineChain` directly, it's acceptable to disable the rule with `// eslint-disable-next-line no-restricted-syntax`.

Applied to files:

  • packages/thirdweb/src/wallets/manager/index.ts
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/exports/** : Export everything via `exports/` directory, grouped by feature in the SDK public API

Applied to files:

  • packages/thirdweb/src/exports/react.native.ts
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/react-native-adapter/** : Mobile platform shims are in `packages/react-native-adapter/`

Applied to files:

  • packages/thirdweb/src/exports/react.native.ts
🧬 Code graph analysis (8)
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx (1)
packages/thirdweb/src/react/core/hooks/connection/types.ts (1)
  • OnConnectCallback (3-3)
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx (3)
packages/thirdweb/src/exports/react.native.ts (1)
  • OnConnectCallback (27-27)
packages/thirdweb/src/exports/react.ts (1)
  • OnConnectCallback (26-26)
packages/thirdweb/src/react/core/hooks/connection/types.ts (1)
  • OnConnectCallback (3-3)
packages/thirdweb/src/react/core/hooks/connection/ConnectEmbedProps.ts (3)
packages/thirdweb/src/exports/react.native.ts (1)
  • OnConnectCallback (27-27)
packages/thirdweb/src/exports/react.ts (1)
  • OnConnectCallback (26-26)
packages/thirdweb/src/react/core/hooks/connection/types.ts (1)
  • OnConnectCallback (3-3)
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModal.tsx (1)
packages/thirdweb/src/react/core/hooks/connection/types.ts (1)
  • OnConnectCallback (3-3)
packages/thirdweb/src/react/core/hooks/connection/types.ts (2)
packages/thirdweb/src/exports/react.native.ts (1)
  • OnConnectCallback (27-27)
packages/thirdweb/src/exports/react.ts (1)
  • OnConnectCallback (26-26)
packages/thirdweb/src/wallets/manager/index.ts (3)
packages/thirdweb/src/exports/react.native.ts (1)
  • OnConnectCallback (27-27)
packages/thirdweb/src/exports/react.ts (1)
  • OnConnectCallback (26-26)
packages/thirdweb/src/react/core/hooks/connection/types.ts (1)
  • OnConnectCallback (3-3)
packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx (3)
packages/thirdweb/src/exports/react.native.ts (1)
  • OnConnectCallback (27-27)
packages/thirdweb/src/exports/react.ts (1)
  • OnConnectCallback (26-26)
packages/thirdweb/src/react/core/hooks/connection/types.ts (1)
  • OnConnectCallback (3-3)
packages/thirdweb/src/react/core/hooks/connection/ConnectButtonProps.ts (3)
packages/thirdweb/src/exports/react.native.ts (1)
  • OnConnectCallback (27-27)
packages/thirdweb/src/exports/react.ts (1)
  • OnConnectCallback (26-26)
packages/thirdweb/src/react/core/hooks/connection/types.ts (1)
  • OnConnectCallback (3-3)
⏰ 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). (7)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Unit Tests
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Size
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (16)
packages/thirdweb/src/exports/react.ts (1)

26-26: LGTM!

The public export of OnConnectCallback is correctly placed and follows the established pattern.

packages/thirdweb/src/wallets/connection/autoConnect.ts (1)

20-23: LGTM!

Documentation example accurately reflects the new two-argument callback signature.

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

11-11: LGTM!

Correct import of the shared OnConnectCallback type for consistency across the codebase.


217-225: LGTM!

Documentation example and type definition correctly reflect the new two-argument callback signature.

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

19-19: LGTM!

Correct import of the shared OnConnectCallback type.


94-94: LGTM!

Type definition correctly uses OnConnectCallback for consistency.

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

31-31: LGTM!

Correct import of the shared OnConnectCallback type.


47-47: LGTM!

Type definition correctly uses OnConnectCallback.


96-98: LGTM!

Callback is correctly invoked with both arguments: the active wallet and all connected wallets from the connection manager.

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

3-3: Add comprehensive TSDoc with example.

Per coding guidelines for packages/thirdweb/src/exports/**, every public symbol must have comprehensive TSDoc with at least one @example block. Since OnConnectCallback is exported publicly via the React exports barrel, it needs documentation.

As per coding guidelines

Apply this diff:

+/**
+ * Callback invoked when a wallet successfully connects.
+ * 
+ * @param activeWallet - The wallet that was just connected and set as active
+ * @param allConnectedWallets - Array of all currently connected wallets including the active wallet
+ * 
+ * @example
+ * ```tsx
+ * import { ConnectButton } from "thirdweb/react";
+ * 
+ * function App() {
+ *   return (
+ *     <ConnectButton
+ *       client={client}
+ *       onConnect={(activeWallet, allConnectedWallets) => {
+ *         console.log("Active wallet:", activeWallet.id);
+ *         console.log("Total connected:", allConnectedWallets.length);
+ *       }}
+ *     />
+ *   );
+ * }
+ * ```
+ */
 export type OnConnectCallback = (activeWallet: Wallet, allConnectedWallets: Wallet[]) => void;
⛔ Skipped due to learnings
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/exports/** : Every public symbol must have comprehensive TSDoc with at least one `example` block that compiles and custom annotation tags (`beta`, `internal`, `experimental`)
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx (1)

43-43: LGTM: Type updated to use centralized OnConnectCallback.

The import and type update align with the new two-argument callback signature used across the connection flow.

Also applies to: 358-358

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

28-28: LGTM: Public API updated with clear documentation.

The onConnect callback signature is updated to accept both the active wallet and all connected wallets. The example code clearly demonstrates the new usage pattern.

Also applies to: 941-948

packages/thirdweb/src/wallets/manager/index.ts (1)

4-4: LGTM: Manager correctly implements new callback signature.

The connection manager now invokes onConnect with both the active wallet and all connected wallets at the appropriate lifecycle points (connect and accountChanged events).

Also applies to: 33-33, 162-162, 171-171

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

22-22: LGTM: Type updated to use OnConnectCallback.

The modal's onConnect prop type is updated to align with the new callback signature.

Also applies to: 30-30

packages/thirdweb/src/wallets/connection/autoConnectCore.ts (1)

210-221: LGTM: Consolidated onConnect invocation with error handling.

The onConnect callback is now invoked once after all auto-connect attempts complete, passing both the active wallet and all connected wallets. The added error handling ensures callback errors are logged without breaking the connection flow.

packages/thirdweb/src/exports/react.native.ts (1)

20-27: LGTM: Public API surface expanded with new types.

The exports now include OnConnectCallback and related connection/payment types, making them available for external use. This aligns with the SDK's public API organization guidelines.

@codecov
Copy link

codecov bot commented Nov 12, 2025

Codecov Report

❌ Patch coverage is 81.25000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.82%. Comparing base (e26d81c) to head (e3edd1b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...web/ui/ConnectWallet/Modal/ConnectModalContent.tsx 0.00% 1 Missing ⚠️
...thirdweb/src/wallets/connection/autoConnectCore.ts 92.30% 1 Missing ⚠️
packages/thirdweb/src/wallets/manager/index.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8403   +/-   ##
=======================================
  Coverage   54.82%   54.82%           
=======================================
  Files         919      919           
  Lines       60840    60843    +3     
  Branches     4135     4135           
=======================================
+ Hits        33356    33359    +3     
  Misses      27383    27383           
  Partials      101      101           
Flag Coverage Δ
packages 54.82% <81.25%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
.../react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx 10.68% <ø> (ø)
.../react/web/ui/ConnectWallet/Modal/ConnectModal.tsx 79.61% <ø> (ø)
...ges/thirdweb/src/wallets/connection/autoConnect.ts 95.23% <ø> (ø)
...web/ui/ConnectWallet/Modal/ConnectModalContent.tsx 9.32% <0.00%> (ø)
...thirdweb/src/wallets/connection/autoConnectCore.ts 79.39% <92.30%> (+0.38%) ⬆️
packages/thirdweb/src/wallets/manager/index.ts 90.84% <50.00%> (ø)
🚀 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: 0

🧹 Nitpick comments (1)
packages/thirdweb/src/wallets/connection/types.ts (1)

104-111: Clarify parameter naming and semantics.

The parameter name otherWallets is inconsistent with the canonical OnConnectCallback type definition (which uses allConnectedWallets) and potentially misleading. The comment "other wallets that were also connected" suggests this array excludes the active wallet, but based on the implementation in ConnectModalContent and autoConnectCore, the second parameter receives connectionManager.connectedWallets.getValue() which typically includes all connected wallets.

Please clarify:

  1. Does the second parameter include the activeWallet or only other wallets?
  2. Update the parameter name to match OnConnectCallback (allConnectedWallets) for consistency
  3. Update the JSDoc comment to accurately describe whether the array includes or excludes the activeWallet

Apply this diff if the array includes all wallets (including active):

  /**
-  * Callback to be called on successful auto-connection of last active wallet. The callback is called with the connected wallet
+  * Callback to be called on successful auto-connection of last active wallet. The callback is called with the active wallet and all connected wallets.
   *
   * ```tsx
   * <AutoConnect
-  *  onConnect={(activeWallet, otherWallets) => {
+  *  onConnect={(activeWallet, allConnectedWallets) => {
   *    console.log("auto connected to", activeWallet)
-  *    console.log("other wallets that were also connected", otherWallets)
+  *    console.log("all connected wallets (including active)", allConnectedWallets)
   *  }}
   * />
   * ```
   */
-  onConnect?: (activeWallet: Wallet, otherWallets: Wallet[]) => void;
+  onConnect?: (activeWallet: Wallet, allConnectedWallets: Wallet[]) => void;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 460011a and e3edd1b.

📒 Files selected for processing (17)
  • .changeset/fair-mails-divide.md (1 hunks)
  • apps/playground-web/src/components/in-app-wallet/ecosystem.tsx (1 hunks)
  • packages/thirdweb/src/exports/react.native.ts (1 hunks)
  • packages/thirdweb/src/exports/react.ts (1 hunks)
  • packages/thirdweb/src/react/core/hooks/connection/ConnectButtonProps.ts (2 hunks)
  • packages/thirdweb/src/react/core/hooks/connection/ConnectEmbedProps.ts (2 hunks)
  • packages/thirdweb/src/react/core/hooks/connection/types.ts (1 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx (2 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModal.tsx (2 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx (3 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx (2 hunks)
  • packages/thirdweb/src/wallets/connection/autoConnect.ts (1 hunks)
  • packages/thirdweb/src/wallets/connection/autoConnectCore.test.ts (4 hunks)
  • packages/thirdweb/src/wallets/connection/autoConnectCore.ts (2 hunks)
  • packages/thirdweb/src/wallets/connection/types.ts (1 hunks)
  • packages/thirdweb/src/wallets/manager/connection-manager.test.ts (1 hunks)
  • packages/thirdweb/src/wallets/manager/index.ts (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/thirdweb/src/wallets/connection/autoConnect.ts
🚧 Files skipped from review as they are similar to previous changes (10)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx
  • packages/thirdweb/src/react/core/hooks/connection/ConnectButtonProps.ts
  • packages/thirdweb/src/react/core/hooks/connection/ConnectEmbedProps.ts
  • packages/thirdweb/src/wallets/manager/index.ts
  • packages/thirdweb/src/wallets/connection/autoConnectCore.test.ts
  • apps/playground-web/src/components/in-app-wallet/ecosystem.tsx
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModal.tsx
  • packages/thirdweb/src/react/core/hooks/connection/types.ts
  • packages/thirdweb/src/exports/react.native.ts
  • packages/thirdweb/src/wallets/manager/connection-manager.test.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

Files:

  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx
  • packages/thirdweb/src/wallets/connection/types.ts
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx
  • packages/thirdweb/src/wallets/connection/autoConnectCore.ts
  • packages/thirdweb/src/exports/react.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx
  • packages/thirdweb/src/wallets/connection/types.ts
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx
  • packages/thirdweb/src/wallets/connection/autoConnectCore.ts
  • packages/thirdweb/src/exports/react.ts
packages/thirdweb/src/wallets/**

📄 CodeRabbit inference engine (CLAUDE.md)

packages/thirdweb/src/wallets/**: Unified Wallet and Account interfaces in wallet architecture
Support for in-app wallets (social/email login)
Smart wallets with account abstraction
EIP-1193, EIP-5792, EIP-7702 standard support in wallet modules

Files:

  • packages/thirdweb/src/wallets/connection/types.ts
  • packages/thirdweb/src/wallets/connection/autoConnectCore.ts
packages/thirdweb/src/exports/**

📄 CodeRabbit inference engine (CLAUDE.md)

packages/thirdweb/src/exports/**: Export everything via exports/ directory, grouped by feature in the SDK public API
Every public symbol must have comprehensive TSDoc with at least one @example block that compiles and custom annotation tags (@beta, @internal, @experimental)

Files:

  • packages/thirdweb/src/exports/react.ts
🧠 Learnings (10)
📓 Common learnings
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : Support for in-app wallets (social/email login)
📚 Learning: 2025-09-23T19:56:43.668Z
Learnt from: MananTank
Repo: thirdweb-dev/js PR: 8106
File: packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx:482-485
Timestamp: 2025-09-23T19:56:43.668Z
Learning: In packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx, the EmbedContainer uses width: "100vw" intentionally rather than "100%" - this is by design for the bridge widget embedding use case.

Applied to files:

  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).

Applied to files:

  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx
  • packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : Unified `Wallet` and `Account` interfaces in wallet architecture

Applied to files:

  • packages/thirdweb/src/wallets/connection/types.ts
  • packages/thirdweb/src/wallets/connection/autoConnectCore.ts
  • .changeset/fair-mails-divide.md
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : EIP-1193, EIP-5792, EIP-7702 standard support in wallet modules

Applied to files:

  • packages/thirdweb/src/wallets/connection/types.ts
  • packages/thirdweb/src/wallets/connection/autoConnectCore.ts
  • .changeset/fair-mails-divide.md
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : Smart wallets with account abstraction

Applied to files:

  • packages/thirdweb/src/wallets/connection/types.ts
  • packages/thirdweb/src/wallets/connection/autoConnectCore.ts
  • .changeset/fair-mails-divide.md
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : Support for in-app wallets (social/email login)

Applied to files:

  • packages/thirdweb/src/wallets/connection/types.ts
  • .changeset/fair-mails-divide.md
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Surface breaking changes prominently in PR descriptions

Applied to files:

  • .changeset/fair-mails-divide.md
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to src/exports/react.native.ts : React Native specific exports are in `src/exports/react.native.ts`

Applied to files:

  • packages/thirdweb/src/exports/react.ts
📚 Learning: 2025-06-17T18:30:52.976Z
Learnt from: MananTank
Repo: thirdweb-dev/js PR: 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.

Applied to files:

  • packages/thirdweb/src/exports/react.ts
🧬 Code graph analysis (2)
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx (1)
packages/thirdweb/src/react/core/hooks/connection/types.ts (1)
  • OnConnectCallback (3-6)
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx (3)
packages/thirdweb/src/exports/react.native.ts (1)
  • OnConnectCallback (27-27)
packages/thirdweb/src/exports/react.ts (1)
  • OnConnectCallback (26-26)
packages/thirdweb/src/react/core/hooks/connection/types.ts (1)
  • OnConnectCallback (3-6)
⏰ 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 (7)
.changeset/fair-mails-divide.md (1)

2-2: Breaking change already flagged in previous review.

A past review comment correctly identified that this callback signature change is breaking and should be marked as major, not minor. Refer to the existing comment for details and the suggested fix.

packages/thirdweb/src/exports/react.ts (1)

26-26: LGTM!

The OnConnectCallback type export is correctly structured and properly placed in the public API surface.

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

19-19: LGTM!

The OnConnectCallback type import is correctly added and used to update the prop type.


358-358: LGTM!

The onConnect prop type is correctly updated to use OnConnectCallback, maintaining consistency with the new callback signature across the codebase.

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

96-98: Verify callback parameter semantics and timing.

The invocation passes wallet (the newly connected wallet) as the first argument, but the OnConnectCallback type names this parameter activeWallet. This creates ambiguity when shouldSetActive is false (line 92-94): the newly connected wallet is NOT the active wallet, yet it's passed as the "activeWallet" parameter.

Additionally, verify that connectionManager.connectedWallets.getValue() returns the updated list immediately after setActiveWallet or addConnectedWallet is called. If these operations are asynchronous or defer state updates, the callback might receive stale data.

Consider these options:

  1. If the first parameter should always be the active wallet (not just the connecting wallet), fetch it explicitly:

    const currentActiveWallet = connectionManager.activeWalletStore.getValue();
    if (currentActiveWallet) {
      props.onConnect(currentActiveWallet, connectionManager.connectedWallets.getValue());
    }
  2. If the first parameter represents the wallet that triggered the connection (regardless of whether it's active), update the parameter name in OnConnectCallback from activeWallet to connectedWallet for clarity.

  3. Document the expected behavior: does onConnect only fire when a wallet becomes active, or does it fire for any connected wallet?

packages/thirdweb/src/wallets/connection/autoConnectCore.ts (2)

209-222: Well-structured callback invocation.

The finalization logic correctly retrieves the active wallet and all connected wallets from the manager stores after all connection attempts complete. This ensures the callback receives accurate state rather than assuming connection results. The try-catch around onConnect prevents callback errors from disrupting the connection flow.

Note: This implementation is more robust than the approach in ConnectModalContent.tsx (line 96-98), which passes the just-connected wallet rather than explicitly fetching the active wallet from the store. Consider aligning ConnectModalContent to use a similar pattern for consistency.


155-160: LGTM!

The connection logic correctly awaits the result and handles errors appropriately. Removing the direct wallet assignment in favor of retrieving the final state from manager stores (lines 210-211) is a cleaner approach.

@joaquim-verges joaquim-verges merged commit d0bbbfd into main Nov 12, 2025
24 checks passed
@joaquim-verges joaquim-verges deleted the _SDK_Add_all_connected_wallets_in_onConnect_callbacks branch November 12, 2025 20:44
@joaquim-verges joaquim-verges mentioned this pull request Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants