Skip to content

feat(wip): implement viem compatible SCA impls for LA #1555

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

moldy530
Copy link
Collaborator

@moldy530 moldy530 commented Apr 21, 2025

PR-Codex overview

This PR focuses on integrating the viem library for managing smart accounts, enhancing the functionality of light accounts, and implementing error handling for paymaster flows.

Detailed summary

  • Introduced foo function in viem.ts to create a bundler client with error handling.
  • Added createViemLightAccount and createViemMultiOwnerLightAccount functions for light account management.
  • Defined parameters for creating light accounts with optional fields.
  • Implemented address computation and factory arguments retrieval.
  • Enhanced error handling in paymaster and fee estimation methods.
  • Established base functionality for light accounts in base.ts.

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

Copy link

vercel bot commented Apr 21, 2025

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

Name Status Preview Comments Updated (UTC)
aa-sdk-site ❌ Failed (Inspect) Apr 21, 2025 8:53pm
aa-sdk-ui-demo ❌ Failed (Inspect) Apr 21, 2025 8:53pm

Copy link

graphite-app bot commented Apr 21, 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

github-actions bot commented Apr 21, 2025

🌿 Documentation Preview

Name Status Preview Updated (UTC)
Alchemy Docs ✅ Ready 🔗 Visit Preview Apr 21, 2025, 8:54 PM

import { createBundlerClient } from "viem/account-abstraction";
import type { AlchemySmartAccountClientConfig } from "./smartAccountClient";

// Yea this isn't great or going to work well, we should just keep using our smart account client, but change the account type to match the viem one
Copy link
Contributor

Choose a reason for hiding this comment

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

💬 What about the idea of a transform then from the current client into this new client. Like rust's Into traits
Or, is it more worth it for the changing of the account type?

},
},
userOperation: {
// This doesn't have the ability to skip gas estimation AFAICT
Copy link
Contributor

Choose a reason for hiding this comment

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

🙀

}

throw new Error(
"this is the biggest issue with viem's approach. we can't skip gas estimation during paymaster flows..."
Copy link
Contributor

Choose a reason for hiding this comment

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

💬 If we do some hacky stuff, like stub it out, it might be possible. But would is it worth the cost to our souls.
Is there a line of communication to the viem team on this at least?

TTransport extends Transport = Transport,
TSigner extends SmartAccountSigner = SmartAccountSigner,
TLightAccountVersion extends LightAccountVersion<"LightAccount"> = "v2.0.0"
> = CreateBaseViemLightAccountParams<
Copy link
Contributor

Choose a reason for hiding this comment

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

💬 ❓ Wondering if it is worth it to do this extend style, maybe we should be flattening this, so just inline this https://github.com/alchemyplatform/aa-sdk/pull/1555/files#diff-477606e38764f257d171de4bf2d12f95adb50f0b6b9256aaf04ff292e20ff638R26

Was hoping that there was a keyword for the types, like satisfies.
That exists but not what I was thinking of.
I would hate that the best is something along the lines of interface implements
but that also doesn't exists. 😞
image


// TODO: define the implementation and return type for single owner light account

// TODO: the return type isn't quite correct here, we can do better following this as an example https://github.com/wevm/viem/blob/main/src/account-abstraction/accounts/implementations/toSoladySmartAccount.ts
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️ Love these todo's

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.

2 participants