Skip to content

chore: upgrade web3auth to v11 - #47

Merged
jinoosss merged 3 commits into
mainfrom
chore/upgrade-web3auth-v11
Nov 13, 2026
Merged

jinoosss merged 3 commits into
mainfrom
chore/upgrade-web3auth-v11

Conversation

@jinoosss

@jinoosss jinoosss commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Summary

MetaMask Embedded Wallets (Web3Auth) v9 Web SDKs reached end-of-life and have been permanently discontinued. Apps on v9 can no longer authenticate through the Web3Auth Network, so social login via GnoSocialWalletProvider is currently broken. This PR migrates the SDK to @web3auth/no-modal v11 (the supported Web version), following the migration guide.

Changes

Dependencies (packages/sdk/package.json)

  • @web3auth/no-modal: 9.5.3 → 11.4.3
  • Removed @web3auth/auth-adapter, @web3auth/base, @web3auth/base-provider (merged into @web3auth/no-modal in v10+).
  • Added viem and @babel/runtime@^7. Both are required (non-optional) peer dependencies of @web3auth/no-modal@11, and viem is imported statically from its main entry.

GnoSocialWalletProvider

  • Dropped AuthAdapter / configureAdapter / code-side loginConfig. In v11 the AUTH connector is registered automatically from the auth connections configured on the dashboard.
  • The Gno chain is now passed via chains (namespace other) instead of a hand-built CommonPrivateKeyProvider. For the other namespace, v11 creates a CommonPrivateKeyProvider internally, so private_key export keeps working.
    • defaultChainId is not used because v11 requires it to be a hex string, which Gno chain IDs are not.
    • v11 merges dashboard chains in front of the code chains, and the initial chain decides which provider the AUTH connector sets up. A small GnoWeb3AuthNoModal subclass overrides initChainsConfig() to narrow the list to the Gno chain only.
  • connectTo(WALLET_ADAPTERS.AUTH, { loginProvider }) → connectTo(WALLET_CONNECTORS.AUTH, { authConnection, authConnectionId })
    • authConnection: google / twitter / email_passwordless
    • authConnectionId: the existing verifier config value (v9 verifiers map to dashboard auth connections)
    • Twitter keeps sending the v9 Auth0 parameters (connection: 'twitter', domain) through extraLoginOptions. Email passwordless keeps login_hint.
  • The private key is read from web3auth.connection.ethereumProvider, because web3auth.provider is write-only in v11.
  • The "already connected with another login" check now compares authConnection + authConnectionId from getUserInfo(). typeOfLogin no longer exists in v11.
    • In v11, getUserInfo() also fetches linked accounts over the network and can throw on a restored session. A failure is treated as a stale session: logout, re-initialize, and log in again.

Public types

  • SocialGoogleConfigure / SocialTwitterConfigure / SocialEmailPasswordlessConfigure: no shape changes (non-breaking). verifier is documented as the dashboard Auth Connection ID. authClientId / googleClientId are marked @deprecated because they are now configured on the dashboard.
  • SocialUserInfo (getSocialUserProfile response): added the v11 fields authConnection, authConnectionId, groupedAuthConnectionId, userId. The v9-only fields (typeOfLogin, verifier, verifierId, aggregateVerifier) are kept as optional and @deprecated.

Tests

  • @web3auth/no-modal@11 transitively loads ESM-only packages (@metamask/connect-evm ships .mjs even for the require condition), and Jest's CJS runtime cannot parse them. Added a Jest-only moduleNameMapper stub (src/__stubs__/web3auth-no-modal.ts). Unit tests never call Web3Auth.

Required dashboard setup (before release)

v11 resolves login configuration from the Embedded Wallets dashboard instead of code:

  • Each social login (Google / Twitter / Email passwordless) must exist as an auth connection whose Auth Connection ID matches the verifier value passed to the SDK.
  • The project must have at least one auth connection. Otherwise, v11 does not register the AUTH connector.

Verification

  • yarn lint
  • yarn test: 40 suites / 155 tests passed. Adds restored-session coverage for connect(), login params, and the real upstream initChainsConfig() + initCachedConnectorAndChainId() steps.
  • yarn build. The CJS (bin/index.js) and ESM (bin/index.mjs) bundles both load in Node 24.
  • Smoke-checked the generated connectTo params for Google / Twitter / Email passwordless.
  • Ran the real v11 init() in Node with jsdom. Only fetchProjectConfig was patched, and it returned an EVM dashboard chain. Result: init() succeeds, the current chain is the Gno chain, and the AUTH connector uses CommonPrivateKeyProvider.
  • Manual end-to-end social login against the real dashboard project (requires dashboard auth connections; not done in this PR).
  • Address continuity: log in with an existing v9 account on each social type and confirm the Gno address is unchanged.

Notes

  • @web3auth/no-modal@11 declares engines.node >= 22. The repo already uses Node 24 (.nvmrc).

Web3Auth (MetaMask Embedded Wallets) v9 SDKs have been discontinued and
can no longer authenticate through the Web3Auth Network. Migrate the
social wallet provider to @web3auth/no-modal v11.

@onbloc-intern onbloc-intern Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Request changes: the migrated initializer rejects non-hex Gno chain IDs before social login can start. Independently reproduced the existing inline finding: #47 (comment).

On the pinned @web3auth/no-modal@11.4.3, executing both actual initialization validators with chainNamespace: 'other' and defaultChainId: 'gnoland-1' fails with WalletInitializationError 5011 (Please provide a valid defaultChainId in constructor). The OTHER exemption in initChainsConfig() does not apply to the subsequent initCachedConnectorAndChainId() guard. Omitting defaultChainId passes that guard and selects chains[0].chainId. Remove the explicit default and add coverage that reaches both initialization steps; do not replace the real Gno chain ID with a hex alias.

Validation on 55bfcc0d17ca5ce194ab33f899a7a9b0e28aaef8 (local Node 22.23.1): immutable install, 38 Jest suites / 146 tests, build, lint, diff checks and CJS/ESM import smoke passed. Eight focused boundary probes also passed for login parameters, synthetic-key derivation, restored-session handling and fail-closed behavior, but they stubbed initialization and therefore did not establish that init() succeeds. The subsequent real-validator probe reproduced the blocker above. No full dashboard/OAuth login or existing-account address-continuity check was executed; those remain release verification requirements.

- Drop defaultChainId: v11 requires it to be a hex string, so init()
  threw for Gno chain IDs. Pin the chain list to the Gno chain instead,
  so dashboard-configured chains cannot become the initial chain and
  swap the AUTH connector away from the private key provider.
- Treat a getUserInfo() failure on a restored session as stale and log
  in again instead of aborting connect().
…params

- Split web3auth construction from init() and run the real upstream
  initChainsConfig() + initCachedConnectorAndChainId() in Jest, with
  and without dashboard chains, plus a guard for the non-hex
  defaultChainId rejection.
- Send the v9 Auth0 jwtParameters.connection ('twitter') again for
  Twitter login so the same identity provider is used.

@onbloc-intern onbloc-intern Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved on 47a57cb0be1ec2edbf0cbc0743057f3aaae48af3; this supersedes my earlier REQUEST_CHANGES review (5889132593).

The non-hex defaultChainId blocker is fixed. I ran the same offline harness against the built old and new SDKs, retaining the actual SDK factory and pinned upstream chain validators. The old head rejects gnoland-1; the new head omits the default and selects only the Gno other chain with no dashboard chains, an EVM dashboard chain, and a cached EVM chain. The synthetic restored-session failure also changes from aborting login to logout, reinitialization and fresh login. Reviewed the subclass filtering, restored-session fallback, Twitter parameters and both added regression suites; no remaining merge-blocking defect identified.

Validation on this head (Node 22.23.1): immutable install, both affected Jest suites (9 tests), build, lint, diff check and built CJS/ESM imports passed. The complete local Jest run timed out at 120 seconds and its retry timed out at 200 seconds; neither is a full-suite pass. The current GitHub build, lint and unit-test checks were observed successful. Prior source-review evidence was reused only for unchanged paths and dependency inputs.

Limits: the offline harness replaces init transport, OAuth and RPC boundaries; it does not establish full dashboard login or existing-user address continuity. Those remain the documented release checks. This approval is a code-review judgment, not confirmation that social login is deployed or those checks are complete.

@jinoosss
jinoosss merged commit 5b07c87 into main Nov 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants