Skip to content

Conversation

@joaquim-verges
Copy link
Member

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


PR-Codex overview

This PR focuses on improving the management of SIWE (Sign-In with Ethereum) chains for external wallets, particularly those that do not support the Ethereum mainnet.

Detailed summary

  • Added a constant NON_ETHEREUM_WALLETS to identify wallets that cannot sign with Ethereum mainnet.
  • Updated siweAuthenticate function to conditionally set siweChain based on whether the wallet is in NON_ETHEREUM_WALLETS.
  • Ensured fallback to mainnet for SIWE compatibility remains intact.

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

Summary by CodeRabbit

  • Bug Fixes
    • Refined SIWE chain management for external wallets to maintain consistent authentication behavior across all wallet types.

@changeset-bot
Copy link

changeset-bot bot commented Nov 18, 2025

🦋 Changeset detected

Latest commit: 06d0538

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

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

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

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

@vercel
Copy link

vercel bot commented Nov 18, 2025

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

Project Deployment Preview Comments Updated (UTC)
docs-v2 Ready Ready Preview Comment Nov 18, 2025 9:56pm
nebula Ready Ready Preview Comment Nov 18, 2025 9:56pm
thirdweb_playground Ready Ready Preview Comment Nov 18, 2025 9:56pm
thirdweb-www Ready Ready Preview Comment Nov 18, 2025 9:56pm
wallet-ui Ready Ready Preview Comment Nov 18, 2025 9:56pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 18, 2025

Walkthrough

This PR adds a changeset documenting a patch release for improved SIWE chain management on external wallets. The primary code change introduces a NON_ETHEREUM_WALLETS constant in the SIWE authentication module with conditional logic branches that currently resolve to identical outcomes.

Changes

Cohort / File(s) Summary
Changeset documentation
\.changeset/sweet-lights-help\.md
Adds a new changeset entry documenting a patch release for the "thirdweb" scope focused on improved SIWE chain management for external wallets.
SIWE authentication refactoring
packages/thirdweb/src/wallets/in-app/core/authentication/siwe\.ts
Introduces a NON_ETHEREUM_WALLETS constant and adds conditional branching based on wallet.id membership; both branches call getCachedChain(1), resulting in no net behavior change. Includes minor comment adjustments.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • The changeset file is straightforward documentation.
  • The siwe.ts change is a structural refactoring with scaffolding for future logic; verify the NON_ETHEREUM_WALLETS constant definition and membership criteria are correct, and confirm the identical outcomes across branches are intentional rather than incomplete implementation.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning PR description lacks required template sections: missing issue tag, notes for reviewer, and how to test information. Add the Linear issue tag (TEAM-0000 format), notes for reviewer, and testing instructions to match the required template structure.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: improving SIWE chain management for external wallets, which is the core objective described in the PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch _SDK_Improve_SIWE_chain_management_for_external_wallets

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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

@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Nov 18, 2025
Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

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

@joaquim-verges joaquim-verges marked this pull request as ready for review November 18, 2025 21:38
@joaquim-verges joaquim-verges requested review from a team as code owners November 18, 2025 21:38
@joaquim-verges joaquim-verges force-pushed the _SDK_Improve_SIWE_chain_management_for_external_wallets branch from 97f3a8e to 06d0538 Compare November 18, 2025 21:39
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/thirdweb/src/wallets/in-app/core/authentication/siwe.ts (2)

13-15: Align comment and naming with actual SIWE behavior

The code makes sense (opt into chain for NON_ETHEREUM_WALLETS, fallback to mainnet otherwise), but the comments/naming could better match behavior:

  • Line 13: The comment says wallets "require a specific chain always", but the implementation still falls back to mainnet (chain || getCachedChain(1)). Consider rephrasing to something like “wallets that prefer a specific chain for SIWE, but fall back to mainnet”.
  • Line 14: If NON_ETHEREUM_WALLETS is meant to be a canonical list, you may want to add a short note or link indicating where wallet IDs like "xyz.abs" come from, so it’s easier to keep this list in sync with wallet metadata.
  • Lines 26–28: The branching is correct for the described behavior; if in the future you truly want to require a non‑mainnet chain for some wallets, you could tighten this by asserting that chain is defined for those IDs instead of silently falling back.

These are all clarity/maintainability points; behavior itself looks intentional.

Also applies to: 26-29


29-31: Fix small typo in comment

Line 29: alnreadyalready.

-  // only connect if the wallet doesn't alnready have an account
+  // only connect if the wallet doesn't already have an account
📜 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 73c924b and 06d0538.

📒 Files selected for processing (2)
  • .changeset/sweet-lights-help.md (1 hunks)
  • packages/thirdweb/src/wallets/in-app/core/authentication/siwe.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: joaquim-verges
Repo: thirdweb-dev/js PR: 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-03T23:44:40.243Z
Learnt from: joaquim-verges
Repo: thirdweb-dev/js PR: 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.

Applied to files:

  • .changeset/sweet-lights-help.md
  • packages/thirdweb/src/wallets/in-app/core/authentication/siwe.ts
🔇 Additional comments (1)
.changeset/sweet-lights-help.md (1)

1-5: Changeset description looks good

Patch scope and message are clear and aligned with the SIWE chain-management change.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 18, 2025

size-limit report 📦

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

@codecov
Copy link

codecov bot commented Nov 18, 2025

Codecov Report

❌ Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.83%. Comparing base (73c924b) to head (06d0538).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...web/src/wallets/in-app/core/authentication/siwe.ts 25.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8432      +/-   ##
==========================================
- Coverage   54.83%   54.83%   -0.01%     
==========================================
  Files         919      919              
  Lines       60865    60868       +3     
  Branches     4141     4141              
==========================================
+ Hits        33373    33374       +1     
- Misses      27390    27392       +2     
  Partials      102      102              
Flag Coverage Δ
packages 54.83% <25.00%> (-0.01%) ⬇️
Files with missing lines Coverage Δ
...web/src/wallets/in-app/core/authentication/siwe.ts 11.53% <25.00%> (+1.33%) ⬆️
🚀 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.

@joaquim-verges joaquim-verges merged commit 9983e6c into main Nov 18, 2025
26 of 32 checks passed
@joaquim-verges joaquim-verges deleted the _SDK_Improve_SIWE_chain_management_for_external_wallets branch November 18, 2025 22:03
@joaquim-verges joaquim-verges mentioned this pull request Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages SDK Involves changes to the thirdweb SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants