[SDK] fix: ignore EIP-1193 code 1013 transient disconnect in injected… (#8807)

Co-authored-by: Cursor <[email protected]>
Co-authored-by: 0xFirekeeper <[email protected]>
This commit is contained in:
Yash
2026-06-15 22:24:42 +07:00
committed by GitHub
co-authored by Cursor 0xFirekeeper
parent 8ab8e07fb1
commit 8c521aa06a
8 changed files with 125 additions and 6 deletions
@@ -0,0 +1,7 @@
---
"thirdweb": patch
---
Fix: injected wallets (e.g. MetaMask) no longer fire a spurious `"disconnect"` event for transient EIP-1193 error code 1013 ("disconnected, will reconnect"). Previously, MetaMask's temporary disconnect during chain changes or RPC hiccups would trigger the thirdweb `disconnect` subscriber and tear down wallet state, causing unexpected logouts. The `onDisconnect` handler now ignores code-1013 errors and lets MetaMask reconnect automatically.
Additionally, the `WalletEmitterEvents["disconnect"]` type is updated from `never` to `WalletDisconnectError | undefined`, so `disconnect` subscribers can inspect the underlying EIP-1193 error code and message when they need to distinguish disconnect causes.