Skip to content

Commit 9fb9635

Browse files
authored
Merge branch 'main' into codex/add-option-to-limit-country-selector
2 parents e9d6224 + a3072c4 commit 9fb9635

File tree

10 files changed

+172
-9
lines changed

10 files changed

+172
-9
lines changed

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.
27.4 KB
Loading
123 KB
Loading

apps/dashboard/src/app/(app)/(dashboard)/(chain)/utils.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import alephZeroBaner from "./temp-assets/AlephZeroBanner.jpg";
88
import alephZeroCTA from "./temp-assets/AlephZeroCTA.jpg";
99
import cotiBanner from "./temp-assets/COTI_Banner.jpg";
1010
import cotiCTA from "./temp-assets/COTI_CTA.jpg";
11+
import eduBanner from "./temp-assets/EDUBanner.jpeg";
12+
import eduCTA from "./temp-assets/EDUCTA.png";
1113
import hemiSepoliaBanner from "./temp-assets/HemiBanner.png";
1214
import hemiSepoliaCTA from "./temp-assets/HemiCTA.png";
1315
import ancient8Banner from "./temp-assets/ancient8-banner.png";
@@ -376,6 +378,31 @@ const chainMetaRecord = {
376378
about:
377379
"Monetize your passion, your way. Discover the freedom to grow with our creator-focused platform.",
378380
},
381+
//EDUMainnet
382+
41923: {
383+
headerImgUrl: eduBanner.src,
384+
about:
385+
"Education On-Chain - A Layer 3 blockchain preparing students and learners for the future of work while advancing onchain education finance (EduFi).",
386+
cta: {
387+
backgroundImageUrl: eduCTA.src,
388+
title: "Education On-Chain",
389+
buttonLink: "https://educhain.xyz/",
390+
buttonText: "Learn More",
391+
},
392+
},
393+
//EDU Testnet <Open Campus Codex>
394+
656476: {
395+
headerImgUrl: eduBanner.src,
396+
about:
397+
"Education On-Chain - A Layer 3 blockchain preparing students and learners for the future of work while advancing onchain education finance (EduFi).",
398+
cta: {
399+
backgroundImageUrl: eduCTA.src,
400+
title: "Education On-Chain",
401+
buttonLink: "https://educhain.xyz/",
402+
buttonText: "Learn More",
403+
},
404+
},
405+
379406
//Etherlink Testnet
380407
128123: {
381408
headerImgUrl: etherlinkBanner.src,

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/engine/cloud/server-wallets/components/try-it-out.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export function TryItOut() {
186186
const sdkExample = () => `\
187187
import { createThirdwebClient, sendTransaction, getContract, Engine } from "thirdweb";
188188
import { baseSepolia } from "thirdweb/chains";
189-
import { claimTo } from "thirdweb/extensions/1155";
189+
import { claimTo } from "thirdweb/extensions/erc1155";
190190
191191
// Create a thirdweb client
192192
const client = createThirdwebClient({
@@ -228,7 +228,7 @@ const txHash = await Engine.waitForTransactionHash({
228228
client,
229229
transactionId,
230230
});
231-
console.log("Transaction hash:", result.transactionHash);
231+
console.log("Transaction hash:", txHash);
232232
`;
233233

234234
const curlExample = () => `\

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/engine/dedicated/(instance)/[engineId]/overview/components/engine-overview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ function BackendWalletsSection(props: {
9595
</UnderlineLink>{" "}
9696
tab, or{" "}
9797
<TrackedUnderlineLink
98-
href="https://portal.thirdweb.com/infrastructure/engine/features/backend-wallets"
98+
href="https://portal.thirdweb.com/engine/v2/configure-wallets/server-wallet"
9999
target="_blank"
100100
label="learn-more"
101101
category="engine"
102102
>
103-
learn more about backend wallets.
103+
learn more about server wallets.
104104
</TrackedUnderlineLink>
105105
</p>
106106
</div>

apps/portal/src/app/engine/v2/get-started/page.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,12 @@ Learn more about [admins](/engine/v2/features/admins) and [access tokens](/engin
9696
**Backend wallet** are your wallets managed by Engine. Engine will send blockchain transactions from these wallets.
9797

9898
- Configure how to back up wallets.
99-
- Create or import a backend wallet.
100-
- Specify the backend wallet to use when calling the Engine API.
10199

102-
[Learn more about backend wallets.](/engine/v2/features/backend-wallets)
100+
- Create or import a server wallet.
101+
- Specify the server wallet to use when calling the Engine API.
102+
103+
104+
[Learn more about server wallets.](/engine/v2/configure-wallets/server-wallet)
103105

104106
## Interact with the blockchain
105107

apps/portal/src/app/nebula/mcp-server/integrations/mcp-clients/page.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,9 @@ This server can be integrated with any client that supports the Model Context Pr
77

88
1. Run the MCP server with the appropriate configuration
99
2. Connect your MCP client to the server using the selected transport (stdio or SSE)
10-
3. Access thirdweb services through the exposed MCP tools
10+
3. Access thirdweb services through the exposed MCP tools
11+
12+
13+
#### References
14+
15+
[thirdweb-mcp references](https://github.com/thirdweb-dev/ai/tree/main/python/thirdweb-mcp)

apps/portal/src/app/page.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@ function LearningResourcesSection() {
154154
description="Wallets, auth, and onchain interactions"
155155
icon={ConnectIcon}
156156
/>
157+
<ArticleCardIndex
158+
href="/pay"
159+
title="Universal Bridge"
160+
description="Bridge and onramp tokens on any chain"
161+
icon={BridgeIcon}
162+
/>
157163
<ArticleCardIndex
158164
href="/engine"
159165
title="Engine"

apps/portal/src/app/pay/sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const sidebar: SideBar = {
2121
links: [
2222
{
2323
name: "Overview",
24-
href: `${paySlug}/overview`,
24+
href: `${paySlug}`,
2525
icon: <WalletIcon />,
2626
},
2727
{

0 commit comments

Comments
 (0)