diff --git a/packages/plugins/wallet-services-plugin/src/plugin.ts b/packages/plugins/wallet-services-plugin/src/plugin.ts index 1fde5037c..2476e2d51 100644 --- a/packages/plugins/wallet-services-plugin/src/plugin.ts +++ b/packages/plugins/wallet-services-plugin/src/plugin.ts @@ -99,14 +99,14 @@ export class WalletServicesPlugin extends SafeEventEmitter implements IPlugin { if (!connectedChainConfig.ticker) throw WalletServicesPluginError.invalidParams("ticker is required in chainConfig"); if (!connectedChainConfig.tickerName) throw WalletServicesPluginError.invalidParams("tickerName is required in chainConfig"); - const enableAccountAbstraction = + const hasAaProvider = web3auth.coreOptions.accountAbstractionProvider && (web3auth.connectedAdapterName === WALLET_ADAPTERS.AUTH || (web3auth.connectedAdapterName !== WALLET_ADAPTERS.AUTH && web3auth.coreOptions.useAAWithExternalWallet)); let accountAbstractionConfig: AccountAbstractionConfig; - if (enableAccountAbstraction) { + if (hasAaProvider) { const smartAccountAddress = (web3auth.coreOptions.accountAbstractionProvider as AccountAbstractionProvider)?.smartAccount.address; const smartAccountType = (web3auth.coreOptions.accountAbstractionProvider as AccountAbstractionProvider)?.config.smartAccountInit.name; const paymasterConfig = (web3auth.coreOptions.accountAbstractionProvider as AccountAbstractionProvider)?.config?.paymasterConfig; @@ -119,6 +119,9 @@ export class WalletServicesPlugin extends SafeEventEmitter implements IPlugin { paymasterConfig: paymasterConfig || undefined, bundlerConfig: bundlerConfig || undefined, } as AccountAbstractionConfig; + } else if (this.walletInitOptions?.accountAbstractionConfig && Object.keys(this.walletInitOptions.accountAbstractionConfig).length > 0) { + // if wallet services plugin is initialized with accountAbstractionConfig we enable wallet service AA without AA provider + accountAbstractionConfig = this.walletInitOptions.accountAbstractionConfig; } const finalInitOptions = {