Skip to content

docs(portal): fix syntax and compilation errors in v5 guide snippets#8845

Open
TanmayDagur wants to merge 1 commit into
thirdweb-dev:mainfrom
TanmayDagur:fix/portal-code-snippets
Open

docs(portal): fix syntax and compilation errors in v5 guide snippets#8845
TanmayDagur wants to merge 1 commit into
thirdweb-dev:mainfrom
TanmayDagur:fix/portal-code-snippets

Conversation

@TanmayDagur

@TanmayDagur TanmayDagur commented Jul 16, 2026

Copy link
Copy Markdown

docs(portal): fix syntax and compilation errors in v5 guide snippets

What

This PR fixes critical syntax and compilation errors in the code examples on the Getting Started and Auth landing pages in the documentation portal.

Why

Currently, copying and pasting the official snippets results in direct compilation or runtime errors:

  • getting-started/page.mdx referenced an undefined TEST_CLIENT variable and passed an invalid type to getWalletBalance (missing client parameter and passing account instead of address).
  • auth/page.mdx contained a syntax error (semicolon inside an object literal) and used an undefined client variable (should be thirdwebClient).

Changes

  • Updated getting-started/page.mdx wallet connect example and getWalletBalance signature.
  • Fixed typo semicolon and renamed client to thirdwebClient in auth/page.mdx.

PR-Codex overview

This PR focuses on updating the authentication and wallet connection logic in the page.mdx files for improved clarity and consistency in handling client and account data.

Detailed summary

  • In apps/portal/src/app/typescript/v5/auth/page.mdx:

    • Changed client reference to thirdwebClient in adminAccount.
  • In apps/portal/src/app/typescript/v5/getting-started/page.mdx:

    • Updated client reference in the wallet connection.
    • Added address: account.address to the getWalletBalance function call.

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

Summary by CodeRabbit

  • Documentation
    • Updated authentication examples to use the current client and admin account configuration syntax.
    • Refined wallet generation examples to reference the configured client.
    • Updated wallet balance examples to use an explicit wallet address when retrieving data.

@TanmayDagur TanmayDagur requested review from a team as code owners July 16, 2026 11:48
@changeset-bot

changeset-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 85754fa

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

@vercel

vercel Bot commented Jul 16, 2026

Copy link
Copy Markdown

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

4 Skipped Deployments
Project Deployment Actions Updated (UTC)
nebula Skipped Skipped Jul 16, 2026 11:48am
thirdweb_playground Skipped Skipped Jul 16, 2026 11:48am
thirdweb-www Skipped Skipped Jul 16, 2026 11:48am
wallet-ui Skipped Skipped Jul 16, 2026 11:48am

@vercel vercel Bot temporarily deployed to Preview – thirdweb_playground July 16, 2026 11:48 Inactive
@vercel vercel Bot temporarily deployed to Preview – nebula July 16, 2026 11:48 Inactive
@vercel vercel Bot temporarily deployed to Preview – wallet-ui July 16, 2026 11:48 Inactive
@vercel vercel Bot temporarily deployed to Preview – thirdweb-www July 16, 2026 11:48 Inactive
@vercel

vercel Bot commented Jul 16, 2026

Copy link
Copy Markdown

@TanmayDagur is attempting to deploy a commit to the thirdweb Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the Portal Involves changes to the Portal (docs) codebase. label Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Updated TypeScript v5 documentation examples to use the current client configuration, account construction, wallet connection, and balance retrieval parameters.

Changes

v5 documentation examples

Layer / File(s) Summary
Authentication example
apps/portal/src/app/typescript/v5/auth/page.mdx
The Server Functions snippet passes the secret key using standard object syntax and constructs adminAccount with privateKeyToAccount using client: thirdwebClient.
Wallet setup and balance example
apps/portal/src/app/typescript/v5/getting-started/page.mdx
The wallet connection uses the current client, and balance retrieval passes client with address: account.address.

Estimated code review effort: 1 (Trivial) | ~4 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main fix: syntax and compilation errors in v5 portal docs snippets.
Description check ✅ Passed The description covers what, why, and changes clearly, though it omits the template's Notes for reviewer and How to test sections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/portal/src/app/typescript/v5/auth/page.mdx`:
- Line 51: Guard the THIRDWEB_PRIVATE_KEY value before the privateKeyToAccount
call in the adminAccount configuration. Validate that the environment-derived
privateKey is present, and fail explicitly before constructing the account when
it is missing; preserve the existing account creation path for a provided key.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f12d2c02-56b5-4742-8f10-2c3529889e88

📥 Commits

Reviewing files that changed from the base of the PR and between 8c521aa and 85754fa.

📒 Files selected for processing (2)
  • apps/portal/src/app/typescript/v5/auth/page.mdx
  • apps/portal/src/app/typescript/v5/getting-started/page.mdx

domain: "localhost:3000",
client: thirdwebClient,
adminAccount: privateKeyToAccount({client, privateKey})
adminAccount: privateKeyToAccount({ client: thirdwebClient, privateKey }),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

sed -n '1,140p' apps/portal/src/app/typescript/v5/auth/page.mdx && printf '\n---\n' && rg -n "privateKeyToAccount|PRIVATE_KEY|process\.env" apps/portal/src/app -S

Repository: thirdweb-dev/js

Length of output: 9328


🌐 Web query:

thirdweb privateKeyToAccount undefined replace source code

💡 Result:

If you are encountering an undefined error when using privateKeyToAccount in the thirdweb TypeScript SDK, please note that the function has been renamed to privateKeyAccount in newer versions of the SDK [1]. To resolve this, update your import and usage as follows: 1. Update your import: import { privateKeyAccount } from "thirdweb/wallets"; 2. Update your implementation: const account = privateKeyAccount({ client, privateKey: process.env.PRIVATE_KEY as string, }); If you were previously relying on the source code implementation of privateKeyToAccount, it is worth noting that the internal implementation automatically handles prefixing the private key with 0x [2]: const privateKey = 0x${options.privateKey.replace(/^0x/, "")} satisfies Hex; If you continue to face runtime or build errors (such as issues in specific environments like Expo), ensure your SDK is updated to the latest version [3], as bug fixes related to import/build errors are frequently released [3]. Top results: [3] #3299 [2] https://cdn.jsdelivr.net/npm/thirdweb@5.116.1/src/wallets/private-key.ts [1] https://portal.thirdweb.com/typescript/v5/account-abstraction/get-started

Citations:


🏁 Script executed:

python3 - <<'PY'
import urllib.request
url = "https://cdn.jsdelivr.net/npm/thirdweb@5.116.1/src/wallets/private-key.ts"
with urllib.request.urlopen(url, timeout=20) as r:
    text = r.read().decode("utf-8")
for i, line in enumerate(text.splitlines(), 1):
    if "replace(" in line or "export function privateKey" in line or "privateKeyToAccount" in line:
        start = max(1, i-3)
        end = min(len(text.splitlines()), i+5)
        for j in range(start, end+1):
            print(f"{j}:{text.splitlines()[j-1]}")
        print("---")
PY

Repository: thirdweb-dev/js

Length of output: 2747


Guard THIRDWEB_PRIVATE_KEY before constructing the account. privateKeyToAccount dereferences privateKey immediately, so this example will throw on startup if the env var is missing. Add an explicit check before the call.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/portal/src/app/typescript/v5/auth/page.mdx` at line 51, Guard the
THIRDWEB_PRIVATE_KEY value before the privateKeyToAccount call in the
adminAccount configuration. Validate that the environment-derived privateKey is
present, and fail explicitly before constructing the account when it is missing;
preserve the existing account creation path for a provided key.

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

Labels

Portal Involves changes to the Portal (docs) codebase.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant