@@ -103,19 +103,23 @@ export class WalletServicesPlugin extends SafeEventEmitter implements IPlugin {
103103 web3auth . coreOptions . useAAWithExternalWallet &&
104104 ( web3auth . connectedAdapterName === WALLET_ADAPTERS . AUTH ||
105105 ( web3auth . connectedAdapterName !== WALLET_ADAPTERS . AUTH && web3auth . coreOptions . useAAWithExternalWallet ) ) ;
106- const smartAccountAddress = ( web3auth . coreOptions . accountAbstractionProvider as AccountAbstractionProvider ) ?. smartAccount . address ;
107- const smartAccountType = ( web3auth . coreOptions . accountAbstractionProvider as AccountAbstractionProvider ) ?. config . smartAccountInit . name ;
108- const paymasterConfig = ( web3auth . coreOptions . accountAbstractionProvider as AccountAbstractionProvider ) ?. config ?. paymasterConfig ;
109- const bundlerConfig = ( web3auth . coreOptions . accountAbstractionProvider as AccountAbstractionProvider ) ?. config ?. bundlerConfig ;
110-
111- // TODO: fix this type casting when we start using accountAbstractionController
112- const accountAbstractionConfig = {
113- enabled : enableAccountAbstraction ,
114- smartAccountAddress : smartAccountAddress || undefined ,
115- smartAccountType : smartAccountType || undefined ,
116- paymasterConfig : paymasterConfig || undefined ,
117- bundlerConfig : bundlerConfig || undefined ,
118- } as AccountAbstractionConfig ;
106+
107+ let accountAbstractionConfig : AccountAbstractionConfig ;
108+
109+ if ( enableAccountAbstraction ) {
110+ const smartAccountAddress = ( web3auth . coreOptions . accountAbstractionProvider as AccountAbstractionProvider ) ?. smartAccount . address ;
111+ const smartAccountType = ( web3auth . coreOptions . accountAbstractionProvider as AccountAbstractionProvider ) ?. config . smartAccountInit . name ;
112+ const paymasterConfig = ( web3auth . coreOptions . accountAbstractionProvider as AccountAbstractionProvider ) ?. config ?. paymasterConfig ;
113+ const bundlerConfig = ( web3auth . coreOptions . accountAbstractionProvider as AccountAbstractionProvider ) ?. config ?. bundlerConfig ;
114+
115+ // TODO: fix this type casting when we start using accountAbstractionController
116+ accountAbstractionConfig = {
117+ smartAccountAddress : smartAccountAddress || undefined ,
118+ smartAccountType : smartAccountType || undefined ,
119+ paymasterConfig : paymasterConfig || undefined ,
120+ bundlerConfig : bundlerConfig || undefined ,
121+ } as AccountAbstractionConfig ;
122+ }
119123
120124 const finalInitOptions = {
121125 ...this . walletInitOptions ,
0 commit comments