-
Notifications
You must be signed in to change notification settings - Fork 620
add api snippets to explorer section #7971
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
|
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant CF as ContractFunction
participant CMD as COMMANDS
participant FS as formatSnippet
participant CS as CodeSegment
User->>CF: open function UI
CF->>CMD: read base snippets (commandsKey)
alt COMMANDS.api[commandsKey] exists
CF->>CMD: read API snippet
end
alt COMMANDS.curl[commandsKey] exists
CF->>CMD: read cURL snippet
end
CF->>CF: merge snippets -> { ...base, ...api?, ...curl? }
CF->>FS: formatSnippet(merged, args, chainId, contractAddress, fn)
FS-->>CF: formatted snippets
CF->>CS: render CodeSegment with available tabs (includes API, cURL, .NET, Unity, etc.)
User->>CS: select tab
CS-->>User: display snippet (language mapping applied: api→javascript, curl→bash, unity/dotnet→cpp)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7971 +/- ##
=======================================
Coverage 56.53% 56.53%
=======================================
Files 904 904
Lines 58626 58626
Branches 4146 4146
=======================================
Hits 33145 33145
Misses 25375 25375
Partials 106 106
🚀 New features to boost your workflow:
|
apps/dashboard/src/@/components/contracts/functions/contract-function.tsx
Outdated
Show resolved
Hide resolved
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: 1
🧹 Nitpick comments (4)
apps/dashboard/src/@/components/blocks/code/code-segment.client.tsx (2)
40-43: Label “API” could be clearer to usersConsider renaming the tab title to “API (HTTP)” to set expectation that these are curl/HTTP snippets.
- { - environment: "api", - title: "API", - }, + { + environment: "api", + title: "API (HTTP)", + },
131-135: Syntax highlighting: prefer csharp over cpp for Unity (if supported)If CodeClient supports it, switch Unity highlighting from cpp to csharp; keeps syntax colors accurate.
- : activeEnvironment === "unity" - ? "cpp" + : activeEnvironment === "unity" + ? "csharp" : activeEnvironment === "api" ? "bash" : activeEnvironmentapps/dashboard/src/@/components/contracts/code-overview.tsx (1)
266-281: Reduce secret leakage risk in examples and appease secret scannersGitleaks flags the literal secret header. Prefer environment variables in examples and keep “backend only” note.
--H "x-secret-key: YOUR_SECRET_KEY" \ +# Backend only: +-H "x-secret-key: $THIRDWEB_SECRET_KEY" \Optionally, add an allowlist rule for the fixed literal
YOUR_SECRET_KEYif you keep it, but env vars are cleaner.apps/dashboard/src/@/components/contracts/functions/contract-function.tsx (1)
115-121: Avoid double formatting; merge then format onceYou format twice (base and api) with identical options, then merge. Format the merged snippet once to keep replacements consistent and cut work.
- const baseSnippet = formatSnippet(COMMANDS[commandsKey], { - args: fn.inputs?.map((i) => i.name || ""), - chainId: contract.chain.id, - contractAddress: contract.address, - extensionNamespace, - fn, - }); - - const apiSnippet = formatSnippet( - { api: COMMANDS.api[commandsKey] }, - { - args: fn.inputs?.map((i) => i.name || ""), - chainId: contract.chain.id, - contractAddress: contract.address, - extensionNamespace, - fn, - }, - ); - - const codeSnippet = { - ...baseSnippet, - ...apiSnippet, - }; + const merged = { + ...COMMANDS[commandsKey], + ...(COMMANDS.api?.[commandsKey] ? { api: COMMANDS.api[commandsKey] } : {}), + }; + const codeSnippet = formatSnippet(merged, { + args: fn.inputs?.map((i) => i.name || ""), + chainId: contract.chain.id, + contractAddress: contract.address, + extensionNamespace, + fn, + });Adds a guard in case a future
commandsKeylacks an API template.Also applies to: 123-137
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
apps/dashboard/src/@/components/blocks/code/code-segment.client.tsx(3 hunks)apps/dashboard/src/@/components/contracts/code-overview.tsx(5 hunks)apps/dashboard/src/@/components/contracts/functions/contract-function.tsx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from@/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:
apps/dashboard/src/@/components/blocks/code/code-segment.client.tsxapps/dashboard/src/@/components/contracts/code-overview.tsxapps/dashboard/src/@/components/contracts/functions/contract-function.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)
Files:
apps/dashboard/src/@/components/blocks/code/code-segment.client.tsxapps/dashboard/src/@/components/contracts/code-overview.tsxapps/dashboard/src/@/components/contracts/functions/contract-function.tsx
apps/{dashboard,playground-web}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
apps/{dashboard,playground-web}/**/*.{ts,tsx}: Import UI primitives from@/components/ui/*(Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator) in dashboard and playground apps
UseNavLinkfor internal navigation with automatic active states in dashboard and playground apps
Use Tailwind CSS only – no inline styles or CSS modules
Usecn()from@/lib/utilsfor conditional class logic
Use design system tokens (e.g.,bg-card,border-border,text-muted-foreground)
Server Components (Node edge): Start files withimport "server-only";
Client Components (browser): Begin files with'use client';
Always callgetAuthToken()to retrieve JWT from cookies on server side
UseAuthorization: Bearerheader – never embed tokens in URLs
Return typed results (e.g.,Project[],User[]) – avoidany
Wrap client-side data fetching calls in React Query (@tanstack/react-query)
Use descriptive, stablequeryKeysfor React Query cache hits
ConfigurestaleTime/cacheTimein React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never importposthog-jsin server components
Files:
apps/dashboard/src/@/components/blocks/code/code-segment.client.tsxapps/dashboard/src/@/components/contracts/code-overview.tsxapps/dashboard/src/@/components/contracts/functions/contract-function.tsx
apps/{dashboard,playground}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
apps/{dashboard,playground}/**/*.{ts,tsx}: Import UI primitives from@/components/ui/_(e.g., Button, Input, Tabs, Card)
UseNavLinkfor internal navigation to get active state handling
Use Tailwind CSS for styling; no inline styles
Merge class names withcn()from@/lib/utilsfor conditional classes
Stick to design tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components must start withimport "server-only"; usenext/headers, server‑only env, heavy data fetching, andredirect()where appropriate
Client Components must start with'use client'; handle interactivity with hooks and browser APIs
Server-side data fetching: callgetAuthToken()from cookies, sendAuthorization: Bearer <token>header, and return typed results (avoidany)
Client-side data fetching: wrap calls in React Query with descriptive, stablequeryKeysand set sensiblestaleTime/cacheTime(≥ 60s default); keep tokens secret via internal routes or server actions
Do not importposthog-jsin server components (client-side only)
Files:
apps/dashboard/src/@/components/blocks/code/code-segment.client.tsxapps/dashboard/src/@/components/contracts/code-overview.tsxapps/dashboard/src/@/components/contracts/functions/contract-function.tsx
apps/{dashboard,playground}/**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
Expose a
classNameprop on the root element of every component
Files:
apps/dashboard/src/@/components/blocks/code/code-segment.client.tsxapps/dashboard/src/@/components/contracts/code-overview.tsxapps/dashboard/src/@/components/contracts/functions/contract-function.tsx
🧬 Code graph analysis (1)
apps/dashboard/src/@/components/contracts/functions/contract-function.tsx (1)
apps/dashboard/src/@/components/contracts/code-overview.tsx (2)
formatSnippet(497-591)COMMANDS(31-292)
🪛 Gitleaks (8.27.2)
apps/dashboard/src/@/components/contracts/code-overview.tsx
252-256: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
266-268: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
281-285: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
⏰ 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). (6)
- GitHub Check: Size
- GitHub Check: Unit Tests
- GitHub Check: E2E Tests (pnpm, vite)
- GitHub Check: E2E Tests (pnpm, esbuild)
- GitHub Check: Lint Packages
- GitHub Check: Analyze (javascript)
🔇 Additional comments (5)
apps/dashboard/src/@/components/blocks/code/code-segment.client.tsx (1)
13-15: Type surface updated to include "api" looks goodUnion extension is consistent with downstream usage. No issues.
apps/dashboard/src/@/components/contracts/code-overview.tsx (4)
114-125: Unity read snippet signature likely incorrectThe sample uses
contract.Read<T>(contract, "...", args). Passingcontractagain and the generic placeholderTmay not match current Unity SDK signatures.Consider adjusting to a self-contained, copyable example (remove duplicate
contract, clarifyT), once verified against the Unity SDK.
281-290: API events: confirm expected field and value formatTemplate uses
"eventName": "{{function}}", butformatSnippetinjects a formatted ABI item. Verify the API expects name vs signature (e.g.,TransfervsTransfer(address,address,uint256)), or a topic.If signature is required, consider renaming the field to
eventSignaturein the payload for clarity (if the API supports it).
568-571: Explicit no-op for API in formatter is fineAcknowledging API doesn’t need extension mapping is correct.
239-250: DefinewalletandweiValue; retain the contract parameter inWrite
Lines 239–250: the Unity snippet references undefinedwalletandweiValue. Add example wallet‐connect andweiValuedefinitions—do not remove the secondcontractargument, as the .NET SDK signature is:var receipt = await contract.Write( wallet, // IThirdwebWallet signer contract, // ThirdwebContract instance "methodName", weiValue, // BigInteger value for payable functions args // optional parameters );- var transactionReceipt = await contract.Write(wallet, contract, "{{function}}", weiValue, {{args}}); + // Connect your wallet + var wallet = await ThirdwebManager.Instance.ConnectWallet( + new WalletOptions(WalletProvider.EmbeddedWallet, {{chainId}}) + ); + // Specify value to send (0 for non-payable) + BigInteger weiValue = BigInteger.Zero; + var transactionReceipt = await contract.Write( + wallet, + contract, + "{{function}}", + weiValue, + {{args}} + );(docs-v2.thirdweb-preview.com)
Likely an incorrect or invalid review comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/dashboard/src/@/components/contracts/code-overview.tsx (1)
879-908: API tab shows empty snippet in “All Functions & Events”Here we pass only COMMANDS[tab]; api snippets live under COMMANDS.api. When the user selects the API environment, the panel will have no content.
Apply this diff to merge API templates just like in contract-function.tsx:
- <CodeSegment - environment={environment} - setEnvironment={setEnvironment} - snippet={formatSnippet( - // biome-ignore lint/suspicious/noExplicitAny: FIXME - COMMANDS[tab as keyof typeof COMMANDS] as any, - { - args: - abi - ?.filter( - (f) => f.type === "function" || f.type === "event", - ) - ?.find( - (f) => - f.name === - (tab === "read" - ? read?.name - : tab === "write" - ? write?.name - : event?.name), - ) - ?.inputs.map((i) => i.name || "") || [], - - chainId, - contractAddress, - extensionNamespace, - fn: tab === "read" ? read : tab === "write" ? write : event, - }, - )} - /> + <CodeSegment + environment={environment} + setEnvironment={setEnvironment} + snippet={{ + ...formatSnippet( + COMMANDS[tab as keyof typeof COMMANDS] as any, + { + args: + abi + ?.filter( + (f) => f.type === "function" || f.type === "event", + ) + ?.find( + (f) => + f.name === + (tab === "read" + ? read?.name + : tab === "write" + ? write?.name + : event?.name), + ) + ?.inputs.map((i) => i.name || "") || [], + chainId, + contractAddress, + extensionNamespace, + fn: tab === "read" ? read : tab === "write" ? write : event, + }, + ), + ...(COMMANDS.api?.[tab as keyof typeof COMMANDS["api"]] + ? formatSnippet( + { + api: + (COMMANDS.api as any)[ + tab as keyof typeof COMMANDS["api"] + ], + }, + { + args: + abi + ?.filter( + (f) => f.type === "function" || f.type === "event", + ) + ?.find( + (f) => + f.name === + (tab === "read" + ? read?.name + : tab === "write" + ? write?.name + : event?.name), + ) + ?.inputs.map((i) => i.name || "") || [], + chainId, + contractAddress, + extensionNamespace, + fn: + tab === "read" ? read : tab === "write" ? write : event, + }, + ) + : {}), + }} + />
♻️ Duplicate comments (1)
apps/dashboard/src/@/components/contracts/functions/contract-function.tsx (1)
123-136: Harden the API snippet guard to avoid undefined accessAlso guard against COMMANDS.api being undefined to prevent a crash if the object shape changes or the import lags.
Apply this diff:
- const apiSnippet = COMMANDS.api[commandsKey] + const apiSnippet = COMMANDS.api && COMMANDS.api[commandsKey] ? formatSnippet( { api: COMMANDS.api[commandsKey] }, { args: fn.inputs?.map((i) => i.name || ""), chainId: contract.chain.id, contractAddress: contract.address, extensionNamespace, fn, }, ) : {};
🧹 Nitpick comments (1)
apps/dashboard/src/@/components/contracts/functions/contract-function.tsx (1)
137-141: Type the merged snippet for stronger TS guaranteesGive CodeSegment an explicitly typed Partial<Record<CodeEnvironment, string>> to avoid widening to any.
- const codeSnippet = { + const codeSnippet: Partial<Record<CodeEnvironment, string>> = { ...baseSnippet, ...apiSnippet, };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
apps/dashboard/src/@/components/contracts/code-overview.tsx(5 hunks)apps/dashboard/src/@/components/contracts/functions/contract-function.tsx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from@/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:
apps/dashboard/src/@/components/contracts/functions/contract-function.tsxapps/dashboard/src/@/components/contracts/code-overview.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)
Files:
apps/dashboard/src/@/components/contracts/functions/contract-function.tsxapps/dashboard/src/@/components/contracts/code-overview.tsx
apps/{dashboard,playground-web}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
apps/{dashboard,playground-web}/**/*.{ts,tsx}: Import UI primitives from@/components/ui/*(Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator) in dashboard and playground apps
UseNavLinkfor internal navigation with automatic active states in dashboard and playground apps
Use Tailwind CSS only – no inline styles or CSS modules
Usecn()from@/lib/utilsfor conditional class logic
Use design system tokens (e.g.,bg-card,border-border,text-muted-foreground)
Server Components (Node edge): Start files withimport "server-only";
Client Components (browser): Begin files with'use client';
Always callgetAuthToken()to retrieve JWT from cookies on server side
UseAuthorization: Bearerheader – never embed tokens in URLs
Return typed results (e.g.,Project[],User[]) – avoidany
Wrap client-side data fetching calls in React Query (@tanstack/react-query)
Use descriptive, stablequeryKeysfor React Query cache hits
ConfigurestaleTime/cacheTimein React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never importposthog-jsin server components
Files:
apps/dashboard/src/@/components/contracts/functions/contract-function.tsxapps/dashboard/src/@/components/contracts/code-overview.tsx
apps/{dashboard,playground}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
apps/{dashboard,playground}/**/*.{ts,tsx}: Import UI primitives from@/components/ui/_(e.g., Button, Input, Tabs, Card)
UseNavLinkfor internal navigation to get active state handling
Use Tailwind CSS for styling; no inline styles
Merge class names withcn()from@/lib/utilsfor conditional classes
Stick to design tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components must start withimport "server-only"; usenext/headers, server‑only env, heavy data fetching, andredirect()where appropriate
Client Components must start with'use client'; handle interactivity with hooks and browser APIs
Server-side data fetching: callgetAuthToken()from cookies, sendAuthorization: Bearer <token>header, and return typed results (avoidany)
Client-side data fetching: wrap calls in React Query with descriptive, stablequeryKeysand set sensiblestaleTime/cacheTime(≥ 60s default); keep tokens secret via internal routes or server actions
Do not importposthog-jsin server components (client-side only)
Files:
apps/dashboard/src/@/components/contracts/functions/contract-function.tsxapps/dashboard/src/@/components/contracts/code-overview.tsx
apps/{dashboard,playground}/**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
Expose a
classNameprop on the root element of every component
Files:
apps/dashboard/src/@/components/contracts/functions/contract-function.tsxapps/dashboard/src/@/components/contracts/code-overview.tsx
🧬 Code graph analysis (1)
apps/dashboard/src/@/components/contracts/functions/contract-function.tsx (1)
apps/dashboard/src/@/components/contracts/code-overview.tsx (2)
formatSnippet(498-592)COMMANDS(31-293)
🪛 Gitleaks (8.27.2)
apps/dashboard/src/@/components/contracts/code-overview.tsx
252-256: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
267-269: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
282-286: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
⏰ 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). (7)
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: E2E Tests (pnpm, esbuild)
- GitHub Check: E2E Tests (pnpm, vite)
- GitHub Check: Size
- GitHub Check: Unit Tests
- GitHub Check: Lint Packages
- GitHub Check: Analyze (javascript)
🔇 Additional comments (7)
apps/dashboard/src/@/components/contracts/functions/contract-function.tsx (1)
115-121: Base snippet generation looks goodCorrectly reuses existing COMMANDS mapping and formatSnippet; args/chainId/address/extension are wired as expected.
apps/dashboard/src/@/components/contracts/code-overview.tsx (6)
68-79: Unity events snippet: verify API surfaceConfirm contract.Events(string) is the correct async API and return type for the current Unity SDK. If it differs (e.g., Events or a different invocation), update the snippet accordingly.
Would you like me to scan the repo/docs to verify the Unity signature?
114-125: Unity read snippet: validate Read signatureDouble-check that Read(contract, method, args...) reflects the latest Unity SDK. If Read expects a params array or omits the contract instance, adjust.
I can search for the method signature across the repo to confirm.
191-195: Unity setup snippet LGTMUpdated GetContract usage is consistent across samples.
239-250: Unity write snippet: confirm payable value handlingEnsure Write(wallet, contract, method, weiValue, args...) is accurate and clarify how to pass 0 for non-payable calls to prevent confusion.
If needed, I can propose a small comment in the snippet indicating weiValue = 0 for non-payable.
569-571: formatSnippet: api branch is correctExplicitly skipping extension-specific remapping for API is appropriate.
282-291: Events API payload:eventNameis correct — repository examples and documentation consistently useeventNamefor this endpoint; no renaming required.
Introduces API and cURL environments to the code segment component and provides example code snippets for reading, writing, and listening to contract events via API and cURL. Updates the contract overview and function components to support these new environments and ensures cURL snippets are only included when available. Also refines code formatting and improves default environment selection.
Refactored the events fetch and curl examples to use the new GET endpoint format with path parameters instead of POST with a JSON body. This aligns with the updated thirdweb API for fetching contract events.
Replaces the previous Thirdweb SDK wallet connection example with a new approach using InAppWallet and Google authentication. The updated code demonstrates connecting with EIP7702Sponsored execution mode and retrieving the wallet address.
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: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
apps/dashboard/src/@/components/contracts/code-overview.tsx (2)
680-684: API/cURL params not valid JSON when using identifiers; generate JSON-safe example valuesCurrently {{args}} expands to identifiers (e.g., to, amount) which yields invalid JSON in API/cURL payloads. Generate example literals from ABI types for these environments.
- if (args?.some((arg) => arg)) { - code[env] = code[env]?.replace(/{{args}}/gm, args?.join(", ") || ""); - } else { - code[env] = code[env]?.replace(/{{args}}/gm, ""); - } + const isJsonPayload = env === "api" || env === "curl"; + if (isJsonPayload && fn && "inputs" in fn) { + const jsonArgValues = (fn.inputs || []).map((i) => { + const t = (i as { type?: string }).type || ""; + if (t.endsWith("[]")) return "[]"; + if (t.startsWith("uint") || t.startsWith("int")) return "0"; + if (t === "bool") return "true"; + if (t === "address") return '"0x..."'; + if (t.startsWith("bytes")) return '"0x"'; + if (t.startsWith("tuple")) return "{}"; + return '"<value>"'; + }); + code[env] = code[env]?.replace(/{{args}}/gm, jsonArgValues.join(", ")); + } else if (args?.some((arg) => arg)) { + code[env] = code[env]?.replace(/{{args}}/gm, args.join(", ")); + } else { + code[env] = code[env]?.replace(/{{args}}/gm, ""); + }
855-884: Defaulting to “API” leaves Install/Setup sections blank; hide or tailor for API/cURLWith environment defaulting to "api", Install/Setup snippets render empty (no API setup/install). Show a short note instead and skip the CodeSegment for these envs.
- {environment === "react-native" || environment === "unity" ? ( + {environment === "react-native" || environment === "unity" ? ( <p className="text-sm text-muted-foreground"> Install the latest version of the SDK.{" "} <UnderlineLink className="text-primary-500" href={`https://portal.thirdweb.com/${environment}`} rel="noopener noreferrer" target="_blank" > Learn how in the{" "} {environment === "react-native" ? "React Native" : "Unity"}{" "} documentation </UnderlineLink> . </p> - ) : ( + ) : environment === "api" || environment === "curl" ? ( + <p className="text-sm text-muted-foreground"> + No installation required for REST API or cURL examples. + </p> + ) : ( <> <p className="text-sm text-muted-foreground"> Install the latest version of the SDK: </p> <CodeSegment environment={environment} hideTabs isInstallCommand setEnvironment={setEnvironment} snippet={COMMANDS.install} /> </> )}- <p className="text-sm text-muted-foreground"> - Initialize the SDK and contract on your project: - </p> - <CodeSegment - environment={environment} - hideTabs - setEnvironment={setEnvironment} - snippet={formatSnippet(COMMANDS.setup, { - chainId, - contractAddress, - })} - /> + {environment === "api" || environment === "curl" ? ( + <p className="text-sm text-muted-foreground"> + No SDK initialization needed for REST API/cURL. See the requests below. + </p> + ) : ( + <> + <p className="text-sm text-muted-foreground"> + Initialize the SDK and contract on your project: + </p> + <CodeSegment + environment={environment} + hideTabs + setEnvironment={setEnvironment} + snippet={formatSnippet(COMMANDS.setup, { + chainId, + contractAddress, + })} + /> + </> + )}Also applies to: 886-904
♻️ Duplicate comments (3)
apps/dashboard/src/@/components/contracts/code-overview.tsx (3)
306-324: API fetch (read/write): add server-only secret guidance + response.ok checkSafer copy-paste: warn about server-only secrets and handle non-2xx responses. This mirrors prior feedback.
-const response = await fetch('https://api.thirdweb.com/v1/contracts/read', { +// Note: Use your secret key only on a trusted server — never expose it to the browser. +const response = await fetch('https://api.thirdweb.com/v1/contracts/read', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-secret-key': '<YOUR_SECRET_KEY>' }, body: JSON.stringify({ calls: [ { contractAddress: "{{contract_address}}", method: "{{function}}", params: [{{args}}] } ], chainId: {{chainId}} }) }); - -const data = await response.json(); +if (!response.ok) { + throw new Error(`Request failed: ${response.status} ${await response.text()}`); +} +const data = await response.json();-const response = await fetch('https://api.thirdweb.com/v1/contracts/write', { +// Note: Use your secret key only on a trusted server — never expose it to the browser. +const response = await fetch('https://api.thirdweb.com/v1/contracts/write', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-secret-key': '<YOUR_SECRET_KEY>' }, body: JSON.stringify({ calls: [ { contractAddress: "{{contract_address}}", method: "{{function}}", params: [{{args}}] } ], chainId: {{chainId}}, from: "<YOUR_WALLET_ADDRESS>" }) }); - -const data = await response.json(); +if (!response.ok) { + throw new Error(`Request failed: ${response.status} ${await response.text()}`); +} +const data = await response.json();Also applies to: 325-344
71-74: Unity events: trailing comma after chainId breaks C#Remove the trailing comma; it’s invalid in argument lists.
var contract = await ThirdwebManager.Instance.GetContract( address: "{{contract_address}}", - chainId: {{chainId}}, -); + chainId: {{chainId}} +);
345-354: Fix events API endpoint and add basic error handlingThe endpoint path is incorrect; chainId must be a query param on /v1/contracts/{address}/events. Also add a minimal response.ok check and clarify secret-key usage is server-only. Docs: GET /v1/contracts/{address}/events?chainId=<chain_id>&decode=true. (portal.thirdweb.com)
-const response = await fetch('https://api.thirdweb.com/v1/contracts/{{chainId}}/{{contract_address}}/events?eventSignature={{function}}', { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - 'x-secret-key': '<YOUR_SECRET_KEY>' - } -}); - -const data = await response.json(); +// Note: Use your secret key only on a trusted server — never expose it to the browser. +const response = await fetch( + `https://api.thirdweb.com/v1/contracts/{{contract_address}}/events?chainId={{chainId}}&decode=true`, + { + method: 'GET', + headers: { + 'x-secret-key': '<YOUR_SECRET_KEY>', + }, + }, +); +if (!response.ok) { + throw new Error(`Request failed: ${response.status} ${await response.text()}`); +} +const data = await response.json();
🧹 Nitpick comments (2)
apps/dashboard/src/@/components/contracts/code-overview.tsx (2)
271-286: Unity write signature likely has an extra contract parameterDouble-check the Write signature; passing both wallet and contract looks suspicious. Please verify against Unity SDK docs and correct if needed (e.g., omit the extra contract argument).
var transactionReceipt = await contract.Write( - wallet, - contract, - "{{function}}", - weiValue, - {{args}} + wallet, + "{{function}}", + weiValue, + {{args}} );
296-303: .NET write signature likely mirrors the Unity mismatchSame concern as Unity: verify correct parameter order and whether the extra contract argument is needed.
var transactionReceipt = await contract.Write( - wallet, - contract, - "{{function}}", - weiValue, - {{args}} + wallet, + "{{function}}", + weiValue, + {{args}} );
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
apps/dashboard/src/@/components/contracts/code-overview.tsx(7 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from@/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:
apps/dashboard/src/@/components/contracts/code-overview.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)
Files:
apps/dashboard/src/@/components/contracts/code-overview.tsx
apps/{dashboard,playground-web}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
apps/{dashboard,playground-web}/**/*.{ts,tsx}: Import UI primitives from@/components/ui/*(Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator) in dashboard and playground apps
UseNavLinkfor internal navigation with automatic active states in dashboard and playground apps
Use Tailwind CSS only – no inline styles or CSS modules
Usecn()from@/lib/utilsfor conditional class logic
Use design system tokens (e.g.,bg-card,border-border,text-muted-foreground)
Server Components (Node edge): Start files withimport "server-only";
Client Components (browser): Begin files with'use client';
Always callgetAuthToken()to retrieve JWT from cookies on server side
UseAuthorization: Bearerheader – never embed tokens in URLs
Return typed results (e.g.,Project[],User[]) – avoidany
Wrap client-side data fetching calls in React Query (@tanstack/react-query)
Use descriptive, stablequeryKeysfor React Query cache hits
ConfigurestaleTime/cacheTimein React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never importposthog-jsin server components
Files:
apps/dashboard/src/@/components/contracts/code-overview.tsx
apps/{dashboard,playground}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
apps/{dashboard,playground}/**/*.{ts,tsx}: Import UI primitives from@/components/ui/_(e.g., Button, Input, Tabs, Card)
UseNavLinkfor internal navigation to get active state handling
Use Tailwind CSS for styling; no inline styles
Merge class names withcn()from@/lib/utilsfor conditional classes
Stick to design tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components must start withimport "server-only"; usenext/headers, server‑only env, heavy data fetching, andredirect()where appropriate
Client Components must start with'use client'; handle interactivity with hooks and browser APIs
Server-side data fetching: callgetAuthToken()from cookies, sendAuthorization: Bearer <token>header, and return typed results (avoidany)
Client-side data fetching: wrap calls in React Query with descriptive, stablequeryKeysand set sensiblestaleTime/cacheTime(≥ 60s default); keep tokens secret via internal routes or server actions
Do not importposthog-jsin server components (client-side only)
Files:
apps/dashboard/src/@/components/contracts/code-overview.tsx
apps/{dashboard,playground}/**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
Expose a
classNameprop on the root element of every component
Files:
apps/dashboard/src/@/components/contracts/code-overview.tsx
⏰ 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). (5)
- GitHub Check: Size
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: E2E Tests (pnpm, vite)
- GitHub Check: Lint Packages
- GitHub Check: Analyze (javascript)
🔇 Additional comments (3)
apps/dashboard/src/@/components/contracts/code-overview.tsx (3)
93-96: .NET install instructions: LGTMNuGet guidance is clear and accurate.
123-136: Unity read snippet: LGTM after removing extraneous contract paramSignature now looks correct.
136-149: .NET read snippet: LGTMCreate + Read flow is consistent.
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: 1
♻️ Duplicate comments (2)
apps/dashboard/src/@/components/contracts/code-overview.tsx (2)
345-353: Events endpoint/path is incorrect; switch to documented GET /v1/contracts/{address}/events with chainId query-const response = await fetch('https://api.thirdweb.com/v1/contracts/{{chainId}}/{{contract_address}}/events?eventSignature={{function}}', { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - 'x-secret-key': '<YOUR_SECRET_KEY>' - } -}); +const response = await fetch(`https://api.thirdweb.com/v1/contracts/{{contract_address}}/events?chainId={{chainId}}&decode=true`, { + method: 'GET', + headers: { + 'x-secret-key': '<YOUR_SECRET_KEY>' + } +});-curl https://api.thirdweb.com/v1/contracts/{{chainId}}/{{contract_address}}/events?eventSignature={{function}} \ - --request GET \ - --header 'Content-Type: application/json' \ - --header 'x-secret-key: <YOUR_SECRET_KEY>' +curl "https://api.thirdweb.com/v1/contracts/{{contract_address}}/events?chainId={{chainId}}&decode=true" \ + --request GET \ + --header 'x-secret-key: <YOUR_SECRET_KEY>'Also applies to: 384-387
71-74: Unity events: trailing comma makes snippet invalid C# in many Unity setupsRemove the trailing comma after chainId.
var contract = await ThirdwebManager.Instance.GetContract( address: "{{contract_address}}", - chainId: {{chainId}}, -); + chainId: {{chainId}} +);
🧹 Nitpick comments (1)
apps/dashboard/src/@/components/contracts/code-overview.tsx (1)
305-324: API snippets: add minimal error handling and server-only secret guidance-const response = await fetch('https://api.thirdweb.com/v1/contracts/read', { +// Note: Use your secret key only on a trusted server – never in the browser. +const response = await fetch('https://api.thirdweb.com/v1/contracts/read', { @@ -}); - -const data = await response.json(); +}); +if (!response.ok) { + throw new Error(`Request failed: ${response.status} ${await response.text()}`); +} +const data = await response.json();-const response = await fetch('https://api.thirdweb.com/v1/contracts/write', { +// Note: Use your secret key only on a trusted server – never in the browser. +const response = await fetch('https://api.thirdweb.com/v1/contracts/write', { @@ -}); - -const data = await response.json(); +}); +if (!response.ok) { + throw new Error(`Request failed: ${response.status} ${await response.text()}`); +} +const data = await response.json();Also applies to: 325-344
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
apps/dashboard/src/@/components/contracts/code-overview.tsx(8 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from@/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:
apps/dashboard/src/@/components/contracts/code-overview.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)
Files:
apps/dashboard/src/@/components/contracts/code-overview.tsx
apps/{dashboard,playground-web}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
apps/{dashboard,playground-web}/**/*.{ts,tsx}: Import UI primitives from@/components/ui/*(Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator) in dashboard and playground apps
UseNavLinkfor internal navigation with automatic active states in dashboard and playground apps
Use Tailwind CSS only – no inline styles or CSS modules
Usecn()from@/lib/utilsfor conditional class logic
Use design system tokens (e.g.,bg-card,border-border,text-muted-foreground)
Server Components (Node edge): Start files withimport "server-only";
Client Components (browser): Begin files with'use client';
Always callgetAuthToken()to retrieve JWT from cookies on server side
UseAuthorization: Bearerheader – never embed tokens in URLs
Return typed results (e.g.,Project[],User[]) – avoidany
Wrap client-side data fetching calls in React Query (@tanstack/react-query)
Use descriptive, stablequeryKeysfor React Query cache hits
ConfigurestaleTime/cacheTimein React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never importposthog-jsin server components
Files:
apps/dashboard/src/@/components/contracts/code-overview.tsx
apps/{dashboard,playground}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
apps/{dashboard,playground}/**/*.{ts,tsx}: Import UI primitives from@/components/ui/_(e.g., Button, Input, Tabs, Card)
UseNavLinkfor internal navigation to get active state handling
Use Tailwind CSS for styling; no inline styles
Merge class names withcn()from@/lib/utilsfor conditional classes
Stick to design tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components must start withimport "server-only"; usenext/headers, server‑only env, heavy data fetching, andredirect()where appropriate
Client Components must start with'use client'; handle interactivity with hooks and browser APIs
Server-side data fetching: callgetAuthToken()from cookies, sendAuthorization: Bearer <token>header, and return typed results (avoidany)
Client-side data fetching: wrap calls in React Query with descriptive, stablequeryKeysand set sensiblestaleTime/cacheTime(≥ 60s default); keep tokens secret via internal routes or server actions
Do not importposthog-jsin server components (client-side only)
Files:
apps/dashboard/src/@/components/contracts/code-overview.tsx
apps/{dashboard,playground}/**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
Expose a
classNameprop on the root element of every component
Files:
apps/dashboard/src/@/components/contracts/code-overview.tsx
🔇 Additional comments (4)
apps/dashboard/src/@/components/contracts/code-overview.tsx (4)
279-286: Unity write: likely extraneous contract parameterWrite usually targets the bound contract; passing
contractagain looks wrong. Please confirm signature and adjust.var transactionReceipt = await contract.Write( - wallet, - contract, + wallet, "{{function}}", weiValue, {{args}} );
296-303: .NET write: likely extraneous contract parameterSame issue as Unity; verify API and remove if not required.
var transactionReceipt = await contract.Write( - wallet, - contract, + wallet, "{{function}}", weiValue, {{args}} );
444-455: Unity wallet snippet: verify API surface and option names
ConnectWallet(...)without a receiver andauthprovidercasing look suspicious for C#. Confirm correct entry point (e.g., ThirdwebManager/SDK) and option property names/casing.
93-96: LGTM on these additions
- .NET install now references NuGet.
- Unity/.NET read snippets use correct signatures.
- Setup snippets look consistent.
- Default environment to "api" matches PR intent.
Also applies to: 123-135, 137-149, 215-219, 223-227, 708-709
Enhanced the CodeOverview component to display API and cURL usage instructions and code snippets. Added a message for API/cURL environments indicating no SDK install is required and updated snippet generation logic to include API and cURL commands if available.
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: 1
♻️ Duplicate comments (3)
apps/dashboard/src/@/components/contracts/code-overview.tsx (3)
71-75: Unity events: trailing comma breaks C# callRemove the trailing comma after chainId before the closing parenthesis.
var contract = await ThirdwebManager.Instance.GetContract( address: "{{contract_address}}", - chainId: {{chainId}}, -); + chainId: {{chainId}} +);
345-353: API events: wrong endpoint and headersUse the documented GET endpoint and drop Content-Type for GET.
-const response = await fetch('https://api.thirdweb.com/v1/contracts/{{chainId}}/{{contract_address}}/events?eventSignature={{function}}', { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - 'x-secret-key': '<YOUR_SECRET_KEY>' - } -}); +const response = await fetch(`https://api.thirdweb.com/v1/contracts/{{contract_address}}/events?chainId={{chainId}}&decode=true`, { + method: 'GET', + headers: { + 'x-secret-key': '<YOUR_SECRET_KEY>' + } +});
384-387: cURL events: wrong path/query; align with docsFix path and query; Content-Type not needed on GET.
-curl https://api.thirdweb.com/v1/contracts/{{chainId}}/{{contract_address}}/events?eventSignature={{function}} \ - --request GET \ - --header 'Content-Type: application/json' \ - --header 'x-secret-key: <YOUR_SECRET_KEY>' +curl "https://api.thirdweb.com/v1/contracts/{{contract_address}}/events?chainId={{chainId}}&decode=true" \ + --request GET \ + --header 'x-secret-key: <YOUR_SECRET_KEY>'
🧹 Nitpick comments (2)
apps/dashboard/src/@/components/contracts/code-overview.tsx (2)
306-324: API read: add server-only secret guidance and basic error handlingMake the snippet safer and copy-paste friendly.
-const response = await fetch('https://api.thirdweb.com/v1/contracts/read', { +// Note: Use your secret key only on a trusted server – never ship it to the browser. +const response = await fetch('https://api.thirdweb.com/v1/contracts/read', { @@ -}); - -const data = await response.json(); +}); +if (!response.ok) { + throw new Error(`Request failed: ${response.status} ${await response.text()}`); +} +const data = await response.json();
325-344: API write: mirror error handling and secret guidanceReplicate the pattern from read.
-const response = await fetch('https://api.thirdweb.com/v1/contracts/write', { +// Note: Use your secret key only on a trusted server – never ship it to the browser. +const response = await fetch('https://api.thirdweb.com/v1/contracts/write', { @@ -}); - -const data = await response.json(); +}); +if (!response.ok) { + throw new Error(`Request failed: ${response.status} ${await response.text()}`); +} +const data = await response.json();
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
apps/dashboard/src/@/components/contracts/code-overview.tsx(10 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from@/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:
apps/dashboard/src/@/components/contracts/code-overview.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)
Files:
apps/dashboard/src/@/components/contracts/code-overview.tsx
apps/{dashboard,playground-web}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
apps/{dashboard,playground-web}/**/*.{ts,tsx}: Import UI primitives from@/components/ui/*(Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator) in dashboard and playground apps
UseNavLinkfor internal navigation with automatic active states in dashboard and playground apps
Use Tailwind CSS only – no inline styles or CSS modules
Usecn()from@/lib/utilsfor conditional class logic
Use design system tokens (e.g.,bg-card,border-border,text-muted-foreground)
Server Components (Node edge): Start files withimport "server-only";
Client Components (browser): Begin files with'use client';
Always callgetAuthToken()to retrieve JWT from cookies on server side
UseAuthorization: Bearerheader – never embed tokens in URLs
Return typed results (e.g.,Project[],User[]) – avoidany
Wrap client-side data fetching calls in React Query (@tanstack/react-query)
Use descriptive, stablequeryKeysfor React Query cache hits
ConfigurestaleTime/cacheTimein React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never importposthog-jsin server components
Files:
apps/dashboard/src/@/components/contracts/code-overview.tsx
apps/{dashboard,playground}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
apps/{dashboard,playground}/**/*.{ts,tsx}: Import UI primitives from@/components/ui/_(e.g., Button, Input, Tabs, Card)
UseNavLinkfor internal navigation to get active state handling
Use Tailwind CSS for styling; no inline styles
Merge class names withcn()from@/lib/utilsfor conditional classes
Stick to design tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components must start withimport "server-only"; usenext/headers, server‑only env, heavy data fetching, andredirect()where appropriate
Client Components must start with'use client'; handle interactivity with hooks and browser APIs
Server-side data fetching: callgetAuthToken()from cookies, sendAuthorization: Bearer <token>header, and return typed results (avoidany)
Client-side data fetching: wrap calls in React Query with descriptive, stablequeryKeysand set sensiblestaleTime/cacheTime(≥ 60s default); keep tokens secret via internal routes or server actions
Do not importposthog-jsin server components (client-side only)
Files:
apps/dashboard/src/@/components/contracts/code-overview.tsx
apps/{dashboard,playground}/**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
Expose a
classNameprop on the root element of every component
Files:
apps/dashboard/src/@/components/contracts/code-overview.tsx
⏰ 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). (1)
- GitHub Check: Size
🔇 Additional comments (5)
apps/dashboard/src/@/components/contracts/code-overview.tsx (5)
123-135: Unity read: signature fix looks correctRemoved the extraneous
contractparameter; this matches the expected call form.
708-709: Default environment to API: good DX choiceMakes sense for quick copy/paste without SDK setup.
852-858: Clear API/cURL guidanceConcise and accurate messaging about client IDs vs secret keys.
296-303: Remove redundantcontractargument fromcontract.WriteThe extra
contractparameter should be removed to align with the method’s expected signature:var transactionReceipt = await contract.Write( wallet, - contract, "{{function}}", weiValue, {{args}} );
279-286: VerifyWritesignature in the SDK
I couldn’t locate a local definition ofcontract.Write(…)—the project’s MDX docs consistently show passing thecontractinstance as the second argument. Please confirm the official method signature in your imported SDK and adjust this call accordingly.
PR-Codex overview
This PR introduces support for additional code snippets for
dotnetandcurlenvironments in the contract function components, enhancing the API and cURL command generation. It refines how snippets are structured and displayed based on the selected command.Detailed summary
codeSnippettobaseSnippet.apiSnippetandcurlSnippetbased onCOMMANDS.CodeEnvironmenttype to includedotnetandcurl.dotnetandcurlinEnvironments.dotnetandcurlexamples.CodeOverviewcomponent to handleapiandcurlenvironments.ConnectWalletfunction.Summary by CodeRabbit