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(aa-sdk): sdk light client can call the alchemy client #1236

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Blu-J
Copy link
Collaborator

@Blu-J Blu-J commented Dec 18, 2024

Pull Request Checklist


PR-Codex overview

This PR focuses on enhancing the createLightAccountClient function to support AlchemyTransport, modifying its return type accordingly, and introducing the isAlchemyTransport utility function.

Detailed summary

  • Updated createLightAccountClient to accept AlchemyTransport.
  • Modified return type to AlchemySmartAccountClient when using AlchemyTransport.
  • Added isAlchemyTransport function to check transport type.
  • Documented changes in the function description.

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

Copy link

vercel bot commented Dec 18, 2024

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 Dec 18, 2024 10:37pm
aa-sdk-ui-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 18, 2024 10:37pm

Copy link

graphite-app bot commented Dec 18, 2024

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.

@@ -67,7 +86,7 @@ export function createLightAccountClient<
*/
export async function createLightAccountClient(
params: CreateLightAccountClientParams
): Promise<SmartAccountClient> {
): Promise<SmartAccountClient | AlchemySmartAccountClient> {
const { transport, chain } = params;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I originally called something like this
But the code in

Suggested change
if (isAlchemyTransport(transport)) {
return await createLightAccountAlchemyClient({
...params,
transport,
});
}

Since the code is the same?
Here is the snapshot of current alchemy client, I don't see a difference
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh the difference is that this by default calls createSmartAccountClient and the alchemy calls createAlchemySmartAccountClient they take slightly different config params (createSCAClient takes in a paymasterMiddleware and createAlchemySCAClient takes in a gasManagerConfig or I think just a policyId)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay, I'll go down the side of testing the params to check the transport as alchemyTransport

Comment on lines 41 to 53
params: AlchemyLightAccountClientConfig<TSigner>
): Promise<
AlchemySmartAccountClient<
Chain | undefined,
LightAccount<TSigner>,
LightAccountClientActions<TSigner>
>
>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

oh nice! this is way cleaner than what I was thinking which was adding to the conditional typing in for CreateLightAccountClientParams based on the transport

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Had to verify this, and slight variation. Good thing for tests right?

Copy link
Collaborator Author

Blu-J commented Dec 20, 2024


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.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

graphite-app bot commented Dec 20, 2024

Merge activity

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