-
Notifications
You must be signed in to change notification settings - Fork 603
[SDK] Export missing x402 types #8218
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
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 7d9669d The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
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 |
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
WalkthroughAdds 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
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)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (2)
Comment |
There was a problem hiding this 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.
📒 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 localtypes.ts
barrels
Prefer type aliases over interface except for nominal shapes
Avoidany
andunknown
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
Prefertype
aliases overinterface
except for nominal shapes
Avoidany
andunknown
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 viaexports/
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 inpackages/*
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.
size-limit report 📦
|
Codecov Report❌ Patch coverage is
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
🚀 New features to boost your workflow:
|
d502192
to
7d9669d
Compare
There was a problem hiding this 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 inaddress
getterFor consistency with the ERC4337 branch (which returns
smartAccountAddress
), consider returning the delegatedaccountAddress
whenexecutionOptions.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.
📒 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 localtypes.ts
barrels
Prefer type aliases over interface except for nominal shapes
Avoidany
andunknown
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
Prefertype
aliases overinterface
except for nominal shapes
Avoidany
andunknown
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 viaexports/
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 goodUnionizing Owner vs SessionKey variants matches the API. No action needed.
Also applies to: 489-511
151-153
: AWS signer error union additions—confirm server parityThe 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‑scopedSerializable shapes look consistent with OpenAPI. No changes requested.
1643-1644
: Status field added to transaction responsesGood 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 fieldsSpreading
executionOptions
ensuressessionKeyAddress/accountAddress
are retained. LGTM.apps/portal/src/app/wallets/session-keys/page.mdx (1)
516-520
: Docs align with new EIP‑7702 session‑key APIExamples correctly use
executionOptions: { type: "EIP7702", sessionKeyAddress, accountAddress }
. Nice.Also applies to: 604-608
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
x402
types export inx402.ts
.@thirdweb-dev/engine
.Eip7702OwnerExecution
andEip7702SessionKeyExecution
types.SerialisableAwsSignerError
andSerialisableAwsSdkError
types.executionOptions
for session keys in relevant functions.Summary by CodeRabbit