Skip to content

Conversation

@0xFirekeeper
Copy link
Member

@0xFirekeeper 0xFirekeeper commented Sep 29, 2025

Introduces ecosystemConfig utility to define allowed chains per ecosystem. Updates ConnectButton, ConnectEmbed, NftGallery, and wallet pages to use ecosystem-specific chain lists, enabling dynamic filtering and selection of chains based on the current ecosystem context.


PR-Codex overview

This PR focuses on enhancing the ecosystem-related functionality in the wallet UI by integrating ecosystem-specific chain IDs, allowing for more dynamic handling of chains based on the selected ecosystem.

Detailed summary

  • Added getEcosystemChainIds and getEcosystemChains functions in ecosystemConfig.ts.
  • Updated Layout to use allowedChainIds for filtering chains.
  • Modified NftGallery to accept allowedChainIds and handle resolved chain IDs.
  • Enhanced ConnectButton to use ecosystem-specific chains.
  • Updated Page to retrieve ecosystem from params and pass allowed chain IDs to NftGallery.
  • Improved ConnectEmbed to utilize ecosystem-specific chains and wallets.

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

Summary by CodeRabbit

  • New Features

    • Ecosystem-aware chain selection across wallet pages with automatic filtering to supported chains.
    • NFT Gallery respects ecosystem-specific allowed chains and selects the most relevant chain for queries and empty states.
    • Connect Button and Connect Embed preselect and display chains based on the current ecosystem; ecosystem-aware wallet option shown when applicable.
    • Wallet routes now include ecosystem in the URL for context-aware views.
  • Refactor

    • Centralized ecosystem-to-chain mapping for consistent behavior across components.

@0xFirekeeper 0xFirekeeper requested review from a team as code owners September 29, 2025 20:08
@changeset-bot
Copy link

changeset-bot bot commented Sep 29, 2025

⚠️ No Changeset found

Latest commit: de22377

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
Copy link

vercel bot commented Sep 29, 2025

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

Project Deployment Preview Comments Updated (UTC)
wallet-ui Ready Ready Preview Comment Sep 29, 2025 9:22pm
4 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
docs-v2 Skipped Skipped Sep 29, 2025 9:22pm
nebula Skipped Skipped Sep 29, 2025 9:22pm
thirdweb_playground Skipped Skipped Sep 29, 2025 9:22pm
thirdweb-www Skipped Skipped Sep 29, 2025 9:22pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 29, 2025

Walkthrough

Adds ecosystem-aware chain configuration: new ecosystemConfig module and use of its functions across wallet layout, page, connect components, and NftGallery so chains, wallets, and token queries can be constrained by an ecosystem identifier.

Changes

Cohort / File(s) Summary
Ecosystem config module
apps/wallet-ui/src/lib/ecosystemConfig.ts
New module exporting getEcosystemChainIds and getEcosystemChains; normalizes ecosystem identifiers and maps special ecosystem chain IDs to Chain objects.
Wallet routing: ecosystem-aware filtering
apps/wallet-ui/src/app/[ecosystem]/(authed)/wallet/[address]/layout.tsx, apps/wallet-ui/src/app/[ecosystem]/(authed)/wallet/[address]/page.tsx
Layout: import and use getEcosystemChainIds to derive allowedChainIds for SimpleHash filtering. Page: params include ecosystem; derive allowedChainIds, parse chainId to number, and pass allowedChainIds, parsed chainId, and checksummed owner to NftGallery.
Connect components: preselected ecosystem chains
apps/wallet-ui/src/components/ConnectButton.tsx, apps/wallet-ui/src/components/ConnectEmbed.tsx
Import and use getEcosystemChains (memoized). Pass chain (first) and chains to Thirdweb connect components; ConnectEmbed conditions wallets on ecosystem id ([ecosystemWallet(ecosystemId)] when present).
Nft gallery: constrained chain querying
apps/wallet-ui/src/components/NftGallery.tsx
NftGallery signature gains optional allowedChainIds?: number[]. Resolves resolvedChainId and chainIdsToQuery from allowedChainIds and incoming chainId; queries tokens with chainIdsToQuery and supplies resolvedChainId to empty state.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Router as App Router
  participant Page as Wallet Page
  participant Config as ecosystemConfig
  participant Gallery as NftGallery
  participant API as Token API

  User->>Router: Navigate /[ecosystem]/wallet/[address]?chainId=...
  Router->>Page: params { ecosystem, address }, searchParams { chainId }
  Page->>Config: getEcosystemChainIds(ecosystem)
  Config-->>Page: allowedChainIds | undefined
  Page->>Gallery: props { owner, chainId, allowedChainIds }
  Note over Gallery: compute resolvedChainId and chainIdsToQuery
  Gallery->>API: getErc721Tokens({ owner, chainIds: chainIdsToQuery })
  API-->>Gallery: Tokens
  Gallery-->>User: Render tokens or empty state (resolvedChainId)
Loading
sequenceDiagram
  autonumber
  actor User
  participant Connect as ConnectButton/ConnectEmbed
  participant Config as ecosystemConfig
  participant Thirdweb as Thirdweb UI

  Connect->>Config: getEcosystemChains(ecosystem)
  Config-->>Connect: chains[] | undefined
  Connect->>Thirdweb: props { chain: chains[0], chains, wallets? }
  Thirdweb-->>User: Ecosystem-scoped connect UI
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description does not follow the repository’s required template, as it omits the commented header block (including the issue tag) and lacks the mandatory “## Notes for the reviewer” and “## How to test” sections. Instead of the prescribed structure, it includes a PR-Codex overview that is not part of the template. This makes it harder for reviewers to find testing instructions and contextual notes. Please update the PR description to include the template’s commented header block with the issue tag if applicable, and add clearly defined “## Notes for the reviewer” and “## How to test” sections to align with repository standards.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title accurately and concisely describes the primary change introduced by this pull request, which is adding support for ecosystem-specific chain configuration. It directly reflects the creation of the ecosystemConfig utility and the related component updates. The phrasing is clear, free of extraneous detail, and provides immediate context for reviewers.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch firekeeper/mon-id-eco-chains

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

@graphite-app
Copy link
Contributor

graphite-app bot commented Sep 29, 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.

@github-actions github-actions bot added the Ecosystem Portal Involves changes to the Ecosystem Portal label Sep 29, 2025
@codecov
Copy link

codecov bot commented Sep 29, 2025

Codecov Report

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

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8147   +/-   ##
=======================================
  Coverage   56.28%   56.28%           
=======================================
  Files         906      906           
  Lines       59208    59208           
  Branches     4176     4176           
=======================================
  Hits        33324    33324           
  Misses      25779    25779           
  Partials      105      105           
Flag Coverage Δ
packages 56.28% <ø> (ø)
🚀 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 29, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 64.69 KB (0%) 1.3 s (0%) 291 ms (+227.3% 🔺) 1.6 s
thirdweb (cjs) 361.52 KB (0%) 7.3 s (0%) 859 ms (+18.79% 🔺) 8.1 s
thirdweb (minimal + tree-shaking) 5.73 KB (0%) 115 ms (0%) 119 ms (+2474.9% 🔺) 234 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 41 ms (+1699.56% 🔺) 51 ms
thirdweb/react (minimal + tree-shaking) 19.14 KB (0%) 383 ms (0%) 114 ms (+2029.22% 🔺) 497 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 (5)
apps/wallet-ui/src/components/ConnectButton.tsx (1)

9-16: Add explicit return type and memoize wallets for referential stability.

  • Annotate the component return type for clarity.
  • Memoize the wallets array to avoid new array instances on every render.

Apply:

-export default function ConnectButton({
+export default function ConnectButton({
   ecosystem,
 }: {
   ecosystem: `ecosystem.${string}`;
-}) {
+}): JSX.Element {
   const { theme } = useTheme();
   const chains = useMemo(() => getEcosystemChains(ecosystem), [ecosystem]);
+  const wallets = useMemo(() => [ecosystemWallet(ecosystem)], [ecosystem]);
-      wallets={[ecosystemWallet(ecosystem)]}
+      wallets={wallets}

As per coding guidelines.

Also applies to: 23-24

apps/wallet-ui/src/app/[ecosystem]/(authed)/wallet/[address]/layout.tsx (1)

49-54: Use a Set for membership checks to reduce per-request work.

Tiny optimization when filtering many chains.

-  const allowedChainIds = specialChainIds ?? SIMPLEHASH_NFT_SUPPORTED_CHAIN_IDS;
+  const allowedChainIds =
+    specialChainIds ?? SIMPLEHASH_NFT_SUPPORTED_CHAIN_IDS;
+  const allowedChainIdSet = new Set(allowedChainIds);

-  const simpleHashChains = thirdwebChains.filter((chain) =>
-    allowedChainIds.includes(chain.chainId),
-  );
+  const simpleHashChains = thirdwebChains.filter((chain) =>
+    allowedChainIdSet.has(chain.chainId),
+  );

Optional: add an explicit return type to Layout for consistency:
export default async function Layout(...): Promise<JSX.Element> { (outside hunk). As per coding guidelines.

apps/wallet-ui/src/components/ConnectEmbed.tsx (1)

47-49: LGTM overall; consider memoizing wallets and using ecosystemSlug in navigation.

  • Passing chain and chains looks correct.
  • Memoize wallets for stable identity; prefer ecosystemSlug over params.ecosystem (which can be string[]).
-  const ecosystemId = ecosystemSlug
+  const ecosystemId = ecosystemSlug
     ? (`ecosystem.${ecosystemSlug}` as `ecosystem.${string}`)
     : undefined;
+  const wallets = useMemo(
+    () => (ecosystemId ? [ecosystemWallet(ecosystemId)] : undefined),
+    [ecosystemId],
+  );
-      wallets={ecosystemId ? [ecosystemWallet(ecosystemId)] : undefined}
+      wallets={wallets}

Additionally, perform navigation in an effect and use ecosystemSlug:

// outside hunk
useEffect(() => {
  if (userAddress) {
    router.push(
      `/wallet/${userAddress}?${searchParams.toString()}`,
      ecosystemSlug || "",
    );
  }
}, [userAddress, searchParams, ecosystemSlug, router]);

Please confirm router.push(url, ecosystem) is the intended signature for your custom router hook. If not, we should adjust accordingly. Based on learnings.

Also applies to: 66-66

apps/wallet-ui/src/lib/ecosystemConfig.ts (2)

6-8: Freeze mapping and keep types precise.

Lock down the config and get stricter compile-time checks.

-const SPECIAL_ECOSYSTEM_CHAIN_IDS: Record<string, readonly number[]> = {
-  "mon-id": [1, 43114] as const,
-};
+const SPECIAL_ECOSYSTEM_CHAIN_IDS = {
+  "mon-id": [1, 43114],
+} as const satisfies Record<string, readonly number[]>;

Optionally narrow the identifier type to avoid diluting the template-literal type:
type EcosystemIdentifier = \ecosystem.${string}` | string | undefined;→ considerstring | undefinedor export a dedicatedEcosystemSlug = string` and keep the template form only at call sites. As per coding guidelines.


29-34: Potential ESLint rule: direct defineChain usage.

Some workspaces restrict direct defineChain. If that rule exists here, add a localized override.

 export function getEcosystemChains(
   ecosystem?: EcosystemIdentifier,
 ): Chain[] | undefined {
   const chainIds = getEcosystemChainIds(ecosystem);
-  return chainIds?.map((chainId) => defineChain(chainId));
+  // eslint-disable-next-line no-restricted-syntax
+  return chainIds?.map((chainId) => defineChain(chainId));
 }

Based on learnings.

📜 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 b8afa98 and bb78223.

📒 Files selected for processing (6)
  • apps/wallet-ui/src/app/[ecosystem]/(authed)/wallet/[address]/layout.tsx (2 hunks)
  • apps/wallet-ui/src/app/[ecosystem]/(authed)/wallet/[address]/page.tsx (2 hunks)
  • apps/wallet-ui/src/components/ConnectButton.tsx (1 hunks)
  • apps/wallet-ui/src/components/ConnectEmbed.tsx (3 hunks)
  • apps/wallet-ui/src/components/NftGallery.tsx (1 hunks)
  • apps/wallet-ui/src/lib/ecosystemConfig.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{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/wallet-ui/src/lib/ecosystemConfig.ts
  • apps/wallet-ui/src/components/ConnectButton.tsx
  • apps/wallet-ui/src/app/[ecosystem]/(authed)/wallet/[address]/layout.tsx
  • apps/wallet-ui/src/components/NftGallery.tsx
  • apps/wallet-ui/src/components/ConnectEmbed.tsx
  • apps/wallet-ui/src/app/[ecosystem]/(authed)/wallet/[address]/page.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/wallet-ui/src/lib/ecosystemConfig.ts
  • apps/wallet-ui/src/components/ConnectButton.tsx
  • apps/wallet-ui/src/app/[ecosystem]/(authed)/wallet/[address]/layout.tsx
  • apps/wallet-ui/src/components/NftGallery.tsx
  • apps/wallet-ui/src/components/ConnectEmbed.tsx
  • apps/wallet-ui/src/app/[ecosystem]/(authed)/wallet/[address]/page.tsx
🧠 Learnings (6)
📓 Common learnings
Learnt from: joaquim-verges
PR: thirdweb-dev/js#7268
File: packages/thirdweb/src/wallets/in-app/core/wallet/in-app-core.ts:210-216
Timestamp: 2025-06-03T23:44:40.243Z
Learning: EIP7702 wallets do not need special handling for switching chains, unlike EIP4337 wallets which require reconnection when switching chains. In the switchChain method condition, EIP7702 should be intentionally excluded from the reconnection logic.
📚 Learning: 2025-06-06T23:46:08.795Z
Learnt from: MananTank
PR: thirdweb-dev/js#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:

  • apps/wallet-ui/src/lib/ecosystemConfig.ts
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).

Applied to files:

  • apps/wallet-ui/src/components/ConnectButton.tsx
  • apps/wallet-ui/src/components/ConnectEmbed.tsx
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : EIP-1193, EIP-5792, EIP-7702 standard support in wallet modules

Applied to files:

  • apps/wallet-ui/src/app/[ecosystem]/(authed)/wallet/[address]/layout.tsx
📚 Learning: 2025-09-23T19:56:43.668Z
Learnt from: MananTank
PR: thirdweb-dev/js#8106
File: packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx:482-485
Timestamp: 2025-09-23T19:56:43.668Z
Learning: In packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx, the EmbedContainer uses width: "100vw" intentionally rather than "100%" - this is by design for the bridge widget embedding use case.

Applied to files:

  • apps/wallet-ui/src/components/ConnectEmbed.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Anything that consumes hooks from `tanstack/react-query` or thirdweb SDKs.

Applied to files:

  • apps/wallet-ui/src/components/ConnectEmbed.tsx
🧬 Code graph analysis (4)
apps/wallet-ui/src/components/ConnectButton.tsx (1)
apps/wallet-ui/src/lib/ecosystemConfig.ts (1)
  • getEcosystemChains (29-34)
apps/wallet-ui/src/app/[ecosystem]/(authed)/wallet/[address]/layout.tsx (1)
apps/wallet-ui/src/lib/ecosystemConfig.ts (1)
  • getEcosystemChainIds (21-27)
apps/wallet-ui/src/components/ConnectEmbed.tsx (1)
apps/wallet-ui/src/lib/ecosystemConfig.ts (1)
  • getEcosystemChains (29-34)
apps/wallet-ui/src/app/[ecosystem]/(authed)/wallet/[address]/page.tsx (2)
apps/wallet-ui/src/lib/ecosystemConfig.ts (1)
  • getEcosystemChainIds (21-27)
apps/wallet-ui/src/components/NftGallery.tsx (1)
  • NftGallery (20-60)
⏰ 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: Size
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Unit Tests
  • GitHub Check: Build Packages
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
apps/wallet-ui/src/components/ConnectButton.tsx (1)

15-21: LGTM: ecosystem-aware preselect and chain list are correctly wired.

Memoized chains, passing chains and default chain looks good.

apps/wallet-ui/src/components/NftGallery.tsx (1)

35-42: Nice fallback to allowed chains.

Switching to a derived chainIdsToQuery keeps the gallery scoped to the ecosystem’s allowed list while still defaulting to the SimpleHash set when no filter is supplied. This keeps the fetch path consistent with the new config.

Comment on lines +18 to 19
const parsedChainId = chainId ? Number(chainId) : undefined;

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 | 🔴 Critical

Bug: NaN chainId can leak into NftGallery and break token queries.

Number(chainId) yields NaN for invalid inputs; current logic passes it through.

Use a guarded parse (and optionally gate by allowedChainIds):

-  const parsedChainId = chainId ? Number(chainId) : undefined;
+  const parsedChainId = (() => {
+    if (!chainId) return undefined;
+    const n = Number(chainId);
+    if (!Number.isInteger(n) || n <= 0) return undefined;
+    // Optional: also ensure it's allowed by the current ecosystem
+    if (allowedChainIds && !allowedChainIds.includes(n)) return undefined;
+    return n;
+  })();

Also consider annotating the component return type:
export default async function Page(...): Promise<JSX.Element> (outside hunk). As per coding guidelines.

🤖 Prompt for AI Agents
In apps/wallet-ui/src/app/[ecosystem]/(authed)/wallet/[address]/page.tsx around
lines 18-19, Number(chainId) can produce NaN and that NaN is passed into
NftGallery breaking token queries; replace the direct Number conversion with a
guarded parse that returns undefined for invalid/non-numeric inputs (e.g.,
parseInt/Number then isFinite check) and optionally validate against an
allowedChainIds whitelist before passing to NftGallery; additionally add an
explicit return type annotation to the component signature (export default async
function Page(...): Promise<JSX.Element>) as per coding guidelines.

type EcosystemIdentifier = `ecosystem.${string}` | string | undefined;

const SPECIAL_ECOSYSTEM_CHAIN_IDS: Record<string, readonly number[]> = {
"mon-id": [1, 43114] as const,
Copy link
Member

Choose a reason for hiding this comment

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

fine for now, but we could totally put this in the ecosystem config. right now we have only 'default chain', but we could let ppl add all the chains they care about

@0xFirekeeper 0xFirekeeper added the merge-queue Adds the pull request to Graphite's merge queue. label Sep 29, 2025
Copy link
Member Author

0xFirekeeper commented Sep 29, 2025

Merge activity

  • Sep 29, 8:38 PM UTC: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Sep 29, 8:38 PM UTC: 0xFirekeeper added this pull request to the Graphite merge queue.
  • Sep 29, 9:02 PM UTC: The Graphite merge queue couldn't merge this PR because it was not satisfying all requirements (Failed CI: 'Vercel – wallet-ui').
  • Sep 29, 9:19 PM UTC: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Sep 29, 9:23 PM UTC: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.

Introduces ecosystemConfig utility to define allowed chains per ecosystem. Updates ConnectButton, ConnectEmbed, NftGallery, and wallet pages to use ecosystem-specific chain lists, enabling dynamic filtering and selection of chains based on the current ecosystem context.

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces ecosystem-specific chain handling in the wallet UI, allowing for dynamic chain selection based on the ecosystem parameter. It enhances components to utilize ecosystem chains and improves the overall functionality of NFT galleries and connection buttons.

### Detailed summary
- Added `getEcosystemChainIds` and `getEcosystemChains` functions in `ecosystemConfig.ts`.
- Updated `Layout` to use `allowedChainIds` based on the ecosystem.
- Modified `NftGallery` to accept `allowedChainIds` and handle resolved chain IDs.
- Enhanced `ConnectButton` to utilize ecosystem-specific chains.
- Adjusted `Page` to retrieve and pass `allowedChainIds` for NFT galleries.
- Updated `ConnectEmbed` to manage ecosystem chains and wallet connections dynamically.

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

<!-- end pr-codex -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **New Features**
  * Ecosystem-aware chain selection across wallet pages, with automatic filtering to supported chains.
  * NFT Gallery now respects ecosystem-specific allowed chains and selects the most relevant chain for queries and empty states.
  * Connect Button and Connect Embed preselect and display chains based on the current ecosystem, improving onboarding.
  * Ecosystem-aware wallet option shown when applicable.
  * Wallet page routing now supports ecosystem in the URL, enabling context-aware views.

* **Refactor**
  * Centralized ecosystem-to-chain mapping to ensure consistent behavior across components.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@graphite-app graphite-app bot force-pushed the firekeeper/mon-id-eco-chains branch from bb78223 to de22377 Compare September 29, 2025 20:39
@vercel vercel bot temporarily deployed to Preview – nebula September 29, 2025 20:39 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground September 29, 2025 20:39 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 September 29, 2025 20:39 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb-www September 29, 2025 20:39 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: 0

🧹 Nitpick comments (1)
apps/wallet-ui/src/components/ConnectEmbed.tsx (1)

66-67: Memoize the ecosystem wallet config

ecosystemWallet creates a fresh config object, and wrapping it in an inline array gives ThirdwebConnectEmbed a brand-new wallets reference on every render. The embed reinitializes connectors whenever that prop changes, so even unrelated state updates (theme toggles, query refetches) can churn the wallet list and interrupt the flow. Cache the array off a useMemo keyed on ecosystemId and pass that stable reference instead.

Apply this diff:

@@
-  const ecosystemId = ecosystemSlug
-    ? (`ecosystem.${ecosystemSlug}` as `ecosystem.${string}`)
-    : undefined;
+  const ecosystemId = ecosystemSlug
+    ? (`ecosystem.${ecosystemSlug}` as `ecosystem.${string}`)
+    : undefined;
+
+  const wallets = useMemo(
+    () => (ecosystemId ? [ecosystemWallet(ecosystemId)] : undefined),
+    [ecosystemId],
+  );
@@
-      wallets={ecosystemId ? [ecosystemWallet(ecosystemId)] : undefined}
+      wallets={wallets}
📜 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 bb78223 and de22377.

📒 Files selected for processing (6)
  • apps/wallet-ui/src/app/[ecosystem]/(authed)/wallet/[address]/layout.tsx (2 hunks)
  • apps/wallet-ui/src/app/[ecosystem]/(authed)/wallet/[address]/page.tsx (2 hunks)
  • apps/wallet-ui/src/components/ConnectButton.tsx (1 hunks)
  • apps/wallet-ui/src/components/ConnectEmbed.tsx (3 hunks)
  • apps/wallet-ui/src/components/NftGallery.tsx (1 hunks)
  • apps/wallet-ui/src/lib/ecosystemConfig.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • apps/wallet-ui/src/lib/ecosystemConfig.ts
  • apps/wallet-ui/src/app/[ecosystem]/(authed)/wallet/[address]/layout.tsx
  • apps/wallet-ui/src/components/NftGallery.tsx
  • apps/wallet-ui/src/app/[ecosystem]/(authed)/wallet/[address]/page.tsx
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{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/wallet-ui/src/components/ConnectEmbed.tsx
  • apps/wallet-ui/src/components/ConnectButton.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/wallet-ui/src/components/ConnectEmbed.tsx
  • apps/wallet-ui/src/components/ConnectButton.tsx
🧠 Learnings (3)
📚 Learning: 2025-09-23T19:56:43.668Z
Learnt from: MananTank
PR: thirdweb-dev/js#8106
File: packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx:482-485
Timestamp: 2025-09-23T19:56:43.668Z
Learning: In packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx, the EmbedContainer uses width: "100vw" intentionally rather than "100%" - this is by design for the bridge widget embedding use case.

Applied to files:

  • apps/wallet-ui/src/components/ConnectEmbed.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Anything that consumes hooks from `tanstack/react-query` or thirdweb SDKs.

Applied to files:

  • apps/wallet-ui/src/components/ConnectEmbed.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).

Applied to files:

  • apps/wallet-ui/src/components/ConnectEmbed.tsx
  • apps/wallet-ui/src/components/ConnectButton.tsx
🧬 Code graph analysis (2)
apps/wallet-ui/src/components/ConnectEmbed.tsx (1)
apps/wallet-ui/src/lib/ecosystemConfig.ts (1)
  • getEcosystemChains (29-34)
apps/wallet-ui/src/components/ConnectButton.tsx (1)
apps/wallet-ui/src/lib/ecosystemConfig.ts (1)
  • getEcosystemChains (29-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). (2)
  • GitHub Check: Size
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
apps/wallet-ui/src/components/ConnectButton.tsx (1)

3-21: Ecosystem-aware chain memoization looks solid

Memoizing getEcosystemChains(ecosystem) keeps the chain objects stable per ecosystem switch, and wiring both the default chain and chains array into ThirdwebConnectButton aligns with the new config utility.

@graphite-app graphite-app bot removed the merge-queue Adds the pull request to Graphite's merge queue. label Sep 29, 2025
@0xFirekeeper 0xFirekeeper added the merge-queue Adds the pull request to Graphite's merge queue. label Sep 29, 2025
@0xFirekeeper 0xFirekeeper merged commit 99c2af5 into main Sep 29, 2025
24 of 25 checks passed
@0xFirekeeper 0xFirekeeper deleted the firekeeper/mon-id-eco-chains branch September 29, 2025 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ecosystem Portal Involves changes to the Ecosystem Portal merge-queue Adds the pull request to Graphite's merge queue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants