Skip to content
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

Merged
merged 5 commits into from
Dec 1, 2023

Conversation

moldy530
Copy link
Collaborator

@moldy530 moldy530 commented Nov 22, 2023

Pull Request Checklist

  • Did you add new tests and confirm existing tests pass? (yarn test)
  • Did you update relevant docs? (docs are found in the site folder, see guidleines below)
  • Do your commits follow the Conventional Commits standard?
  • Does your PR title also follow the Conventional Commits standard?
  • If you have a breaking change, is it [correctly reflected in your commit message](https://www.conventionalcommits.org/en/v1.0.0/#examples? (e.g. feat!: breaking change)
  • Did you run lint (yarn lint:check) and fix any issues? (yarn lint:fix)
  • Is the base branch you're merging into development and not main?

PR-Codex overview

This PR focuses on improving the plugin management system in the codebase.

Detailed summary:

  • Added support for the generate script in nx.json.
  • Added a new generate script in package.json which runs the generate command.
  • Updated the build script in package.json to include a lint:write command after the build process.
  • Added new types and imports related to plugin management.
  • Updated the useAlchemyProvider hook in aa-simple-dapp to use the createMultiOwnerMSCA function instead of LightSmartContractAccount.
  • Added new files and changes related to plugin management in the accounts package.
  • Added new files and changes related to plugin management in the core package.
  • Updated the provider package to include new types and imports related to plugin management.
  • Updated the SmartAccountProvider class in the provider package to include support for provider decorators.
  • Updated the disconnect method in the SmartAccountProvider class to include support for provider decorators.
  • Added new files and changes related to plugin management in the msca package.
  • Added new exports and types related to plugin management in the accounts package.

The following files were skipped due to too many changes: packages/core/src/account/types.ts, packages/accounts/src/msca/plugins/multi-owner.ts, packages/accounts/scripts/plugingen.ts, packages/accounts/src/msca/abis/IPluginManager.ts, packages/accounts/src/msca/builder.ts

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link
Contributor

@avasisht23 avasisht23 left a 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

Copy link
Contributor

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.

Copy link
Collaborator Author

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

Copy link
Contributor

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

Copy link
Collaborator Author

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 = <
Copy link
Contributor

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()"?

Copy link
Collaborator Author

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

Copy link
Contributor

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?

Copy link
Collaborator Author

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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?

Copy link
Collaborator Author

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 = <
Copy link
Contributor

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?

Copy link
Contributor

@avasisht23 avasisht23 left a 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

Copy link
Contributor

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 = <
Copy link
Contributor

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?

@moldy530 moldy530 marked this pull request as ready for review November 30, 2023 20:03
Copy link
Contributor

@avasisht23 avasisht23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Comment on lines +16 to +19
manifestHash?: Hash;
pluginInitData?: Hash;
dependencies?: Address[];
injectedHooks?: InjectedHook[];
Copy link
Contributor

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moldy530 and others added 5 commits December 1, 2023 11:24
* 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
@moldy530 moldy530 merged commit 0f62d68 into msca-base Dec 1, 2023
2 of 3 checks passed
@moldy530 moldy530 deleted the moldy/plugin-manager branch December 1, 2023 16:25
moldy530 added a commit that referenced this pull request Dec 1, 2023
* 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]>
denniswon added a commit that referenced this pull request Dec 1, 2023
* 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]>
denniswon added a commit that referenced this pull request Dec 1, 2023
* 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]>
avasisht23 added a commit that referenced this pull request Dec 3, 2023
* 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]>
avasisht23 added a commit that referenced this pull request Dec 3, 2023
* 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]>
moldy530 added a commit that referenced this pull request Dec 4, 2023
* 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]>
avasisht23 added a commit that referenced this pull request Dec 4, 2023
* 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]>
moldy530 added a commit that referenced this pull request Jan 8, 2024
* 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]>
moldy530 added a commit that referenced this pull request Jan 8, 2024
* 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]>
avasisht23 added a commit that referenced this pull request Jan 9, 2024
* 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]>
avasisht23 added a commit that referenced this pull request Jan 9, 2024
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants