Skip to content

Conversation

@joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented Nov 26, 2025


PR-Codex overview

This PR focuses on enhancing the SignInRequiredModal in the thirdweb library by adding customization options and introducing a new blockchain definition for monad. It also updates the useFetchWithPayment hook to support these new features.

Detailed summary

  • Added monad chain definition with explorers and native currency.
  • Introduced customization options (title, description, buttonLabel) for SignInRequiredModal.
  • Updated useFetchWithPayment to accept customization options for the modal.
  • Modified SignInRequiredModal to utilize new props for dynamic content.

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

Summary by CodeRabbit

  • New Features

    • Support for the Monad blockchain (native currency and block explorer integrations).
    • Customizable sign-in modal options (title, description, button label) for the fetch-with-payment flow.
    • make balance invalidation callable without arguments for convenience.
  • Bug Fixes

    • Preserve the current wallet during payment retry to avoid re-showing the connect modal with stale state.
  • Chores

    • Added changeset entries for patch releases.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Nov 26, 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 Nov 26, 2025 9:47pm
nebula Ready Ready Preview Comment Nov 26, 2025 9:47pm
thirdweb_playground Ready Ready Preview Comment Nov 26, 2025 9:47pm
thirdweb-www Ready Ready Preview Comment Nov 26, 2025 9:47pm
wallet-ui Ready Ready Preview Comment Nov 26, 2025 9:47pm

@changeset-bot
Copy link

changeset-bot bot commented Nov 26, 2025

🦋 Changeset detected

Latest commit: c720f7f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
thirdweb Patch
@thirdweb-dev/nebula Patch
@thirdweb-dev/wagmi-adapter Patch
wagmi-inapp Patch

Not sure what this means? Click here to learn what changesets are.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 26, 2025

Walkthrough

Adds a Monad chain definition and export, introduces two changesets, preserves wallet context during 402 retry, makes the sign-in-required modal customizable via new options/props, and allows useInvalidateBalances' returned callback to be called without arguments by adding a default parameter.

Changes

Cohort / File(s) Summary
Changesets
\.changeset/moody-camels-hear.md, \.changeset/angry-monkeys-dress.md
Two new changeset files: one records adding the Monad chain definition; the other marks a patch describing sign-in modal customization.
Chain definition & export
Monad
packages/thirdweb/src/chains/chain-definitions/monad.ts, packages/thirdweb/src/exports/chains.ts
Adds and exports a new monad chain definition (id: 143, name: "Monad", nativeCurrency: Mon, 18 decimals) with two block explorers (Monad Vision, Monad Scan).
Payment fetch core logic
packages/thirdweb/src/react/core/hooks/x402/useFetchWithPaymentCore.ts
In the 402 retry path, executeFetch is invoked with the current wallet to preserve wallet context across retries.
Payment hook (web) — API change
packages/thirdweb/src/react/web/hooks/x402/useFetchWithPayment.tsx
Adds signInRequiredModal?: { title?: string; description?: string; buttonLabel?: string } to UseFetchWithPaymentConfig and passes these values into modal display logic.
Sign-in modal UI
packages/thirdweb/src/react/web/ui/x402/SignInRequiredModal.tsx
SignInRequiredModal gains optional title, description, and buttonLabel props with defaults; replaces hardcoded strings with these props.
Balances invalidation hook
packages/thirdweb/src/react/core/hooks/others/useInvalidateBalances.ts
The returned callback now accepts an optional parameter with a default empty object: ({ chainId }: { chainId?: number } = {}), allowing invocation with no arguments.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant App
  participant Hook as useFetchWithPayment
  participant Core as useFetchWithPaymentCore
  participant Modal as SignInRequiredModal
  participant Wallet as ConnectWallet
  participant Server

  Note over Hook,Core: Fetch with payment flow
  App->>Hook: trigger fetchWithPayment(...)
  Hook->>Core: executeFetch(...)
  Core->>Server: request
  alt payment required (402)
    Server-->>Core: 402 PaymentRequired
    Core->>Hook: onPaymentRequired
    Hook->>Modal: show SignInRequiredModal (title/desc/buttonLabel)
    Modal-->>Hook: onSignIn
    Hook->>Wallet: open ConnectWallet
    Wallet-->>Hook: walletSelected
    Hook->>Core: executeFetch(currentWallet)  %% preserve wallet across retry %%
    Core->>Server: request (with wallet)
    Server-->>Core: 200 OK
    Core-->>Hook: result
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify monad metadata (chain ID, native currency, explorer URLs) and ensure export paths/builds succeed.
  • Confirm passing currentWallet into retry has no unintended lifecycle or state consequences.
  • Check signInRequiredModal typing, propagation, and default values in SignInRequiredModal.
  • Ensure useInvalidateBalances default parameter change doesn't break callers expecting a required argument.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description uses template placeholders without filling them in; critical sections like 'Notes for the reviewer' and 'How to test' are empty except for the PR-Codex summary. Fill in the required template sections: provide reviewer notes highlighting key changes and testing instructions (unit tests, manual testing steps, etc.).
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and clearly reflects the main change: adding a Monad chain definition to the SDK.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch _SDK_Add_Monad_chain_definition

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.

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

@joaquim-verges joaquim-verges marked this pull request as ready for review November 26, 2025 20:57
@joaquim-verges joaquim-verges requested review from a team as code owners November 26, 2025 20:57
@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Nov 26, 2025
Copy link
Member Author

joaquim-verges commented Nov 26, 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.

This stack of pull requests is managed by Graphite. Learn more about stacking.

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 (1)
packages/thirdweb/src/chains/chain-definitions/monad.ts (1)

19-19: Optional: Align native currency name with chain/token branding

Right now the native currency is { decimals: 18, name: "Mon", symbol: "MON" }. For consistency and clearer UX, you might consider naming it "Monad" to match the symbol and chain name:

-  nativeCurrency: { decimals: 18, name: "Mon", symbol: "MON" },
+  nativeCurrency: { decimals: 18, name: "Monad", symbol: "MON" },

Purely cosmetic; feel free to keep as-is if "Mon" is the preferred label.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • 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 512f9dd and 9f98e1c.

📒 Files selected for processing (2)
  • .changeset/moody-camels-hear.md (1 hunks)
  • packages/thirdweb/src/chains/chain-definitions/monad.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each TypeScript 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 in TypeScript
Avoid any and unknown in TypeScript unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.) in TypeScript

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity and testability
Re-use shared types from @/types or local types.ts barrel exports
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics whenever possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic in TypeScript files; avoid restating TypeScript types and signatures in prose

Files:

  • packages/thirdweb/src/chains/chain-definitions/monad.ts
packages/thirdweb/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

packages/thirdweb/src/**/*.{ts,tsx}: Comment only ambiguous logic in SDK code; avoid restating TypeScript in prose
Load heavy dependencies inside async paths to keep initial bundle lean (e.g. const { jsPDF } = await import("jspdf");)

Lazy-load heavy dependencies inside async paths to keep the initial bundle lean (e.g., const { jsPDF } = await import('jspdf');)

Files:

  • packages/thirdweb/src/chains/chain-definitions/monad.ts
**/*.{js,jsx,ts,tsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Biome governs formatting and linting; its rules live in biome.json. Run pnpm fix & pnpm lint before committing, ensure there are no linting errors

Files:

  • packages/thirdweb/src/chains/chain-definitions/monad.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Lazy-import optional features; avoid top-level side-effects

Files:

  • packages/thirdweb/src/chains/chain-definitions/monad.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: MananTank
Repo: thirdweb-dev/js PR: 7298
File: apps/dashboard/src/app/nebula-app/move-funds/move-funds.tsx:424-424
Timestamp: 2025-06-06T23:46:08.795Z
Learning: The thirdweb project has an ESLint rule that restricts direct usage of `defineChain`. When it's necessary to use `defineChain` directly, it's acceptable to disable the rule with `// eslint-disable-next-line no-restricted-syntax`.
📚 Learning: 2025-06-06T23:46:08.795Z
Learnt from: MananTank
Repo: thirdweb-dev/js PR: 7298
File: apps/dashboard/src/app/nebula-app/move-funds/move-funds.tsx:424-424
Timestamp: 2025-06-06T23:46:08.795Z
Learning: The thirdweb project has an ESLint rule that restricts direct usage of `defineChain`. When it's necessary to use `defineChain` directly, it's acceptable to disable the rule with `// eslint-disable-next-line no-restricted-syntax`.

Applied to files:

  • packages/thirdweb/src/chains/chain-definitions/monad.ts
  • .changeset/moody-camels-hear.md
📚 Learning: 2025-11-24T22:45:01.202Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T22:45:01.202Z
Learning: Applies to packages/**/.changeset/*.md : Each change in packages/* should contain a changeset for the appropriate package with the appropriate version bump: patch for changes that don't impact the public API, minor for any new/modified public API

Applied to files:

  • .changeset/moody-camels-hear.md
⏰ 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). (9)
  • GitHub Check: Vercel Agent Review
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Size
  • GitHub Check: Build Packages
  • GitHub Check: Unit Tests
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
packages/thirdweb/src/chains/chain-definitions/monad.ts (2)

6-20: Monad chain definition looks good and matches the PR scope

The chain object is a pure defineChain config with id, name, native currency, and the two explorers expected for Monad. No runtime logic, and the definition is self-contained and consistent with how other chains are typically modeled.


6-6: Check ESLint rule around direct defineChain usage

There is an ESLint rule in this repo that can restrict direct defineChain usage. If that rule is active for this SDK path, you may need to locally disable it for this declaration, e.g.:

- export const monad = /*@__PURE__*/ defineChain({
+ // eslint-disable-next-line no-restricted-syntax
+ export const monad = /*@__PURE__*/ defineChain({

If the rule is already scoped away from packages/thirdweb/src/chains, no change is needed.

Based on learnings, please ensure pnpm lint passes without flagging this defineChain call.

Comment on lines +1 to +5
---
"thirdweb": patch
---

Add monad chain definition
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

Script executed:

#!/bin/bash

# First, let's find the changeset file and understand its structure
echo "=== Changeset file content ==="
find . -name "moody-camels-hear.md" -type f | head -5 | xargs cat

echo -e "\n=== Looking for monad chain definition in the PR ==="
# Search for monad chain definition
rg -i "monad" --type ts --type js -B2 -A2 | head -40

echo -e "\n=== Looking for chain definitions pattern ==="
# Find where chains are defined and exported
rg "chain" --type ts --type js -i "export.*chain" -B1 -A1 | head -50

Repository: thirdweb-dev/js


<shell_result>
Repository: thirdweb-dev/js
Exit code: 0

stdout:

=== Changeset file content ===
---
"thirdweb": patch
---

Add monad chain definition

=== Looking for monad chain definition in the PR ===
packages/thirdweb/src/exports/chains.ts-export { mode } from "../chains/chain-definitions/mode.js";
packages/thirdweb/src/exports/chains.ts-export { modeTestnet } from "../chains/chain-definitions/mode-testnet.js";
packages/thirdweb/src/exports/chains.ts:export { monadTestnet } from "../chains/chain-definitions/monad-testnet.js";
packages/thirdweb/src/exports/chains.ts-export { moonbeam } from "../chains/chain-definitions/moonbeam.js";
packages/thirdweb/src/exports/chains.ts-export { optimism } from "../chains/chain-definitions/optimism.js";
--
packages/thirdweb/src/chains/chain-definitions/monad-testnet.ts- * @chain
packages/thirdweb/src/chains/chain-definitions/monad-testnet.ts- */
packages/thirdweb/src/chains/chain-definitions/monad-testnet.ts:export const monadTestnet = /*@__PURE__*/ defineChain({
packages/thirdweb/src/chains/chain-definitions/monad-testnet.ts-  blockExplorers: [
packages/thirdweb/src/chains/chain-definitions/monad-testnet.ts-    {
packages/thirdweb/src/chains/chain-definitions/monad-testnet.ts:      name: "Monad Explorer",
packages/thirdweb/src/chains/chain-definitions/monad-testnet.ts:      url: "https://testnet.monadexplorer.com/",
packages/thirdweb/src/chains/chain-definitions/monad-testnet.ts-    },
packages/thirdweb/src/chains/chain-definitions/monad-testnet.ts-  ],
packages/thirdweb/src/chains/chain-definitions/monad-testnet.ts-  id: 10143,
packages/thirdweb/src/chains/chain-definitions/monad-testnet.ts:  name: "Monad Testnet",
packages/thirdweb/src/chains/chain-definitions/monad-testnet.ts-  nativeCurrency: { decimals: 18, name: "Mon", symbol: "MON" },
packages/thirdweb/src/chains/chain-definitions/monad-testnet.ts-  testnet: true,
--
packages/thirdweb/src/chains/chain-definitions/monad.ts- * @chain
packages/thirdweb/src/chains/chain-definitions/monad.ts- */
packages/thirdweb/src/chains/chain-definitions/monad.ts:export const monad = /*@__PURE__*/ defineChain({
packages/thirdweb/src/chains/chain-definitions/monad.ts-  blockExplorers: [
packages/thirdweb/src/chains/chain-definitions/monad.ts-    {
packages/thirdweb/src/chains/chain-definitions/monad.ts:      name: "Monad Vision",
packages/thirdweb/src/chains/chain-definitions/monad.ts:      url: "https://monadvision.com/",
packages/thirdweb/src/chains/chain-definitions/monad.ts-    },
packages/thirdweb/src/chains/chain-definitions/monad.ts-    {
packages/thirdweb/src/chains/chain-definitions/monad.ts:      name: "Monad Scan",
packages/thirdweb/src/chains/chain-definitions/monad.ts:      url: "https://monadscan.com/",
packages/thirdweb/src/chains/chain-definitions/monad.ts-    },
packages/thirdweb/src/chains/chain-definitions/monad.ts-  ],
packages/thirdweb/src/chains/chain-definitions/monad.ts-  id: 143,
packages/thirdweb/src/chains/chain-definitions/monad.ts:  name: "Monad",
packages/thirdweb/src/chains/chain-definitions/monad.ts-  nativeCurrency: { decimals: 18, name: "Mon", symbol: "MON" },
packages/thirdweb/src/chains/chain-definitions/monad.ts-});

=== Looking for chain definitions pattern ===

stderr:

export.*chain: No such file or directory (os error 2)

</shell_result>


Script executed:

#!/bin/bash

echo "=== Confirm monad is exported from chains.ts ==="
rg "export.*monad" packages/thirdweb/src/exports/chains.ts

echo -e "\n=== Check package.json exports or public API definition ==="
fd "package.json" -path "*/packages/thirdweb/*" --type f | head -1 | xargs head -50

echo -e "\n=== Look at recent changesets for chain additions ==="
fd "\.md" -path "*/.changeset/*" --type f | head -20 | xargs grep -l "chain" | head -5 | xargs cat

echo -e "\n=== Check if chains.ts is in the public exports ==="
cat packages/thirdweb/src/exports/chains.ts | head -20

Repository: thirdweb-dev/js


<shell_result>
Repository: thirdweb-dev/js
Exit code: 0

stdout:

=== Confirm monad is exported from chains.ts ===
export { monadTestnet } from "../chains/chain-definitions/monad-testnet.js";

=== Check package.json exports or public API definition ===

=== Look at recent changesets for chain additions ===

=== Check if chains.ts is in the public exports ===
// chain types

export { abstract } from "../chains/chain-definitions/abstract.js";
export { abstractTestnet } from "../chains/chain-definitions/abstract-testnet.js";

/**
 * PRE_DEFINED CHAINS
 */
export { anvil } from "../chains/chain-definitions/anvil.js";
export { arbitrum } from "../chains/chain-definitions/arbitrum.js";
export { arbitrumNova } from "../chains/chain-definitions/arbitrum-nova.js";
export { arbitrumSepolia } from "../chains/chain-definitions/arbitrum-sepolia.js";
export { arcTestnet } from "../chains/chain-definitions/arc-testnet.js";
export { assetChainTestnet } from "../chains/chain-definitions/assetchain-testnet.js";
export { astriaEvmDusknet } from "../chains/chain-definitions/astria-evm-dusknet.js";
export { avalanche } from "../chains/chain-definitions/avalanche.js";
export { avalancheFuji } from "../chains/chain-definitions/avalanche-fuji.js";
export { base } from "../chains/chain-definitions/base.js";
export { baseSepolia } from "../chains/chain-definitions/base-sepolia.js";
export { berachain } from "../chains/chain-definitions/berachain.js";

stderr:

error: 'h' isn't a valid value for '--type <filetype>'
  [possible values: file, directory, symlink, executable, empty, socket, pipe]

For more information try '--help'
error: 'h' isn't a valid value for '--type <filetype>'
  [possible values: file, directory, symlink, executable, empty, socket, pipe]

For more information try '--help'

</shell_result>


Script executed:

#!/bin/bash

echo "=== Search for all monad exports (not just monadTestnet) ==="
rg "export.*monad" packages/thirdweb/src/exports/chains.ts -A1 -B1

echo -e "\n=== List changesets directory ==="
ls -la .changeset/ | grep -v "^d" | head -20

echo -e "\n=== Check a few recent changesets for context ==="
find .changeset -name "*.md" -type f ! -name "README.md" ! -name "config.json" | head -10 | xargs cat

Repository: thirdweb-dev/js


<shell_result>
Repository: thirdweb-dev/js
Exit code: 0

stdout:

=== Search for all monad exports (not just monadTestnet) ===
export { modeTestnet } from "../chains/chain-definitions/mode-testnet.js";
export { monadTestnet } from "../chains/chain-definitions/monad-testnet.js";
export { moonbeam } from "../chains/chain-definitions/moonbeam.js";

=== List changesets directory ===
total 12
-rw-r--r--  1 jailuser jailuser 510 Nov 26 20:57 README.md
-rw-r--r--  1 jailuser jailuser 627 Nov 26 20:57 config.json
-rw-r--r--  1 jailuser jailuser  54 Nov 26 20:57 moody-camels-hear.md

=== Check a few recent changesets for context ===
---
"thirdweb": patch
---

Add monad chain definition

</shell_result>


Script executed:

#!/bin/bash

echo "=== Full search for monad in chains.ts ==="
rg "monad" packages/thirdweb/src/exports/chains.ts

echo -e "\n=== Count total lines in chains.ts to understand scope ==="
wc -l packages/thirdweb/src/exports/chains.ts

echo -e "\n=== Check if monad appears elsewhere in exports ==="
rg "export.*monad" packages/thirdweb/src/exports/

echo -e "\n=== Look at the actual monad.ts file to confirm it's a real chain definition ==="
head -30 packages/thirdweb/src/chains/chain-definitions/monad.ts

echo -e "\n=== Verify this is a public API entry point ==="
rg "from.*exports/chains" --type ts --type js | head -10

Repository: thirdweb-dev/js


<shell_result>
Repository: thirdweb-dev/js
Exit code: 0

stdout:

=== Full search for monad in chains.ts ===
export { monadTestnet } from "../chains/chain-definitions/monad-testnet.js";

=== Count total lines in chains.ts to understand scope ===
95 packages/thirdweb/src/exports/chains.ts

=== Check if monad appears elsewhere in exports ===
packages/thirdweb/src/exports/chains.ts:export { monadTestnet } from "../chains/chain-definitions/monad-testnet.js";

=== Look at the actual monad.ts file to confirm it's a real chain definition ===
import { defineChain } from "../utils.js";

/**
 * @chain
 */
export const monad = /*@__PURE__*/ defineChain({
  blockExplorers: [
    {
      name: "Monad Vision",
      url: "https://monadvision.com/",
    },
    {
      name: "Monad Scan",
      url: "https://monadscan.com/",
    },
  ],
  id: 143,
  name: "Monad",
  nativeCurrency: { decimals: 18, name: "Mon", symbol: "MON" },
});

=== Verify this is a public API entry point ===
packages/thirdweb/src/wallets/smart/smart-wallet-integration.test.ts:import { baseSepolia } from "../../exports/chains.js";
packages/thirdweb/src/wallets/eip5792/send-calls.test.ts:import { sepolia } from "../../exports/chains.js";
packages/thirdweb/src/transaction/actions/gasless/providers/engine.test.ts:import { polygon } from "../../../../exports/chains.js";

</shell_result>


Script executed:

#!/bin/bash

echo "=== Check if monad export was added in this PR by looking at git diff ==="
git diff HEAD -- packages/thirdweb/src/exports/chains.ts | head -40

echo -e "\n=== Verify the learning applies to this repository ==="
cat AGENTS.md 2>/dev/null | grep -A5 -B5 "changeset" | head -30

Repository: thirdweb-dev/js


<shell_result>
Repository: thirdweb-dev/js
Exit code: 0

stdout:

=== Check if monad export was added in this PR by looking at git diff ===

=== Verify the learning applies to this repository ===

⸻

8. Documentation & Developer Experience

- Each change in packages/\* should contain a changeset for the appropriate package, with the appropriate version bump

  - patch for changes that don't impact the public API
  - minor for any new/modified public API

- Surface breaking changes prominently in PR descriptions.

</shell_result>


Based on my verification:

  1. Chain definitions are public API: The file packages/thirdweb/src/exports/chains.ts is the central export point for chain definitions, and test files across the codebase import chains from this public API entry point.

  2. New chain is being added: The PR adds a new monad chain definition (file packages/thirdweb/src/chains/chain-definitions/monad.ts exists and is ready for export).

  3. Project policy confirmed: The AGENTS.md file explicitly states: "minor for any new/modified public API" and "patch for changes that don't impact the public API."

  4. This is a public API addition: Adding a new exportable chain constant is a new public API surface that consumers can import and use.


Update changeset to use minor version bump for new public chain export.

The PR adds a new chain definition (monad) to the thirdweb package's public API. Per project guidance in AGENTS.md, new/modified public APIs require a minor version bump, not patch.

---
-"thirdweb": patch
+"thirdweb": minor
---
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
---
"thirdweb": patch
---
Add monad chain definition
---
"thirdweb": minor
---
Add monad chain definition
🤖 Prompt for AI Agents
In .changeset/moody-camels-hear.md around lines 1 to 5, the changeset currently
lists "thirdweb": patch but this PR adds a new public chain export (monad) so
the version bump must be minor; update the frontmatter to "thirdweb": minor (and
keep the description), save the file so the package receives a minor version
bump per AGENTS.md guidance.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 26, 2025

size-limit report 📦

Path Size
@thirdweb-dev/nexus (esm) 104.88 KB (0%)
@thirdweb-dev/nexus (cjs) 316.6 KB (0%)

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: 0

🧹 Nitpick comments (1)
packages/thirdweb/src/chains/chain-definitions/monad.ts (1)

3-5: Minimal TSDoc for chain definition.

The @chain annotation is present, but coding guidelines suggest comprehensive TSDoc with at least one @example block for public exports. However, chain definitions are largely self-documenting data structures, so this minimal documentation may be acceptable per project conventions.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • 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 9f98e1c and 17cced3.

📒 Files selected for processing (7)
  • .changeset/angry-monkeys-dress.md (1 hunks)
  • .changeset/moody-camels-hear.md (1 hunks)
  • packages/thirdweb/src/chains/chain-definitions/monad.ts (1 hunks)
  • packages/thirdweb/src/exports/chains.ts (1 hunks)
  • packages/thirdweb/src/react/core/hooks/x402/useFetchWithPaymentCore.ts (1 hunks)
  • packages/thirdweb/src/react/web/hooks/x402/useFetchWithPayment.tsx (4 hunks)
  • packages/thirdweb/src/react/web/ui/x402/SignInRequiredModal.tsx (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/moody-camels-hear.md
🧰 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 TypeScript 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 in TypeScript
Avoid any and unknown in TypeScript unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.) in TypeScript

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity and testability
Re-use shared types from @/types or local types.ts barrel exports
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics whenever possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic in TypeScript files; avoid restating TypeScript types and signatures in prose

Files:

  • packages/thirdweb/src/chains/chain-definitions/monad.ts
  • packages/thirdweb/src/react/core/hooks/x402/useFetchWithPaymentCore.ts
  • packages/thirdweb/src/exports/chains.ts
  • packages/thirdweb/src/react/web/ui/x402/SignInRequiredModal.tsx
  • packages/thirdweb/src/react/web/hooks/x402/useFetchWithPayment.tsx
packages/thirdweb/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

packages/thirdweb/src/**/*.{ts,tsx}: Comment only ambiguous logic in SDK code; avoid restating TypeScript in prose
Load heavy dependencies inside async paths to keep initial bundle lean (e.g. const { jsPDF } = await import("jspdf");)

Lazy-load heavy dependencies inside async paths to keep the initial bundle lean (e.g., const { jsPDF } = await import('jspdf');)

Files:

  • packages/thirdweb/src/chains/chain-definitions/monad.ts
  • packages/thirdweb/src/react/core/hooks/x402/useFetchWithPaymentCore.ts
  • packages/thirdweb/src/exports/chains.ts
  • packages/thirdweb/src/react/web/ui/x402/SignInRequiredModal.tsx
  • packages/thirdweb/src/react/web/hooks/x402/useFetchWithPayment.tsx
**/*.{js,jsx,ts,tsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Biome governs formatting and linting; its rules live in biome.json. Run pnpm fix & pnpm lint before committing, ensure there are no linting errors

Files:

  • packages/thirdweb/src/chains/chain-definitions/monad.ts
  • packages/thirdweb/src/react/core/hooks/x402/useFetchWithPaymentCore.ts
  • packages/thirdweb/src/exports/chains.ts
  • packages/thirdweb/src/react/web/ui/x402/SignInRequiredModal.tsx
  • packages/thirdweb/src/react/web/hooks/x402/useFetchWithPayment.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Lazy-import optional features; avoid top-level side-effects

Files:

  • packages/thirdweb/src/chains/chain-definitions/monad.ts
  • packages/thirdweb/src/react/core/hooks/x402/useFetchWithPaymentCore.ts
  • packages/thirdweb/src/exports/chains.ts
  • packages/thirdweb/src/react/web/ui/x402/SignInRequiredModal.tsx
  • packages/thirdweb/src/react/web/hooks/x402/useFetchWithPayment.tsx
packages/thirdweb/src/exports/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

packages/thirdweb/src/exports/**/*.{ts,tsx}: Export everything via exports/ directory, grouped by feature in SDK development
Every public symbol must have comprehensive TSDoc with at least one @example block that compiles and custom annotation tags (@beta, @internal, @experimental)

Export everything in packages/thirdweb via the exports/ directory, grouped by feature. Every public symbol must have comprehensive TSDoc including at least one @example block that compiles and one custom annotation (@beta, @internal, @experimental, etc.)

Files:

  • packages/thirdweb/src/exports/chains.ts
🧠 Learnings (11)
📚 Learning: 2025-11-24T22:45:01.202Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T22:45:01.202Z
Learning: Applies to packages/**/.changeset/*.md : Each change in packages/* should contain a changeset for the appropriate package with the appropriate version bump: patch for changes that don't impact the public API, minor for any new/modified public API

Applied to files:

  • .changeset/angry-monkeys-dress.md
📚 Learning: 2025-11-24T22:43:43.644Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T22:43:43.644Z
Learning: Use `patch` version bump for changes that don't impact the public API

Applied to files:

  • .changeset/angry-monkeys-dress.md
📚 Learning: 2025-06-06T23:46:08.795Z
Learnt from: MananTank
Repo: thirdweb-dev/js PR: 7298
File: apps/dashboard/src/app/nebula-app/move-funds/move-funds.tsx:424-424
Timestamp: 2025-06-06T23:46:08.795Z
Learning: The thirdweb project has an ESLint rule that restricts direct usage of `defineChain`. When it's necessary to use `defineChain` directly, it's acceptable to disable the rule with `// eslint-disable-next-line no-restricted-syntax`.

Applied to files:

  • packages/thirdweb/src/chains/chain-definitions/monad.ts
📚 Learning: 2025-11-24T22:43:43.644Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T22:43:43.644Z
Learning: Applies to apps/dashboard/src/**/*.{ts,tsx} : Handle interactive UI with React hooks (`useState`, `useEffect`, React Query, wallet hooks) in client components

Applied to files:

  • packages/thirdweb/src/react/core/hooks/x402/useFetchWithPaymentCore.ts
  • packages/thirdweb/src/react/web/hooks/x402/useFetchWithPayment.tsx
📚 Learning: 2025-11-24T22:44:20.977Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-11-24T22:44:20.977Z
Learning: Applies to apps/dashboard/**/*fetch*.{ts,tsx} : Create light wrapper functions (e.g., `fetchJson`) that automatically attach the JWT from cookies/session when calling internal API routes

Applied to files:

  • packages/thirdweb/src/react/core/hooks/x402/useFetchWithPaymentCore.ts
📚 Learning: 2025-05-27T19:54:55.885Z
Learnt from: MananTank
Repo: thirdweb-dev/js PR: 7177
File: apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/erc20.tsx:15-17
Timestamp: 2025-05-27T19:54:55.885Z
Learning: The `fetchDashboardContractMetadata` function from "3rdweb-sdk/react/hooks/useDashboardContractMetadata" has internal error handlers for all promises and cannot throw errors, so external error handling is not needed when calling this function.

Applied to files:

  • packages/thirdweb/src/react/core/hooks/x402/useFetchWithPaymentCore.ts
📚 Learning: 2025-11-24T22:45:01.202Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T22:45:01.202Z
Learning: Applies to packages/thirdweb/src/exports/**/*.{ts,tsx} : Export everything in packages/thirdweb via the exports/ directory, grouped by feature. Every public symbol must have comprehensive TSDoc including at least one example block that compiles and one custom annotation (beta, internal, experimental, etc.)

Applied to files:

  • packages/thirdweb/src/exports/chains.ts
📚 Learning: 2025-11-24T22:43:43.644Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T22:43:43.644Z
Learning: Applies to packages/thirdweb/src/exports/**/*.{ts,tsx} : Export everything via `exports/` directory, grouped by feature in SDK development

Applied to files:

  • packages/thirdweb/src/exports/chains.ts
📚 Learning: 2025-11-24T22:43:43.644Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T22:43:43.644Z
Learning: Applies to **/*.test.{ts,tsx} : Use `FORKED_ETHEREUM_CHAIN` for mainnet interactions and `ANVIL_CHAIN` for isolated tests

Applied to files:

  • packages/thirdweb/src/exports/chains.ts
📚 Learning: 2025-11-24T22:44:20.977Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-11-24T22:44:20.977Z
Learning: Use interactive client components for UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks)

Applied to files:

  • packages/thirdweb/src/react/web/hooks/x402/useFetchWithPayment.tsx
📚 Learning: 2025-11-24T22:45:01.202Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T22:45:01.202Z
Learning: Applies to apps/{dashboard,playground}/**/*.{tsx,ts} : Client Components: Begin files with 'use client'; before imports, handle interactive UI relying on React hooks (useState, useEffect, React Query, wallet hooks), access browser APIs (localStorage, window, IntersectionObserver, etc.), and support fast transitions with client-side data prefetching

Applied to files:

  • packages/thirdweb/src/react/web/hooks/x402/useFetchWithPayment.tsx
🧬 Code graph analysis (2)
packages/thirdweb/src/chains/chain-definitions/monad.ts (1)
packages/thirdweb/src/exports/chains.ts (2)
  • monad (55-55)
  • defineChain (93-93)
packages/thirdweb/src/react/web/ui/x402/SignInRequiredModal.tsx (1)
packages/thirdweb/src/react/web/ui/components/basic.tsx (3)
  • Container (80-193)
  • ModalHeader (36-68)
  • ScreenBottomContainer (14-23)
⏰ 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). (9)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Unit Tests
  • GitHub Check: Size
  • GitHub Check: Build Packages
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Vercel Agent Review
🔇 Additional comments (9)
packages/thirdweb/src/react/core/hooks/x402/useFetchWithPaymentCore.ts (1)

102-104: LGTM! Preserves wallet context across retries.

The change correctly passes currentWallet to the recursive executeFetch call during retry, preventing the use of a stale wallet reference from the outer closure. The comment clearly explains the intent.

.changeset/angry-monkeys-dress.md (1)

1-5: LGTM! Accurate changeset description.

The patch-level version bump is appropriate for adding optional customization options without breaking the public API. The description accurately reflects the sign-in modal enhancements.

packages/thirdweb/src/exports/chains.ts (1)

55-55: LGTM! Follows the established export pattern.

The export is correctly placed alphabetically and follows the convention of exporting both mainnet and testnet chain definitions.

packages/thirdweb/src/react/web/hooks/x402/useFetchWithPayment.tsx (3)

49-59: LGTM! Well-structured optional configuration.

The new signInRequiredModal option is properly typed with clear property names and maintains backward compatibility through optional fields.


161-170: LGTM! Clear and helpful documentation.

The TSDoc example demonstrates the customization API clearly and follows the project's documentation standards with compilable code.


227-229: LGTM! Props correctly wired to modal component.

The configuration options are properly passed through to the SignInRequiredModal, with prop names matching the component's interface.

packages/thirdweb/src/react/web/ui/x402/SignInRequiredModal.tsx (2)

18-20: LGTM! Well-designed optional props.

The new props enable customization while maintaining a clean interface with clear names: title, description, and buttonLabel.


27-34: LGTM! Clean refactor with proper defaults.

The implementation correctly uses the new props with sensible defaults that preserve the original hardcoded behavior. The destructuring pattern with default values ensures backward compatibility.

Also applies to: 48-48, 51-51, 68-68, 76-76

packages/thirdweb/src/chains/chain-definitions/monad.ts (1)

1-20: <function_calls>

"Monad" blockchain "chain ID" 143 mainnet

@codecov
Copy link

codecov bot commented Nov 26, 2025

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8465      +/-   ##
==========================================
+ Coverage   54.82%   54.84%   +0.02%     
==========================================
  Files         919      920       +1     
  Lines       60875    60891      +16     
  Branches     4141     4141              
==========================================
+ Hits        33374    33395      +21     
+ Misses      27399    27394       -5     
  Partials      102      102              
Flag Coverage Δ
packages 54.84% <100.00%> (+0.02%) ⬆️
Files with missing lines Coverage Δ
...ges/thirdweb/src/chains/chain-definitions/monad.ts 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

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

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 (1)
.changeset/moody-camels-hear.md (1)

1-5: Update changeset to use minor version bump.

A previous review comment has already identified that this changeset should use minor instead of patch because adding a new public chain export (monad) is a new public API addition. Based on learnings, new/modified public APIs require a minor version bump.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • 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 17cced3 and c720f7f.

📒 Files selected for processing (8)
  • .changeset/angry-monkeys-dress.md (1 hunks)
  • .changeset/moody-camels-hear.md (1 hunks)
  • packages/thirdweb/src/chains/chain-definitions/monad.ts (1 hunks)
  • packages/thirdweb/src/exports/chains.ts (1 hunks)
  • packages/thirdweb/src/react/core/hooks/others/useInvalidateBalances.ts (1 hunks)
  • packages/thirdweb/src/react/core/hooks/x402/useFetchWithPaymentCore.ts (1 hunks)
  • packages/thirdweb/src/react/web/hooks/x402/useFetchWithPayment.tsx (4 hunks)
  • packages/thirdweb/src/react/web/ui/x402/SignInRequiredModal.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .changeset/angry-monkeys-dress.md
  • packages/thirdweb/src/react/core/hooks/x402/useFetchWithPaymentCore.ts
🧰 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 TypeScript 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 in TypeScript
Avoid any and unknown in TypeScript unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.) in TypeScript

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity and testability
Re-use shared types from @/types or local types.ts barrel exports
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics whenever possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic in TypeScript files; avoid restating TypeScript types and signatures in prose

Files:

  • packages/thirdweb/src/chains/chain-definitions/monad.ts
  • packages/thirdweb/src/react/web/ui/x402/SignInRequiredModal.tsx
  • packages/thirdweb/src/exports/chains.ts
  • packages/thirdweb/src/react/web/hooks/x402/useFetchWithPayment.tsx
  • packages/thirdweb/src/react/core/hooks/others/useInvalidateBalances.ts
packages/thirdweb/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

packages/thirdweb/src/**/*.{ts,tsx}: Comment only ambiguous logic in SDK code; avoid restating TypeScript in prose
Load heavy dependencies inside async paths to keep initial bundle lean (e.g. const { jsPDF } = await import("jspdf");)

Lazy-load heavy dependencies inside async paths to keep the initial bundle lean (e.g., const { jsPDF } = await import('jspdf');)

Files:

  • packages/thirdweb/src/chains/chain-definitions/monad.ts
  • packages/thirdweb/src/react/web/ui/x402/SignInRequiredModal.tsx
  • packages/thirdweb/src/exports/chains.ts
  • packages/thirdweb/src/react/web/hooks/x402/useFetchWithPayment.tsx
  • packages/thirdweb/src/react/core/hooks/others/useInvalidateBalances.ts
**/*.{js,jsx,ts,tsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Biome governs formatting and linting; its rules live in biome.json. Run pnpm fix & pnpm lint before committing, ensure there are no linting errors

Files:

  • packages/thirdweb/src/chains/chain-definitions/monad.ts
  • packages/thirdweb/src/react/web/ui/x402/SignInRequiredModal.tsx
  • packages/thirdweb/src/exports/chains.ts
  • packages/thirdweb/src/react/web/hooks/x402/useFetchWithPayment.tsx
  • packages/thirdweb/src/react/core/hooks/others/useInvalidateBalances.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Lazy-import optional features; avoid top-level side-effects

Files:

  • packages/thirdweb/src/chains/chain-definitions/monad.ts
  • packages/thirdweb/src/react/web/ui/x402/SignInRequiredModal.tsx
  • packages/thirdweb/src/exports/chains.ts
  • packages/thirdweb/src/react/web/hooks/x402/useFetchWithPayment.tsx
  • packages/thirdweb/src/react/core/hooks/others/useInvalidateBalances.ts
packages/thirdweb/src/exports/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

packages/thirdweb/src/exports/**/*.{ts,tsx}: Export everything via exports/ directory, grouped by feature in SDK development
Every public symbol must have comprehensive TSDoc with at least one @example block that compiles and custom annotation tags (@beta, @internal, @experimental)

Export everything in packages/thirdweb via the exports/ directory, grouped by feature. Every public symbol must have comprehensive TSDoc including at least one @example block that compiles and one custom annotation (@beta, @internal, @experimental, etc.)

Files:

  • packages/thirdweb/src/exports/chains.ts
🧠 Learnings (12)
📚 Learning: 2025-06-06T23:46:08.795Z
Learnt from: MananTank
Repo: thirdweb-dev/js PR: 7298
File: apps/dashboard/src/app/nebula-app/move-funds/move-funds.tsx:424-424
Timestamp: 2025-06-06T23:46:08.795Z
Learning: The thirdweb project has an ESLint rule that restricts direct usage of `defineChain`. When it's necessary to use `defineChain` directly, it's acceptable to disable the rule with `// eslint-disable-next-line no-restricted-syntax`.

Applied to files:

  • packages/thirdweb/src/chains/chain-definitions/monad.ts
  • .changeset/moody-camels-hear.md
📚 Learning: 2025-11-24T22:43:43.644Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T22:43:43.644Z
Learning: Applies to apps/dashboard/src/**/*.{ts,tsx} : Handle interactive UI with React hooks (`useState`, `useEffect`, React Query, wallet hooks) in client components

Applied to files:

  • packages/thirdweb/src/react/web/ui/x402/SignInRequiredModal.tsx
  • packages/thirdweb/src/react/web/hooks/x402/useFetchWithPayment.tsx
📚 Learning: 2025-05-30T17:14:25.332Z
Learnt from: MananTank
Repo: thirdweb-dev/js PR: 7227
File: apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components/OpenEditionMetadata.tsx:26-26
Timestamp: 2025-05-30T17:14:25.332Z
Learning: The ModuleCardUIProps interface already includes a client prop of type ThirdwebClient, so when components use `Omit<ModuleCardUIProps, "children" | "updateButton">`, they inherit the client prop without needing to add it explicitly.

Applied to files:

  • packages/thirdweb/src/react/web/ui/x402/SignInRequiredModal.tsx
📚 Learning: 2025-11-24T22:45:01.202Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T22:45:01.202Z
Learning: Applies to packages/thirdweb/src/exports/**/*.{ts,tsx} : Export everything in packages/thirdweb via the exports/ directory, grouped by feature. Every public symbol must have comprehensive TSDoc including at least one example block that compiles and one custom annotation (beta, internal, experimental, etc.)

Applied to files:

  • packages/thirdweb/src/exports/chains.ts
📚 Learning: 2025-11-24T22:43:43.644Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T22:43:43.644Z
Learning: Applies to packages/thirdweb/src/exports/**/*.{ts,tsx} : Export everything via `exports/` directory, grouped by feature in SDK development

Applied to files:

  • packages/thirdweb/src/exports/chains.ts
📚 Learning: 2025-11-24T22:43:43.644Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T22:43:43.644Z
Learning: Applies to **/*.test.{ts,tsx} : Use `FORKED_ETHEREUM_CHAIN` for mainnet interactions and `ANVIL_CHAIN` for isolated tests

Applied to files:

  • packages/thirdweb/src/exports/chains.ts
📚 Learning: 2025-11-24T22:44:20.977Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-11-24T22:44:20.977Z
Learning: Use interactive client components for UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks)

Applied to files:

  • packages/thirdweb/src/react/web/hooks/x402/useFetchWithPayment.tsx
📚 Learning: 2025-11-24T22:45:01.202Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T22:45:01.202Z
Learning: Applies to apps/{dashboard,playground}/**/*.{tsx,ts} : Client Components: Begin files with 'use client'; before imports, handle interactive UI relying on React hooks (useState, useEffect, React Query, wallet hooks), access browser APIs (localStorage, window, IntersectionObserver, etc.), and support fast transitions with client-side data prefetching

Applied to files:

  • packages/thirdweb/src/react/web/hooks/x402/useFetchWithPayment.tsx
📚 Learning: 2025-11-24T22:45:01.202Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T22:45:01.202Z
Learning: Applies to packages/**/.changeset/*.md : Each change in packages/* should contain a changeset for the appropriate package with the appropriate version bump: patch for changes that don't impact the public API, minor for any new/modified public API

Applied to files:

  • .changeset/moody-camels-hear.md
📚 Learning: 2025-11-24T22:43:43.644Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T22:43:43.644Z
Learning: Surface breaking changes prominently in PR descriptions

Applied to files:

  • .changeset/moody-camels-hear.md
📚 Learning: 2025-11-24T22:43:43.644Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T22:43:43.644Z
Learning: Use `minor` version bump for any new/modified public API

Applied to files:

  • .changeset/moody-camels-hear.md
📚 Learning: 2025-11-24T22:43:43.644Z
Learnt from: CR
Repo: thirdweb-dev/js PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T22:43:43.644Z
Learning: Use `major` version bump for breaking changes and surface prominently in PR descriptions

Applied to files:

  • .changeset/moody-camels-hear.md
🧬 Code graph analysis (2)
packages/thirdweb/src/chains/chain-definitions/monad.ts (1)
packages/thirdweb/src/exports/chains.ts (2)
  • monad (55-55)
  • defineChain (93-93)
packages/thirdweb/src/react/web/ui/x402/SignInRequiredModal.tsx (2)
packages/thirdweb/src/react/web/ui/components/basic.tsx (3)
  • Container (80-193)
  • ModalHeader (36-68)
  • ScreenBottomContainer (14-23)
packages/thirdweb/src/react/web/ui/components/text.tsx (1)
  • Text (18-34)
⏰ 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). (9)
  • GitHub Check: Unit Tests
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Build Packages
  • GitHub Check: Lint Packages
  • GitHub Check: Vercel Agent Review
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (5)
packages/thirdweb/src/react/web/ui/x402/SignInRequiredModal.tsx (1)

18-20: LGTM! Clean implementation of customizable modal props.

The addition of optional title, description, and buttonLabel props with sensible defaults enhances the modal's flexibility while maintaining backward compatibility. The implementation correctly applies these props throughout the component.

Also applies to: 27-34, 48-76

packages/thirdweb/src/react/core/hooks/others/useInvalidateBalances.ts (1)

15-15: LGTM! Aligns implementation with documented API.

Adding the default parameter allows calling invalidateBalances() without arguments as shown in the docstring example, improving developer experience.

packages/thirdweb/src/react/web/hooks/x402/useFetchWithPayment.tsx (1)

49-59: LGTM! Well-documented customization option.

The new signInRequiredModal option follows the established pattern of other customization options in this hook. The type definition is clear, JSDoc is comprehensive with examples, and the implementation correctly passes the props to the SignInRequiredModal component.

Also applies to: 87-87, 161-170, 227-229

packages/thirdweb/src/exports/chains.ts (1)

55-55: LGTM! Export follows established pattern.

The monad chain export is correctly positioned alphabetically and follows the same pattern as other chain definitions in the file.

packages/thirdweb/src/chains/chain-definitions/monad.ts (1)

6-20: Chain metadata is accurate and verified.

Both block explorer URLs are accessible (HTTP 200), and the chain details match official specifications:

  • Chain ID 143 ✓
  • Native currency: Mon (MON, 18 decimals) ✓
  • Block explorers: Monad Vision and Monad Scan both reachable ✓

Comment on lines +3 to +5
/**
* @chain
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Add comprehensive TSDoc for the public chain export.

Per coding guidelines, every public symbol exported via exports/ must have comprehensive TSDoc including:

  • A description of the chain
  • At least one @example block showing usage
  • A custom annotation tag (@beta, @internal, or @experimental)

Currently, the TSDoc only contains @chain.

Apply this diff to add complete documentation:

 /**
+ * The Monad mainnet chain.
+ *
+ * @example
+ * ```ts
+ * import { monad } from "thirdweb/chains";
+ * import { createThirdwebClient } from "thirdweb";
+ *
+ * const client = createThirdwebClient({ clientId: "..." });
+ * const contract = getContract({ client, chain: monad, address: "0x..." });
+ * ```
+ *
  * @chain
+ * @beta
  */

Based on coding guidelines.

🤖 Prompt for AI Agents
In packages/thirdweb/src/chains/chain-definitions/monad.ts around lines 3 to 5,
the public export has only the `@chain` tag; update the TSDoc block to include a
short description of the Monad chain, an @example showing import and basic usage
(import { monad } from "thirdweb/chains"; createThirdwebClient(...);
getContract({ client, chain: monad, address: "0x..." });), and add a custom
annotation tag such as `@beta`; replace the minimal `@chain` comment with a full
JSDoc block that contains description, the example code block, `@chain`, and
`@beta`.

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

Labels

packages SDK Involves changes to the thirdweb SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants