Skip to content

Commit 8a981e5

Browse files
pass undefined aaConfig if it's not enabled on sdk config
1 parent a260b04 commit 8a981e5

File tree

1 file changed

+17
-13
lines changed
  • packages/plugins/wallet-services-plugin/src

1 file changed

+17
-13
lines changed

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

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)