File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
packages/wagmi-adapter/src Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @thirdweb-dev/wagmi-adapter " : patch
3+ ---
4+
5+ Fix wagmi adapter usage with account factories
Original file line number Diff line number Diff line change @@ -95,9 +95,10 @@ export function inAppWalletConnector(
9595 const lastChainId = await config . storage ?. getItem ( "tw.lastChainId" ) ;
9696 if ( params ?. isReconnecting ) {
9797 const { autoConnect } = await import ( "thirdweb/wallets" ) ;
98+ const chainId = lastChainId || args . smartAccount ?. chain ?. id || 1 ;
9899 await autoConnect ( {
99100 client,
100- chain : defineChain ( lastChainId || 1 ) ,
101+ chain : defineChain ( chainId ) ,
101102 wallets : [ wallet ] ,
102103 } ) ;
103104
@@ -108,7 +109,7 @@ export function inAppWalletConnector(
108109
109110 return {
110111 accounts : [ getAddress ( account . address ) ] ,
111- chainId : lastChainId || 1 ,
112+ chainId : chainId ,
112113 } ;
113114 }
114115 const inAppOptions = params && "strategy" in params ? params : undefined ;
@@ -117,7 +118,12 @@ export function inAppWalletConnector(
117118 "Missing strategy prop, pass it to connect() when connecting to this connector" ,
118119 ) ;
119120 }
120- const chain = defineChain ( inAppOptions ?. chainId || lastChainId || 1 ) ;
121+ const chain = defineChain (
122+ inAppOptions ?. chainId ||
123+ lastChainId ||
124+ args . smartAccount ?. chain ?. id ||
125+ 1 ,
126+ ) ;
121127 const decoratedOptions = {
122128 ...inAppOptions ,
123129 client,
You can’t perform that action at this time.
0 commit comments