Skip to content

Commit c0a5441

Browse files
committed
Merge branch 'joe-UB-Route-Discovery' of https://github.com/thirdweb-dev/js into joe-UB-Route-Discovery
2 parents 7318c7c + 5ab96c3 commit c0a5441

File tree

394 files changed

+12798
-8352
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

394 files changed

+12798
-8352
lines changed

.changeset/loud-points-count.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/sour-flies-post.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ We use [Turborepo](https://turbo.build/repo/docs) to manage the repository, and
1414

1515
We use [pnpm](https://pnpm.io) for package management across the repo. `pnpm` is similar to `npm` or `yarn` but with more efficient disk space usage.
1616

17-
**With the v5 SDK, we've consolidated everything into a single project at [/packages/thirdweb](./packages/thirdweb). You can still find the legacy packages at [/legacy_packages](./legacy_packages).**
17+
**With the v5 SDK, we've consolidated everything into a single project at [/packages/thirdweb](../packages/thirdweb). You can still find the legacy packages at [/legacy_packages](../legacy_packages).**
1818

1919
This single package provides a performant & lightweight SDK to interact with any EVM chain across Node, React, and React Native. Learn more about how to use the thirdweb SDK in our [documentation](https://portal.thirdweb.com/typescript/v5).
2020

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
- run: pnpm test
9090

9191
- name: Code Coverage
92-
uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2
92+
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
9393
with:
9494
directory: packages/
9595
flags: packages

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
# Initializes the CodeQL tools for scanning.
4848
- name: Initialize CodeQL
49-
uses: github/codeql-action/init@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17
49+
uses: github/codeql-action/init@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
5050
with:
5151
languages: ${{ matrix.language }}
5252
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -59,7 +59,7 @@ jobs:
5959
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
6060
# If this step fails, then you should remove it and run the build manually (see below)
6161
- name: Autobuild
62-
uses: github/codeql-action/autobuild@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17
62+
uses: github/codeql-action/autobuild@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
6363

6464
# ℹ️ Command-line programs to run using the OS shell.
6565
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -72,4 +72,4 @@ jobs:
7272
# ./location_of_script_within_repo/buildscript.sh
7373

7474
- name: Perform CodeQL Analysis
75-
uses: github/codeql-action/analyze@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17
75+
uses: github/codeql-action/analyze@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636

3737
- name: Create release Pull Request or publish to NPM
3838
id: changesets
39-
uses: changesets/action@746c25e23caa47dceb6a48ee85b4cbc5a9f5f293 #v1.4.0
39+
uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba #v1.4.0
4040
with:
4141
publish: pnpm release
4242
version: pnpm version-packages

AGENTS.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
🤖 Codex Agent Guidelines for thirdweb-dev/js
2+
3+
Welcome, AI copilots! This guide captures the coding standards, architectural decisions, and workflow conventions that every automated agent (and human contributor!) must follow. Unless a rule explicitly targets a sub‑project, it applies repo‑wide.
4+
5+
6+
7+
1. GitHub Workflow & Etiquette
8+
9+
- Pull‑request titles must start with the affected workspace in brackets (e.g. [SDK], [Dashboard], [Portal], [Playground]).
10+
- Begin the PR description with a one‑sentence summary, then add a checklist of changes and reference issues with Fixes #123.
11+
- Keep commits small and topical – one logical change per commit.
12+
- Branch names should follow area/brief-topic (e.g. sdk/fix-gas-estimate). Avoid personal names.
13+
- Request at least one core maintainer review. Do not self‑merge unless you are the sole owner of that package.
14+
- All CI checks (type‑check, Biome, tests) must pass before merging.
15+
16+
17+
18+
2. Formatting & Linting
19+
20+
- Biome governs formatting and linting; its rules live in biome.json.
21+
- Run pnpm biome check --apply before committing.
22+
- Avoid editor‑specific configs; rely on the shared settings.
23+
24+
25+
26+
3. TypeScript Style Guide
27+
28+
- Write idiomatic TypeScript: explicit function declarations and return types.
29+
- Limit each file to one stateless, single‑responsibility function for clarity and testability.
30+
- Re‑use shared types from @/types or local types.ts barrels.
31+
- Prefer type aliases over interface except for nominal shapes.
32+
- Avoid any and unknown unless unavoidable; narrow generics whenever possible.
33+
- Choose composition over inheritance; leverage utility types (Partial, Pick, etc.).
34+
35+
36+
37+
4. Testing Strategy
38+
39+
- Co‑locate tests: foo.ts ↔ foo.test.ts.
40+
- Use real function invocations with stub data; avoid brittle mocks.
41+
- For network interactions, use Mock Service Worker (MSW) to intercept fetch/HTTP calls, mocking only scenarios that are hard to reproduce.
42+
- Keep tests deterministic and side‑effect free; Jest is pre‑configured.
43+
44+
45+
46+
5. packages/thirdweb
47+
48+
5.1 Public API Surface
49+
50+
- Export everything via the exports/ directory, grouped by feature.
51+
- Every public symbol must have comprehensive TSDoc:
52+
- Include at least one @example block that compiles.
53+
- Tag with one custom annotation (@beta, @internal, @experimental, etc.).
54+
- Comment only ambiguous logic; avoid restating TypeScript in prose.
55+
56+
5.2 Performance
57+
58+
- Lazy‑load heavy dependencies inside async paths to keep the initial bundle lean:
59+
60+
`const { jsPDF } = await import("jspdf");`
61+
62+
63+
64+
6. apps/dashboard & apps/playground
65+
66+
6.1 Core UI Toolkit
67+
68+
- Import primitives from @/components/ui/\_ (e.g. Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator).
69+
- Use NavLink for internal navigation so active states are handled automatically.
70+
- Group feature‑specific components under feature/components/\_ and expose a barrel index.ts when necessary.
71+
72+
6.2 Styling Conventions
73+
74+
- Tailwind CSS is the styling system – no inline styles or CSS modules.
75+
- Merge class names with cn() from @/lib/utils to keep conditional logic readable.
76+
- Stick to design tokens: backgrounds (bg-card), borders (border-border), muted text (text-muted-foreground), etc.
77+
- Expose a className prop on the root element of every component for overrides.
78+
79+
6.3 Component Patterns
80+
81+
- Server Components (run on the Node edge):
82+
-- Read cookies/headers with next/headers.
83+
-- Access server‑only environment variables or secrets.
84+
-- Perform heavy data fetching that should not ship to the client.
85+
-- Implement redirect logic with redirect() from next/navigation.
86+
-- Start files with import "server-only"; to prevent client bundling.
87+
- Client Components (run in the browser):
88+
-- Begin files with 'use client'; before imports.
89+
-- Handle interactive UI relying on React hooks (useState, useEffect, React Query, wallet hooks).
90+
-- Access browser APIs (localStorage, window, IntersectionObserver, etc.).
91+
-- Support fast transitions where data is prefetched on the client.
92+
93+
6.4 Data Fetching Guidelines
94+
95+
- Server Side
96+
-- Always call getAuthToken() to retrieve the JWT from cookies.
97+
-- Inject the token as an Authorization: Bearer header – never embed it in the URL.
98+
-- Return typed results (Project[], User[], …) – avoid any.
99+
- Client Side
100+
-- Wrap calls in React Query (@tanstack/react-query).
101+
-- Use descriptive, stable queryKeys for cache hits.
102+
-- Configure staleTime / cacheTime based on freshness requirements (default ≥ 60 s).
103+
-- Keep tokens secret by calling internal API routes or server actions.
104+
105+
106+
107+
7. Performance & Bundle Size
108+
109+
- Track bundle budgets via package.json#size-limit.
110+
- Lazy‑import optional features; avoid top‑level side‑effects.
111+
- De‑duplicate dependencies across packages through pnpm workspace hoisting.
112+
113+
114+
115+
8. Documentation & Developer Experience
116+
117+
- Each change in packages/\* should contain a changeset for the appropriate package, with the appropriate version bump
118+
119+
- patch for changes that don't impact the public API
120+
- minor for any new/modified public API
121+
122+
- Surface breaking changes prominently in PR descriptions.
123+
- For new UI components, add Storybook stories (\*.stories.tsx) alongside the code.

apps/dashboard/package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"ioredis": "^5.6.1",
7272
"ipaddr.js": "^2.2.0",
7373
"lucide-react": "0.503.0",
74-
"next": "15.3.1",
74+
"next": "15.3.2",
7575
"next-plausible": "^3.12.4",
7676
"next-themes": "^0.4.6",
7777
"nextjs-toploader": "^1.6.12",
@@ -110,25 +110,25 @@
110110
"devDependencies": {
111111
"@chakra-ui/cli": "^2.4.1",
112112
"@chromatic-com/storybook": "3.2.6",
113-
"@next/bundle-analyzer": "15.3.1",
114-
"@next/eslint-plugin-next": "15.3.1",
113+
"@next/bundle-analyzer": "15.3.2",
114+
"@next/eslint-plugin-next": "15.3.2",
115115
"@playwright/test": "1.52.0",
116-
"@storybook/addon-essentials": "8.6.12",
117-
"@storybook/addon-interactions": "8.6.12",
118-
"@storybook/addon-links": "8.6.12",
119-
"@storybook/addon-onboarding": "8.6.12",
120-
"@storybook/addon-viewport": "8.6.12",
121-
"@storybook/blocks": "8.6.12",
122-
"@storybook/nextjs": "8.6.12",
123-
"@storybook/react": "8.6.12",
124-
"@storybook/test": "8.6.12",
116+
"@storybook/addon-essentials": "8.6.14",
117+
"@storybook/addon-interactions": "8.6.14",
118+
"@storybook/addon-links": "8.6.14",
119+
"@storybook/addon-onboarding": "8.6.14",
120+
"@storybook/addon-viewport": "8.6.14",
121+
"@storybook/blocks": "8.6.14",
122+
"@storybook/nextjs": "8.6.14",
123+
"@storybook/react": "8.6.14",
124+
"@storybook/test": "8.6.14",
125125
"@types/color": "4.2.0",
126126
"@types/node": "22.14.1",
127-
"@types/papaparse": "^5.3.15",
127+
"@types/papaparse": "^5.3.16",
128128
"@types/pluralize": "^0.0.33",
129129
"@types/qrcode": "^1.5.5",
130-
"@types/react": "19.1.2",
131-
"@types/react-dom": "19.1.2",
130+
"@types/react": "19.1.4",
131+
"@types/react-dom": "19.1.5",
132132
"@types/react-table": "^7.7.20",
133133
"@types/spdx-correct": "^3.1.3",
134134
"@types/swagger-ui-react": "^5.18.0",
@@ -140,10 +140,10 @@
140140
"eslint-config-biome": "1.9.4",
141141
"eslint-plugin-react-compiler": "19.0.0-beta-e993439-20250405",
142142
"eslint-plugin-storybook": "0.12.0",
143-
"knip": "5.50.5",
143+
"knip": "5.56.0",
144144
"next-sitemap": "^4.2.3",
145145
"postcss": "8.5.3",
146-
"storybook": "8.6.12",
146+
"storybook": "8.6.14",
147147
"tailwindcss": "3.4.17",
148148
"typescript": "5.8.3"
149149
}

apps/dashboard/src/@/api/analytics.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ async function fetchAnalytics(
4848
);
4949
}
5050
// client id DEBUG OVERRIDE
51-
// ANALYTICS_SERVICE_URL.searchParams.delete("projectId");
52-
// ANALYTICS_SERVICE_URL.searchParams.delete("teamId");
53-
// ANALYTICS_SERVICE_URL.searchParams.append(
51+
// analyticsServiceUrl.searchParams.delete("projectId");
52+
// analyticsServiceUrl.searchParams.delete("teamId");
53+
// analyticsServiceUrl.searchParams.append(
5454
// "teamId",
55-
// "team_clmb33q9w00gn1x0u2ri8z0k0",
55+
// "team_cm0lde33r02344w129k5hm2xz",
5656
// );
57-
// ANALYTICS_SERVICE_URL.searchParams.append(
57+
// analyticsServiceUrl.searchParams.append(
5858
// "projectId",
59-
// "prj_clyqwud5y00u1na7nzxnzlz7o",
59+
// "prj_cm4rqwx9b002qrnsnr37wqpo6",
6060
// );
6161

6262
return fetch(analyticsServiceUrl, {
@@ -377,7 +377,7 @@ export async function getEcosystemWalletUsage(args: {
377377

378378
export async function getUniversalBridgeUsage(args: {
379379
teamId: string;
380-
projectId: string;
380+
projectId?: string;
381381
from?: Date;
382382
to?: Date;
383383
period?: "day" | "week" | "month" | "year" | "all";
@@ -395,11 +395,10 @@ export async function getUniversalBridgeUsage(args: {
395395
console.error(
396396
`Failed to fetch universal bridge stats: ${res?.status} - ${res.statusText} - ${reason}`,
397397
);
398-
return null;
398+
return [];
399399
}
400400

401401
const json = await res.json();
402-
403402
return json.data as UniversalBridgeStats[];
404403
}
405404

@@ -430,6 +429,5 @@ export async function getUniversalBridgeWalletUsage(args: {
430429
}
431430

432431
const json = await res.json();
433-
434432
return json.data as UniversalBridgeWalletStats[];
435433
}

apps/dashboard/src/@/components/blocks/SidebarLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ function RenderSidebarGroup(props: {
137137
}
138138

139139
if ("separator" in link) {
140-
return <SidebarSeparator className="my-1" />;
140+
return <SidebarSeparator key={Math.random()} className="my-1" />;
141141
}
142142

143143
return (

0 commit comments

Comments
 (0)