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

Merged
merged 1 commit into from
Jan 10, 2025

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 a new return type for the Alchemy transport and introduces a utility function isAlchemyTransport to check transport types.

Detailed summary

  • Modified the return type of createLightAccountClient to return AlchemySmartAccountClient when the transport is Alchemy.
  • Added isAlchemyTransport function to determine if the transport is of type AlchemyTransport.
  • Updated CreateLightAccountClientParams to include AlchemyTransport.

✨ 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 Jan 10, 2025 5:33pm
aa-sdk-ui-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2025 5:33pm

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

# Pull Request Checklist

- [x] Did you add new tests and confirm existing tests pass? (`yarn test`)
- [x] Did you update relevant docs? (docs are found in the `site` folder, and guidelines for updating/adding docs can be found in the [contribution guide](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md))
- [x] Do your commits follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard?
- [x] Does your PR title also follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard?
- [x] 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`)
- [x] Did you run lint (`yarn lint:check`) and fix any issues? (`yarn lint:write`)
- [x] Did you follow the [contribution guidelines](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md)?

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the `createLightAccountClient` function to support an `AlchemyTransport`, modifying its return type accordingly. Additionally, it introduces the `isAlchemyTransport` utility to check the transport type.

### Detailed summary
- Modified `createLightAccountClient` to return `AlchemySmartAccountClient` when using `AlchemyTransport`.
- Added `isAlchemyTransport` function to verify if the transport is an `AlchemyTransport`.
- Updated type parameters in `CreateLightAccountClientParams` to include `AlchemyTransport`.
- Enhanced documentation for the `createLightAccountClient` function.

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

<!-- end pr-codex -->
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