Skip to content

Fix: Exclude IAW when smart wallets are used #7454

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 4 commits into from
Jun 27, 2025

Conversation

gregfromstl
Copy link
Member

@gregfromstl gregfromstl commented Jun 27, 2025


PR-Codex overview

This PR introduces a patch for the thirdweb package, enhancing the ConnectButton component to support account abstraction with an execution mode and modifies the getDefaultWallets function to accept an execution mode option.

Detailed summary

  • Added executionMode to the ConnectButton component.
  • Updated the connection logic to include props.accountAbstraction.
  • Modified getDefaultWallets to accept an executionMode parameter.
  • Adjusted createWallet calls to incorporate the new executionMode option.

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

Summary by CodeRabbit

  • New Features

    • Added support for configuring execution mode (including EIP4337) when connecting wallets, enhancing flexibility for wallet connections.
  • Bug Fixes

    • Prevented the admin wallet from connecting if required configuration is missing, improving security and configuration control.

@gregfromstl gregfromstl requested review from a team as code owners June 27, 2025 00:35
Copy link

linear bot commented Jun 27, 2025

Copy link

changeset-bot bot commented Jun 27, 2025

⚠️ No Changeset found

Latest commit: abdb47c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link

vercel bot commented Jun 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 27, 2025 6:06pm
nebula ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 27, 2025 6:06pm
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 27, 2025 6:06pm
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 27, 2025 6:06pm
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 27, 2025 6:06pm

Copy link
Contributor

coderabbitai bot commented Jun 27, 2025

Walkthrough

This change introduces support for an executionMode configuration when creating the "inApp" wallet, updates the getDefaultWallets function signature to accept this option, and ensures the ConnectButton component passes the appropriate execution mode based on its accountAbstraction prop. Additionally, a patch prevents the admin wallet from connecting without the required IAW configuration.

Changes

File(s) Change Summary
.changeset/fifty-turtles-sneeze.md Documents a patch preventing admin wallet connection if IAW configuration is missing.
packages/thirdweb/src/react/web/ui/ConnectWallet/ConnectButton.tsx Adds logic to set executionMode for default wallets based on accountAbstraction prop; updates useMemo deps.
packages/thirdweb/src/wallets/defaultWallets.ts Updates getDefaultWallets signature to accept executionMode; passes it to "inApp" wallet creation.

Sequence Diagram(s)

sequenceDiagram
    participant UI as ConnectButton
    participant Wallets as getDefaultWallets
    participant InApp as InApp Wallet

    UI->>Wallets: getDefaultWallets({ executionMode })
    alt executionMode present
        Wallets->>InApp: createWallet({ executionMode })
    else executionMode absent
        Wallets->>InApp: createWallet()
    end
Loading

Possibly related PRs

  • thirdweb-dev/js#7241: Refactors and consolidates smart wallet detection and sponsored transaction checks, including for "inApp" wallets, directly relating to the execution mode and wallet configuration changes in this PR.

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.

📜 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 2835956 and 35341cb.

📒 Files selected for processing (3)
  • .changeset/fifty-turtles-sneeze.md (1 hunks)
  • packages/thirdweb/src/react/web/ui/ConnectWallet/ConnectButton.tsx (1 hunks)
  • packages/thirdweb/src/wallets/defaultWallets.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.@(ts|tsx)`: Accept a typed 'props' object and export a named function (e.g...

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

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

List of files the instruction was applied to:

  • packages/thirdweb/src/wallets/defaultWallets.ts
  • packages/thirdweb/src/react/web/ui/ConnectWallet/ConnectButton.tsx
🧠 Learnings (4)
📓 Common learnings
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-25T02:13:08.257Z
Learning: Wallet architecture should unify Wallet and Account interfaces, support in-app wallets (social/email login), smart wallets with account abstraction, and EIP-1193, EIP-5792, EIP-7702 standards.
Learnt from: joaquim-verges
PR: thirdweb-dev/js#7268
File: packages/thirdweb/src/wallets/in-app/core/wallet/in-app-core.ts:210-216
Timestamp: 2025-06-03T23:44:40.243Z
Learning: EIP7702 wallets do not need special handling for switching chains, unlike EIP4337 wallets which require reconnection when switching chains. In the switchChain method condition, EIP7702 should be intentionally excluded from the reconnection logic.
.changeset/fifty-turtles-sneeze.md (1)
Learnt from: joaquim-verges
PR: thirdweb-dev/js#7268
File: packages/thirdweb/src/wallets/in-app/core/wallet/in-app-core.ts:210-216
Timestamp: 2025-06-03T23:44:40.243Z
Learning: EIP7702 wallets do not need special handling for switching chains, unlike EIP4337 wallets which require reconnection when switching chains. In the switchChain method condition, EIP7702 should be intentionally excluded from the reconnection logic.
packages/thirdweb/src/wallets/defaultWallets.ts (3)
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-25T02:13:08.257Z
Learning: Wallet architecture should unify Wallet and Account interfaces, support in-app wallets (social/email login), smart wallets with account abstraction, and EIP-1193, EIP-5792, EIP-7702 standards.
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-25T02:13:08.257Z
Learning: For multi-platform support, provide platform-specific exports and adapters (e.g., React Native, Node.js, Wagmi, Ethers).
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-25T02:13:08.257Z
Learning: Use FORKED_ETHEREUM_CHAIN for mainnet interactions and ANVIL_CHAIN for isolated tests.
packages/thirdweb/src/react/web/ui/ConnectWallet/ConnectButton.tsx (3)
Learnt from: joaquim-verges
PR: thirdweb-dev/js#7268
File: packages/thirdweb/src/wallets/in-app/core/wallet/in-app-core.ts:210-216
Timestamp: 2025-06-03T23:44:40.243Z
Learning: EIP7702 wallets do not need special handling for switching chains, unlike EIP4337 wallets which require reconnection when switching chains. In the switchChain method condition, EIP7702 should be intentionally excluded from the reconnection logic.
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-25T02:13:08.257Z
Learning: Wallet architecture should unify Wallet and Account interfaces, support in-app wallets (social/email login), smart wallets with account abstraction, and EIP-1193, EIP-5792, EIP-7702 standards.
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.
🧬 Code Graph Analysis (1)
packages/thirdweb/src/wallets/defaultWallets.ts (1)
packages/thirdweb/src/wallets/in-app/core/wallet/types.ts (1)
  • ExecutionModeOptions (44-61)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Unit Tests
  • GitHub Check: Lint Packages
  • GitHub Check: Size
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (6)
.changeset/fifty-turtles-sneeze.md (1)

1-6: LGTM! Well-documented changeset.

The changeset properly documents the patch-level change with a clear description of the admin wallet connection prevention when no IAW configuration is specified.

packages/thirdweb/src/wallets/defaultWallets.ts (3)

4-4: Good type import.

Properly importing the ExecutionModeOptions type to support the new functionality.


11-15: Well-designed function signature extension.

The optional executionMode parameter maintains backwards compatibility while enabling the new account abstraction functionality.


17-19: Targeted implementation for in-app wallet.

Correctly passing the executionMode only to the in-app wallet creation, which is the appropriate wallet type for execution mode configuration based on the available ExecutionModeOptions (EIP4337, EIP7702, EOA).

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

295-301: Excellent conditional logic for execution mode configuration.

The implementation correctly maps the accountAbstraction prop to the appropriate executionMode configuration:

  • When account abstraction is enabled, uses EIP4337 mode with smart account options
  • When disabled, leaves executionMode undefined for standard wallet behavior

This provides a clean API for users to enable account abstraction functionality.


302-302: Proper dependency array update.

Correctly includes props.accountAbstraction in the useMemo dependency array to ensure the wallets are recalculated when the account abstraction configuration changes.

✨ 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 Jun 27, 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 Jun 27, 2025
@gregfromstl gregfromstl changed the title Feature: Exclude IAW if smart wallets are used Feature: Exclude IAW in Payment Widgets if smart wallets are used Jun 27, 2025
@gregfromstl gregfromstl force-pushed the greg/tool-4864-handle-sponsored-gas-in-new-widgets branch 2 times, most recently from 325e98b to 8ba5959 Compare June 27, 2025 00:36
@gregfromstl gregfromstl marked this pull request as draft June 27, 2025 00:36
@gregfromstl gregfromstl force-pushed the greg/tool-4864-handle-sponsored-gas-in-new-widgets branch from 8ba5959 to 2835956 Compare June 27, 2025 00:39
@gregfromstl gregfromstl changed the title Feature: Exclude IAW in Payment Widgets if smart wallets are used Feature: Exclude IAW when smart wallest are used Jun 27, 2025
@gregfromstl gregfromstl marked this pull request as ready for review June 27, 2025 00:39
Copy link
Contributor

github-actions bot commented Jun 27, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 63.11 KB (0%) 1.3 s (0%) 248 ms (+196.65% 🔺) 1.6 s
thirdweb (cjs) 352.61 KB (0%) 7.1 s (0%) 638 ms (+8.6% 🔺) 7.7 s
thirdweb (minimal + tree-shaking) 5.72 KB (0%) 115 ms (0%) 81 ms (+1099.12% 🔺) 196 ms
thirdweb/chains (tree-shaking) 530 B (0%) 11 ms (0%) 41 ms (+2420.67% 🔺) 52 ms
thirdweb/react (minimal + tree-shaking) 19.59 KB (0%) 392 ms (0%) 99 ms (+903.14% 🔺) 490 ms

@gregfromstl gregfromstl changed the title Feature: Exclude IAW when smart wallest are used Feature: Exclude IAW when smart wallets are used Jun 27, 2025
@gregfromstl gregfromstl force-pushed the greg/tool-4864-handle-sponsored-gas-in-new-widgets branch from 2835956 to 134573f Compare June 27, 2025 17:47
@vercel vercel bot temporarily deployed to Preview – nebula June 27, 2025 17:48 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 27, 2025 17:48 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 27, 2025 17:48 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 27, 2025 17:48 Inactive
@gregfromstl gregfromstl changed the title Feature: Exclude IAW when smart wallets are used Fix: Exclude IAW when smart wallets are used Jun 27, 2025
@gregfromstl gregfromstl added the merge-queue Adds the pull request to Graphite's merge queue. label Jun 27, 2025
Copy link
Member Author

gregfromstl commented Jun 27, 2025

Merge activity

  • Jun 27, 5:50 PM UTC: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jun 27, 5:51 PM UTC: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jun 27, 8:39 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

codecov bot commented Jun 27, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 5 lines in your changes missing coverage. Please review.

Project coverage is 51.91%. Comparing base (e814248) to head (35341cb).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...b/src/react/web/ui/ConnectWallet/ConnectButton.tsx 28.57% 5 Missing ⚠️

❌ Your patch status has failed because the patch coverage (50.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    #7454      +/-   ##
==========================================
- Coverage   51.92%   51.91%   -0.01%     
==========================================
  Files         947      947              
  Lines       63932    63940       +8     
  Branches     4216     4218       +2     
==========================================
+ Hits        33194    33197       +3     
- Misses      30632    30637       +5     
  Partials      106      106              
Flag Coverage Δ
packages 51.91% <50.00%> (-0.01%) ⬇️
Files with missing lines Coverage Δ
packages/thirdweb/src/wallets/defaultWallets.ts 100.00% <100.00%> (ø)
...b/src/react/web/ui/ConnectWallet/ConnectButton.tsx 56.90% <28.57%> (-0.83%) ⬇️
🚀 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 6d1d344 into main Jun 27, 2025
23 of 24 checks passed
@gregfromstl gregfromstl deleted the greg/tool-4864-handle-sponsored-gas-in-new-widgets branch June 27, 2025 20:36
@joaquim-verges joaquim-verges mentioned this pull request Jun 27, 2025
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