@@ -9,12 +9,14 @@ import {
99 type MultiStepAuthArgsType ,
1010 type SingleStepAuthArgsType ,
1111 inAppWallet as thirdwebInAppWallet ,
12+ type Wallet ,
1213} from "thirdweb/wallets" ;
1314
1415export type InAppWalletParameters = Prettify <
1516 InAppWalletCreationOptions & {
1617 client : ThirdwebClient ;
1718 ecosystemId ?: `ecosystem.${string } `;
19+ onConnect ?: ( wallet : Wallet ) => void ;
1820 }
1921> ;
2022export type InAppWalletConnector = ReturnType < typeof inAppWalletConnector > ;
@@ -106,6 +108,7 @@ export function inAppWalletConnector(
106108 chain : defineChain ( chainId ) ,
107109 client,
108110 wallets : [ wallet ] ,
111+ onConnect : args . onConnect ,
109112 } ) ;
110113
111114 const account = wallet . getAccount ( ) ;
@@ -140,6 +143,7 @@ export function inAppWalletConnector(
140143 rawStorage ?. setItem ( connectedWalletIdsKey , JSON . stringify ( [ wallet . id ] ) ) ;
141144 rawStorage ?. setItem ( activeWalletIdKey , wallet . id ) ;
142145 await config . storage ?. setItem ( "thirdweb:lastChainId" , chain . id ) ;
146+ args . onConnect ?.( wallet ) ;
143147 return { accounts : [ getAddress ( account . address ) ] , chainId : chain . id } ;
144148 } ,
145149 disconnect : async ( ) => {
@@ -166,6 +170,7 @@ export function inAppWalletConnector(
166170 chain,
167171 client,
168172 wallets : [ wallet ] ,
173+ onConnect : args . onConnect ,
169174 } ) ;
170175 }
171176 return EIP1193 . toProvider ( {
0 commit comments