-
Notifications
You must be signed in to change notification settings - Fork 262
fix: do not support 7702/5792 for 4337 AA accounts #2507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
242a67f
e48f76f
0f8553a
ce3efcb
3725c90
b199357
c4980ae
e9312b1
3de8499
23bdef6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,8 @@ import { | |
| type AccountAbstractionMultiChainConfig, | ||
| type BiconomySmartAccountConfig, | ||
| type BundlerConfig, | ||
| EIP_5792_METHODS, | ||
| EIP_7702_METHODS, | ||
| type ISmartAccount, | ||
| type KernelSmartAccountConfig, | ||
| type MetamaskSmartAccountConfig, | ||
|
|
@@ -80,9 +82,10 @@ class AccountAbstractionProvider extends BaseProvider<AccountAbstractionProvider | |
| } | ||
|
|
||
| public async setupProvider(eoaProvider: IProvider): Promise<void> { | ||
| const { currentChain } = this; | ||
| const { chainNamespace } = currentChain; | ||
| if (chainNamespace !== this.PROVIDER_CHAIN_NAMESPACE) throw WalletInitializationError.incompatibleChainNameSpace("Invalid chain namespace"); | ||
| const currentChain = this.currentChain; | ||
| const chainNamespace = currentChain?.chainNamespace; | ||
| if (chainNamespace && chainNamespace !== this.PROVIDER_CHAIN_NAMESPACE) | ||
| throw WalletInitializationError.incompatibleChainNameSpace("Invalid chain namespace"); | ||
|
chaitanyapotti marked this conversation as resolved.
Outdated
|
||
| const bundlerAndPaymasterConfig = this.config.smartAccountChainsConfig.find((config) => config.chainId === currentChain.chainId); | ||
| if (!bundlerAndPaymasterConfig) | ||
| throw WalletInitializationError.invalidProviderConfigError(`Bundler and paymaster config not found for chain ${currentChain.chainId}`); | ||
|
|
@@ -154,7 +157,19 @@ class AccountAbstractionProvider extends BaseProvider<AccountAbstractionProvider | |
| eoaProvider, | ||
| handlers: providerHandlers, | ||
| }); | ||
| const eoaMiddleware = providerAsMiddleware(eoaProvider); | ||
|
|
||
| // override EIP-5792 and EIP-7702 methods to throw unsupported method error | ||
| // 4437 AA Account will not support the EIP7702/5792 methods | ||
| const overrideEip5792And7702MethodsHandlers = Object.fromEntries( | ||
| [...Object.values(EIP_5792_METHODS), ...Object.values(EIP_7702_METHODS)].map((method) => [ | ||
| method, | ||
| async () => { | ||
| throw providerErrors.unsupportedMethod(`${method} is not supported for account abstraction provider`); | ||
| }, | ||
| ]) | ||
| ); | ||
|
|
||
| const eoaMiddleware = providerAsMiddleware(eoaProvider, overrideEip5792And7702MethodsHandlers); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no. don't change provider as middleware.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed here, 0f8553a |
||
| const engine = JRPCEngineV2.create({ middleware: [aaMiddleware, eoaMiddleware] }); | ||
| const provider = providerFromEngineV2(engine); | ||
| this.updateProviderEngineProxy(provider); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.