@@ -41,7 +41,7 @@ export class WalletServicesPlugin extends SafeEventEmitter implements IPlugin {
4141 private isInitialized = false ;
4242
4343 get proxyProvider ( ) : SafeEventEmitterProvider | null {
44- return this . wsEmbedInstance . provider ? ( this . wsEmbedInstance . provider as unknown as SafeEventEmitterProvider ) : null ;
44+ return this . wsEmbedInstance ? .provider ? ( this . wsEmbedInstance . provider as unknown as SafeEventEmitterProvider ) : null ;
4545 }
4646
4747 async initWithWeb3Auth ( web3auth : IWeb3AuthCore , _whiteLabel ?: WhiteLabelData ) : Promise < void > {
@@ -101,32 +101,32 @@ export class WalletServicesPlugin extends SafeEventEmitter implements IPlugin {
101101 }
102102
103103 async showWalletConnectScanner ( showWalletConnectParams ?: BaseEmbedControllerState [ "showWalletConnect" ] ) : Promise < void > {
104- if ( ! this . wsEmbedInstance . isLoggedIn ) throw WalletServicesPluginError . walletPluginNotConnected ( ) ;
104+ if ( ! this . wsEmbedInstance ? .isLoggedIn ) throw WalletServicesPluginError . walletPluginNotConnected ( ) ;
105105 return this . wsEmbedInstance . showWalletConnectScanner ( showWalletConnectParams ) ;
106106 }
107107
108108 async showCheckout ( showCheckoutParams ?: BaseEmbedControllerState [ "showCheckout" ] ) : Promise < void > {
109- if ( ! this . wsEmbedInstance . isLoggedIn ) throw WalletServicesPluginError . walletPluginNotConnected ( ) ;
109+ if ( ! this . wsEmbedInstance ? .isLoggedIn ) throw WalletServicesPluginError . walletPluginNotConnected ( ) ;
110110 return this . wsEmbedInstance . showCheckout ( showCheckoutParams ) ;
111111 }
112112
113113 async showWalletUi ( showWalletUiParams ?: BaseEmbedControllerState [ "showWalletUi" ] ) : Promise < void > {
114- if ( ! this . wsEmbedInstance . isLoggedIn ) throw WalletServicesPluginError . walletPluginNotConnected ( ) ;
114+ if ( ! this . wsEmbedInstance ? .isLoggedIn ) throw WalletServicesPluginError . walletPluginNotConnected ( ) ;
115115 return this . wsEmbedInstance . showWalletUi ( showWalletUiParams ) ;
116116 }
117117
118118 async showSwap ( showSwapParams ?: BaseEmbedControllerState [ "showSwap" ] ) : Promise < void > {
119- if ( ! this . wsEmbedInstance . isLoggedIn ) throw WalletServicesPluginError . walletPluginNotConnected ( ) ;
119+ if ( ! this . wsEmbedInstance ? .isLoggedIn ) throw WalletServicesPluginError . walletPluginNotConnected ( ) ;
120120 return this . wsEmbedInstance . showSwap ( showSwapParams ) ;
121121 }
122122
123123 async cleanup ( ) : Promise < void > {
124- return this . wsEmbedInstance . cleanUp ( ) ;
124+ return this . wsEmbedInstance ? .cleanUp ( ) ;
125125 }
126126
127127 async disconnect ( ) : Promise < void > {
128128 // if web3auth is being used and connected to unsupported connector throw error
129- if ( this . wsEmbedInstance . isLoggedIn ) {
129+ if ( this . wsEmbedInstance ? .isLoggedIn ) {
130130 await this . wsEmbedInstance . logout ( ) ;
131131 this . emit ( PLUGIN_EVENTS . DISCONNECTED ) ;
132132 this . status = PLUGIN_STATUS . DISCONNECTED ;
0 commit comments