Skip to content

Update engine API #7427

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 24, 2025


PR-Codex overview

This PR focuses on updating various components of the project to support the latest engine API and schema versions, improve error handling, and enhance type definitions. It includes updates to configuration files, JSON schemas, and TypeScript interfaces.

Detailed summary

  • Updated JSON schema versions in multiple biome.json files to 2.0.4.
  • Enhanced error handling in wait-for-tx-hash.ts and backend.ts.
  • Added new engine v3 APIs and breaking changes in changelogs.
  • Improved type definitions in types.ts and params.ts.
  • Refactored transaction error messages for clarity.
  • Introduced new tests for in-app wallet functionality.
  • Updated tsconfig files for better development support.
  • Adjusted client request handling in client.ts for improved response parsing.

The following files were skipped due to too many changes: packages/engine/src/client/client/types.ts, packages/engine/src/client/client/utils.ts, packages/engine/src/client/sdk.gen.ts, packages/engine/src/client/types.gen.ts

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

Summary by CodeRabbit

  • New Features

    • Expanded API support with new endpoints for transaction analytics, activity logs, and transaction search.
    • Introduced detailed error reporting and enhanced type safety for contract interactions and transaction management.
    • Added comprehensive client request utilities including serialization, authentication, configuration merging, and interceptor middleware.
    • Provided new body serializers for form data, JSON, and URL-encoded formats.
    • Added centralized exports for client types and functions to simplify imports.
    • Added typed success/error response handling utilities.
    • Introduced a new test suite for in-app wallet backend integration, covering message signing and transaction queuing.
  • Bug Fixes

    • Improved error message handling in transaction details, now displaying structured error information when available.
    • Enhanced error message formatting for failed transactions and signing operations.
    • Improved backend authentication error reporting with detailed messages.
  • Refactor

    • Comprehensive reorganization and renaming of SDK client functions and types to align with updated API specifications.
    • Unified and clarified execution and signing option handling for server wallets.
    • Enhanced client configuration with request validation support.
    • Updated domain URLs to use the development engine endpoint.
    • Streamlined transaction parameter defaults and signing request processing.
    • Simplified React component JSX by removing unnecessary fragments.
  • Style

    • Reformatted code and configuration files for consistency and readability.
    • Updated Biome linter configurations to a newer schema version with stricter import extension rules.
  • Chores

    • Updated linter and TypeScript configurations.
    • Added and reorganized dependencies and scripts for better project maintenance.
    • Added new utility types and type guards for error and success response discrimination.
  • Tests

    • Adjusted server wallet tests to reflect updated domain configuration and execution options.

Copy link

vercel bot commented Jun 24, 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 28, 2025 2:11am
nebula ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 28, 2025 2:11am
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 28, 2025 2:11am
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 28, 2025 2:11am
wallet-ui 🛑 Canceled (Inspect) Jun 28, 2025 2:11am

Copy link

changeset-bot bot commented Jun 24, 2025

🦋 Changeset detected

Latest commit: e58d5f7

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

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

@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Jun 24, 2025
Copy link
Contributor

coderabbitai bot commented Jun 24, 2025

Walkthrough

This update refactors the engine client and SDK to align with a revised API specification, introducing new and restructured TypeScript types, client utilities, and endpoint functions. Execution and signing options are unified, error handling is enhanced, and new analytics and activity log endpoints are added. Supporting modules and configuration files are reorganized and expanded for improved type safety and maintainability.

Changes

File(s) Change Summary
packages/engine/src/client/types.gen.ts Major expansion and refactor of API types: added detailed request/response types, new union types for execution and signing options, error handling, contract interaction, analytics, and activity logs; updated baseUrl; improved type safety.
packages/engine/src/client/sdk.gen.ts Comprehensive realignment of SDK client functions to new API: renamed functions, updated endpoints/methods, added analytics/activity log functions, enhanced error typing, and updated imports to use local modules.
packages/engine/src/client/client/index.ts New module re-exporting client types and functions from internal modules, centralizing client-related imports/exports.
packages/engine/src/client/client/types.ts New file defining comprehensive types/interfaces for client configuration, request/response handling, and utility types for modular extensibility.
packages/engine/src/client/client/utils.ts New file providing utilities for URL/query/path serialization, authentication, config merging, and middleware interceptors for client requests.
packages/engine/src/client/core/auth.ts New module defining authentication types and a utility function to resolve and format auth tokens for requests.
packages/engine/src/client/core/bodySerializer.ts New file implementing body serialization utilities for JSON, FormData, and URLSearchParams, with helpers for serializing key-value pairs.
packages/engine/src/client/core/params.ts New file providing logic to map input arguments into structured parameter slots (body, headers, path, query) based on field configuration.
packages/engine/src/client/core/pathSerializer.ts New file implementing serialization of arrays, objects, and primitives for query and path parameters, supporting multiple OpenAPI styles.
packages/engine/src/client/core/types.ts Added optional requestValidator property to Config interface; formatting changes only.
packages/engine/src/client/client/client.ts Added invocation of optional requestValidator in the request lifecycle before body serialization; formatting changes only.
packages/engine/openapi-ts.config.ts Updated OpenAPI input URL to "https://engine.thirdweb-dev.com/openapi", added commented localhost option, removed plugins array.
packages/engine/package.json Reorganized field order, added dependency on @hey-api/client-fetch, updated scripts, and reordered exports and engines fields.
packages/engine/biome.json Expanded Biome linter config: enabled useImportExtensions rule, set root property, removed extends.
packages/engine/tsconfig.build.json, packages/engine/tsconfig.json Changed indentation from spaces to tabs; no semantic changes.
packages/engine/src/configure.ts Added MaybeErrorResponse type and type guard functions isErrorResponse and isSuccessResponse for discriminating success and error API responses.
packages/engine/src/client/client.gen.ts Reformatted imports and changed baseUrl to new domain "https://engine.thirdweb-dev.com"; no functional changes.
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/analytics/tx-table/types.ts Updated FAILED status in ExecutionResult4337Serialized to use a detailed error object instead of a string.
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/tx/[id]/transaction-details-ui.tsx Refined error handling: extracts error message, adds JSON error details rendering, updates display logic for error details card.
packages/thirdweb/src/engine/server-wallet.ts Unified execution options, added getSigningOptions, updated transaction and signing logic to use new option structure and error handling.
packages/thirdweb/src/engine/server-wallet.test.ts Updated domain configuration, skipped one test, changed wallet address env var and removed execution options from EOA test.
packages/engine/src/exports/thirdweb.ts Expanded exports from ../configure.js to include isErrorResponse and isSuccessResponse.
packages/thirdweb/src/engine/wait-for-tx-hash.ts Improved error message formatting by stringifying executionResult.error before inclusion in thrown error message.
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx Removed unnecessary React fragment wrapping for single expression in JSX rendering.

Sequence Diagram(s)

sequenceDiagram
    participant App
    participant EngineClient
    participant API

    App->>EngineClient: call writeContract(options)
    EngineClient->>API: POST /v1/write/contract (with options, headers)
    API-->>EngineClient: Response (success or error)
    EngineClient-->>App: Result

    App->>EngineClient: call getTransactionAnalytics(options)
    EngineClient->>API: POST /v1/transactions/analytics (with filters, headers)
    API-->>EngineClient: Analytics Data
    EngineClient-->>App: Analytics Result

    App->>EngineClient: call signMessage(options)
    EngineClient->>API: POST /v1/sign/message (with signingOptions, headers)
    API-->>EngineClient: Signature Result
    EngineClient-->>App: Signature
Loading

Possibly related PRs

  • thirdweb-dev/js#7428: Introduces and updates EOA execution options, aligning with this PR’s unification and restructuring of execution options.
  • thirdweb-dev/js#7431: Removes dependency on @hey-api/client-fetch and replaces imports with local client modules, matching similar changes in this PR.
  • thirdweb-dev/js#7429: Updates server wallet execution and signing options handling, related to this PR’s refactor of execution options and signing logic.

Suggested reviewers

  • joaquim-verges

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.

🪧 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
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 marked this pull request as ready for review June 24, 2025 01:50
@joaquim-verges joaquim-verges requested review from a team as code owners June 24, 2025 01:50
@joaquim-verges joaquim-verges changed the title Switch Engine API endpoint to localhost for development Update engine API Jun 24, 2025
@joaquim-verges joaquim-verges force-pushed the Switch_Engine_API_endpoint_to_localhost_for_development branch from f19431b to d745795 Compare June 24, 2025 01:51
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 (4)
packages/thirdweb/src/engine/server-wallet.ts (1)

152-156: Remove unnecessary type casting.

The type casting of executionOptions to ExecutionOptions | undefined appears redundant since it's already typed in the function parameter.

-  const getExecutionOptions = (chainId: number): ExecutionOptions => {
-    const options: ExecutionOptions | undefined = executionOptions as
-      | ExecutionOptions
-      | undefined;
+  const getExecutionOptions = (chainId: number): ExecutionOptions => {
+    const options = executionOptions;
packages/engine/src/client/types.gen.ts (3)

20-60: Consider using branded types for better type safety

While using string for AddressDef, BytesDef, and U256Def is functional, consider using branded types or template literal types for better compile-time validation:

type AddressDef = `0x${string}` & { readonly __brand: "Address" };
type BytesDef = `0x${string}` & { readonly __brand: "Bytes" };

This would prevent accidental type mixing and provide better IntelliSense support.

Also applies to: 952-952


921-921: Consider more specific types instead of unknown

The use of unknown for message and types fields in TypedDataDef and for the Value type reduces type safety. Consider using more specific types or generics to maintain type information:

export type TypedDataDef<TMessage = unknown, TTypes = unknown> = {
  message: TMessage;
  types: TTypes;
  // ...
};

Also applies to: 928-929, 954-954


1633-1635: Clarify the baseUrl type union pattern

The baseUrl type uses an unusual pattern: "http://localhost:3009" | (string & {}). This allows any string while providing IntelliSense for the localhost option. Consider using a more explicit pattern or adding a comment explaining this TypeScript idiom for better maintainability.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c26be2d and d745795.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • packages/engine/openapi-ts.config.ts (1 hunks)
  • packages/engine/package.json (2 hunks)
  • packages/engine/src/client/client.gen.ts (2 hunks)
  • packages/engine/src/client/sdk.gen.ts (1 hunks)
  • packages/engine/src/client/types.gen.ts (1 hunks)
  • packages/thirdweb/src/engine/create-server-wallet.ts (1 hunks)
  • packages/thirdweb/src/engine/get-status.ts (1 hunks)
  • packages/thirdweb/src/engine/list-server-wallets.ts (1 hunks)
  • packages/thirdweb/src/engine/search-transactions.ts (1 hunks)
  • packages/thirdweb/src/engine/server-wallet.test.ts (3 hunks)
  • packages/thirdweb/src/engine/server-wallet.ts (9 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.@(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. ...

**/*.@(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).

  • packages/thirdweb/src/engine/create-server-wallet.ts
  • packages/thirdweb/src/engine/list-server-wallets.ts
  • packages/thirdweb/src/engine/get-status.ts
  • packages/thirdweb/src/engine/search-transactions.ts
  • packages/engine/src/client/client.gen.ts
  • packages/engine/openapi-ts.config.ts
  • packages/thirdweb/src/engine/server-wallet.test.ts
  • packages/thirdweb/src/engine/server-wallet.ts
  • packages/engine/src/client/sdk.gen.ts
  • packages/engine/src/client/types.gen.ts
🧬 Code Graph Analysis (1)
packages/engine/src/client/client.gen.ts (1)
packages/engine/src/client/types.gen.ts (1)
  • ClientOptions (1633-1635)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Size
  • GitHub Check: Unit Tests
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (17)
packages/thirdweb/src/engine/server-wallet.test.ts (2)

37-43: Good: Explicit domain configuration for local testing.

The explicit configuration of domain endpoints is well-structured and clearly supports local development testing against the localhost engine instance.


52-52: Address the skipped test case.

The test "should create a server wallet" is being skipped, which could indicate a temporary issue or incomplete implementation. Consider either fixing the underlying issue or adding a comment explaining why the test is disabled.

Should this test remain skipped permanently, or is there a plan to re-enable it? If it's a known issue, consider adding a TODO comment explaining the reason for skipping.

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

50-50: LGTM: Response structure updated to use HTTP status codes.

The change to access response data under the 201 status code key aligns with REST API conventions for create operations and matches the pattern being applied across the codebase.

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

39-39: LGTM: Consistent response structure update.

The change to access response data under the 200 status code key is appropriate for a list operation and maintains consistency with the updated API response structure.

packages/thirdweb/src/engine/get-status.ts (1)

102-102: LGTM: Response structure consistently updated.

The change to access transaction data under the 200 status code key maintains consistency with the updated API response structure across all engine functions.

packages/thirdweb/src/engine/search-transactions.ts (1)

125-125: LGTM! Response data access updated correctly.

The change to access data under the [200] status code key aligns with the new API response format consistently applied across the engine client.

packages/engine/src/client/client.gen.ts (1)

25-27: Verify deployment configuration for production environments.

The baseUrl change to http://localhost:3009 enables local development. However, ensure that production deployments properly override this default value to avoid connection issues.

packages/engine/package.json (1)

1-61: LGTM! Package.json reorganization improves structure.

The field reordering follows common conventions and the new build:generate script properly integrates OpenAPI generation into the build workflow.

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

199-221: Transaction handling updates look good.

The changes correctly implement:

  • Migration to the new writeTransaction API
  • Proper default values for optional transaction parameters
  • Correct status code key [202] for accepted responses

327-348: Message signing updates implemented correctly.

The changes properly implement:

  • Parameter rename from messageFormat to format
  • New signingOptions structure supporting both EOA and smart account signing
  • Correct status code key [200] for successful responses

Also applies to: 361-368

packages/engine/src/client/sdk.gen.ts (1)

1-427: Auto-generated SDK updates align with API specification.

The comprehensive reorganization correctly implements:

  • New API endpoint mappings with descriptive function names
  • Consistent client instance handling with fallback to default
  • Proper Content-Type headers on all POST requests
  • Security configuration for API key authentication

The changes follow the expected patterns for the updated Engine API.

packages/engine/src/client/types.gen.ts (6)

3-18: Good improvement making operation field mandatory

Making the operation field required in TransactionsFilterValue improves type safety by ensuring all filters explicitly specify their combination logic. The recursive structure with TransactionsFilterNested provides good flexibility for complex queries.


32-48: Excellent documentation for execution options

The detailed documentation explaining execution strategy inference, version defaults, and field relationships is extremely helpful. The clear explanation of how the system determines optimal execution paths based on provided values will greatly assist developers.

Also applies to: 370-405


97-168: Well-structured error types for contract interactions

The ContractInteractionErrorKind type provides comprehensive error categorization with appropriate context for each error variant. This discriminated union pattern will make error handling more precise and debugging easier.


988-1008: Verify the HTTP status code key pattern is intentional

The response types consistently use numeric HTTP status codes as object keys (e.g., 200: {...}). While this allows different response shapes per status code, it's an unusual pattern that differs from typical response wrappers. Please confirm this is the intended API design pattern for the engine client.

Also applies to: 1069-1123, 1229-1283


278-349: Complex but well-structured error union types

The EngineError and RpcErrorKind types use complex discriminated unions, but they're well-structured with clear discrimination. Each variant includes appropriate context, making error handling and debugging more effective. The complexity appears justified by the comprehensive error information needed.

Also applies to: 578-633


1113-1117: Consistent pagination structure across endpoints

The pagination metadata structure is consistently applied across all list endpoints with totalCount, page, and limit fields. This uniformity will make it easier to build reusable pagination components.

Also applies to: 1273-1277, 1341-1345, 1401-1405

Comment on lines 4 to 5
// input: "https://engine.thirdweb.com/openapi",
input: "http://localhost:3009/openapi",
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

Consider environment-based configuration for API endpoints.

Hardcoding localhost URLs in configuration files can lead to issues if accidentally deployed to production. Consider using environment variables to dynamically set the input URL based on the deployment environment.

-	// input: "https://engine.thirdweb.com/openapi",
-	input: "http://localhost:3009/openapi",
+	input: process.env.OPENAPI_INPUT_URL || "https://engine.thirdweb.com/openapi",
📝 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
// input: "https://engine.thirdweb.com/openapi",
input: "http://localhost:3009/openapi",
input: process.env.OPENAPI_INPUT_URL || "https://engine.thirdweb.com/openapi",
🤖 Prompt for AI Agents
In packages/engine/openapi-ts.config.ts around lines 4 to 5, the input URL is
hardcoded to localhost, which risks incorrect URLs in different environments.
Replace the hardcoded URL with a dynamic value sourced from environment
variables, such as process.env.API_BASE_URL, and provide a fallback if needed.
This ensures the input URL adapts based on the deployment environment and avoids
accidental production misconfigurations.

Copy link

codecov bot commented Jun 24, 2025

Codecov Report

Attention: Patch coverage is 0% with 253 lines in your changes missing coverage. Please review.

Project coverage is 51.88%. Comparing base (1387337) to head (a02f3bb).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
packages/thirdweb/src/engine/server-wallet.ts 0.00% 252 Missing ⚠️
packages/thirdweb/src/engine/wait-for-tx-hash.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7427      +/-   ##
==========================================
- Coverage   51.96%   51.88%   -0.08%     
==========================================
  Files         947      947              
  Lines       63823    63922      +99     
  Branches     4217     4214       -3     
==========================================
+ Hits        33163    33166       +3     
- Misses      30554    30650      +96     
  Partials      106      106              
Flag Coverage Δ
packages 51.88% <0.00%> (-0.08%) ⬇️
Files with missing lines Coverage Δ
packages/thirdweb/src/engine/wait-for-tx-hash.ts 4.34% <0.00%> (ø)
packages/thirdweb/src/engine/server-wallet.ts 3.80% <0.00%> (-0.83%) ⬇️

... and 6 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: 1

♻️ Duplicate comments (1)
packages/thirdweb/src/engine/server-wallet.ts (1)

152-177: Address the type casting issues in execution options handling.

The getExecutionOptions function contains unsafe type casting with FIXME comments that indicate unresolved type issues. This was previously flagged and should be properly resolved.

Replace the forced type assertions with proper type guards:

- const options: ExecutionOptions | undefined = executionOptions as
-   | ExecutionOptions
-   | undefined;
+ const options = executionOptions ? { 
+   ...executionOptions, 
+   chainId 
+ } as ExecutionOptions : undefined;

Additionally, consider adding runtime validation to ensure executionOptions conforms to the expected structure before usage.

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

199-201: Improve transaction parameter validation.

The default values for transaction parameters could be more explicit about their purpose and validation.

  params: transaction.map((t) => ({
-   data: t.data || "0x",
-   to: t.to ?? "", // TODO this should be allowed to be undefined
-   value: t.value?.toString() || "0",
+   data: t.data ?? "0x", // Default to empty calldata
+   to: t.to ?? "", // Empty string for contract creation - consider allowing undefined
+   value: t.value?.toString() ?? "0", // Default to zero value
  })),

The TODO comment suggests to should allow undefined - consider updating the API types to support contract creation transactions properly.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d745795 and f82a048.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (13)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/analytics/tx-table/types.ts (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/tx/[id]/transaction-details-ui.tsx (2 hunks)
  • packages/engine/openapi-ts.config.ts (1 hunks)
  • packages/engine/package.json (2 hunks)
  • packages/engine/src/client/client.gen.ts (2 hunks)
  • packages/engine/src/client/sdk.gen.ts (1 hunks)
  • packages/engine/src/client/types.gen.ts (1 hunks)
  • packages/thirdweb/src/engine/create-server-wallet.ts (1 hunks)
  • packages/thirdweb/src/engine/get-status.ts (1 hunks)
  • packages/thirdweb/src/engine/list-server-wallets.ts (1 hunks)
  • packages/thirdweb/src/engine/search-transactions.ts (1 hunks)
  • packages/thirdweb/src/engine/server-wallet.test.ts (3 hunks)
  • packages/thirdweb/src/engine/server-wallet.ts (9 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/engine/package.json
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/engine/openapi-ts.config.ts
  • packages/thirdweb/src/engine/server-wallet.test.ts
  • packages/engine/src/client/client.gen.ts
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.@(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. ...

**/*.@(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).

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/analytics/tx-table/types.ts
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/tx/[id]/transaction-details-ui.tsx
  • packages/thirdweb/src/engine/server-wallet.ts
  • packages/engine/src/client/sdk.gen.ts
  • packages/engine/src/client/types.gen.ts
  • packages/thirdweb/src/engine/create-server-wallet.ts
  • packages/thirdweb/src/engine/get-status.ts
  • packages/thirdweb/src/engine/list-server-wallets.ts
  • packages/thirdweb/src/engine/search-transactions.ts
🪛 GitHub Check: codecov/patch
packages/thirdweb/src/engine/server-wallet.ts

[warning] 152-153: packages/thirdweb/src/engine/server-wallet.ts#L152-L153
Added lines #L152 - L153 were not covered by tests


[warning] 156-166: packages/thirdweb/src/engine/server-wallet.ts#L156-L166
Added lines #L156 - L166 were not covered by tests


[warning] 168-174: packages/thirdweb/src/engine/server-wallet.ts#L168-L174
Added lines #L168 - L174 were not covered by tests


[warning] 176-176: packages/thirdweb/src/engine/server-wallet.ts#L176
Added line #L176 was not covered by tests


[warning] 199-201: packages/thirdweb/src/engine/server-wallet.ts#L199-L201
Added lines #L199 - L201 were not covered by tests


[warning] 205-205: packages/thirdweb/src/engine/server-wallet.ts#L205
Added line #L205 was not covered by tests


[warning] 217-217: packages/thirdweb/src/engine/server-wallet.ts#L217
Added line #L217 was not covered by tests


[warning] 321-321: packages/thirdweb/src/engine/server-wallet.ts#L321
Added line #L321 was not covered by tests


[warning] 327-327: packages/thirdweb/src/engine/server-wallet.ts#L327
Added line #L327 was not covered by tests


[warning] 332-348: packages/thirdweb/src/engine/server-wallet.ts#L332-L348
Added lines #L332 - L348 were not covered by tests


[warning] 361-361: packages/thirdweb/src/engine/server-wallet.ts#L361
Added line #L361 was not covered by tests


[warning] 367-367: packages/thirdweb/src/engine/server-wallet.ts#L367
Added line #L367 was not covered by tests


[warning] 376-376: packages/thirdweb/src/engine/server-wallet.ts#L376
Added line #L376 was not covered by tests


[warning] 383-399: packages/thirdweb/src/engine/server-wallet.ts#L383-L399
Added lines #L383 - L399 were not covered by tests


[warning] 412-412: packages/thirdweb/src/engine/server-wallet.ts#L412
Added line #L412 was not covered by tests


[warning] 418-418: packages/thirdweb/src/engine/server-wallet.ts#L418
Added line #L418 was not covered by tests

packages/thirdweb/src/engine/create-server-wallet.ts

[warning] 50-50: packages/thirdweb/src/engine/create-server-wallet.ts#L50
Added line #L50 was not covered by tests

packages/thirdweb/src/engine/get-status.ts

[warning] 102-102: packages/thirdweb/src/engine/get-status.ts#L102
Added line #L102 was not covered by tests

packages/thirdweb/src/engine/list-server-wallets.ts

[warning] 39-39: packages/thirdweb/src/engine/list-server-wallets.ts#L39
Added line #L39 was not covered by tests

packages/thirdweb/src/engine/search-transactions.ts

[warning] 125-125: packages/thirdweb/src/engine/search-transactions.ts#L125
Added line #L125 was not covered by tests

⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Lint Packages
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Size
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (8)
packages/thirdweb/src/engine/create-server-wallet.ts (1)

50-50: LGTM: API response structure update is consistent.

The change correctly adapts to the new API response format where data is nested under HTTP status code keys. Using 201 for creation operations is semantically appropriate.

Note: This line lacks test coverage according to static analysis.

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

39-39: LGTM: Consistent with API response format update.

The change correctly adapts to the new response structure using status code 200 for successful list operations, which is semantically appropriate.

Note: This line lacks test coverage according to static analysis.

packages/thirdweb/src/engine/get-status.ts (1)

102-102: LGTM: API response format consistently updated.

The change correctly adapts to the new response structure where search results are nested under status code 200. The transaction extraction logic remains intact.

Note: This line lacks test coverage according to static analysis.

packages/thirdweb/src/engine/search-transactions.ts (1)

125-125: LGTM: Consistent API response structure adaptation.

The change correctly updates the data extraction to use the new response format with status code 200 for successful search operations.

Note: This line lacks test coverage according to static analysis.

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/analytics/tx-table/types.ts (1)

37-44: LGTM: Enhanced error structure improves debugging capabilities.

The change from a simple string error to a structured error object significantly improves error reporting and debugging. The new structure provides:

  • Detailed error context (stage, message, errorCode)
  • Nested error information (inner_error)
  • Transaction-specific details (nonce_used, account_address)

This structured approach will enable better error handling and user feedback in the dashboard.

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

217-217: ```shell
#!/bin/bash

Find import of writeTransaction in server-wallet.ts

grep -R "writeTransaction" -n packages/thirdweb/src/engine/server-wallet.ts


</details>
<details>
<summary>packages/engine/src/client/sdk.gen.ts (1)</summary>

`1-426`: **Auto-generated SDK client changes align with API specification updates.**

The extensive restructuring of SDK functions, type imports, and endpoint mappings is consistent with the API specification updates mentioned in the PR objectives. The new functions for transaction analytics, signing operations, contract reading, and encoding expand the API surface appropriately.



Key improvements observed:
- Consistent client instance selection pattern
- Proper JSON content-type headers for POST requests  
- Updated security configurations
- New endpoints for enhanced functionality (analytics, activity logs, signing operations)

</details>
<details>
<summary>packages/engine/src/client/types.gen.ts (1)</summary>

`3-1635`: **Comprehensive type definitions support the API specification overhaul.**

The extensive type system updates provide a solid foundation for the engine client API changes. Key improvements include:

- Unified `ExecutionOptions` type combining base and specific execution options
- Detailed error handling with `EngineError` and related types  
- Strong typing for contract interactions, signing operations, and analytics
- Structured response types with status code keys matching the new API pattern
- Support for new endpoints (transaction analytics, activity logs)



The type definitions align well with the changes in the SDK client and server wallet implementations, supporting enhanced type safety and API functionality.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

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/engine/src/client/types.gen.ts (1)

3-13: Breaking change acknowledged - operation field now required.

This confirms the breaking change flagged in previous reviews where the operation field in TransactionsFilterValue is now mandatory. Since this is an auto-generated file, ensure all consuming code has been updated to provide the required operation value ("AND" or "OR").

🧹 Nitpick comments (2)
packages/thirdweb/src/wallets/in-app/web/lib/in-app-gateway.test.ts (2)

16-19: TODO: Complete test productionization.

The test suite is currently skipped with a TODO to productionize it. Consider creating a tracking issue for completing this work, as it provides valuable integration testing for the in-app wallet gateway functionality.

Would you like me to help create a plan for productionizing this test suite, including removing debug statements and making it suitable for CI?


113-114: Remove debug console.log statements for production.

The console.log statements should be removed or replaced with proper test logging when productionizing this test suite.

-      console.log(txId);
+      // Transaction queued successfully with ID: ${txId}
-      console.log(tx);
+      // Transaction confirmed: ${tx.transactionHash}

Also applies to: 123-123

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1098ddf and 2547ca0.

📒 Files selected for processing (6)
  • packages/engine/openapi-ts.config.ts (0 hunks)
  • packages/engine/package.json (2 hunks)
  • packages/engine/src/client/client.gen.ts (2 hunks)
  • packages/engine/src/client/types.gen.ts (1 hunks)
  • packages/thirdweb/src/wallets/in-app/core/authentication/backend.ts (1 hunks)
  • packages/thirdweb/src/wallets/in-app/web/lib/in-app-gateway.test.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/engine/openapi-ts.config.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/engine/src/client/client.gen.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/engine/package.json
🧰 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/in-app/core/authentication/backend.ts
  • packages/thirdweb/src/wallets/in-app/web/lib/in-app-gateway.test.ts
  • packages/engine/src/client/types.gen.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-25T02:13:08.257Z
Learning: All CI checks (type-check, Biome, tests) must pass before merging a pull request.
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-25T02:13:08.257Z
Learning: Keep documentation focused on developer experience and practical usage, and surface breaking changes prominently in PR descriptions.
packages/thirdweb/src/wallets/in-app/core/authentication/backend.ts (1)
Learnt from: jnsdls
PR: thirdweb-dev/js#7364
File: apps/dashboard/src/app/(app)/account/components/AccountHeader.tsx:36-41
Timestamp: 2025-06-18T02:13:34.500Z
Learning: In the logout flow in apps/dashboard/src/app/(app)/account/components/AccountHeader.tsx, when `doLogout()` fails, the cleanup steps (resetAnalytics(), wallet disconnect, router refresh) should NOT execute. This is intentional to maintain consistency - if server-side logout fails, client-side cleanup should not occur.
packages/thirdweb/src/wallets/in-app/web/lib/in-app-gateway.test.ts (2)
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: jnsdls
PR: thirdweb-dev/js#7364
File: apps/dashboard/src/app/(app)/account/components/AccountHeader.tsx:36-41
Timestamp: 2025-06-18T02:13:34.500Z
Learning: In the logout flow in apps/dashboard/src/app/(app)/account/components/AccountHeader.tsx, when `doLogout()` fails, the cleanup steps (resetAnalytics(), wallet disconnect, router refresh) should NOT execute. This is intentional to maintain consistency - if server-side logout fails, client-side cleanup should not occur.
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Unit Tests
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Build Packages
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (6)
packages/engine/src/client/types.gen.ts (3)

1699-1701: Improved: baseUrl no longer hardcoded to localhost.

The ClientOptions type now uses a production URL (https://engine.thirdweb.com) as the default instead of the previously hardcoded localhost, addressing the flexibility concern from earlier reviews. This allows for production deployments while maintaining type safety.


56-155: Comprehensive error handling types added.

The new discriminated union types for batch results provide detailed error categorization (RPC_ERROR, VAULT_ERROR, CONTRACT_INTERACTION_ERROR, etc.) with specific error contexts. This enables robust error handling throughout the client SDK.

Also applies to: 163-242, 250-338


642-646: Unified execution options design.

The ExecutionOptions type effectively combines base and specific execution options, providing a clean API surface while maintaining type safety through discriminated unions.

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

34-35: Enhanced error handling with response body context.

Including the response body text in the error message provides valuable debugging information when backend authentication fails. This improvement aligns with the broader error handling enhancements throughout the codebase.

packages/thirdweb/src/wallets/in-app/web/lib/in-app-gateway.test.ts (2)

28-43: Good test setup with proper authentication flow.

The test setup correctly initializes the in-app wallet with backend strategy and validates the authentication token retrieval. The domain configuration ensures tests run against the correct environment.


45-80: Comprehensive message signing test with API validation.

The test effectively validates both local wallet signing and backend API signing, ensuring consistency between the two approaches. The error handling properly extracts and reports signing failures.

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

🧹 Nitpick comments (2)
.changeset/lovely-brooms-relax.md (2)

5-5: Insert the determiner “the” for grammatical correctness

Minor wording tweak improves readability:

-Support latest engine API
+Support the latest engine API

5-6: Expand the summary to capture impactful changes

The one-line summary doesn’t communicate the scope (e.g., schema bump to 2.0.4, new endpoints, renamed types). A more descriptive message helps consumers understand what changed and whether action is required.
Example:

Support the latest engine API

- Bump schema to 2.0.4
- Add analytics & activity-log endpoints
- Unify execution & signing options
- BREAKING: renamed `ServerWalletExecuteTx``ExecuteTransaction`

This richer summary surfaces breaking changes and upgrade notes directly in the changelog.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2547ca0 and e58d5f7.

📒 Files selected for processing (2)
  • .changeset/heavy-banks-think.md (1 hunks)
  • .changeset/lovely-brooms-relax.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/heavy-banks-think.md
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-25T02:13:08.257Z
Learning: All CI checks (type-check, Biome, tests) must pass before merging a pull request.
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-25T02:13:08.257Z
Learning: Keep documentation focused on developer experience and practical usage, and surface breaking changes prominently in PR descriptions.
.changeset/lovely-brooms-relax.md (1)
Learnt from: MananTank
PR: thirdweb-dev/js#7298
File: apps/dashboard/src/app/nebula-app/move-funds/move-funds.tsx:424-424
Timestamp: 2025-06-06T23:46:08.795Z
Learning: The thirdweb project has an ESLint rule that restricts direct usage of `defineChain`. When it's necessary to use `defineChain` directly, it's acceptable to disable the rule with `// eslint-disable-next-line no-restricted-syntax`.
🪛 LanguageTool
.changeset/lovely-brooms-relax.md

[uncategorized] ~5-~5: You might be missing the article “the” here.
Context: --- "thirdweb": patch --- Support latest engine API

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Lint Packages
  • GitHub Check: Build Packages
  • GitHub Check: Unit Tests
  • GitHub Check: Analyze (javascript)

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. Ecosystem Portal Involves changes to the Ecosystem Portal packages Playground Changes involving the Playground codebase. 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.

2 participants