Skip to content

feat(clerk-js,clerk-react): Support Base Wallet #6556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

jacekradko
Copy link
Member

@jacekradko jacekradko commented Aug 16, 2025

Description

Fixes: USER-2591

TODO:

  • Investigate bundle size increase
  • Add proper test coverage
Screenshot 2025-08-18 at 3 00 41 PM

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • New Features

    • Added Base Account as a new Web3 provider for sign-in and sign-up; SDKs expose public authentication methods and updated types to support Base Account.
  • Chores

    • Coordinated a multi-package minor release to roll out Base Account support (package bumps, release metadata).
    • Added the Base Account runtime dependency, lazy-loading and bundling support, and bundle-size monitoring for Base Account assets.

Copy link

vercel bot commented Aug 16, 2025

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

Project Deployment Preview Comments Updated (UTC)
clerk-js-sandbox Ready Ready Preview Comment Aug 19, 2025 0:08am

@jacekradko jacekradko changed the title feat: support base wallet feat: Support base wallet Aug 16, 2025
Copy link

changeset-bot bot commented Aug 16, 2025

🦋 Changeset detected

Latest commit: e5be17f

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

This PR includes changesets to release 22 packages
Name Type
@clerk/clerk-js Minor
@clerk/shared Minor
@clerk/clerk-react Minor
@clerk/types Minor
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/elements Patch
@clerk/expo-passkeys Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/remix Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch
@clerk/vue Patch
@clerk/localizations Patch
@clerk/themes 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

Copy link
Contributor

coderabbitai bot commented Aug 16, 2025

📝 Walkthrough

Walkthrough

Adds Base Wallet ("base_wallet") web3 authentication across frontend SDKs. Implements getBaseWalletIdentifier and generateSignatureWithBaseWallet with a lazy dynamic import of @base-org/account. Adds a WEB3_PROVIDERS entry for Base Wallet and new authenticateWithBaseWallet methods on Clerk, SignIn, SignUp, IsomorphicClerk, and corresponding type additions. Adds @base-org/account to packages/clerk-js/package.json and a changeset bumping multiple packages with the note "Adding support for Base Account." Updates bundling (rspack) to isolate @base-org/account into a base-account async chunk and adds a bundlewatch entry for base-account.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Assessment against linked issues

Objective Addressed Explanation
Frontend SDK: add Base SDK dependency and client-side authentication methods (USER-2591)
Backend: introduce Base web3 provider and align signature verification with Coinbase (USER-2591) No backend/server code, provider registration, or signature verification changes present in this PR.
Dashboard: add Base as supported Web3 provider in Configure > Web3 (USER-2591) No dashboard or admin UI changes included.
Docs: add Base guide to documentation (USER-2591) No documentation or docs-site changes included.

Out-of-scope changes

Code Change Explanation
Added changeset file (.changeset/silent-insects-cheat.md) Release metadata only; not required by the linked issue objectives.
bundlewatch addition for base-account (packages/clerk-js/bundlewatch.config.json) Build/CI size monitoring change unrelated to the functional objectives in the linked issue.
rspack config changes to isolate @base-org/account into base-account async chunk (packages/clerk-js/rspack.config.js) Build/bundling configuration change; not explicitly part of the linked issue requirements.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • 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 dd94966 and e5be17f.

📒 Files selected for processing (1)
  • packages/clerk-js/bundlewatch.config.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/clerk-js/bundlewatch.config.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Build Packages
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

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

CodeRabbit Configuration File (.coderabbit.yaml)

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

Status, Documentation and Community

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

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

🔭 Outside diff range comments (1)
packages/clerk-js/src/core/resources/SignIn.ts (1)

145-154: Add SignIn.prepareFirstFactor support for 'web3_base_account_signature'

When calling authenticateWithWeb3 for Base Account, we end up invoking prepareFirstFactor with the web3 factor returned from FAPI. Since 'web3_base_account_signature' is not included in this switch, clerkInvalidStrategy will be thrown and the flow will fail.

Add a case mirroring the other web3 providers.

Apply this diff to include Base Account:

       case 'web3_coinbase_wallet_signature':
         config = { web3WalletId: factor.web3WalletId } as Web3SignatureConfig;
         break;
       case 'web3_okx_wallet_signature':
         config = { web3WalletId: factor.web3WalletId } as Web3SignatureConfig;
         break;
+      case 'web3_base_account_signature':
+        config = { web3WalletId: factor.web3WalletId } as Web3SignatureConfig;
+        break;
🧹 Nitpick comments (10)
packages/types/src/signIn.ts (1)

117-118: Add JSDoc for the new public API method

Public APIs must be documented. Please add a short JSDoc describing what this method does and what it returns.

Apply this diff:

   authenticateWithOKXWallet: () => Promise<SignInResource>;
 
+  /**
+   * Authenticate the current sign-in using the Base Account provider
+   * via a web3 signature flow.
+   * Returns the updated SignInResource on success.
+   */
   authenticateWithBaseAccount: () => Promise<SignInResource>;
.changeset/silent-insects-cheat.md (1)

1-9: Enrich the changeset description for downstream consumers

Consider adding a brief summary of the public API surface changes and a one-line migration/use note (e.g., newly added methods and provider key/strategy). This helps package consumers understand what changed without scanning the PR.

For example:

  • Adds Base Account as a web3 provider: provider = "base_account", strategy = "web3_base_account_signature".
  • New public APIs:
    • Clerk.authenticateWithBaseAccount(params?)
    • SignIn.authenticateWithBaseAccount()
    • SignUp.authenticateWithBaseAccount(params?)
  • Docs: Add Base Account auth guide (link).
packages/clerk-js/src/core/resources/SignIn.ts (1)

364-371: Expose minimal JSDoc for the new public API

The new public method is missing JSDoc. For consistency with our guidelines (public APIs documented) and discoverability, add a brief description and return type info.

Example:

+  /**
+   * Authenticates the user using Base Account.
+   * Uses `web3_base_account_signature` strategy under the hood.
+   */
   public authenticateWithBaseAccount = async (): Promise<SignInResource> => {
packages/clerk-js/src/core/clerk.ts (1)

2171-2181: Prefer provider-based branching for consistency

You compute provider above; then branch on strategy only for Base while using provider for the other wallets. Use provider === 'base_account' for consistency/readability.

Apply this diff:

-    const generateSignature =
-      provider === 'metamask'
-        ? generateSignatureWithMetamask
-        : strategy === 'web3_base_account_signature'
-          ? generateSignatureWithBaseAccount
-          : provider === 'coinbase_wallet'
-            ? generateSignatureWithCoinbaseWallet
-            : generateSignatureWithOKXWallet;
+    const generateSignature =
+      provider === 'metamask'
+        ? generateSignatureWithMetamask
+        : provider === 'base_account'
+        ? generateSignatureWithBaseAccount
+        : provider === 'coinbase_wallet'
+        ? generateSignatureWithCoinbaseWallet
+        : generateSignatureWithOKXWallet;
packages/clerk-js/src/core/resources/SignUp.ts (2)

261-274: SignUp Base Account flow mirrors existing providers (LGTM)

The new method follows the established pattern: fetch identifier, delegate to authenticateWithWeb3 with the correct strategy, and forward metadata/consent. Looks correct.

Consider adding a one-line JSDoc to align with our “All public APIs must be documented” guideline.


181-229: Optional: Confirm whether Base Account needs a “retry on user rejected” behavior

The Coinbase Wallet flow retries on error code 4001. If Base Account SDK shares the same behavior, we might want to extend the retry condition accordingly; if not, ignore.

Would you like me to add a guarded retry for Base if the SDK signals a transient, user-first-time setup rejection?

packages/clerk-js/src/utils/web3.ts (4)

61-63: Public util added: add JSDoc and test coverage

Implementation is fine. Please document this public API and add tests that cover:

  • Returns first address when provider resolves
  • Returns empty string when provider is unavailable or user rejects

Suggested JSDoc:

/**
 * Returns the first EIP-1193 account for the Base Account provider or '' if unavailable.
 * Note: resolves to '' when the provider cannot be loaded or no accounts are returned.
 */

82-84: Public util added: add JSDoc and test coverage

Looks good. Please document and add tests validating:

  • Successful signature generation for a given nonce and identifier
  • Empty string fallback when provider import fails (consistent with existing behavior)

Suggested JSDoc:

/**
 * Signs the given nonce with the Base Account provider using personal_sign.
 * Returns '' if the provider cannot be loaded.
 */

28-30: Avoid local type duplication and potential confusion with GenerateSignatureParams

This file defines a local type GenerateSignatureParams while @clerk/types already exposes GenerateSignatureParams (with an optional provider). To reduce confusion and ensure consistency, import and derive from the canonical type:

-import type { Web3Provider } from '@clerk/types';
+import type { Web3Provider, GenerateSignatureParams as PublicGenerateSignatureParams } from '@clerk/types';

-type GenerateWeb3SignatureParams = GenerateSignatureParams & {
+type GenerateWeb3SignatureParams = Omit<PublicGenerateSignatureParams, 'provider'> & {
   provider: Web3Provider;
 };
-
-type GenerateSignatureParams = {
-  identifier: string;
-  nonce: string;
-};
+type GenerateSignatureParams = Omit<PublicGenerateSignatureParams, 'provider'>;

This keeps the public and internal signatures aligned and avoids shadowing.

Also applies to: 65-68


101-111: Consider SSR/RHC parity and developer-facing warnings for Base Account

Coinbase has an environment guard using __BUILD_DISABLE_RHC__ plus a warning. For parity and clearer developer signals, consider mirroring this pattern for Base Account:

  • Gate Base Account when that flag is enabled (if intended).
  • Emit a consistent warning when the provider cannot be loaded (e.g., missing dependency, SSR, CSP).

Example:

if (__BUILD_DISABLE_RHC__) {
  clerkUnsupportedEnvironmentWarning('Base Account');
  return null;
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • 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 413468c and 681dcf7.

📒 Files selected for processing (11)
  • .changeset/silent-insects-cheat.md (1 hunks)
  • packages/clerk-js/src/core/clerk.ts (3 hunks)
  • packages/clerk-js/src/core/resources/SignIn.ts (2 hunks)
  • packages/clerk-js/src/core/resources/SignUp.ts (2 hunks)
  • packages/clerk-js/src/utils/web3.ts (3 hunks)
  • packages/react/src/isomorphicClerk.ts (2 hunks)
  • packages/shared/src/web3.ts (1 hunks)
  • packages/types/src/clerk.ts (2 hunks)
  • packages/types/src/signIn.ts (1 hunks)
  • packages/types/src/signUp.ts (1 hunks)
  • packages/types/src/web3.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

**/*.{js,jsx,ts,tsx}: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels

Files:

  • packages/types/src/signUp.ts
  • packages/shared/src/web3.ts
  • packages/types/src/signIn.ts
  • packages/clerk-js/src/core/resources/SignIn.ts
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/utils/web3.ts
  • packages/clerk-js/src/core/resources/SignUp.ts
  • packages/clerk-js/src/core/clerk.ts
  • packages/react/src/isomorphicClerk.ts
  • packages/types/src/web3.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/types/src/signUp.ts
  • packages/shared/src/web3.ts
  • packages/types/src/signIn.ts
  • packages/clerk-js/src/core/resources/SignIn.ts
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/utils/web3.ts
  • packages/clerk-js/src/core/resources/SignUp.ts
  • packages/clerk-js/src/core/clerk.ts
  • packages/react/src/isomorphicClerk.ts
  • packages/types/src/web3.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/types/src/signUp.ts
  • packages/shared/src/web3.ts
  • packages/types/src/signIn.ts
  • packages/clerk-js/src/core/resources/SignIn.ts
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/utils/web3.ts
  • packages/clerk-js/src/core/resources/SignUp.ts
  • packages/clerk-js/src/core/clerk.ts
  • packages/react/src/isomorphicClerk.ts
  • packages/types/src/web3.ts
packages/**/*.{ts,tsx,d.ts}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Packages should export TypeScript types alongside runtime code

Files:

  • packages/types/src/signUp.ts
  • packages/shared/src/web3.ts
  • packages/types/src/signIn.ts
  • packages/clerk-js/src/core/resources/SignIn.ts
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/utils/web3.ts
  • packages/clerk-js/src/core/resources/SignUp.ts
  • packages/clerk-js/src/core/clerk.ts
  • packages/react/src/isomorphicClerk.ts
  • packages/types/src/web3.ts
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Use const assertions for literal types: as const
Use satisfies operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports: import type { ... } from ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)

Files:

  • packages/types/src/signUp.ts
  • packages/shared/src/web3.ts
  • packages/types/src/signIn.ts
  • packages/clerk-js/src/core/resources/SignIn.ts
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/utils/web3.ts
  • packages/clerk-js/src/core/resources/SignUp.ts
  • packages/clerk-js/src/core/clerk.ts
  • packages/react/src/isomorphicClerk.ts
  • packages/types/src/web3.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.

Files:

  • packages/types/src/signUp.ts
  • packages/shared/src/web3.ts
  • packages/types/src/signIn.ts
  • packages/clerk-js/src/core/resources/SignIn.ts
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/utils/web3.ts
  • packages/clerk-js/src/core/resources/SignUp.ts
  • packages/clerk-js/src/core/clerk.ts
  • packages/react/src/isomorphicClerk.ts
  • packages/types/src/web3.ts
**/*

⚙️ CodeRabbit Configuration File

If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

Files:

  • packages/types/src/signUp.ts
  • packages/shared/src/web3.ts
  • packages/types/src/signIn.ts
  • packages/clerk-js/src/core/resources/SignIn.ts
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/utils/web3.ts
  • packages/clerk-js/src/core/resources/SignUp.ts
  • packages/clerk-js/src/core/clerk.ts
  • packages/react/src/isomorphicClerk.ts
  • packages/types/src/web3.ts
.changeset/**

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

Automated releases must use Changesets.

Files:

  • .changeset/silent-insects-cheat.md
🧬 Code Graph Analysis (5)
packages/clerk-js/src/core/resources/SignIn.ts (2)
packages/types/src/signIn.ts (1)
  • SignInResource (76-128)
packages/clerk-js/src/utils/web3.ts (2)
  • getBaseAccountIdentifier (61-63)
  • generateSignatureWithBaseAccount (82-84)
packages/clerk-js/src/utils/web3.ts (1)
packages/types/src/web3Wallet.ts (1)
  • GenerateSignatureParams (36-40)
packages/clerk-js/src/core/resources/SignUp.ts (2)
packages/types/src/signUp.ts (2)
  • SignUpAuthenticateWithWeb3Params (210-212)
  • SignUpResource (50-120)
packages/clerk-js/src/utils/web3.ts (2)
  • getBaseAccountIdentifier (61-63)
  • generateSignatureWithBaseAccount (82-84)
packages/clerk-js/src/core/clerk.ts (2)
packages/types/src/clerk.ts (1)
  • AuthenticateWithCoinbaseWalletParams (2167-2173)
packages/clerk-js/src/utils/web3.ts (3)
  • generateSignatureWithBaseAccount (82-84)
  • generateSignatureWithCoinbaseWallet (74-76)
  • generateSignatureWithOKXWallet (78-80)
packages/react/src/isomorphicClerk.ts (1)
packages/types/src/clerk.ts (1)
  • AuthenticateWithBaseAccountParams (2188-2194)
🪛 ESLint
packages/clerk-js/src/utils/web3.ts

[error] 108-108: 'e' is defined but never used.

(@typescript-eslint/no-unused-vars)

🪛 GitHub Actions: CI
packages/clerk-js/src/utils/web3.ts

[warning] 96-98: Module not found: Can't resolve '@base-org/account' in '/home/runner/_work/javascript/javascript/packages/clerk-js/src/utils' (import in web3.ts during build:bundle).


[error] 103-103: TS2307: Cannot find module '@base-org/account' or its corresponding type declarations.

⏰ 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: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (9)
packages/types/src/web3.ts (1)

12-18: No action required: web3_base_account_signature is already included in Web3Strategy

  • Web3Strategy is defined as
    export type Web3Strategy = \web3_${Web3Provider}_signature`;`
  • Web3Provider includes
    export type BaseAccountWeb3Provider = 'base_account';
    and is part of the union used in that template literal.
  • Therefore 'web3_base_account_signature' is implicitly part of Web3Strategy.
packages/shared/src/web3.ts (1)

9-13: LGTM: provider entry added and order consistent with @clerk/types

Provider key, strategy, and display name look correct and align with the types registry. Good placement right after MetaMask.

packages/clerk-js/src/core/resources/SignIn.ts (1)

45-55: Imports for Base Account look correct

New web3 utils (generateSignatureWithBaseAccount, getBaseAccountIdentifier) are imported consistently alongside existing providers.

packages/clerk-js/src/core/clerk.ts (1)

103-124: Importing Base signature helper is fine

The added import for generateSignatureWithBaseAccount is consistent with existing helpers.

packages/clerk-js/src/core/resources/SignUp.ts (1)

29-39: Imports for Base Account utilities look good

Consistent import additions for generateSignatureWithBaseAccount and getBaseAccountIdentifier.

packages/react/src/isomorphicClerk.ts (2)

15-55: Type surface updated to include Base Account params

The addition of AuthenticateWithBaseAccountParams to the types import is correct and enables proper typing downstream.


1354-1361: Isomorphic proxy for Base Account matches existing pattern (LGTM)

Premount queuing + proxy call are implemented consistently with other auth methods.

packages/types/src/clerk.ts (2)

817-821: New Clerk API: authenticateWithBaseAccount

API shape and return type match the existing wallet methods. Brief JSDoc is present. Looks good.


2188-2194: Params interface for Base Account is aligned with other providers

The params mirror the Coinbase/OKX parameter types. All good.

Copy link

pkg-pr-new bot commented Aug 16, 2025

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6556

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6556

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6556

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6556

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6556

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6556

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6556

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6556

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6556

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6556

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6556

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6556

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6556

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6556

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6556

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6556

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6556

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6556

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6556

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6556

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6556

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6556

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6556

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6556

commit: e5be17f

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/clerk-js/package.json (1)

66-66: Add/confirm tests for Base Account auth paths

If not already in this PR, add tests covering:

  • getBaseAccountIdentifier and generateSignatureWithBaseAccount happy/edge cases
  • authenticateWithBaseAccount on Clerk, SignIn, SignUp, and IsomorphicClerk flows (success, user cancel, provider unavailable)
  • Strategy wiring to web3_base_account_signature in shared provider list

This helps prevent regressions across sign-in/sign-up surfaces.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • 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 681dcf7 and b1231e3.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • packages/clerk-js/package.json (1 hunks)
  • packages/clerk-js/src/core/clerk.ts (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/clerk-js/src/core/clerk.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/clerk-js/package.json
packages/*/package.json

📄 CodeRabbit Inference Engine (.cursor/rules/global.mdc)

All publishable packages should be placed under the packages/ directory

packages/*/package.json: All publishable packages must be located in the 'packages/' directory.
All packages must be published under the @clerk namespace on npm.
Semantic versioning must be used across all packages.

Files:

  • packages/clerk-js/package.json
**/*

⚙️ CodeRabbit Configuration File

If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

Files:

  • packages/clerk-js/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep/ci
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (2)
packages/clerk-js/package.json (2)

66-66: Dependency addition looks correct and consistent with existing Web3 deps

Pinning "@base-org/account" to 2.0.1 mirrors the exact-pin approach used for "@coinbase/wallet-sdk" and aligns with the PR’s Base Account support. Good placement under runtime dependencies.


66-66: Dependency health check: @base-org/account@2.0.1

  • License: Apache-2.0 (MIT-compatible)
  • Peer dependencies: none
  • Vulnerabilities (OSV): none found
  • Module format: ESM only (pkg.json "type":"module"); CJS entries declared but Node will treat .js as ESM
  • Browser support: browser field points to dist/base-account.min.js for script-tag usage
  • Registry metadata: 371 files, unpacked size ~7.39 MB (no dist.size reported)

Please run local bundle-impact checks before merge:
• pnpm --filter @clerk/clerk-js bundlewatch
• pnpm --filter @clerk/clerk-js build:stats (inspect stats.json)

@jacekradko jacekradko changed the title feat: Support base wallet feat(clerk-js,react): Support base wallet Aug 18, 2025
@jacekradko jacekradko changed the title feat(clerk-js,react): Support base wallet feat(clerk-js,clerk-react): Support base wallet Aug 18, 2025
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: 4

♻️ Duplicate comments (1)
packages/clerk-js/src/utils/web3.ts (1)

101-111: Add RHC/unsupported env guard and surface a dev-friendly warning on import failure

Coinbase branch guards __BUILD_DISABLE_RHC__ and emits an environment warning. Mirror that for Base Wallet to avoid SSR/RHC pitfalls and help developers debug missing SDK installs. Also consider a dev-only warning in the catch.

Apply this diff:

   if (provider === 'base_wallet') {
-    try {
+    if (__BUILD_DISABLE_RHC__) {
+      clerkUnsupportedEnvironmentWarning('Base Wallet');
+      return null;
+    }
+    try {
       const { createBaseAccountSDK } = await import('@base-org/account');
       const sdk = createBaseAccountSDK({
         appName: typeof document !== 'undefined' ? document.title || 'Clerk' : 'Clerk',
       });
       return sdk.getProvider();
     } catch {
+      // Optionally log a dev-friendly warning (guard with your internal dev flag if available)
+      // console.warn('[Clerk] Failed to initialize Base Account SDK. Is @base-org/account installed?');
       return null;
     }
   }
🧹 Nitpick comments (1)
packages/types/src/clerk.ts (1)

2188-2195: Add JSDoc for new public params interface

All public APIs and their params should be documented. Add a short JSDoc block to mirror the other wallet param interfaces.

Apply this diff:

+/**
+ * Parameters for {@link Clerk.authenticateWithBaseWallet}.
+ * Mirrors {@link AuthenticateWithCoinbaseWalletParams}.
+ */
 export interface AuthenticateWithBaseWalletParams {
   customNavigate?: (to: string) => Promise<unknown>;
   redirectUrl?: string;
   signUpContinueUrl?: string;
   unsafeMetadata?: SignUpUnsafeMetadata;
   legalAccepted?: boolean;
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • 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 4e5193a and eccdecb.

📒 Files selected for processing (10)
  • packages/clerk-js/src/core/clerk.ts (4 hunks)
  • packages/clerk-js/src/core/resources/SignIn.ts (3 hunks)
  • packages/clerk-js/src/core/resources/SignUp.ts (2 hunks)
  • packages/clerk-js/src/utils/web3.ts (3 hunks)
  • packages/react/src/isomorphicClerk.ts (2 hunks)
  • packages/shared/src/web3.ts (1 hunks)
  • packages/types/src/clerk.ts (2 hunks)
  • packages/types/src/signIn.ts (1 hunks)
  • packages/types/src/signUp.ts (1 hunks)
  • packages/types/src/web3.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • packages/types/src/signIn.ts
  • packages/react/src/isomorphicClerk.ts
  • packages/types/src/signUp.ts
  • packages/shared/src/web3.ts
  • packages/clerk-js/src/core/resources/SignIn.ts
  • packages/clerk-js/src/core/clerk.ts
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

**/*.{js,jsx,ts,tsx}: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels

Files:

  • packages/clerk-js/src/core/resources/SignUp.ts
  • packages/types/src/clerk.ts
  • packages/types/src/web3.ts
  • packages/clerk-js/src/utils/web3.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/clerk-js/src/core/resources/SignUp.ts
  • packages/types/src/clerk.ts
  • packages/types/src/web3.ts
  • packages/clerk-js/src/utils/web3.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/clerk-js/src/core/resources/SignUp.ts
  • packages/types/src/clerk.ts
  • packages/types/src/web3.ts
  • packages/clerk-js/src/utils/web3.ts
packages/**/*.{ts,tsx,d.ts}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Packages should export TypeScript types alongside runtime code

Files:

  • packages/clerk-js/src/core/resources/SignUp.ts
  • packages/types/src/clerk.ts
  • packages/types/src/web3.ts
  • packages/clerk-js/src/utils/web3.ts
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Use const assertions for literal types: as const
Use satisfies operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports: import type { ... } from ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)

Files:

  • packages/clerk-js/src/core/resources/SignUp.ts
  • packages/types/src/clerk.ts
  • packages/types/src/web3.ts
  • packages/clerk-js/src/utils/web3.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.

Files:

  • packages/clerk-js/src/core/resources/SignUp.ts
  • packages/types/src/clerk.ts
  • packages/types/src/web3.ts
  • packages/clerk-js/src/utils/web3.ts
**/*

⚙️ CodeRabbit Configuration File

If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

Files:

  • packages/clerk-js/src/core/resources/SignUp.ts
  • packages/types/src/clerk.ts
  • packages/types/src/web3.ts
  • packages/clerk-js/src/utils/web3.ts
🧬 Code Graph Analysis (2)
packages/clerk-js/src/core/resources/SignUp.ts (2)
packages/types/src/signUp.ts (2)
  • SignUpAuthenticateWithWeb3Params (210-212)
  • SignUpResource (50-120)
packages/clerk-js/src/utils/web3.ts (2)
  • getBaseWalletIdentifier (61-63)
  • generateSignatureWithCoinbaseWallet (74-76)
packages/clerk-js/src/utils/web3.ts (1)
packages/types/src/web3Wallet.ts (1)
  • GenerateSignatureParams (36-40)
⏰ 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). (4)
  • GitHub Check: Build Packages
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (3)
packages/clerk-js/src/utils/web3.ts (1)

61-63: LGTM: Identifier helper for Base Wallet mirrors existing pattern

This wrapper correctly plugs Base Wallet into the generic getWeb3Identifier flow.

packages/types/src/clerk.ts (1)

817-821: LGTM: Public Clerk API gains Base Wallet method

API shape and JSDoc align with existing Metamask/Coinbase/OKX entries.

packages/types/src/web3.ts (1)

31-35: LGTM: Base Wallet provider & strategy union verified

  • Confirmed base_wallet is included in the Web3Provider union in packages/types/src/web3.ts
  • The template-literal Web3Strategy = \web3_${Web3Provider}_signature`automatically coversweb3_base_wallet_signature`
  • Shared WEB3_PROVIDERS in packages/shared/src/web3.ts includes the new Base Wallet entry

No further changes needed.

@jacekradko jacekradko changed the title feat(clerk-js,clerk-react): Support base wallet feat(clerk-js,clerk-react): Support Base Wallet Aug 18, 2025
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 (3)
packages/elements/src/react/hooks/use-third-party-provider.hook.ts (3)

79-95: Reduce duplication: map Web3 providers to strategies instead of chained conditionals

Consolidating the provider→strategy mapping reduces chance of omissions when adding new wallets and keeps this logic DRY.

Apply this diff to replace the four Web3-specific ifs with a single mapping:

-      if (provider === 'base_wallet') {
-        return ref.send({ type: 'AUTHENTICATE.WEB3', strategy: 'web3_base_wallet_signature' });
-      }
-
-      if (provider === 'metamask') {
-        return ref.send({ type: 'AUTHENTICATE.WEB3', strategy: 'web3_metamask_signature' });
-      }
-
-      if (provider === 'coinbase_wallet') {
-        return ref.send({ type: 'AUTHENTICATE.WEB3', strategy: 'web3_coinbase_wallet_signature' });
-      }
-
-      if (provider === 'okx_wallet') {
-        return ref.send({ type: 'AUTHENTICATE.WEB3', strategy: 'web3_okx_wallet_signature' });
-      }
+      const web3StrategyByProvider = {
+        metamask: 'web3_metamask_signature',
+        coinbase_wallet: 'web3_coinbase_wallet_signature',
+        okx_wallet: 'web3_okx_wallet_signature',
+        base_wallet: 'web3_base_wallet_signature',
+      } as const satisfies Record<Web3Provider, string>;
+
+      const web3Strategy = web3StrategyByProvider[provider as Web3Provider];
+      if (web3Strategy) {
+        return ref.send({ type: 'AUTHENTICATE.WEB3', strategy: web3Strategy });
+      }

100-105: Fix dashboard link for all Web3 providers (including Base Wallet)

The error message links to the Web3 dashboard section only for MetaMask. Base Wallet (and other Web3 wallets) should also route to /web3.

Apply this diff to generalize the path:

-  const dashboardPath = `https://dashboard.clerk.com/last-active?path=/user-authentication/${provider === 'metamask' ? 'web3' : 'social-connections'}`;
+  const isWeb3Provider =
+    provider === 'metamask' ||
+    provider === 'coinbase_wallet' ||
+    provider === 'okx_wallet' ||
+    provider === 'base_wallet';
+  const dashboardPath = `https://dashboard.clerk.com/last-active?path=/user-authentication/${isWeb3Provider ? 'web3' : 'social-connections'}`;

63-98: Add tests for Base Wallet flow through this hook

Please add unit/integration tests to cover:

  • authenticate() dispatch for provider === 'base_wallet' (AUTHENTICATE.WEB3 with web3_base_wallet_signature)
  • Error path when Base Wallet is disabled (throws with correct dashboard link)

I can scaffold tests for the hook (using react-testing-library + xstate actor mocks). Want me to open a follow-up PR with test coverage?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • 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 5e05b7a and df00e95.

📒 Files selected for processing (1)
  • packages/elements/src/react/hooks/use-third-party-provider.hook.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

**/*.{js,jsx,ts,tsx}: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels

Files:

  • packages/elements/src/react/hooks/use-third-party-provider.hook.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/elements/src/react/hooks/use-third-party-provider.hook.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/elements/src/react/hooks/use-third-party-provider.hook.ts
packages/**/*.{ts,tsx,d.ts}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Packages should export TypeScript types alongside runtime code

Files:

  • packages/elements/src/react/hooks/use-third-party-provider.hook.ts
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Use const assertions for literal types: as const
Use satisfies operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports: import type { ... } from ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)

Files:

  • packages/elements/src/react/hooks/use-third-party-provider.hook.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.

Files:

  • packages/elements/src/react/hooks/use-third-party-provider.hook.ts
**/*

⚙️ CodeRabbit Configuration File

If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

Files:

  • packages/elements/src/react/hooks/use-third-party-provider.hook.ts
⏰ 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). (4)
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Build Packages
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
packages/elements/src/react/hooks/use-third-party-provider.hook.ts (1)

79-81: Verified: Base Wallet Web3 strategy fully integrated

All checks confirm that the new base_wallet branch is correctly wired:

  • WEB3_PROVIDERS entries in both packages/types/src/web3.ts and packages/shared/src/web3.ts include provider: 'base_wallet' with strategy: 'web3_base_wallet_signature'.
  • providerToDisplayData (from third-party-strategies.ts) aggregates WEB3_PROVIDERS, so providerToDisplayData['base_wallet'] is defined.
  • Web3Provider and Web3Strategy types in packages/types/src include BaseWalletWeb3Provider ('base_wallet') and therefore the strategy template web3_${Web3Provider}_signature covers web3_base_wallet_signature.
  • Router types (BaseRouterRedirectWeb3Event) and both Sign-In/Sign-Up XState machines accept the 'AUTHENTICATE.WEB3' event with our strategy.

All dependencies, types, registries, and state transitions are in place.

Copy link
Member

@tmilewski tmilewski left a comment

Choose a reason for hiding this comment

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

Nice! Just one simple comment regarding remotely hosted code.

Comment on lines +103 to +107
const { createBaseAccountSDK } = await import('@base-org/account');
const sdk = createBaseAccountSDK({
appName: typeof document !== 'undefined' ? document.title || 'Clerk' : 'Clerk',
});
return sdk.getProvider();
Copy link
Member

Choose a reason for hiding this comment

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

🙃 Just make sure that this doesn't wind up in the No RHC/Chrome Extension build with __BUILD_DISABLE_RHC__. Some prior art is on line 86 of this file.

Copy link
Member Author

Choose a reason for hiding this comment

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

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 (2)
packages/clerk-js/rspack.config.js (2)

104-110: Isolate @base-org/account into its own async chunk (nice). Consider grouping its deps to avoid extra network hops.

The dedicated cacheGroup with higher priority ensures Base Account code doesn’t bleed into vendors. To further reduce additional async vendor requests, consider capturing the dependency subtree of @base-org/account into the same chunk (when those deps aren’t shared elsewhere) by matching on the issuer chain.

Apply this if you want to co-locate its non-shared deps with the base-account chunk:

-          baseAccountVendor: {
-            test: /[\\/]node_modules[\\/](@base-org\/account)[\\/]/,
-            name: 'base-account',
-            chunks: 'async',
-            priority: 50,
-            enforce: true,
-          },
+          baseAccountVendor: {
+            // Group @base-org/account and its dependency subtree into one async chunk
+            test: module => {
+              const re = /[\\/]node_modules[\\/]@base-org[\\/]account[\\/]/;
+              const res = module.resource || '';
+              if (re.test(res)) return true;
+              // Walk issuer chain to include modules whose issuer is @base-org/account
+              let issuer = module.issuer;
+              while (issuer) {
+                const issuerRes = issuer.resource || '';
+                if (re.test(issuerRes)) return true;
+                issuer = issuer.issuer;
+              }
+              return false;
+            },
+            name: 'base-account',
+            chunks: 'async',
+            priority: 50,
+            enforce: true,
+          },

Note: If any of those deps are also used by initial chunks, rspack will prefer hoisting to shared vendors; this keeps duplication low while still attempting to co-locate when possible.


129-129: Confirm intention: ui-common limited to initial chunks

Switching ui-common to chunks: 'initial' can reduce the risk of async-only code leaking into the common chunk, but may also reduce cross-chunk reuse and slightly increase async payload duplication. If unintentional, consider using 'all' here.

If broader sharing was intended:

-            chunks: 'initial',
+            chunks: 'all',
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • 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 df00e95 and dd94966.

📒 Files selected for processing (3)
  • packages/clerk-js/bundlewatch.config.json (1 hunks)
  • packages/clerk-js/rspack.config.js (2 hunks)
  • packages/clerk-js/src/utils/web3.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/clerk-js/src/utils/web3.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/clerk-js/bundlewatch.config.json
  • packages/clerk-js/rspack.config.js
**/*

⚙️ CodeRabbit Configuration File

If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

Files:

  • packages/clerk-js/bundlewatch.config.json
  • packages/clerk-js/rspack.config.js
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

**/*.{js,jsx,ts,tsx}: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels

Files:

  • packages/clerk-js/rspack.config.js
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.

Files:

  • packages/clerk-js/rspack.config.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Build Packages
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (2)
packages/clerk-js/bundlewatch.config.json (1)

11-11: Verify base-account bundlewatch entry

Before approving, please perform the following checks once your CI artifacts are available:

  • Confirm the emitted chunk filenames under packages/clerk-js/dist match the glob base-account*.js (rspack uses name: 'base-account' plus any hash or variant suffix).

  • Measure the actual size of the async “base-account” chunk and adjust the "maxSize": "45KB" threshold accordingly.

  • Ensure the cache group in packages/clerk-js/rspack.config.js is named exactly 'base-account' and targets only async chunks:

      baseAccountVendor: {
        test: /[\\/]node_modules[\\/]@base-org\/account[\\/]/,
        name: 'base-account',
        chunks: 'async',
        priority: 50,
      },
  • Verify there are no static imports or CommonJS requires of @base-org/account (it must be loaded dynamically):

    rg -n -C2 "import\s+.*from\s+['\"]@base-org/account['\"]" packages/clerk-js
    rg -n -C2 "require\(['\"]@base-org/account['\"]\)" packages/clerk-js
    rg -n -C2 "import\(['\"]@base-org/account" packages/clerk-js

Once you’ve validated filenames, import patterns, and size, please update the budget if needed and mark this ready.

packages/clerk-js/rspack.config.js (1)

134-139: Exclude @base-org/account from defaultVendors (good).

Guarding on module.resource and excluding @base-org/account avoids it being folded into vendors, letting the dedicated cacheGroup own it. Looks correct.

Copy link
Member

@chanioxaris chanioxaris left a comment

Choose a reason for hiding this comment

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

Let's make sure to use 'Base' instead of 'Base Wallet' across our naming and source code

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

Successfully merging this pull request may close these issues.

4 participants