File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
packages/thirdweb/src/wallets/coinbase Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " thirdweb " : patch
3+ ---
4+
5+ Dont attempt chain switching for cb wallet if already connected to the right chain
Original file line number Diff line number Diff line change @@ -474,6 +474,16 @@ async function switchChainCoinbaseWalletSDK(
474474 provider : ProviderInterface ,
475475 chain : Chain ,
476476) {
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+
477487 const chainIdHex = numberToHex ( chain . id ) ;
478488
479489 try {
You can’t perform that action at this time.
0 commit comments