Skip to content

feat(mosaic): sign up with a web3 wallet - #11062

Draft
austincalvelage wants to merge 14 commits into
austin/mosaic-sign-up-email-linkfrom
austin/mosaic-sign-up-web3-wallets
Draft

austincalvelage wants to merge 14 commits into
austin/mosaic-sign-up-email-linkfrom
austin/mosaic-sign-up-web3-wallets

Conversation

@austincalvelage

@austincalvelage austincalvelage commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Description

Signs up with a Web3 wallet in Mosaic <SignUp />. Stacked on #11049.

On an instance with web3 first factors, the start screen shows a button for each wallet (MetaMask, Coinbase Wallet, OKX Wallet, Base, Solana), after the social buttons and in the instance's order. A wallet that already belongs to a user signs that user in, as the legacy SignUp does. A new wallet signs up and then goes on like the form: continue, the Protect check, or finishing. Solana opens a wallet chooser. A web3-only instance now shows these buttons instead of an empty card. The buttons are hidden during an invitation sign-up and on continue, as in legacy.

Shared changes (for Mosaic reviewers)

  • useSolanaWallets moves from user-profile to src/hooks/ with no behavior change (first commit), then gains a required { enabled } so sign-up asks wallets to register only once the chooser opens (second commit). That is a new parameter on a shared hook. Austin asked for the move to ship in this PR; both commits sit at the bottom so they can be split out. A third commit adds loadSolanaWallets() beside the hook: it loads the library once and resolves with the eligible wallets, sharing the hook's eligibility rule. The hook's signature and behavior are unchanged. The reuse list in AGENTS.md and the hook's .doc.ts are updated.
  • src/__tests__/feature/wallets.ts holds registerWallets, stubEvmModules, solanaWallet and holdWalletRegistry, shared by the sign-up and user-profile tests. fapi.ts gains a typed fapiSignIn builder.
  • The fake FAPI signs up and signs in with a web3 wallet. It mirrors an instance with enumeration protection off, and docs/testing.md says so.
  • finishSignIn(resource, { landing }) is extracted from the OAuth return's transfer branch, and both paths use it.

1. A wallet click tries sign-in first, then signs up. These are the steps clerk.authenticateWithWeb3 takes, run in the model so the flow controller keeps the result. The Future signUp.web3() can't do Solana, has no walletName, and never tries sign-in.

// sign-up.model.ts
const identifier = await getWeb3Identifier({ provider: provider.provider, walletName });
const signedIn = await client.signIn.authenticateWithWeb3(wallet).catch(/* form_identifier_not_found → undefined */);
if (signedIn) {
  await finishSignIn(signedIn.__internal_future, { landing: afterSignUpUrl });
  return undefined;
}
const signedUp = await client.signUp.authenticateWithWeb3({ ...wallet, unsafeMetadata, legalAccepted });
return next(signedUp.__internal_future);

2. The result goes through the same flow as the form. A new sign-up returns its step to next, so continue (which no longer asks for a password once the wallet is verified), Protect, finishing and the in-card organization task work unchanged. An existing wallet's sign-in finishes in place and lands on the after sign-up URL, as legacy does, or goes to the sign-in route for a step it still needs.

3. Solana holds its button until the wallet list is ready, then opens the chooser on choose-wallet. It follows the enterprise connection chooser: the click runs in the provider buttons' pending action, the model's listWallets() returns the list, and the flow opens the chooser with go('wallets') and the list in hand, so its spinner never shows. The chooser lists the installed wallet-standard wallets that can sign in with Solana and keeps following wallets that register or unregister. With none installed it links to a wallet list. Back returns to start. Opening /choose-wallet directly shows the spinner until the list is ready. On an instance without Solana, or during an invitation, the route falls back to start.

Situation Sign-up
No wallet installed "A Web3 Wallet extension cannot be found…", and nothing is sent to FAPI
The user rejects the signature The rejected copy, and the button works again
FAPI blocks the request The blocked notice
Clerk rejects the sign-up Its error on the form
Anything else The generic error

Deliberate changes from legacy

  • A rejected EVM signature (wallet code 4001) shows web3_signature_request_rejected. Legacy shows the wallet's raw message.
  • An unknown failure shows the generic error. Legacy shows nothing.
  • No wallet installed sends nothing to FAPI. Legacy sends a sign-in with an empty identifier and remaps form_param_nil.
  • A failed wallet sign-up resets the client sign-up. Otherwise getSignUpNextStep maps the unverified wallet to unknown and the user sees Start over.
  • The Solana chooser sends legal consent and lands missing fields on continue. Legacy drops consent and resolves continue relative to choose-wallet.
  • A wallet sign-in that still needs a step goes to the sign-in route for it, such as first factor or reset password. Legacy navigates only for Protect and second factor.

Known gaps

  • A wallet sign-in that needs a second factor, a Protect check or a session task has no test. It reuses the OAuth transfer finish, which does.
  • The Coinbase and Base SDK popups have no test.
  • If the wallet library fails to load, pressing Solana again shows the same error until the page is reloaded: the browser keeps a failed module load failed for the page.
  • The untested cases are listed as it.todo in the web3 test file, including browser Back from the chooser, which belongs to the path routing work.
  • On a web3-only instance with legal consent, consent is asked on continue, following the existing Mosaic rule. Legacy's start screen may differ.
  • SignInFirstFactorJSON types the web3 factor as web_3_wallet_id, but the wire field is web3_wallet_id. The fake casts that one field.

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:

🤖 Generated with Claude Code

@vercel

vercel Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Dec 2, 2026 5:57pm UTC
mosaic-docs Ready Ready Preview Dec 2, 2026 5:57pm UTC
swingset Ready Ready Preview Dec 2, 2026 5:57pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ab86440

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

This PR includes changesets to release 0 packages

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

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

coderabbitai Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@pkg-pr-new

pkg-pr-new Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@11062

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@11062

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@11062

@clerk/expo

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

@clerk/expo-biometrics

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

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@11062

@clerk/expo-native-components

npm i https://pkg.pr.new/@clerk/expo-native-components@11062

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@11062

@clerk/localizations

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

@clerk/mosaic

npm i https://pkg.pr.new/@clerk/mosaic@11062

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@11062

@clerk/upgrade

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

@clerk/vue

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

commit: ab86440

Move the Solana wallet discovery hook from the user profile's web3 section
to src/hooks so sign-up can list the same wallets. User profile imports it
from there; its behavior and tests are unchanged.
A caller that stays mounted, such as a flow whose wallet picker is one of
its routes, enables discovery only while the picker shows, so installed
wallets are not asked to register before then. The user profile's picker
mounts only while open and enables it always.
Sign-up's wallet tests register wallet-standard wallets and stub Clerk's
Coinbase and Base SDK imports the way the user profile's do, so
registerWallets and stubEvmModules move next to the other feature test
helpers and the testing guide lists them.
The sign-up fake accepts a web3_wallet, prepares a web3 signature with a
nonce and message, verifies the signature of that message and drops the
password requirement once the wallet is verified, as FAPI does. The sign-in
fake answers form_identifier_not_found for an unknown wallet and signs in a
known one through the first-factor prepare and attempt.
The start screen shows a button for each web3 first factor between the
social providers and the other phone channels. A wallet that already has a
user signs that user in; a new one signs up, continues with any fields the
instance still needs, and finishes like the form. Rejecting the signature
shows the rejected copy, and any failure resets the half-made sign-up so the
error shows on the start screen.
The Solana button opens the choose-wallet route, which lists the installed
wallet-standard wallets that can sign in with Solana and follows wallets
that register while it is open. Discovery starts only when the chooser
shows. Picking a wallet runs the same sign-in-first flow with that wallet
and the start screen's legal consent; Back returns to the start screen.
…wallet

Add the web3 wallet section to the sign-in and sign-up flow doc, and
Swingset stories for the start screen's wallet buttons and the chooser
while it looks for wallets or finds none.
A button that opens a wallet picker can now wait for the list inside its
pending action and open the picker with the list in hand. It shares the
eligibility rule with useSolanaWallets, whose signature and behavior are
unchanged.
The Solana button now loads the wallet list under the start screen's
provider action, so it stays pending and the rest of the screen disabled
until the list is ready, and a failure shows on the start screen. The flow
then opens the chooser with that list, which it shows until live discovery
takes over, so the chooser never opens onto its spinner. Opening the chooser
route directly still shows the spinner until the list is ready.
A wallet sign-in that needs a second factor, a Protect check or a session task reuses the OAuth transfer finish and has no wallet test. Pressing Solana again after the wallet library failed to load does not load it again, because the browser keeps a failed module load failed for the page. Browser Back from the chooser belongs to the path routing work.
…activity machine

The wallet sign-in now resolves with signed_in, like the OAuth return's, and
next sends it to FINALIZE. The result says where it came from, so it still
lands on the after sign-up URL and sends a task to the sign-in task route, as
legacy's authenticateWithWeb3 does.
Choosing a Solana wallet is now the choosingWallet state, like choosing an
enterprise connection. CHOOSE_WALLET keeps the list until Back sends
CANCEL_WALLETS, in place of the controller's useState.

This branch was successfully deployed

2 active deployments
Preview – swingset — ab86440d Deployed Dec 2, 2026 by vercel[bot]
Preview – clerk-js-sandbox — ab86440d Deployed Dec 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant