Skip to content

Commit f351d6b

Browse files
Merge pull request #2041 from Web3Auth/feat/allow-wallet-aa-without-aa-provider
Update aa config to require bundler and smart account type
2 parents 02b0d16 + 19e225d commit f351d6b

File tree

1 file changed

+5
-2
lines changed
  • packages/plugins/wallet-services-plugin/src

1 file changed

+5
-2
lines changed

packages/plugins/wallet-services-plugin/src/plugin.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ export class WalletServicesPlugin extends SafeEventEmitter implements IPlugin {
9999
if (!connectedChainConfig.ticker) throw WalletServicesPluginError.invalidParams("ticker is required in chainConfig");
100100
if (!connectedChainConfig.tickerName) throw WalletServicesPluginError.invalidParams("tickerName is required in chainConfig");
101101

102-
const enableAccountAbstraction =
102+
const hasAaProvider =
103103
web3auth.coreOptions.accountAbstractionProvider &&
104104
(web3auth.connectedAdapterName === WALLET_ADAPTERS.AUTH ||
105105
(web3auth.connectedAdapterName !== WALLET_ADAPTERS.AUTH && web3auth.coreOptions.useAAWithExternalWallet));
106106

107107
let accountAbstractionConfig: AccountAbstractionConfig;
108108

109-
if (enableAccountAbstraction) {
109+
if (hasAaProvider) {
110110
const smartAccountAddress = (web3auth.coreOptions.accountAbstractionProvider as AccountAbstractionProvider)?.smartAccount.address;
111111
const smartAccountType = (web3auth.coreOptions.accountAbstractionProvider as AccountAbstractionProvider)?.config.smartAccountInit.name;
112112
const paymasterConfig = (web3auth.coreOptions.accountAbstractionProvider as AccountAbstractionProvider)?.config?.paymasterConfig;
@@ -119,6 +119,9 @@ export class WalletServicesPlugin extends SafeEventEmitter implements IPlugin {
119119
paymasterConfig: paymasterConfig || undefined,
120120
bundlerConfig: bundlerConfig || undefined,
121121
} as AccountAbstractionConfig;
122+
} else if (this.walletInitOptions?.accountAbstractionConfig && Object.keys(this.walletInitOptions.accountAbstractionConfig).length > 0) {
123+
// if wallet services plugin is initialized with accountAbstractionConfig we enable wallet service AA without AA provider
124+
accountAbstractionConfig = this.walletInitOptions.accountAbstractionConfig;
122125
}
123126

124127
const finalInitOptions = {

0 commit comments

Comments
 (0)