Skip to content

Conversation

@joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented Sep 5, 2025


PR-Codex overview

This PR adds a detailed documentation comment for the create7702MinimalAccount function, explaining its purpose, parameters, return value, and providing an example for users.

Detailed summary

  • Added a JSDoc comment for the create7702MinimalAccount function.
  • Described EIP-7702 account delegation and its benefits.
  • Explained parameters: client, adminAccount, sponsorGas.
  • Provided an example of creating and using a minimal account.

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

Summary by CodeRabbit

  • New Features
    • Added support for creating EIP-7702 minimal smart accounts in in-app wallets, allowing EOAs to delegate to a MinimalAccount.
    • Enables batch transactions, optional sponsored gas, and compatibility with EIP-5792 flows.
    • Improves transaction flexibility and reduces user friction; backwards compatible with no removed functionality.

@vercel
Copy link

vercel bot commented Sep 5, 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 Sep 6, 2025 0:38am
nebula Ready Ready Preview Comment Sep 6, 2025 0:38am
thirdweb_playground Ready Ready Preview Comment Sep 6, 2025 0:38am
thirdweb-www Ready Ready Preview Comment Sep 6, 2025 0:38am
wallet-ui Ready Ready Preview Comment Sep 6, 2025 0:38am

@changeset-bot
Copy link

changeset-bot bot commented Sep 5, 2025

⚠️ No Changeset found

Latest commit: b68d1c0

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 5, 2025

Walkthrough

Adds a new exported factory function create7702MinimalAccount that constructs an EIP-7702-enabled MinimalAccount from a ThirdwebClient and an admin Account, with optional gas sponsorship. No existing public APIs are modified.

Changes

Cohort / File(s) Summary
EIP-7702 Minimal Account Factory
packages/thirdweb/src/wallets/in-app/core/eip7702/minimal-account.ts
Adds export const create7702MinimalAccount(args: { client: ThirdwebClient; adminAccount: Account; sponsorGas?: boolean; }): Account with comprehensive JSDoc and example usage. Extends public API to create an EIP-7702 MinimalAccount supporting batch transactions and EIP-5792; does not change existing APIs.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer
  participant Lib as create7702MinimalAccount
  participant Client as ThirdwebClient
  participant Admin as Admin Account (EOA)
  participant MA as MinimalAccount (EIP-7702)
  Note over Lib: New factory API

  Dev->>Lib: create7702MinimalAccount({ client, adminAccount, sponsorGas? })
  Lib->>Client: initialize dependencies / config
  Lib->>Admin: bind EOA as admin/delegator (EIP-7702)
  Lib->>MA: construct MinimalAccount wrapper
  alt sponsorGas enabled
    Lib->>MA: enable sponsored-gas handling
  end
  Lib-->>Dev: return Account (supports batch tx, EIP-5792)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (3)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.
  • EIP-7702: Entity not found: Issue - Could not find referenced Issue.
  • EIP-5792: Entity not found: Issue - Could not find referenced Issue.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • 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 6a7d126 and b68d1c0.

📒 Files selected for processing (1)
  • packages/thirdweb/src/wallets/in-app/core/eip7702/minimal-account.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/thirdweb/src/wallets/in-app/core/eip7702/minimal-account.ts
⏰ 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). (8)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Build Packages
  • GitHub Check: Unit Tests
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch _Wallets_Add_documentation_for_create7702MinimalAccount_function

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

@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Sep 5, 2025
Copy link
Member Author

joaquim-verges commented Sep 5, 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 marked this pull request as ready for review September 5, 2025 22:52
@joaquim-verges joaquim-verges requested review from a team as code owners September 5, 2025 22:52
@joaquim-verges joaquim-verges changed the title [Wallets] Add documentation for create7702MinimalAccount function [SDK] Add documentation for create7702MinimalAccount function Sep 5, 2025
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: 2

🧹 Nitpick comments (1)
packages/thirdweb/src/wallets/in-app/core/eip7702/minimal-account.ts (1)

134-139: Grammar: “a EIP-7702” → “an EIP-7702”.

- * // Wrap it with a EIP-7702 account
+ * // Wrap it with an EIP-7702 account
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • 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 14fe9ee and 6a7d126.

📒 Files selected for processing (1)
  • packages/thirdweb/src/wallets/in-app/core/eip7702/minimal-account.ts (1 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

**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size

Files:

  • packages/thirdweb/src/wallets/in-app/core/eip7702/minimal-account.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/wallets/in-app/core/eip7702/minimal-account.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/in-app/core/eip7702/minimal-account.ts
packages/thirdweb/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/thirdweb/**/*.{ts,tsx}: Every public symbol must have comprehensive TSDoc with at least one compiling @example and a custom tag (@beta, @internal, @experimental, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
Lazy‑load heavy dependencies inside async paths (e.g., const { jsPDF } = await import("jspdf"))

Files:

  • packages/thirdweb/src/wallets/in-app/core/eip7702/minimal-account.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
PR: thirdweb-dev/js#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
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
PR: thirdweb-dev/js#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/in-app/core/eip7702/minimal-account.ts
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
PR: thirdweb-dev/js#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/in-app/core/eip7702/minimal-account.ts
⏰ 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: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Unit Tests
  • GitHub Check: Build Packages
  • GitHub Check: Size
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
packages/thirdweb/src/wallets/in-app/core/eip7702/minimal-account.ts (1)

118-121: Fix the example to use the Account API (and remove a likely non-existent root helper).

Use minimal7702Account.sendBatchTransaction(...) instead of importing sendBatchTransaction from thirdweb, and destructure transactionHash from the result.

- * import { createThirdwebClient, sendBatchTransaction } from "thirdweb";
+ * import { createThirdwebClient } from "thirdweb";
  * import { privateKeyToAccount } from "thirdweb/wallets";
  * import { create7702MinimalAccount } from "thirdweb/wallets/in-app";
  * import { sepolia } from "thirdweb/chains";
@@
- * // Send a batch of transactions
- * const result = await sendBatchTransaction({
- *   account: minimal7702Account,
- *   transactions: [
- *   {
- *     to: "0x...",
- *     data: "0x...",
- *     value: 0n,
- *     chainId: sepolia.id
- *   },
- *   {
- *     to: "0x...",
- *     data: "0x...",
- *     value: 0n,
- *     chainId: sepolia.id
- *   }
- * ]});
- *
- * console.log("Batch transaction hash:", result.transactionHash);
+ * // Send a batch of transactions
+ * const { transactionHash } = await minimal7702Account.sendBatchTransaction([
+ *   {
+ *     to: "0x...",
+ *     data: "0x...",
+ *     value: 0n,
+ *     chainId: sepolia.id,
+ *   },
+ *   {
+ *     to: "0x...",
+ *     data: "0x...",
+ *     value: 0n,
+ *     chainId: sepolia.id,
+ *   },
+ * ]);
+ *
+ * console.log("Batch transaction hash:", transactionHash);

Also applies to: 141-160

⛔ Skipped due to learnings
Learnt from: CR
PR: thirdweb-dev/js#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
PR: thirdweb-dev/js#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
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to test/src/test-wallets.ts : Predefined test accounts are in `test/src/test-wallets.ts`
Learnt from: CR
PR: thirdweb-dev/js#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
Learnt from: CR
PR: thirdweb-dev/js#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)

Comment on lines +160 to +162
* ```
*
* @wallet
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add required stability tag and a short remark per package docs policy.

Public symbols need a custom stability tag; also note the bundler requirement for sponsored gas.

  * @wallet
+ * @beta
+ * @remarks Sponsored gas (`sponsorGas: true`) requires a bundler/paymaster setup that supports the `tw_getDelegationContract` RPC on the target chain.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* ```
*
* @wallet
*/
*
🤖 Prompt for AI Agents
In packages/thirdweb/src/wallets/in-app/core/eip7702/minimal-account.ts around
lines 160-163, the public symbol is missing the required stability JSDoc tag and
a short remark per package docs policy; add a stability tag (e.g., @stability
experimental or @stability stable as appropriate for the package) directly in
the comment block for this exported wallet symbol and append a one-line remark
noting that sponsored-gas functionality requires using a bundler (i.e.,
"Requires a bundler to use sponsored gas") so documentation and tooling can pick
up both the stability level and the bundler requirement.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 64.01 KB (0%) 1.3 s (0%) 437 ms (+40.63% 🔺) 1.8 s
thirdweb (cjs) 357.32 KB (0%) 7.2 s (0%) 2.2 s (+7.3% 🔺) 9.4 s
thirdweb (minimal + tree-shaking) 5.73 KB (0%) 115 ms (0%) 105 ms (+297.7% 🔺) 220 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 74 ms (+1123.35% 🔺) 84 ms
thirdweb/react (minimal + tree-shaking) 19.15 KB (0%) 383 ms (0%) 82 ms (+83.83% 🔺) 465 ms

@codecov
Copy link

codecov bot commented Sep 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.63%. Comparing base (14fe9ee) to head (6a7d126).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7996   +/-   ##
=======================================
  Coverage   56.63%   56.63%           
=======================================
  Files         904      904           
  Lines       58677    58677           
  Branches     4161     4163    +2     
=======================================
  Hits        33231    33231           
  Misses      25340    25340           
  Partials      106      106           
Flag Coverage Δ
packages 56.63% <ø> (ø)
Files with missing lines Coverage Δ
...src/wallets/in-app/core/eip7702/minimal-account.ts 90.89% <ø> (ø)
🚀 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages SDK Involves changes to the thirdweb SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants