-
Notifications
You must be signed in to change notification settings - Fork 614
setup @thirdweb-dev/nexus package #8332
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
🦋 Changeset detectedLatest commit: bf26725 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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 a new @thirdweb-dev/nexus package (types, Zod schemas, encode/decode, facilitator HTTP client, verify/settle flows, bigint/decimal utils), TypeScript and package configs, size limits and CI reporting for nexus; updates thirdweb exports, turbo task key, and adds changesets. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Verify as verifyPayment()
participant Decode as decodePaymentRequest()
participant Facilitator
Client->>Verify: PaymentArgs
Verify->>Decode: args
Decode->>Decode: networkToChainId(network)
Decode->>Decode: processPriceToAtomicAmount(price)
Decode->>Decode: Validate paymentData header
Decode->>Decode: decodePayment(base64)
Decode->>Decode: Match requirements by scheme/network
Decode-->>Verify: 200 + decoded info or 402 + accepts
alt Decode success (200)
Verify->>Facilitator: verify(decodedPayment, selectedRequirements)
alt Verify success
Facilitator-->>Verify: VerifyResponse (200)
Verify-->>Client: 200 + decodedPayment + selectedRequirements
else Verify fails
Facilitator-->>Verify: error
Verify-->>Client: 402 + errorMessage + accepts
end
else Decode failed (402)
Verify-->>Client: 402 + errorMessage + accepts
end
sequenceDiagram
participant Client
participant Settle as settlePayment()
participant Decode as decodePaymentRequest()
participant Facilitator
Client->>Settle: SettlePaymentArgs
Settle->>Decode: args
Decode-->>Settle: 200 + decoded info or 402 + accepts
alt Decode success (200)
Settle->>Facilitator: settle(decodedPayment, selectedRequirements, waitUntil)
alt Settle success
Facilitator-->>Settle: FacilitatorSettleResponse (200)
Settle-->>Client: 200 + paymentReceipt + X-PAYMENT-RESPONSE header
else Settle fails
Facilitator-->>Settle: error
Settle-->>Client: 402 + errorMessage + accepts
end
else Decode failed (402)
Settle-->>Client: 402 + errorMessage + accepts
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Comment |
size-limit report 📦
|
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: 5
🧹 Nitpick comments (2)
packages/nexus/scripts/version.mjs (1)
3-9: Add error handling for robustness.The script lacks error handling for file operations and JSON parsing. Consider adding try-catch blocks to provide helpful error messages if package.json is missing, malformed, or if the write operation fails.
Apply this diff to add error handling:
import { readFile, writeFile } from "node:fs/promises"; -const packageVersion = JSON.parse(await readFile("./package.json")).version; +let packageVersion; +try { + const packageJson = JSON.parse( + await readFile("./package.json", "utf-8") + ); + packageVersion = packageJson.version; + if (!packageVersion) { + throw new Error("version field not found in package.json"); + } +} catch (error) { + console.error("Failed to read version from package.json:", error); + process.exit(1); +} -await writeFile( - "./src/version.ts", - `// this file is auto-generated by the version.mjs script +try { + await writeFile( + "./src/version.ts", + `// this file is auto-generated by the version.mjs script export const version = "${packageVersion}";\n`, -); + ); + console.log(`Generated version.ts with version ${packageVersion}`); +} catch (error) { + console.error("Failed to write version.ts:", error); + process.exit(1); +}packages/nexus/tsconfig.base.json (1)
4-5: Reconcile contradictory incremental builds documentation.The comments on lines 4–5 suggest that incremental builds speed up
tscand recommend enabling them, yet line 17 sets"incremental": false. Either enable incremental builds or update the comment to explain why they are disabled (e.g., cache reliability concerns outweigh performance gains in this context).Also applies to: 17-17
📜 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 ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (9)
packages/nexus/biome.json(1 hunks)packages/nexus/knip.json(1 hunks)packages/nexus/package.json(1 hunks)packages/nexus/scripts/version.mjs(1 hunks)packages/nexus/src/exports/nexus.ts(1 hunks)packages/nexus/src/version.ts(1 hunks)packages/nexus/tsconfig.base.json(1 hunks)packages/nexus/tsconfig.build.json(1 hunks)packages/nexus/tsconfig.json(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/package.json
📄 CodeRabbit inference engine (AGENTS.md)
Track bundle budgets via
package.json#size-limit
Files:
packages/nexus/package.json
**/*.{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@/typesor localtypes.tsbarrels
Prefer type aliases over interface except for nominal shapes
Avoidanyandunknownunless 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@/typeswhere applicable
Prefertypealiases overinterfaceexcept for nominal shapes
Avoidanyandunknownunless 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/nexus/src/version.tspackages/nexus/src/exports/nexus.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/nexus/src/version.tspackages/nexus/src/exports/nexus.ts
🧠 Learnings (22)
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to biome.json : Biome governs formatting and linting; project rules live in biome.json
Applied to files:
packages/nexus/knip.jsonpackages/nexus/biome.json
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to **/*.{ts,tsx} : Re‑use shared types from `@/types` where applicable
Applied to files:
packages/nexus/tsconfig.build.jsonpackages/nexus/tsconfig.base.jsonpackages/nexus/tsconfig.json
📚 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 **/*.{ts,tsx} : Re-use shared types from `@/types` or local `types.ts` barrels
Applied to files:
packages/nexus/tsconfig.build.jsonpackages/nexus/tsconfig.base.jsonpackages/nexus/tsconfig.json
📚 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 **/*.test.{ts,tsx} : Place tests alongside code: `foo.ts` ↔ `foo.test.ts`
Applied to files:
packages/nexus/tsconfig.build.jsonpackages/nexus/tsconfig.json
📚 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/exports/** : Export everything via `exports/` directory, grouped by feature in the SDK public API
Applied to files:
packages/nexus/package.jsonpackages/nexus/src/exports/nexus.ts
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to packages/thirdweb/exports/** : Export all public API via `packages/thirdweb/exports/`, grouped by feature
Applied to files:
packages/nexus/package.json
📚 Learning: 2025-06-17T18:30:52.976Z
Learnt from: MananTank
PR: thirdweb-dev/js#7356
File: apps/nebula/src/app/not-found.tsx:1-1
Timestamp: 2025-06-17T18:30:52.976Z
Learning: In the thirdweb/js project, the React namespace is available for type annotations (like React.FC) without needing to explicitly import React. This is project-specific configuration that differs from typical TypeScript/React setups.
Applied to files:
packages/nexus/package.jsonpackages/nexus/tsconfig.base.json
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to **/*.{ts,tsx} : Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size
Applied to files:
packages/nexus/tsconfig.base.json
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to **/*.{ts,tsx} : Use explicit function declarations and explicit return types in TypeScript
Applied to files:
packages/nexus/tsconfig.base.json
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to packages/thirdweb/**/*.{ts,tsx} : Comment only ambiguous logic; avoid restating TypeScript in prose
Applied to files:
packages/nexus/tsconfig.base.json
📚 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 **/*.{ts,tsx} : Write idiomatic TypeScript with explicit function declarations and return types
Applied to files:
packages/nexus/tsconfig.base.json
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to **/*.{ts,tsx} : Avoid `any` and `unknown` unless unavoidable; narrow generics when possible
Applied to files:
packages/nexus/tsconfig.base.json
📚 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 **/*.{ts,tsx} : Comment only ambiguous logic; avoid restating TypeScript in prose
Applied to files:
packages/nexus/tsconfig.base.json
📚 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 **/*.{ts,tsx} : Choose composition over inheritance; leverage utility types (`Partial`, `Pick`, etc.)
Applied to files:
packages/nexus/tsconfig.base.json
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to {.vscode/**,.idea/**} : Avoid editor‑specific configs; rely on shared settings
Applied to files:
packages/nexus/tsconfig.base.json
📚 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 **/*.{ts,tsx,js,jsx} : Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)
Applied to files:
packages/nexus/tsconfig.base.json
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to **/types.ts : Provide and re‑use local type barrels in a `types.ts` file
Applied to files:
packages/nexus/tsconfig.base.jsonpackages/nexus/tsconfig.json
📚 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 src/exports/react.native.ts : React Native specific exports are in `src/exports/react.native.ts`
Applied to files:
packages/nexus/src/exports/nexus.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 biome.json : Biome is the primary linter/formatter; rules are defined in `biome.json`
Applied to files:
packages/nexus/biome.json
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Run `pnpm biome check --apply` before committing
Applied to files:
packages/nexus/biome.json
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to **/*.test.{ts,tsx} : Co‑locate tests as `foo.test.ts(x)` next to the implementation
Applied to files:
packages/nexus/tsconfig.json
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to **/*.test.{ts,tsx} : Use MSW to intercept HTTP calls for network interactions; mock only hard‑to‑reproduce scenarios
Applied to files:
packages/nexus/tsconfig.json
🧬 Code graph analysis (1)
packages/nexus/src/exports/nexus.ts (1)
packages/nexus/src/version.ts (1)
version(2-2)
⏰ 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). (4)
- GitHub Check: Unit Tests
- GitHub Check: Lint Packages
- GitHub Check: Size
- GitHub Check: Analyze (javascript)
🔇 Additional comments (7)
packages/nexus/knip.json (1)
1-12: LGTM!The Knip configuration is well-structured and appropriate for the new Nexus package. The entry points, ignores, and rule overrides align with the package structure and build scripts.
packages/nexus/package.json (1)
17-18: Verify Node.js version requirement.The package requires Node.js >=22, which is very recent. Please confirm this strict requirement is intentional, as it may limit adoption. If the package doesn't use Node 22-specific features, consider lowering to Node 18 or 20 LTS.
packages/nexus/biome.json (1)
4-15: LGTM!The override to disable key sorting for
package.jsonis appropriate, as it allows manual control of field ordering for better readability and conventional structure.packages/nexus/tsconfig.json (1)
1-13: LGTM!The TypeScript configuration for local development is well-structured. The path alias for test utilities and the inclusion of both source and test directories are appropriate.
packages/nexus/tsconfig.build.json (1)
1-16: LGTM!The build configuration correctly excludes test and benchmark files while enabling source maps and setting the root directory appropriately.
packages/nexus/tsconfig.base.json (2)
1-48: Configuration looks solid overall.The base configuration enforces strict type checking (
strict: true), unused variable/parameter detection, and explicit module syntax (verbatimModuleSyntax), which aligns well with the retrieved learnings on using explicit TypeScript and narrowing types. The emptyincludearray is appropriate for a base config intended to be extended bytsconfig.build.jsonandtsconfig.json.Verify that downstream configs that extend this base properly configure
include,rootDir, and other build-specific settings to avoid silent compilation issues.
2-2: Remove duplicate comments to reduce redundancy.Lines 2 and 46 contain identical comments, and lines 4–5 and 15–16 both document the incremental builds note. Consolidate these into a single comment block at the top to maintain clarity and follow the DRY principle.
Apply this diff to consolidate comments:
{ + // This tsconfig file contains the shared config for the build (tsconfig.build.json) and type checking (tsconfig.json) config. + // Incremental builds: Enabling incremental builds speeds up `tsc`. Keep in mind though that it does not reliably bust the cache when the `tsconfig.json` file changes. "compilerOptions": { - // Incremental builds - // NOTE: Enabling incremental builds speeds up `tsc`. Keep in mind though that it does not reliably bust the cache when the `tsconfig.json` file changes. "allowJs": false, ... // Interop constraints "esModuleInterop": false, "exactOptionalPropertyTypes": false, "forceConsistentCasingInFileNames": true, "importHelpers": true, - // Incremental builds - // NOTE: Enabling incremental builds speeds up `tsc`. Keep in mind though that it does not reliably bust the cache when the `tsconfig.json` file changes. "incremental": false, ... - // This tsconfig file contains the shared config for the build (tsconfig.build.json) and type checking (tsconfig.json) config. "include": [] }Also applies to: 15-16, 46-46
⛔ 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 **/*.{ts,tsx} : Comment only ambiguous logic; avoid restating TypeScript in proseLearnt from: CR PR: thirdweb-dev/js#0 File: AGENTS.md:0-0 Timestamp: 2025-08-29T15:37:38.513Z Learning: Applies to packages/thirdweb/**/*.{ts,tsx} : Comment only ambiguous logic; avoid restating TypeScript in proseLearnt from: CR PR: thirdweb-dev/js#0 File: AGENTS.md:0-0 Timestamp: 2025-08-29T15:37:38.513Z Learning: Applies to **/*.{ts,tsx} : Re‑use shared types from `@/types` where applicableLearnt from: CR PR: thirdweb-dev/js#0 File: AGENTS.md:0-0 Timestamp: 2025-08-29T15:37:38.513Z Learning: Applies to **/*.{ts,tsx} : Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle sizeLearnt from: CR PR: thirdweb-dev/js#0 File: AGENTS.md:0-0 Timestamp: 2025-08-29T15:37:38.513Z Learning: Applies to **/*.{ts,tsx} : Avoid `any` and `unknown` unless unavoidable; narrow generics when possibleLearnt from: CR PR: thirdweb-dev/js#0 File: CLAUDE.md:0-0 Timestamp: 2025-07-18T19:19:55.613Z Learning: Applies to **/*.{ts,tsx} : Avoid `any` and `unknown` unless unavoidable; narrow generics when possibleLearnt from: CR PR: thirdweb-dev/js#0 File: AGENTS.md:0-0 Timestamp: 2025-08-29T15:37:38.513Z Learning: Applies to 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.)Learnt from: CR PR: thirdweb-dev/js#0 File: CLAUDE.md:0-0 Timestamp: 2025-07-18T19:19:55.613Z Learning: Applies to **/*.{ts,tsx} : Choose composition over inheritance; leverage utility types (`Partial`, `Pick`, etc.)Learnt from: CR PR: thirdweb-dev/js#0 File: CLAUDE.md:0-0 Timestamp: 2025-07-18T19:19:55.613Z Learning: Applies to **/*.{ts,tsx} : Re-use shared types from `@/types` or local `types.ts` barrels
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8332 +/- ##
=======================================
Coverage 54.90% 54.91%
=======================================
Files 920 920
Lines 60715 60715
Branches 4130 4134 +4
=======================================
+ Hits 33336 33340 +4
+ Misses 27278 27273 -5
- Partials 101 102 +1
🚀 New features to boost your workflow:
|
c368b03 to
1c0905c
Compare
1c0905c to
0d79a0a
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/nexus/package.json (1)
56-57: Fix invalid TypeScript compiler flag--noCheck.The
--noCheckflag is not recognized by TypeScript. Replace it with--skipLibCheckto skip type checking of declaration files, or remove it if not needed.Apply this diff:
- "build:cjs": "tsc --noCheck --project ./tsconfig.build.json --module commonjs --outDir ./dist/cjs --verbatimModuleSyntax false && printf '{\"type\":\"commonjs\"}' > ./dist/cjs/package.json", - "build:esm": "tsc --noCheck --project ./tsconfig.build.json --module es2020 --outDir ./dist/esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/esm/package.json", + "build:cjs": "tsc --skipLibCheck --project ./tsconfig.build.json --module commonjs --outDir ./dist/cjs --verbatimModuleSyntax false && printf '{\"type\":\"commonjs\"}' > ./dist/cjs/package.json", + "build:esm": "tsc --skipLibCheck --project ./tsconfig.build.json --module es2020 --outDir ./dist/esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/esm/package.json",Also apply the same fix to lines 61–62 for the
dev:cjsanddev:esmscripts:- "dev:cjs": "printf '{\"type\":\"commonjs\"}' > ./dist/cjs/package.json && tsc --noCheck --project ./tsconfig.build.json --module commonjs --outDir ./dist/cjs --verbatimModuleSyntax false --watch", - "dev:esm": "printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/esm/package.json && tsc --noCheck --project ./tsconfig.build.json --module es2020 --outDir ./dist/esm --watch", + "dev:cjs": "printf '{\"type\":\"commonjs\"}' > ./dist/cjs/package.json && tsc --skipLibCheck --project ./tsconfig.build.json --module commonjs --outDir ./dist/cjs --verbatimModuleSyntax false --watch", + "dev:esm": "printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/esm/package.json && tsc --skipLibCheck --project ./tsconfig.build.json --module es2020 --outDir ./dist/esm --watch",Also applies to: 61-62
🧹 Nitpick comments (2)
packages/nexus/package.json (2)
13-15: Add bundle size budget configuration.The
size-limitpackage is listed as a devDependency but there is nosizeLimitconfiguration inpackage.json. As per the coding guidelines, bundle budgets should be tracked viapackage.json#size-limit.Add a
sizeLimitfield to define your bundle size budget:+ "sizeLimit": [ + { + "path": "./dist/esm/exports/nexus.js", + "limit": "100 B" + } + ],Adjust the
limitvalue based on your actual bundle size expectations.
17-19: Node >=22 is a very strict version constraint.Requiring Node >=22 significantly limits adoption, especially for projects using LTS versions. Consider relaxing this to a more permissive constraint like
>=20(which covers both Node 20 LTS and 22), or>=18if you need broader compatibility.
📜 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 ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (10)
packages/nexus/biome.json(1 hunks)packages/nexus/knip.json(1 hunks)packages/nexus/package.json(1 hunks)packages/nexus/scripts/version.mjs(1 hunks)packages/nexus/src/exports/nexus.ts(1 hunks)packages/nexus/src/version.ts(1 hunks)packages/nexus/tsconfig.base.json(1 hunks)packages/nexus/tsconfig.build.json(1 hunks)packages/nexus/tsconfig.json(1 hunks)turbo.json(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
- packages/nexus/tsconfig.json
- packages/nexus/tsconfig.build.json
- packages/nexus/biome.json
- packages/nexus/knip.json
- packages/nexus/src/exports/nexus.ts
- packages/nexus/src/version.ts
- packages/nexus/scripts/version.mjs
- packages/nexus/tsconfig.base.json
🧰 Additional context used
📓 Path-based instructions (1)
**/package.json
📄 CodeRabbit inference engine (AGENTS.md)
Track bundle budgets via
package.json#size-limit
Files:
packages/nexus/package.json
🧠 Learnings (10)
📓 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/exports/** : Export everything via `exports/` directory, grouped by feature in the SDK public API
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to packages/thirdweb/exports/** : Export all public API via `packages/thirdweb/exports/`, grouped by feature
📚 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: Build all packages using `pnpm build` and specific packages with dependencies using `turbo run build --filter=./packages/*`
Applied to files:
turbo.json
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to packages/thirdweb/**/*.{ts,tsx} : Lazy‑load heavy dependencies inside async paths (e.g., `const { jsPDF } = await import("jspdf")`)
Applied to files:
turbo.json
📚 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/exports/** : Export everything via `exports/` directory, grouped by feature in the SDK public API
Applied to files:
packages/nexus/package.json
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to **/*.{ts,tsx} : Avoid `any` and `unknown` unless unavoidable; narrow generics when possible
Applied to files:
packages/nexus/package.json
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to **/*.{ts,tsx} : Use explicit function declarations and explicit return types in TypeScript
Applied to files:
packages/nexus/package.json
📚 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 **/*.test.{ts,tsx} : Keep tests deterministic and side-effect free
Applied to files:
packages/nexus/package.json
📚 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 **/*.{ts,tsx} : Comment only ambiguous logic; avoid restating TypeScript in prose
Applied to files:
packages/nexus/package.json
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to **/*.test.{ts,tsx} : Keep tests deterministic and side‑effect free; use Vitest
Applied to files:
packages/nexus/package.json
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to packages/thirdweb/exports/** : Export all public API via `packages/thirdweb/exports/`, grouped by feature
Applied to files:
packages/nexus/package.json
⏰ 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: Analyze (javascript)
- GitHub Check: Size
🔇 Additional comments (1)
turbo.json (1)
99-102: Turbo task rename looks appropriate.The task renaming from
thirdweb#update-versiontoupdate-versionaligns with the new Nexus package versioning setup. The inputs and outputs are correctly configured.
0d79a0a to
adc8273
Compare
b0b0991 to
a3751a5
Compare
a3751a5 to
59be482
Compare
59be482 to
fe37319
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: 2
♻️ Duplicate comments (1)
packages/nexus/biome.json (1)
3-3: Fix invalid extends path.The
extendsfield contains"//"which is a placeholder or invalid path. This will cause Biome configuration to fail.
📜 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 ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (23)
.changeset/neat-squids-go.md(1 hunks).changeset/witty-spies-know.md(1 hunks).github/workflows/CI.yml(1 hunks)packages/nexus/.size-limit.json(1 hunks)packages/nexus/biome.json(1 hunks)packages/nexus/knip.json(1 hunks)packages/nexus/package.json(1 hunks)packages/nexus/src/common.ts(1 hunks)packages/nexus/src/encode.ts(1 hunks)packages/nexus/src/exports/nexus.ts(1 hunks)packages/nexus/src/facilitator.ts(1 hunks)packages/nexus/src/schemas.ts(1 hunks)packages/nexus/src/settle-payment.ts(1 hunks)packages/nexus/src/types.ts(1 hunks)packages/nexus/src/utils.ts(1 hunks)packages/nexus/src/verify-payment.ts(1 hunks)packages/nexus/tsconfig.base.json(1 hunks)packages/nexus/tsconfig.build.json(1 hunks)packages/nexus/tsconfig.json(1 hunks)packages/thirdweb/.size-limit.json(1 hunks)packages/thirdweb/src/exports/contract.ts(1 hunks)packages/thirdweb/src/exports/extensions/erc20.ts(2 hunks)turbo.json(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- .changeset/witty-spies-know.md
🚧 Files skipped from review as they are similar to previous changes (12)
- packages/nexus/knip.json
- .changeset/neat-squids-go.md
- packages/nexus/tsconfig.base.json
- packages/nexus/src/verify-payment.ts
- packages/nexus/package.json
- packages/nexus/src/types.ts
- packages/nexus/tsconfig.json
- packages/thirdweb/.size-limit.json
- packages/nexus/src/encode.ts
- packages/thirdweb/src/exports/extensions/erc20.ts
- packages/thirdweb/src/exports/contract.ts
- packages/nexus/src/exports/nexus.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{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@/typesor localtypes.tsbarrels
Prefer type aliases over interface except for nominal shapes
Avoidanyandunknownunless 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@/typeswhere applicable
Prefertypealiases overinterfaceexcept for nominal shapes
Avoidanyandunknownunless 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/nexus/src/settle-payment.tspackages/nexus/src/common.tspackages/nexus/src/schemas.tspackages/nexus/src/utils.tspackages/nexus/src/facilitator.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/nexus/src/settle-payment.tspackages/nexus/src/common.tspackages/nexus/src/schemas.tspackages/nexus/src/utils.tspackages/nexus/src/facilitator.ts
🧠 Learnings (19)
📓 Common learnings
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to packages/thirdweb/exports/** : Export all public API via `packages/thirdweb/exports/`, grouped by feature
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/exports/** : Export everything via `exports/` directory, grouped by feature in the SDK public API
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to packages/thirdweb/**/*.{ts,tsx} : Lazy‑load heavy dependencies inside async paths (e.g., `const { jsPDF } = await import("jspdf")`)
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to biome.json : Biome governs formatting and linting; project rules live in biome.json
Applied to files:
packages/nexus/biome.json
📚 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 biome.json : Biome is the primary linter/formatter; rules are defined in `biome.json`
Applied to files:
packages/nexus/biome.json
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Run `pnpm biome check --apply` before committing
Applied to files:
packages/nexus/biome.json
📚 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: Run `pnpm biome check --apply` before committing (pre-commit hook)
Applied to files:
packages/nexus/biome.json
📚 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: Build all packages using `pnpm build` and specific packages with dependencies using `turbo run build --filter=./packages/*`
Applied to files:
turbo.json
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to packages/thirdweb/**/*.{ts,tsx} : Lazy‑load heavy dependencies inside async paths (e.g., `const { jsPDF } = await import("jspdf")`)
Applied to files:
turbo.jsonpackages/nexus/.size-limit.json
📚 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 package.json : Track bundle budgets via `package.json#size-limit`
Applied to files:
packages/nexus/.size-limit.json.github/workflows/CI.yml
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to **/package.json : Track bundle budgets via `package.json#size-limit`
Applied to files:
packages/nexus/.size-limit.json.github/workflows/CI.yml
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to packages/thirdweb/exports/** : Export all public API via `packages/thirdweb/exports/`, grouped by feature
Applied to files:
packages/nexus/.size-limit.json
📚 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/exports/** : Export everything via `exports/` directory, grouped by feature in the SDK public API
Applied to files:
packages/nexus/.size-limit.json
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to **/*.{ts,tsx} : Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size
Applied to files:
packages/nexus/.size-limit.json
📚 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 **/*.{ts,tsx,js,jsx} : Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)
Applied to files:
packages/nexus/.size-limit.json
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to **/*.{ts,tsx} : Re‑use shared types from `@/types` where applicable
Applied to files:
packages/nexus/tsconfig.build.json
📚 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 **/*.{ts,tsx} : Re-use shared types from `@/types` or local `types.ts` barrels
Applied to files:
packages/nexus/tsconfig.build.json
📚 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 **/*.test.{ts,tsx} : Place tests alongside code: `foo.ts` ↔ `foo.test.ts`
Applied to files:
packages/nexus/tsconfig.build.json
📚 Learning: 2025-08-28T20:50:33.170Z
Learnt from: joaquim-verges
PR: thirdweb-dev/js#7922
File: apps/playground-web/src/app/ai/ai-sdk/components/chat-container.tsx:167-181
Timestamp: 2025-08-28T20:50:33.170Z
Learning: The thirdweb-dev/ai-sdk-provider schemas use snake_case field naming convention (e.g., chain_id, transaction_hash) rather than camelCase, as defined in the zod schemas in packages/ai-sdk-provider/src/tools.ts.
Applied to files:
packages/nexus/src/schemas.ts
📚 Learning: 2025-06-26T19:46:04.024Z
Learnt from: gregfromstl
PR: thirdweb-dev/js#7450
File: packages/thirdweb/src/bridge/Webhook.ts:57-81
Timestamp: 2025-06-26T19:46:04.024Z
Learning: In the onramp webhook schema (`packages/thirdweb/src/bridge/Webhook.ts`), the `currencyAmount` field is intentionally typed as `z.number()` while other amount fields use `z.string()` because `currencyAmount` represents fiat currency amounts in decimals (like $10.50), whereas other amount fields represent token amounts in wei (very large integers that benefit from bigint representation). The different naming convention (`currencyAmount` vs `amount`) reflects this intentional distinction.
Applied to files:
packages/nexus/src/schemas.ts
📚 Learning: 2025-06-13T21:59:58.910Z
Learnt from: MananTank
PR: thirdweb-dev/js#7332
File: apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/nft/overview/nfts-grid.tsx:347-351
Timestamp: 2025-06-13T21:59:58.910Z
Learning: Intl.NumberFormat.prototype.format supports bigint values in modern JavaScript (ES2020+), so bigint values can be passed directly to formatter.format() without conversion to number.
Applied to files:
packages/nexus/src/utils.ts
🧬 Code graph analysis (4)
packages/nexus/src/settle-payment.ts (5)
packages/nexus/src/exports/nexus.ts (3)
settlePayment(14-14)SettlePaymentArgs(19-19)SettlePaymentResult(20-20)packages/nexus/src/types.ts (2)
SettlePaymentArgs(39-41)SettlePaymentResult(68-77)packages/nexus/src/common.ts (1)
decodePaymentRequest(31-182)packages/nexus/src/encode.ts (1)
safeBase64Encode(57-65)packages/nexus/src/utils.ts (1)
stringify(17-33)
packages/nexus/src/common.ts (5)
packages/nexus/src/schemas.ts (3)
RequestedPaymentRequirements(28-30)RequestedPaymentPayload(20-22)networkToChainId(86-109)packages/nexus/src/types.ts (6)
PaymentArgs(20-37)PaymentRequiredResult(43-61)ERC20TokenAmount(97-108)x402Version(13-13)DefaultAsset(110-110)SupportedSignatureType(93-95)packages/nexus/src/encode.ts (1)
decodePayment(39-49)packages/nexus/src/facilitator.ts (2)
ThirdwebX402Facilitator(24-46)supported(206-231)packages/nexus/src/utils.ts (1)
toUnits(48-93)
packages/nexus/src/schemas.ts (1)
packages/thirdweb/src/x402/schemas.ts (1)
RequestedPaymentRequirementsSchema(32-35)
packages/nexus/src/facilitator.ts (2)
packages/nexus/src/schemas.ts (5)
RequestedPaymentPayload(20-22)RequestedPaymentRequirements(28-30)FacilitatorVerifyResponse(44-46)FacilitatorSettleResponse(36-38)FacilitatorSupportedResponse(82-84)packages/nexus/src/utils.ts (1)
stringify(17-33)
⏰ 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). (3)
- GitHub Check: Analyze (javascript)
- GitHub Check: Unit Tests
- GitHub Check: Size
🔇 Additional comments (4)
packages/nexus/tsconfig.build.json (1)
1-16: Verify build output settings are properly configured in the build process.The base config at
packages/nexus/tsconfig.base.jsonexists and is comprehensive, but it's missing critical build settings:declaration: true,outDir, anddeclarationMap.This is a monorepo-wide pattern—identical minimal configs exist in
packages/api/,packages/engine/, and other packages. This appears intentional, suggesting the build process is configured elsewhere (likely in build scripts,package.json, or a build tool like esbuild).Before proceeding, confirm:
- How the build process handles TypeScript compilation (check
package.jsonbuild scripts or build tool configuration)- Whether
declarationandoutDirare passed via CLI flags or configured in a build tool- Whether this pattern is intentional across the monorepo
Additionally, consider moving the
extendsproperty (line 14) to the top of the config, beforecompilerOptions, to follow TypeScript configuration conventions—though this is a minor style improvement since JSON property order doesn't affect parsing..github/workflows/CI.yml (1)
191-203: Bundle size reporting properly split per-package.The workflow correctly separates bundle size reporting for thirdweb and nexus packages with independent directory isolation. Verification confirms both packages have
.size-limit.jsonconfigurations in place and build scripts defined. The changes enable independent bundle tracking per package as intended.packages/nexus/.size-limit.json (1)
1-13: Size-limit configuration is appropriate—no changes needed.The 110 kB ESM and 350 kB CJS limits are justified. The x402 Payment Protocol implementation and Zod schema validation are the primary size drivers. The ~3.2× CJS/ESM ratio is expected since CommonJS lacks tree-shaking and includes the full x402 protocol stack and Zod dependencies. The configuration correctly tracks these essential modules.
turbo.json (1)
99-99: Task rename successfully verified — no broken references.The renaming from
"thirdweb#update-version"to"update-version"is complete and correct:
- Task properly defined in turbo.json with inputs/outputs configured
- All references in package.json scripts (
release,release:nightly) correctly useturbo run update-version- No lingering references to the old task name remain
fe37319 to
bf26725
Compare

PR-Codex overview
This PR introduces several updates to the
thirdweband@thirdweb-dev/nexuspackages, including minor version changes, new features, configuration updates, and various enhancements to the codebase.Detailed summary
@thirdweb-dev/nexusto minor version.thirdwebto patch version, exposing ERC20 extensions.biomeandknip.ERC20extensions with new functions.thirdwebandnexus.Summary by CodeRabbit
New Features
Chores