-
Notifications
You must be signed in to change notification settings - Fork 125
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
feat: add plugin manager decorator for MSCA #274
Conversation
012fa4e
to
0453694
Compare
0453694
to
b3cbe07
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some questions on setup, thanks for porting this over from 6900
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should the plugin-manager be under "plugins"? especially since it's a separate interface than pluginExecutors?
i'd have put it in a different folder under msca, but curious what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I was gonna keep all plugin stuff in plugins
the plugins/manager
was meant to denote that it is separate from executors. What are you suggesting as a alt? I'm open to moving it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was suggesting /accounts/src/msca/plugin-manager
as the folder for the manager, as opposed to the /accounts/src/msca/plugins
for the plugin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yea I'm fine with that change too
type UninstallPluginParams, | ||
} from "./uninstallPlugin.js"; | ||
|
||
export const pluginManagerDecorator = < |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit[learn] is there a reason you're using the keyword "Decorator", isnce it's mainly used for functions that wrap some context (a class/method), not an object as you have here? As I understand it from typescript, do you plan to use it like:
class ExampleClass {
@pluginManagerDecorator()
method() {}
}
I can see this being very useful for the plugins themselves on something like execute
, but as for the manager feels more like an extend function, like ".withPluginManager()"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea a decorator is the @
thing usually, but this is also meant to be used with the Decorator Pattern defined on provider and account: https://refactoring.guru/design-patterns/decorator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@moldy530 how should we integrate with the provider in aa-sdk?
should we have the clients of aa-sdk to directly use this decorator on the SmartAccountProvider (AlchemyProvider or other) on the client side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea the idea is that any ISmartAccountProvider
can call .extend(pluginManagerDecorator)
as a result we don't really need to provide much more than this. I think we can take all of the decorators that we build for MSCA in one big mscaDecorators
or something to make this easier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@denniswon see: #287
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this need any re-factoring re: fitting into #287's new Plugin interface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, I think it's fine for this to be standalone as it is here. the MSCA builder will just leverage this as is
type UninstallPluginParams, | ||
} from "./uninstallPlugin.js"; | ||
|
||
export const pluginManagerDecorator = < |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@moldy530 how should we integrate with the provider in aa-sdk?
should we have the clients of aa-sdk to directly use this decorator on the SmartAccountProvider (AlchemyProvider or other) on the client side?
b3cbe07
to
56d6277
Compare
4f99d57
to
dc4c98b
Compare
4c1b14b
to
9052c2e
Compare
e453d12
to
26460de
Compare
6a2cce7
to
7a7328f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last few recs, then lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was suggesting /accounts/src/msca/plugin-manager
as the folder for the manager, as opposed to the /accounts/src/msca/plugins
for the plugin
type UninstallPluginParams, | ||
} from "./uninstallPlugin.js"; | ||
|
||
export const pluginManagerDecorator = < |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this need any re-factoring re: fitting into #287's new Plugin interface?
7a7328f
to
9e24f7b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
manifestHash?: Hash; | ||
pluginInitData?: Hash; | ||
dependencies?: Address[]; | ||
injectedHooks?: InjectedHook[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we have these here? are there cases where plugin manifest contract cannot be read through rpc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is on the interface: https://eips.ethereum.org/EIPS/eip-6900#ipluginmanagersol
9e24f7b
to
ef0f578
Compare
* feat: add some plugin generation logic * chore: add generate commands * style: apply PR suggestion Co-authored-by: Dennis Won <[email protected]> * refactor: create plugin config concept * feat: add multi-owner-msca impl that leverages the plugin gen (#263) * feat: add multi-owner-msca impl that leverages the plugin gen * feat: proposal for msca builder pattern (#264) * feat: proposal for msca builder pattern * refactor: rework plugin gen to create read methods for the account --------- Co-authored-by: Dennis Won <[email protected]>
* feat: add a mechanism for adding provider decorators to accounts * chore: update lerna and package json to lint generated files * refactor: rename MSCA to IMSCA
8c812a8
to
eb454b6
Compare
* feat: add initial skeleton for 6900 account support * feat: add some plugin generation logic (#262) * feat: add some plugin generation logic * chore: add generate commands * style: apply PR suggestion Co-authored-by: Dennis Won <[email protected]> * refactor: create plugin config concept * feat: add multi-owner-msca impl that leverages the plugin gen (#263) * feat: add multi-owner-msca impl that leverages the plugin gen * feat: proposal for msca builder pattern (#264) * feat: proposal for msca builder pattern * refactor: rework plugin gen to create read methods for the account --------- Co-authored-by: Dennis Won <[email protected]> * chore: update plugin gen * feat: add plugin manager decorator for MSCA * feat: add a mechanism for adding provider decorators to accounts (#287) * feat: add a mechanism for adding provider decorators to accounts * chore: update lerna and package json to lint generated files * refactor: rename MSCA to IMSCA --------- Co-authored-by: Dennis Won <[email protected]> Co-authored-by: avasisht23 <[email protected]>
* feat: add initial skeleton for 6900 account support * feat: add some plugin generation logic (#262) * feat: add some plugin generation logic * chore: add generate commands * style: apply PR suggestion Co-authored-by: Dennis Won <[email protected]> * refactor: create plugin config concept * feat: add multi-owner-msca impl that leverages the plugin gen (#263) * feat: add multi-owner-msca impl that leverages the plugin gen * feat: proposal for msca builder pattern (#264) * feat: proposal for msca builder pattern * refactor: rework plugin gen to create read methods for the account --------- Co-authored-by: Dennis Won <[email protected]> * chore: update plugin gen * feat: add plugin manager decorator for MSCA * feat: add a mechanism for adding provider decorators to accounts (#287) * feat: add a mechanism for adding provider decorators to accounts * chore: update lerna and package json to lint generated files * refactor: rename MSCA to IMSCA --------- Co-authored-by: Dennis Won <[email protected]> Co-authored-by: avasisht23 <[email protected]>
* feat: add initial skeleton for 6900 account support * feat: add some plugin generation logic (#262) * feat: add some plugin generation logic * chore: add generate commands * style: apply PR suggestion Co-authored-by: Dennis Won <[email protected]> * refactor: create plugin config concept * feat: add multi-owner-msca impl that leverages the plugin gen (#263) * feat: add multi-owner-msca impl that leverages the plugin gen * feat: proposal for msca builder pattern (#264) * feat: proposal for msca builder pattern * refactor: rework plugin gen to create read methods for the account --------- Co-authored-by: Dennis Won <[email protected]> * chore: update plugin gen * feat: add plugin manager decorator for MSCA * feat: add a mechanism for adding provider decorators to accounts (#287) * feat: add a mechanism for adding provider decorators to accounts * chore: update lerna and package json to lint generated files * refactor: rename MSCA to IMSCA --------- Co-authored-by: Dennis Won <[email protected]> Co-authored-by: avasisht23 <[email protected]>
* feat: add initial skeleton for 6900 account support * feat: add some plugin generation logic (#262) * feat: add some plugin generation logic * chore: add generate commands * style: apply PR suggestion Co-authored-by: Dennis Won <[email protected]> * refactor: create plugin config concept * feat: add multi-owner-msca impl that leverages the plugin gen (#263) * feat: add multi-owner-msca impl that leverages the plugin gen * feat: proposal for msca builder pattern (#264) * feat: proposal for msca builder pattern * refactor: rework plugin gen to create read methods for the account --------- Co-authored-by: Dennis Won <[email protected]> * chore: update plugin gen * feat: add plugin manager decorator for MSCA * feat: add a mechanism for adding provider decorators to accounts (#287) * feat: add a mechanism for adding provider decorators to accounts * chore: update lerna and package json to lint generated files * refactor: rename MSCA to IMSCA --------- Co-authored-by: Dennis Won <[email protected]> Co-authored-by: avasisht23 <[email protected]>
* feat: add initial skeleton for 6900 account support * feat: add some plugin generation logic (#262) * feat: add some plugin generation logic * chore: add generate commands * style: apply PR suggestion Co-authored-by: Dennis Won <[email protected]> * refactor: create plugin config concept * feat: add multi-owner-msca impl that leverages the plugin gen (#263) * feat: add multi-owner-msca impl that leverages the plugin gen * feat: proposal for msca builder pattern (#264) * feat: proposal for msca builder pattern * refactor: rework plugin gen to create read methods for the account --------- Co-authored-by: Dennis Won <[email protected]> * chore: update plugin gen * feat: add plugin manager decorator for MSCA * feat: add a mechanism for adding provider decorators to accounts (#287) * feat: add a mechanism for adding provider decorators to accounts * chore: update lerna and package json to lint generated files * refactor: rename MSCA to IMSCA --------- Co-authored-by: Dennis Won <[email protected]> Co-authored-by: avasisht23 <[email protected]>
* feat: add initial skeleton for 6900 account support * feat: add some plugin generation logic (#262) * feat: add some plugin generation logic * chore: add generate commands * style: apply PR suggestion Co-authored-by: Dennis Won <[email protected]> * refactor: create plugin config concept * feat: add multi-owner-msca impl that leverages the plugin gen (#263) * feat: add multi-owner-msca impl that leverages the plugin gen * feat: proposal for msca builder pattern (#264) * feat: proposal for msca builder pattern * refactor: rework plugin gen to create read methods for the account --------- Co-authored-by: Dennis Won <[email protected]> * chore: update plugin gen * feat: add plugin manager decorator for MSCA * feat: add a mechanism for adding provider decorators to accounts (#287) * feat: add a mechanism for adding provider decorators to accounts * chore: update lerna and package json to lint generated files * refactor: rename MSCA to IMSCA --------- Co-authored-by: Dennis Won <[email protected]> Co-authored-by: avasisht23 <[email protected]>
* feat: add initial skeleton for 6900 account support * feat: add some plugin generation logic (#262) * feat: add some plugin generation logic * chore: add generate commands * style: apply PR suggestion Co-authored-by: Dennis Won <[email protected]> * refactor: create plugin config concept * feat: add multi-owner-msca impl that leverages the plugin gen (#263) * feat: add multi-owner-msca impl that leverages the plugin gen * feat: proposal for msca builder pattern (#264) * feat: proposal for msca builder pattern * refactor: rework plugin gen to create read methods for the account --------- Co-authored-by: Dennis Won <[email protected]> * chore: update plugin gen * feat: add plugin manager decorator for MSCA * feat: add a mechanism for adding provider decorators to accounts (#287) * feat: add a mechanism for adding provider decorators to accounts * chore: update lerna and package json to lint generated files * refactor: rename MSCA to IMSCA --------- Co-authored-by: Dennis Won <[email protected]> Co-authored-by: avasisht23 <[email protected]>
* feat: add initial skeleton for 6900 account support * feat: add some plugin generation logic (#262) * feat: add some plugin generation logic * chore: add generate commands * style: apply PR suggestion Co-authored-by: Dennis Won <[email protected]> * refactor: create plugin config concept * feat: add multi-owner-msca impl that leverages the plugin gen (#263) * feat: add multi-owner-msca impl that leverages the plugin gen * feat: proposal for msca builder pattern (#264) * feat: proposal for msca builder pattern * refactor: rework plugin gen to create read methods for the account --------- Co-authored-by: Dennis Won <[email protected]> * chore: update plugin gen * feat: add plugin manager decorator for MSCA * feat: add a mechanism for adding provider decorators to accounts (#287) * feat: add a mechanism for adding provider decorators to accounts * chore: update lerna and package json to lint generated files * refactor: rename MSCA to IMSCA --------- Co-authored-by: Dennis Won <[email protected]> Co-authored-by: avasisht23 <[email protected]>
* feat: add some plugin generation logic (#262) * feat: add some plugin generation logic * chore: add generate commands * style: apply PR suggestion Co-authored-by: Dennis Won <[email protected]> * refactor: create plugin config concept * feat: add multi-owner-msca impl that leverages the plugin gen (#263) * feat: add multi-owner-msca impl that leverages the plugin gen * feat: proposal for msca builder pattern (#264) * feat: proposal for msca builder pattern * refactor: rework plugin gen to create read methods for the account --------- Co-authored-by: Dennis Won <[email protected]> * chore: lint * feat: add plugin manager decorator for MSCA (#274) * feat: add initial skeleton for 6900 account support * feat: add some plugin generation logic (#262) * feat: add some plugin generation logic * chore: add generate commands * style: apply PR suggestion Co-authored-by: Dennis Won <[email protected]> * refactor: create plugin config concept * feat: add multi-owner-msca impl that leverages the plugin gen (#263) * feat: add multi-owner-msca impl that leverages the plugin gen * feat: proposal for msca builder pattern (#264) * feat: proposal for msca builder pattern * refactor: rework plugin gen to create read methods for the account --------- Co-authored-by: Dennis Won <[email protected]> * chore: update plugin gen * feat: add plugin manager decorator for MSCA * feat: add a mechanism for adding provider decorators to accounts (#287) * feat: add a mechanism for adding provider decorators to accounts * chore: update lerna and package json to lint generated files * refactor: rename MSCA to IMSCA --------- Co-authored-by: Dennis Won <[email protected]> Co-authored-by: avasisht23 <[email protected]> * fix: missed some plugingen fixes * refactor: change the names of the plugin decorators and add example usages (#308) * feat: extend msca account with account loupe decorators (#309) * refactor: move required by types to aa-core utils types folder * feat: extend msca account with account loupe decorators * feat: move extend method on account from msca to base account * Update packages/core/src/account/types.ts Co-authored-by: Michael Moldoveanu <[email protected]> * Update packages/core/src/account/types.ts Co-authored-by: Michael Moldoveanu <[email protected]> * Update packages/core/src/account/types.ts Co-authored-by: Michael Moldoveanu <[email protected]> * Update packages/accounts/src/msca/account-loupe/decorator.ts Co-authored-by: Michael Moldoveanu <[email protected]> * fix: fix lint and build --------- Co-authored-by: Michael Moldoveanu <[email protected]> * fix: update the logic for signing 1271 messages * feat: msca plugingen to accept multichain address format (#314) * feat: msca plugingen to accept multichain address format * Update packages/accounts/scripts/plugingen.ts Co-authored-by: Michael Moldoveanu <[email protected]> * Update packages/accounts/wagmi.config.ts Co-authored-by: Michael Moldoveanu <[email protected]> * feat: changed address field in plugingenconfig to addresses --------- Co-authored-by: Michael Moldoveanu <[email protected]> * feat: msca token receiver plugin with opt out option to exclude default token receiver plugin (#316) * feat: msca plugingen to accept multichain address format * feat: msca token receiver plugin with opt out option to exclude default token receiver plugin * feat: add session key plugin abi and plugingen (#284) * feat: msca plugingen to accept multichain address format * feat: msca token receiver plugin with opt out option to exclude default token receiver plugin * feat: msca token receiver plugin with opt out option to exclude default token receiver plugin * feat: add session key plugin abi and plugingen * feat: msca plugin provider decorator to support user op overrides (#342) * feat: msca plugingen to generate subfolders for each plugin (#350) --------- Co-authored-by: Dennis Won <[email protected]> Co-authored-by: avasisht23 <[email protected]>
* feat: add initial skeleton for 6900 account support * feat: add some plugin generation logic (#262) * feat: add some plugin generation logic * chore: add generate commands * style: apply PR suggestion Co-authored-by: Dennis Won <[email protected]> * refactor: create plugin config concept * feat: add multi-owner-msca impl that leverages the plugin gen (#263) * feat: add multi-owner-msca impl that leverages the plugin gen * feat: proposal for msca builder pattern (#264) * feat: proposal for msca builder pattern * refactor: rework plugin gen to create read methods for the account --------- Co-authored-by: Dennis Won <[email protected]> * chore: update plugin gen * feat: add plugin manager decorator for MSCA * feat: add a mechanism for adding provider decorators to accounts (#287) * feat: add a mechanism for adding provider decorators to accounts * chore: update lerna and package json to lint generated files * refactor: rename MSCA to IMSCA --------- Co-authored-by: Dennis Won <[email protected]> Co-authored-by: avasisht23 <[email protected]>
* feat: add initial skeleton for 6900 account support * feat: add some plugin generation logic (#262) * feat: add some plugin generation logic * chore: add generate commands * style: apply PR suggestion Co-authored-by: Dennis Won <[email protected]> * refactor: create plugin config concept * feat: add multi-owner-msca impl that leverages the plugin gen (#263) * feat: add multi-owner-msca impl that leverages the plugin gen * feat: proposal for msca builder pattern (#264) * feat: proposal for msca builder pattern * refactor: rework plugin gen to create read methods for the account --------- Co-authored-by: Dennis Won <[email protected]> * chore: update plugin gen * feat: add plugin manager decorator for MSCA * feat: add a mechanism for adding provider decorators to accounts (#287) * feat: add a mechanism for adding provider decorators to accounts * chore: update lerna and package json to lint generated files * refactor: rename MSCA to IMSCA --------- Co-authored-by: Dennis Won <[email protected]> Co-authored-by: avasisht23 <[email protected]>
Pull Request Checklist
yarn test
)site
folder, see guidleines below)feat!: breaking change
)yarn lint:check
) and fix any issues? (yarn lint:fix
)development
and notmain
?PR-Codex overview
This PR focuses on improving the plugin management system in the codebase.
Detailed summary:
generate
script innx.json
.generate
script inpackage.json
which runs thegenerate
command.build
script inpackage.json
to include alint:write
command after the build process.useAlchemyProvider
hook inaa-simple-dapp
to use thecreateMultiOwnerMSCA
function instead ofLightSmartContractAccount
.accounts
package.core
package.provider
package to include new types and imports related to plugin management.SmartAccountProvider
class in theprovider
package to include support for provider decorators.disconnect
method in theSmartAccountProvider
class to include support for provider decorators.msca
package.accounts
package.