Skip to content

Conversation

joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented Oct 9, 2025


PR-Codex overview

This PR focuses on updating the thirdweb library with new types and execution options for EIP-7702, as well as refining error handling related to AWS SDK errors.

Detailed summary

  • Added missing x402 types export in x402.ts.
  • Updated API spec for @thirdweb-dev/engine.
  • Introduced Eip7702OwnerExecution and Eip7702SessionKeyExecution types.
  • Enhanced error handling with new SerialisableAwsSignerError and SerialisableAwsSdkError types.
  • Added executionOptions for session keys in relevant functions.

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

Summary by CodeRabbit

  • New Features
    • Exposes Money and PaymentMiddlewareConfig types via the x402 export.
    • Adds EIP-7702 session-key execution support and returns execution options that can include session key info.
    • Transaction responses now include a status field for better visibility.
    • Adds standardized AWS signer error shapes for clearer error reporting.
  • Documentation
    • Updated docs/examples showing session-key usage.
  • Chores
    • Added changeset entries to publish as a patch.

Copy link

vercel bot commented Oct 9, 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 Oct 9, 2025 8:15am
nebula Ready Ready Preview Comment Oct 9, 2025 8:15am
thirdweb_playground Ready Ready Preview Comment Oct 9, 2025 8:15am
thirdweb-www Ready Ready Preview Comment Oct 9, 2025 8:15am
wallet-ui Ready Ready Preview Comment Oct 9, 2025 8:15am

Copy link

changeset-bot bot commented Oct 9, 2025

🦋 Changeset detected

Latest commit: 7d9669d

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

This PR includes changesets to release 5 packages
Name Type
thirdweb Patch
@thirdweb-dev/engine Patch
@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

@joaquim-verges joaquim-verges changed the title [thirdweb] Export missing x402 types [SDK] Export missing x402 types Oct 9, 2025
@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Oct 9, 2025
@joaquim-verges joaquim-verges marked this pull request as ready for review October 9, 2025 00:12
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.

@joaquim-verges joaquim-verges requested review from a team as code owners October 9, 2025 00:12
Copy link
Contributor

coderabbitai bot commented Oct 9, 2025

Walkthrough

Adds changeset entries, re-exports two missing x402 types, extends engine client types (AWS signer error unions, transaction status fields, and EIP-7702 execution option variants), and updates server-wallet handling and an example to support EIP-7702/session-key execution options.

Changes

Cohort / File(s) Summary of changes
Release metadata
\.changeset/fluffy-cooks-kiss.md, \.changeset/warm-jokes-vanish.md
Adds two changeset entries: one noting export of missing x402 types; one bump/patch note for @thirdweb-dev/engine.
x402 exports update
packages/thirdweb/src/exports/x402.ts
Adds type re-exports: export type { Money, PaymentMiddlewareConfig } from "x402/types". Public type surface expanded; no runtime change.
Engine client types
packages/engine/src/client/types.gen.ts
Adds AWS signer error shapes (SerialisableAwsSdkError, SerialisableAwsSignerError) and integrates AWS_KMS_SIGNER_ERROR into several EngineError unions; adds `status: string
EIP-7702 / server-wallet usage
packages/thirdweb/src/engine/server-wallet.ts, apps/portal/src/app/wallets/session-keys/page.mdx
Adjusts serverWallet.getExecutionOptionsWithChainId to spread provided executionOptions for EIP7702 (removes unconditional from assignment); updates example docs to pass executionOptions with type: "EIP7702", sessionKeyAddress, and accountAddress.

Sequence Diagram(s)

sequenceDiagram
  %% Colors applied sparingly via participant notes
  participant Client as Client (App)
  participant Engine as Engine.serverWallet
  participant ServerWallet as server-wallet.getExecutionOptionsWithChainId
  participant Executor as Transaction Executor

  Client->>Engine: request serverWallet(executionOptions)
  note right of Engine #E8F0FF: Engine constructs server wallet\nwith provided executionOptions
  Engine->>ServerWallet: getExecutionOptionsWithChainId(executionOptions, chainId)
  alt executionOptions.type == "EIP7702"
    ServerWallet-->>Engine: {...executionOptions, chainId, /* no forced from */}
  else other execution options
    ServerWallet-->>Engine: resolved execution options (original flow)
  end
  Engine->>Executor: execute tx using returned execution options
  Executor-->>Client: result (success / error)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description contains only the commented template and an autogenerated PR-Codex summary without any filled "## Notes for the reviewer" or "## How to test" sections required by the repository template, leaving reviewers without context or testing guidance. Populate the PR description by removing or completing the commented template placeholders, adding actual reviewer notes that highlight key considerations, and providing detailed steps under "How to test" to enable proper validation of the changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "[SDK] Export missing x402 types" accurately and concisely summarizes the primary change of exporting missing types from the x402 module in the SDK, making the main update immediately clear to reviewers.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ 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 _thirdweb_Export_missing_x402_types

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

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

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

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

📜 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 163ab8a and d502192.

📒 Files selected for processing (2)
  • .changeset/fluffy-cooks-kiss.md (1 hunks)
  • packages/thirdweb/src/exports/x402.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{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/exports/x402.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/x402.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/exports/x402.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/exports/x402.ts
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

.changeset/*.md: Each change in packages/* must include a changeset for the appropriate package
Version bump rules: patch for non‑API changes; minor for new/modified public API

Files:

  • .changeset/fluffy-cooks-kiss.md
⏰ 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). (2)
  • GitHub Check: Size
  • GitHub Check: Unit Tests
🔇 Additional comments (1)
packages/thirdweb/src/exports/x402.ts (1)

20-20: Unable to locate definitions for Money and PaymentMiddlewareConfig
Please manually verify that these types exist in their source files and include comprehensive TSDoc with at least one @example block and the required custom annotation tags.

Copy link
Contributor

github-actions bot commented Oct 9, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 64.51 KB (-0.15% 🔽) 1.3 s (-0.15% 🔽) 148 ms (+203.58% 🔺) 1.5 s
thirdweb (cjs) 365.79 KB (+0.02% 🔺) 7.4 s (+0.02% 🔺) 554 ms (+14.22% 🔺) 7.9 s
thirdweb (minimal + tree-shaking) 5.73 KB (0%) 115 ms (0%) 74 ms (+3483.39% 🔺) 188 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 58 ms (+3515.97% 🔺) 68 ms
thirdweb/react (minimal + tree-shaking) 19.13 KB (0%) 383 ms (0%) 61 ms (+1872.02% 🔺) 444 ms

Copy link

codecov bot commented Oct 9, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 55.02%. Comparing base (62cfbb7) to head (7d9669d).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
packages/thirdweb/src/engine/server-wallet.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8218   +/-   ##
=======================================
  Coverage   55.02%   55.02%           
=======================================
  Files         919      919           
  Lines       60583    60583           
  Branches     4126     4130    +4     
=======================================
+ Hits        33333    33338    +5     
+ Misses      27146    27141    -5     
  Partials      104      104           
Flag Coverage Δ
packages 55.02% <0.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
packages/thirdweb/src/engine/server-wallet.ts 3.38% <0.00%> (ø)

... and 2 files 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.

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

♻️ Duplicate comments (1)
packages/thirdweb/src/exports/x402.ts (1)

1-1: Fix ESM import path and add required TSDoc for public export

  • Use the same relative path + .js extension as the rest of the file to avoid resolution failures.
  • Add TSDoc for public symbols in exports/, including an example and custom tag.

Apply:

-export type { Money, PaymentMiddlewareConfig } from "x402/types";
+/**
+ * Re-exports x402 payment types.
+ * @beta
+ * @example
+ * import type { Money, PaymentMiddlewareConfig } from "thirdweb/x402";
+ * declare const m: Money;
+ */
+export type { Money, PaymentMiddlewareConfig } from "../x402/types.js";

As per coding guidelines

🧹 Nitpick comments (1)
packages/thirdweb/src/engine/server-wallet.ts (1)

291-299: Expose accountAddress for EIP‑7702 session‑key in address getter

For consistency with the ERC4337 branch (which returns smartAccountAddress), consider returning the delegated accountAddress when executionOptions.type === "EIP7702" and it’s provided. This avoids exposing the session key address as the account.

Outside the changed range, suggested implementation:

const getAddress = () => {
  if (executionOptions?.type === "ERC4337" && executionOptions.smartAccountAddress) {
    return executionOptions.smartAccountAddress;
  }
  if (executionOptions?.type === "EIP7702") {
    const eo = executionOptions as { accountAddress?: string };
    if (eo.accountAddress) return eo.accountAddress;
  }
  return address;
};
📜 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 d502192 and 7d9669d.

📒 Files selected for processing (6)
  • .changeset/fluffy-cooks-kiss.md (1 hunks)
  • .changeset/warm-jokes-vanish.md (1 hunks)
  • apps/portal/src/app/wallets/session-keys/page.mdx (2 hunks)
  • packages/engine/src/client/types.gen.ts (7 hunks)
  • packages/thirdweb/src/engine/server-wallet.ts (1 hunks)
  • packages/thirdweb/src/exports/x402.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/warm-jokes-vanish.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/fluffy-cooks-kiss.md
🧰 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/engine/server-wallet.ts
  • packages/thirdweb/src/exports/x402.ts
  • packages/engine/src/client/types.gen.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/engine/server-wallet.ts
  • packages/thirdweb/src/exports/x402.ts
  • packages/engine/src/client/types.gen.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/engine/server-wallet.ts
  • packages/thirdweb/src/exports/x402.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/x402.ts
🧠 Learnings (1)
📚 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/engine/server-wallet.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, vite)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Lint Packages
  • GitHub Check: Size
  • GitHub Check: Unit Tests
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (6)
packages/engine/src/client/types.gen.ts (4)

484-487: EIP-7702 execution options union looks good

Unionizing Owner vs SessionKey variants matches the API. No action needed.

Also applies to: 489-511


151-153: AWS signer error union additions—confirm server parity

The new (SerialisableAwsSignerError & { type: "AWS_KMS_SIGNER_ERROR" }) variants are fine. Please confirm the server emits the exact discriminator.

Also applies to: 241-243, 340-342


922-979: New AWS error types are well‑scoped

Serializable shapes look consistent with OpenAPI. No changes requested.


1643-1644: Status field added to transaction responses

Good addition. Ensure downstream consumers and docs reflect status: string | null (vs the filter’s enum type).

Also applies to: 1804-1805

packages/thirdweb/src/engine/server-wallet.ts (1)

192-195: Correctly preserve EIP‑7702 fields

Spreading executionOptions ensures sessionKeyAddress/accountAddress are retained. LGTM.

apps/portal/src/app/wallets/session-keys/page.mdx (1)

516-520: Docs align with new EIP‑7702 session‑key API

Examples correctly use executionOptions: { type: "EIP7702", sessionKeyAddress, accountAddress }. Nice.

Also applies to: 604-608

@joaquim-verges joaquim-verges merged commit f630912 into main Oct 9, 2025
22 of 24 checks passed
@joaquim-verges joaquim-verges deleted the _thirdweb_Export_missing_x402_types branch October 9, 2025 08:14
@joaquim-verges joaquim-verges mentioned this pull request Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages Portal Involves changes to the Portal (docs) codebase. SDK Involves changes to the thirdweb SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant