We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9809d5c commit 52aba0fCopy full SHA for 52aba0f
2 files changed
.changeset/vast-nails-wash.md
@@ -0,0 +1,5 @@
1
+---
2
+"thirdweb": patch
3
4
+
5
+Dont attempt chain switching for cb wallet if already connected to the right chain
packages/thirdweb/src/wallets/coinbase/coinbase-web.ts
@@ -474,6 +474,16 @@ async function switchChainCoinbaseWalletSDK(
474
provider: ProviderInterface,
475
chain: Chain,
476
) {
477
+ // check if chain is already connected
478
+ const connectedChainId = (await provider.request({
479
+ method: "eth_chainId",
480
+ })) as string | number;
481
+ const connectedChain = getCachedChain(normalizeChainId(connectedChainId));
482
+ if (connectedChain?.id === chain.id) {
483
+ // chain is already connected, no need to switch
484
+ return;
485
+ }
486
487
const chainIdHex = numberToHex(chain.id);
488
489
try {
0 commit comments