Skip to content

Commit

Permalink
use wallet service plugin aa config if available
Browse files Browse the repository at this point in the history
  • Loading branch information
lionellbriones committed Dec 17, 2024
1 parent f00eed2 commit 19e225d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/plugins/wallet-services-plugin/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 = {
Expand Down

0 comments on commit 19e225d

Please sign in to comment.