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: eip-7702 support in aa-sdk/core, and sma7702 support in account-kit/smart-contracts #1287

Merged
merged 26 commits into from
Feb 10, 2025

Conversation

adamegyed
Copy link
Collaborator

@adamegyed adamegyed commented Jan 23, 2025

Pull Request Checklist


PR-Codex overview

This PR primarily updates the viem package version across multiple package.json files and introduces the ModularAccountV2 functionality, including new methods and types for account creation and management.

Detailed summary

  • Updated viem version from ^2.20.0 to ^2.22.6 in multiple package.json files.
  • Added ModularAccountV2 support in several components.
  • Introduced new types and methods for handling ModularAccountV2.
  • Updated account creation logic to include ModularAccountV2.
  • Enhanced error handling for invalid account modes.
  • Modified hooks to support ModularAccountV2 in the React components.

The following files were skipped due to too many changes: account-kit/smart-contracts/src/ma-v2/client/client.ts, account-kit/smart-contracts/src/ma-v2/account/semiModularAccountV2.ts, yarn.lock

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

Copy link

vercel bot commented Jan 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
aa-sdk-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 10, 2025 9:16pm
aa-sdk-ui-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 10, 2025 9:16pm

Copy link

graphite-app bot commented Jan 23, 2025

How to use the Graphite Merge Queue

Add the label graphite-merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

Copy link
Collaborator

@moldy530 moldy530 left a comment

Choose a reason for hiding this comment

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

this is looking good!

One thing missing is some client.test at a minimum (though would be great if we could extend it to installValidation.ts and have unit tests for installValidation.test.ts)

OOS for this PR is the naming I think, but calling it out here as @howydev and @linnall look at consolidating to the Prism naming as just looking at this PR it's clear that it'll be much better devex externally to have both a Prism account factory and Prism client factory for release


export type MAV2Account<
TSigner extends SmartAccountSigner = SmartAccountSigner
> = SmartContractAccountWithSigner<"MAV2Account", TSigner, "0.7.0"> & {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this base type should probably be generic on source as well since source should be unique per instance (ie. the first generic parameter in SmartContractAccountWithSigner)

Comment on lines 28 to 24
signer: TSigner;
entryPoint?: EntryPointDef<"0.7.0", Chain>;
signerEntity?: SignerEntity;
Copy link
Collaborator

Choose a reason for hiding this comment

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

oh yea I remember seeing this during hackathon and thinking it odd. Why can't we merge signer and signerEntity?

Copy link
Collaborator

Choose a reason for hiding this comment

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

* chore: move optional mode into account params

* chore: removed unused var
const is7702 =
params.accountParams &&
"mode" in params.accountParams &&
params.accountParams.mode === "7702";
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit simplification:

const is7702 = params?.accountParams?.mode === "7702";

Copy link
Collaborator

Choose a reason for hiding this comment

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

actually, if its just used in a single place, you can probably do it below directly

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
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, it seems like the branching destructuring at the top of this file is breaking the type relationship between account.source and params.accountParams, even though we can obviously see that there should be a relationship.

For now, I'll leave it as is, and make note of avoiding this type of destructuring to preserve type checking.

Screenshot 2025-02-10 at 3 56 12 PM

@@ -277,9 +221,22 @@ export async function createSMAV2Account(
: callData;
};

const baseAccount = await toSmartContractAccount({
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm, instead of modifying toSmartContractAccount, another option would be to override getNonce and getImplementationAddress when unrolling below right?

this would be a bigger refactor and there's no issue with the current impl, so think we can keep the existing one for speed

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
Collaborator

Choose a reason for hiding this comment

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

ok, sg

Copy link
Collaborator

@howydev howydev left a comment

Choose a reason for hiding this comment

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

need to update docs in 2 places, other that that LGTM

howydev
howydev previously approved these changes Feb 10, 2025
Copy link
Collaborator

@howydev howydev left a comment

Choose a reason for hiding this comment

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

read the example wrongly, we're good to go!

howydev
howydev previously approved these changes Feb 10, 2025
@adamegyed adamegyed merged commit 8d5501f into main Feb 10, 2025
7 checks passed
@adamegyed adamegyed deleted the adam/7702-core branch February 10, 2025 22:01
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.

5 participants