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(
95
95
const lastChainId = await config . storage ?. getItem ( "tw.lastChainId" ) ;
96
96
if ( params ?. isReconnecting ) {
97
97
const { autoConnect } = await import ( "thirdweb/wallets" ) ;
98
+ const chainId = lastChainId || args . smartAccount ?. chain ?. id || 1 ;
98
99
await autoConnect ( {
99
100
client,
100
- chain : defineChain ( lastChainId || 1 ) ,
101
+ chain : defineChain ( chainId ) ,
101
102
wallets : [ wallet ] ,
102
103
} ) ;
103
104
@@ -108,7 +109,7 @@ export function inAppWalletConnector(
108
109
109
110
return {
110
111
accounts : [ getAddress ( account . address ) ] ,
111
- chainId : lastChainId || 1 ,
112
+ chainId : chainId ,
112
113
} ;
113
114
}
114
115
const inAppOptions = params && "strategy" in params ? params : undefined ;
@@ -117,7 +118,12 @@ export function inAppWalletConnector(
117
118
"Missing strategy prop, pass it to connect() when connecting to this connector" ,
118
119
) ;
119
120
}
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
+ ) ;
121
127
const decoratedOptions = {
122
128
...inAppOptions ,
123
129
client,
You can’t perform that action at this time.
0 commit comments