Skip to content

Conversation

@Yash094
Copy link
Member

@Yash094 Yash094 commented Sep 3, 2025


PR-Codex overview

This PR introduces support for additional code snippets for dotnet and curl environments 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

  • Renamed codeSnippet to baseSnippet.
  • Added safety checks for apiSnippet and curlSnippet based on COMMANDS.
  • Updated CodeEnvironment type to include dotnet and curl.
  • Added environment entries for dotnet and curl in Environments.
  • Enhanced snippet generation to include dotnet and curl examples.
  • Modified the CodeOverview component to handle api and curl environments.
  • Improved wallet connection handling in ConnectWallet function.

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

Summary by CodeRabbit

  • New Features
    • Added API and cURL examples and an API tab (now the default) for read, write, and events.
    • Introduced Unity and .NET code samples across setup, read, write, and events with updated install guidance (NuGet for .NET).
    • Code snippet selector now includes API, cURL, Unity, and .NET options with proper language highlighting.
    • Contract function pages now show SDK, API, and cURL examples together.
    • Unity wallet snippet updated to use a ConnectWallet-based flow.

@Yash094 Yash094 requested review from a team as code owners September 3, 2025 14:46
@changeset-bot
Copy link

changeset-bot bot commented Sep 3, 2025

⚠️ No Changeset found

Latest commit: e86db52

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 3, 2025

Note

Other AI code review bot(s) detected

CodeRabbit 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.

Walkthrough

Adds api, dotnet, and curl environments and UI tabs; extends COMMANDS with API and cURL groups plus Unity and .NET snippets; updates Unity/Dotnet snippets to new contract retrieval patterns; contract-function now merges base, api, and curl snippets before passing to CodeSegment; default environment set to api.

Changes

Cohort / File(s) Summary
Code environment support
apps/dashboard/src/@/components/blocks/code/code-segment.client.tsx
Adds api, dotnet, and curl to CodeEnvironment; adds UI entries for API, .NET, and cURL; updates language mapping for non-install paths (react/react-native→tsx, unity/dotnet→cpp, api→javascript, curl→bash); keeps install-command path behavior unchanged.
Contract code snippets library
apps/dashboard/src/@/components/contracts/code-overview.tsx
Adds Unity and Dotnet snippets for events/read/setup/write; introduces top-level COMMANDS.api and COMMANDS.curl (API and cURL templates); updates Unity snippets to use GetContract(address, chainId) and Dotnet to use ThirdwebContract.Create/equivalent; formatSnippet extended to handle api; default environment set to api.
Contract function code generation
apps/dashboard/src/@/components/contracts/functions/contract-function.tsx
Replaces single-source snippet with merged snippet built from base COMMANDS[commandsKey], optional COMMANDS.api[commandsKey], and optional COMMANDS.curl[commandsKey] ({ ...baseSnippet, ...apiSnippet, ...curlSnippet }); includes presence checks before merging; passes merged result to CodeSegment.

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)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch yash/add-api-snippets

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the Dashboard Involves changes to the Dashboard. label Sep 3, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Sep 3, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@vercel
Copy link

vercel bot commented Sep 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs-v2 Ready Ready Preview Comment Sep 3, 2025 10:45pm
nebula Ready Ready Preview Comment Sep 3, 2025 10:45pm
thirdweb_playground Ready Ready Preview Comment Sep 3, 2025 10:45pm
thirdweb-www Ready Ready Preview Comment Sep 3, 2025 10:45pm
wallet-ui Ready Ready Preview Comment Sep 3, 2025 10:45pm

@codecov
Copy link

codecov bot commented Sep 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.53%. Comparing base (2328985) to head (e86db52).
⚠️ Report is 1 commits behind head on main.

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           
Flag Coverage Δ
packages 56.53% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 3, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 64.01 KB (0%) 1.3 s (0%) 231 ms (+201.9% 🔺) 1.6 s
thirdweb (cjs) 357.32 KB (0%) 7.2 s (0%) 691 ms (+11.04% 🔺) 7.9 s
thirdweb (minimal + tree-shaking) 5.73 KB (0%) 115 ms (0%) 75 ms (+1398.12% 🔺) 189 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 53 ms (+3561.12% 🔺) 63 ms
thirdweb/react (minimal + tree-shaking) 19.15 KB (0%) 383 ms (0%) 86 ms (+719.78% 🔺) 469 ms

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (4)
apps/dashboard/src/@/components/blocks/code/code-segment.client.tsx (2)

40-43: Label “API” could be clearer to users

Consider 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"
                   : activeEnvironment
apps/dashboard/src/@/components/contracts/code-overview.tsx (1)

266-281: Reduce secret leakage risk in examples and appease secret scanners

Gitleaks 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_KEY if 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 once

You 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 commandsKey lacks 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.

📥 Commits

Reviewing files that changed from the base of the PR and between b8f4966 and da82426.

📒 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 @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless 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 @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless 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.tsx
  • apps/dashboard/src/@/components/contracts/code-overview.tsx
  • apps/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.tsx
  • apps/dashboard/src/@/components/contracts/code-overview.tsx
  • apps/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
Use NavLink for internal navigation with automatic active states in dashboard and playground apps
Use Tailwind CSS only – no inline styles or CSS modules
Use cn() from @/lib/utils for conditional class logic
Use design system tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components (Node edge): Start files with import "server-only";
Client Components (browser): Begin files with 'use client';
Always call getAuthToken() to retrieve JWT from cookies on server side
Use Authorization: Bearer header – never embed tokens in URLs
Return typed results (e.g., Project[], User[]) – avoid any
Wrap client-side data fetching calls in React Query (@tanstack/react-query)
Use descriptive, stable queryKeys for React Query cache hits
Configure staleTime/cacheTime in React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never import posthog-js in server components

Files:

  • apps/dashboard/src/@/components/blocks/code/code-segment.client.tsx
  • apps/dashboard/src/@/components/contracts/code-overview.tsx
  • apps/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)
Use NavLink for internal navigation to get active state handling
Use Tailwind CSS for styling; no inline styles
Merge class names with cn() from @/lib/utils for conditional classes
Stick to design tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components must start with import "server-only"; use next/headers, server‑only env, heavy data fetching, and redirect() where appropriate
Client Components must start with 'use client'; handle interactivity with hooks and browser APIs
Server-side data fetching: call getAuthToken() from cookies, send Authorization: Bearer <token> header, and return typed results (avoid any)
Client-side data fetching: wrap calls in React Query with descriptive, stable queryKeys and set sensible staleTime/cacheTime (≥ 60s default); keep tokens secret via internal routes or server actions
Do not import posthog-js in server components (client-side only)

Files:

  • apps/dashboard/src/@/components/blocks/code/code-segment.client.tsx
  • apps/dashboard/src/@/components/contracts/code-overview.tsx
  • apps/dashboard/src/@/components/contracts/functions/contract-function.tsx
apps/{dashboard,playground}/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Expose a className prop on the root element of every component

Files:

  • apps/dashboard/src/@/components/blocks/code/code-segment.client.tsx
  • apps/dashboard/src/@/components/contracts/code-overview.tsx
  • apps/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 good

Union extension is consistent with downstream usage. No issues.

apps/dashboard/src/@/components/contracts/code-overview.tsx (4)

114-125: Unity read snippet signature likely incorrect

The sample uses contract.Read<T>(contract, "...", args). Passing contract again and the generic placeholder T may not match current Unity SDK signatures.

Consider adjusting to a self-contained, copyable example (remove duplicate contract, clarify T), once verified against the Unity SDK.


281-290: API events: confirm expected field and value format

Template uses "eventName": "{{function}}", but formatSnippet injects a formatted ABI item. Verify the API expects name vs signature (e.g., Transfer vs Transfer(address,address,uint256)), or a topic.

If signature is required, consider renaming the field to eventSignature in the payload for clarity (if the API supports it).


568-571: Explicit no-op for API in formatter is fine

Acknowledging API doesn’t need extension mapping is correct.


239-250: Define wallet and weiValue; retain the contract parameter in Write
Lines 239–250: the Unity snippet references undefined wallet and weiValue. Add example wallet‐connect and weiValue definitions—do not remove the second contract argument, 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.

@vercel vercel bot temporarily deployed to Preview – thirdweb_playground September 3, 2025 15:07 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 September 3, 2025 15:07 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui September 3, 2025 15:07 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula September 3, 2025 15:07 Inactive
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

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 access

Also 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 guarantees

Give 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.

📥 Commits

Reviewing files that changed from the base of the PR and between da82426 and 76d5464.

📒 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 @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless 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 @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless 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.tsx
  • 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/functions/contract-function.tsx
  • 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
Use NavLink for internal navigation with automatic active states in dashboard and playground apps
Use Tailwind CSS only – no inline styles or CSS modules
Use cn() from @/lib/utils for conditional class logic
Use design system tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components (Node edge): Start files with import "server-only";
Client Components (browser): Begin files with 'use client';
Always call getAuthToken() to retrieve JWT from cookies on server side
Use Authorization: Bearer header – never embed tokens in URLs
Return typed results (e.g., Project[], User[]) – avoid any
Wrap client-side data fetching calls in React Query (@tanstack/react-query)
Use descriptive, stable queryKeys for React Query cache hits
Configure staleTime/cacheTime in React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never import posthog-js in server components

Files:

  • apps/dashboard/src/@/components/contracts/functions/contract-function.tsx
  • 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)
Use NavLink for internal navigation to get active state handling
Use Tailwind CSS for styling; no inline styles
Merge class names with cn() from @/lib/utils for conditional classes
Stick to design tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components must start with import "server-only"; use next/headers, server‑only env, heavy data fetching, and redirect() where appropriate
Client Components must start with 'use client'; handle interactivity with hooks and browser APIs
Server-side data fetching: call getAuthToken() from cookies, send Authorization: Bearer <token> header, and return typed results (avoid any)
Client-side data fetching: wrap calls in React Query with descriptive, stable queryKeys and set sensible staleTime/cacheTime (≥ 60s default); keep tokens secret via internal routes or server actions
Do not import posthog-js in server components (client-side only)

Files:

  • apps/dashboard/src/@/components/contracts/functions/contract-function.tsx
  • apps/dashboard/src/@/components/contracts/code-overview.tsx
apps/{dashboard,playground}/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Expose a className prop on the root element of every component

Files:

  • apps/dashboard/src/@/components/contracts/functions/contract-function.tsx
  • apps/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 good

Correctly 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 surface

Confirm 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 signature

Double-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 LGTM

Updated GetContract usage is consistent across samples.


239-250: Unity write snippet: confirm payable value handling

Ensure 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 correct

Explicitly skipping extension-specific remapping for API is appropriate.


282-291: Events API payload: eventName is correct — repository examples and documentation consistently use eventName for this endpoint; no renaming required.

@vercel vercel bot temporarily deployed to Preview – wallet-ui September 3, 2025 17:10 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 September 3, 2025 17:10 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground September 3, 2025 17:10 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula September 3, 2025 17:10 Inactive
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.
@vercel vercel bot temporarily deployed to Preview – nebula September 3, 2025 21:38 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground September 3, 2025 21:38 Inactive
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.
@vercel vercel bot temporarily deployed to Preview – nebula September 3, 2025 21:46 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground September 3, 2025 21:46 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 September 3, 2025 21:46 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui September 3, 2025 21:46 Inactive
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.
@vercel vercel bot temporarily deployed to Preview – docs-v2 September 3, 2025 21:51 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui September 3, 2025 21:51 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground September 3, 2025 21:51 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula September 3, 2025 21:51 Inactive
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

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 values

Currently {{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/cURL

With 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 check

Safer 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 handling

The 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 parameter

Double-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 mismatch

Same 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.

📥 Commits

Reviewing files that changed from the base of the PR and between b378489 and 79ea412.

📒 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 @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless 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 @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless 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
Use NavLink for internal navigation with automatic active states in dashboard and playground apps
Use Tailwind CSS only – no inline styles or CSS modules
Use cn() from @/lib/utils for conditional class logic
Use design system tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components (Node edge): Start files with import "server-only";
Client Components (browser): Begin files with 'use client';
Always call getAuthToken() to retrieve JWT from cookies on server side
Use Authorization: Bearer header – never embed tokens in URLs
Return typed results (e.g., Project[], User[]) – avoid any
Wrap client-side data fetching calls in React Query (@tanstack/react-query)
Use descriptive, stable queryKeys for React Query cache hits
Configure staleTime/cacheTime in React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never import posthog-js in 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)
Use NavLink for internal navigation to get active state handling
Use Tailwind CSS for styling; no inline styles
Merge class names with cn() from @/lib/utils for conditional classes
Stick to design tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components must start with import "server-only"; use next/headers, server‑only env, heavy data fetching, and redirect() where appropriate
Client Components must start with 'use client'; handle interactivity with hooks and browser APIs
Server-side data fetching: call getAuthToken() from cookies, send Authorization: Bearer <token> header, and return typed results (avoid any)
Client-side data fetching: wrap calls in React Query with descriptive, stable queryKeys and set sensible staleTime/cacheTime (≥ 60s default); keep tokens secret via internal routes or server actions
Do not import posthog-js in 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 className prop 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: LGTM

NuGet guidance is clear and accurate.


123-136: Unity read snippet: LGTM after removing extraneous contract param

Signature now looks correct.


136-149: .NET read snippet: LGTM

Create + Read flow is consistent.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (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 setups

Remove 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 79ea412 and 34f2fc4.

📒 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 @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless 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 @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless 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
Use NavLink for internal navigation with automatic active states in dashboard and playground apps
Use Tailwind CSS only – no inline styles or CSS modules
Use cn() from @/lib/utils for conditional class logic
Use design system tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components (Node edge): Start files with import "server-only";
Client Components (browser): Begin files with 'use client';
Always call getAuthToken() to retrieve JWT from cookies on server side
Use Authorization: Bearer header – never embed tokens in URLs
Return typed results (e.g., Project[], User[]) – avoid any
Wrap client-side data fetching calls in React Query (@tanstack/react-query)
Use descriptive, stable queryKeys for React Query cache hits
Configure staleTime/cacheTime in React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never import posthog-js in 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)
Use NavLink for internal navigation to get active state handling
Use Tailwind CSS for styling; no inline styles
Merge class names with cn() from @/lib/utils for conditional classes
Stick to design tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components must start with import "server-only"; use next/headers, server‑only env, heavy data fetching, and redirect() where appropriate
Client Components must start with 'use client'; handle interactivity with hooks and browser APIs
Server-side data fetching: call getAuthToken() from cookies, send Authorization: Bearer <token> header, and return typed results (avoid any)
Client-side data fetching: wrap calls in React Query with descriptive, stable queryKeys and set sensible staleTime/cacheTime (≥ 60s default); keep tokens secret via internal routes or server actions
Do not import posthog-js in 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 className prop 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 parameter

Write usually targets the bound contract; passing contract again 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 parameter

Same 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 and authprovider casing 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.
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground September 3, 2025 22:12 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula September 3, 2025 22:12 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui September 3, 2025 22:12 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 September 3, 2025 22:12 Inactive
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (3)
apps/dashboard/src/@/components/contracts/code-overview.tsx (3)

71-75: Unity events: trailing comma breaks C# call

Remove 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 headers

Use 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 docs

Fix 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 handling

Make 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 guidance

Replicate 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 34f2fc4 and e86db52.

📒 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 @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless 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 @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless 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
Use NavLink for internal navigation with automatic active states in dashboard and playground apps
Use Tailwind CSS only – no inline styles or CSS modules
Use cn() from @/lib/utils for conditional class logic
Use design system tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components (Node edge): Start files with import "server-only";
Client Components (browser): Begin files with 'use client';
Always call getAuthToken() to retrieve JWT from cookies on server side
Use Authorization: Bearer header – never embed tokens in URLs
Return typed results (e.g., Project[], User[]) – avoid any
Wrap client-side data fetching calls in React Query (@tanstack/react-query)
Use descriptive, stable queryKeys for React Query cache hits
Configure staleTime/cacheTime in React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never import posthog-js in 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)
Use NavLink for internal navigation to get active state handling
Use Tailwind CSS for styling; no inline styles
Merge class names with cn() from @/lib/utils for conditional classes
Stick to design tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components must start with import "server-only"; use next/headers, server‑only env, heavy data fetching, and redirect() where appropriate
Client Components must start with 'use client'; handle interactivity with hooks and browser APIs
Server-side data fetching: call getAuthToken() from cookies, send Authorization: Bearer <token> header, and return typed results (avoid any)
Client-side data fetching: wrap calls in React Query with descriptive, stable queryKeys and set sensible staleTime/cacheTime (≥ 60s default); keep tokens secret via internal routes or server actions
Do not import posthog-js in 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 className prop 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 correct

Removed the extraneous contract parameter; this matches the expected call form.


708-709: Default environment to API: good DX choice

Makes sense for quick copy/paste without SDK setup.


852-858: Clear API/cURL guidance

Concise and accurate messaging about client IDs vs secret keys.


296-303: Remove redundant contract argument from contract.Write

The extra contract parameter should be removed to align with the method’s expected signature:

 var transactionReceipt = await contract.Write(
   wallet,
-  contract,
   "{{function}}",
   weiValue,
   {{args}}
 );

279-286: Verify Write signature in the SDK
I couldn’t locate a local definition of contract.Write(…)—the project’s MDX docs consistently show passing the contract instance as the second argument. Please confirm the official method signature in your imported SDK and adjust this call accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Dashboard Involves changes to the Dashboard.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants