File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -261,9 +261,15 @@ export class Web3AuthNoModal extends SafeEventEmitter<Web3AuthNoModalEvents> imp
261261 async connectTo < T > ( walletName : WALLET_ADAPTER_TYPE , loginParams ?: T ) : Promise < IProvider | null > {
262262 if ( ! this . walletAdapters [ walletName ] || ! this . commonJRPCProvider )
263263 throw WalletInitializationError . notFound ( `Please add wallet adapter for ${ walletName } wallet, before connecting` ) ;
264- const provider = await this . walletAdapters [ walletName ] . connect ( loginParams ) ;
265- this . commonJRPCProvider . updateProviderEngineProxy ( ( provider as IBaseProvider < unknown > ) . provider || ( provider as SafeEventEmitterProvider ) ) ;
266- return this . provider ;
264+ return new Promise ( ( resolve , reject ) => {
265+ this . once ( ADAPTER_EVENTS . CONNECTED , ( _ ) => {
266+ resolve ( this . provider ) ;
267+ } ) ;
268+ this . once ( ADAPTER_EVENTS . ERRORED , ( err ) => {
269+ reject ( err ) ;
270+ } ) ;
271+ this . walletAdapters [ walletName ] . connect ( loginParams ) ;
272+ } ) ;
267273 }
268274
269275 async logout ( options : { cleanup : boolean } = { cleanup : false } ) : Promise < void > {
You can’t perform that action at this time.
0 commit comments