Skip to content

[SDK] Support EIP7702 execution for ecosystem wallets #7268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented Jun 3, 2025


PR-Codex overview

This PR introduces support for EIP7702 execution in ecosystem wallets, enhancing wallet functionality and options for users. It modifies several components to accommodate this new execution mode and refines the user interface for better interaction.

Detailed summary

  • Added executionMode option to wallet configuration, supporting "EIP4337" and "EIP7702".
  • Updated accountFactoryAddress to be optional.
  • Changed ecosystemWallet call from "ecosystem.catlovers" to "ecosystem.catfans".
  • Modified AuthOptionsSection and AuthOptionsForm to accept client prop.
  • Introduced resolveSmartAccountOptionsFromEcosystem function to handle options based on ecosystem settings.
  • Updated UI components in AuthOptionsForm to include executionMode selection.
  • Enhanced error handling for chain selection in wallet creation.
  • Removed redundant code related to ecosystem options fetching.

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

Summary by CodeRabbit

  • New Features
    • Added support for selecting between EIP-4337 and EIP-7702 execution modes when configuring ecosystem wallets.
    • Introduced a new execution mode selector in the smart account configuration UI.
    • Enhanced smart account options to allow optional account factory addresses and execution mode selection.
  • UI Improvements
    • Redesigned smart account configuration layout with clearer controls for execution mode and account factory options.
    • Improved network selection with an updated selector component.
  • Other Changes
    • Updated development environment wallet identifier for ecosystem wallets.

Copy link

vercel bot commented Jun 3, 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 3, 2025 11:39pm
login ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 3, 2025 11:39pm
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 3, 2025 11:39pm
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 3, 2025 11:39pm
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 3, 2025 11:39pm

Copy link

changeset-bot bot commented Jun 3, 2025

🦋 Changeset detected

Latest commit: 0bcc997

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

This PR includes changesets to release 2 packages
Name Type
thirdweb Patch
@thirdweb-dev/wagmi-adapter Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link
Contributor

coderabbitai bot commented Jun 3, 2025

Walkthrough

This change introduces support for the EIP-7702 execution mode in ecosystem wallets, updates type definitions and UI to allow users to select between EIP-4337 and EIP-7702, and refactors smart account option resolution logic for improved maintainability. Several components and types are updated to accommodate the new execution mode.

Changes

File(s) / Path(s) Change Summary
.changeset/small-moons-add.md Adds a changelog entry noting EIP-7702 support for ecosystem wallets in the "thirdweb" component.
apps/dashboard/src/app/(app)/team/[team_slug]/.../EcosystemPermissionsPage.tsx Imports and utilizes getClientThirdwebClient to create a client instance, passing it to AuthOptionsSection as a prop.
apps/dashboard/src/app/(app)/team/[team_slug]/.../auth-options-form.client.tsx Extends form data and UI to support executionMode ("EIP4337" or "EIP7702"), updates validation, adds a selector for execution mode, and conditionally renders account factory options.
apps/dashboard/src/app/(app)/team/[team_slug]/.../auth-options-section.tsx Updates AuthOptionsSection to require and forward a client prop to AuthOptionsForm.
apps/dashboard/src/app/(app)/team/[team_slug]/.../ecosystem/types.ts Updates Ecosystem type: makes accountFactoryAddress optional and adds an optional executionMode property.
apps/playground-web/src/components/in-app-wallet/ecosystem.tsx Changes ecosystem wallet identifier from "ecosystem.catlovers" to "ecosystem.catfans".
packages/thirdweb/src/wallets/ecosystem/get-ecosystem-wallet-auth-options.ts Updates SmartAccountOptions type: makes accountFactoryAddress optional and adds optional executionMode property.
packages/thirdweb/src/wallets/in-app/core/wallet/in-app-core.ts Refactors smart account option resolution into a helper, adds EIP-7702 support, centralizes logic for execution mode handling, and updates chain switching logic.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant EcosystemPermissionsPage
    participant AuthOptionsSection
    participant AuthOptionsForm
    participant ThirdwebClient
    participant InAppWalletCore

    User->>EcosystemPermissionsPage: Loads permissions page
    EcosystemPermissionsPage->>ThirdwebClient: getClientThirdwebClient(authToken, teamId)
    EcosystemPermissionsPage->>AuthOptionsSection: Render with client
    AuthOptionsSection->>AuthOptionsForm: Render with client
    User->>AuthOptionsForm: Selects executionMode (EIP4337 or EIP7702)
    AuthOptionsForm->>ThirdwebClient: (If needed) Fetch chain info
    AuthOptionsForm->>InAppWalletCore: Submit form with executionMode, sponsorGas, etc.
    InAppWalletCore->>InAppWalletCore: resolveSmartAccountOptionsFromEcosystem()
    InAppWalletCore->>InAppWalletCore: Set options based on executionMode
Loading

Possibly related PRs

  • thirdweb-dev/js#7241: Refactors and improves smart wallet detection logic and sponsored transaction checks for inApp and ecosystem wallets; both PRs modify smart wallet-related logic, with this PR focusing on detection and identification, and the current PR on execution mode support.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@joaquim-verges joaquim-verges marked this pull request as ready for review June 3, 2025 23:24
@joaquim-verges joaquim-verges requested review from a team as code owners June 3, 2025 23:24
@github-actions github-actions bot added Dashboard Involves changes to the Dashboard. Playground Changes involving the Playground codebase. packages SDK Involves changes to the thirdweb SDK labels Jun 3, 2025
Copy link
Member Author

joaquim-verges commented Jun 3, 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.

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

@joaquim-verges joaquim-verges force-pushed the _SDK_Support_EIP7702_execution_for_ecosystem_wallets branch 2 times, most recently from 87d6fd2 to c515d8b Compare June 3, 2025 23:26
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

🔭 Outside diff range comments (2)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/auth-options-form.client.tsx (2)

48-53: ⚠️ Potential issue

defaultChainId must allow undefined to satisfy current usage

defaultValues and several validators allow defaultChainId to be omitted, but the type marks it as mandatory.
This will fail a strict TypeScript build.

-  defaultChainId: number;
+  defaultChainId?: number;

194-218: 🛠️ Refactor suggestion

accountFactoryAddress should be conditioned on EIP-4337 only

When executionMode is EIP7702 the factory address is irrelevant but still sent.
Safer pattern:

-      smartAccountOptions = {
-        defaultChainId: data.defaultChainId,
-        sponsorGas: data.sponsorGas,
-        accountFactoryAddress,
-        executionMode: data.executionMode,
-      };
+      smartAccountOptions = {
+        defaultChainId: data.defaultChainId,
+        sponsorGas: data.sponsorGas,
+        executionMode: data.executionMode,
+        ...(data.executionMode === "EIP4337"
+          ? { accountFactoryAddress }
+          : {}),
+      };
🧹 Nitpick comments (1)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/auth-options-form.client.tsx (1)

103-108: Minor schema mismatch after making defaultChainId optional

Once the field is typed number | undefined, you can drop the redundant .optional() call:

-          defaultChainId: z.coerce.number({ ... }).optional(),
+          defaultChainId: z.coerce.number({ ... }).optional(),

(The call is now consistent with the new optional type, so no behaviour change – purely clarity.)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3d1c321 and 0bcc997.

📒 Files selected for processing (8)
  • .changeset/small-moons-add.md (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/EcosystemPermissionsPage.tsx (3 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/auth-options-form.client.tsx (8 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/server/auth-options-section.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/types.ts (1 hunks)
  • apps/playground-web/src/components/in-app-wallet/ecosystem.tsx (1 hunks)
  • packages/thirdweb/src/wallets/ecosystem/get-ecosystem-wallet-auth-options.ts (1 hunks)
  • packages/thirdweb/src/wallets/in-app/core/wallet/in-app-core.ts (5 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/EcosystemPermissionsPage.tsx (2)
packages/engine/src/client/client.gen.ts (1)
  • client (24-28)
apps/dashboard/src/@/constants/thirdweb-client.client.ts (1)
  • getClientThirdwebClient (3-11)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/auth-options-form.client.tsx (2)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/types.ts (1)
  • Ecosystem (21-48)
packages/thirdweb/src/exports/thirdweb.ts (1)
  • ThirdwebClient (26-26)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Unit Tests
  • GitHub Check: Size
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (10)
apps/playground-web/src/components/in-app-wallet/ecosystem.tsx (1)

11-11: Ecosystem identifier updated for development environment.

The change from "ecosystem.catlovers" to "ecosystem.catfans" is a straightforward identifier update for the development ecosystem. This aligns with the broader ecosystem wallet enhancements in this PR.

.changeset/small-moons-add.md (1)

1-6: Changeset documentation is properly formatted.

The changeset correctly documents the new EIP7702 execution mode support for ecosystem wallets as a patch-level change to the thirdweb package.

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/EcosystemPermissionsPage.tsx (3)

2-2: Import addition looks good.

The import of getClientThirdwebClient is correctly added to support the new client prop functionality.


22-22: Client instantiation is properly implemented.

The client is correctly created using the provided authToken as JWT and teamId, which aligns with the function signature from the relevant code snippets.


35-35: Client prop properly passed to AuthOptionsSection.

The newly created client instance is correctly passed down to the AuthOptionsSection component, enabling the enhanced functionality for EIP7702 execution mode support.

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/types.ts (1)

41-42: Type definition updates properly support EIP7702 execution mode.

The changes correctly:

  • Make accountFactoryAddress optional, which is appropriate since EIP7702 may not require a factory address
  • Add the new executionMode property with the correct union type supporting both "EIP4337" and "EIP7702"
  • Maintain backward compatibility by making both properties optional

These type updates align well with the PR objectives to introduce EIP7702 execution mode support.

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/server/auth-options-section.tsx (1)

12-18: Prop definition looks good

The new client prop is clearly typed and plumbed through to the child form – no issues spotted here.

packages/thirdweb/src/wallets/ecosystem/get-ecosystem-wallet-auth-options.ts (1)

18-20: Remember to update downstream type-guards / serializers

accountFactoryAddress is now optional and executionMode added, but consumers of SmartAccountOptions (e.g. runtime validators, schema Zod objects, backend responses) may still treat these fields as required / unknown. Double-check any zod, io-ts, or manual checks that touch this shape.

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/auth-options-form.client.tsx (1)

525-529: Verify SingleNetworkSelector signature

The control passes field.value (number | undefined) and onChange (value ⇒ void).
Ensure SingleNetworkSelector receives exactly these props (chainId?: number, onChange(id: number)).

packages/thirdweb/src/wallets/in-app/core/wallet/in-app-core.ts (1)

60-99: Good extraction of ecosystem-specific logic

Centralising smart-account resolution removes duplication in three call-sites and keeps the behaviour consistent.

Copy link
Contributor

github-actions bot commented Jun 3, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 62.57 KB (0%) 1.3 s (0%) 202 ms (+148.96% 🔺) 1.5 s
thirdweb (cjs) 345.38 KB (0%) 7 s (0%) 623 ms (+6.58% 🔺) 7.6 s
thirdweb (minimal + tree-shaking) 5.7 KB (0%) 114 ms (0%) 103 ms (+2229.64% 🔺) 217 ms
thirdweb/chains (tree-shaking) 531 B (0%) 11 ms (0%) 31 ms (+2128.85% 🔺) 42 ms
thirdweb/react (minimal + tree-shaking) 19.56 KB (0%) 392 ms (0%) 85 ms (+641.01% 🔺) 477 ms

Copy link

codecov bot commented Jun 3, 2025

Codecov Report

Attention: Patch coverage is 72.34043% with 13 lines in your changes missing coverage. Please review.

Project coverage is 55.57%. Comparing base (dfe4cf0) to head (0bcc997).
Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
...dweb/src/wallets/in-app/core/wallet/in-app-core.ts 72.34% 13 Missing ⚠️

❌ Your patch status has failed because the patch coverage (72.34%) 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    #7268   +/-   ##
=======================================
  Coverage   55.57%   55.57%           
=======================================
  Files         909      909           
  Lines       58680    58667   -13     
  Branches     4157     4156    -1     
=======================================
- Hits        32610    32606    -4     
+ Misses      25963    25954    -9     
  Partials      107      107           
Flag Coverage Δ
packages 55.57% <72.34%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
...ets/ecosystem/get-ecosystem-wallet-auth-options.ts 70.58% <ø> (ø)
...dweb/src/wallets/in-app/core/wallet/in-app-core.ts 74.50% <72.34%> (+2.49%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@joaquim-verges joaquim-verges merged commit b237318 into main Jun 4, 2025
24 of 25 checks passed
@joaquim-verges joaquim-verges deleted the _SDK_Support_EIP7702_execution_for_ecosystem_wallets branch June 4, 2025 07:09
@joaquim-verges joaquim-verges mentioned this pull request Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dashboard Involves changes to the Dashboard. 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.

1 participant