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 alchemy transport update for the mav2 account client #1271

Conversation

Blu-J
Copy link
Collaborator

@Blu-J Blu-J commented Jan 10, 2025

Pull Request Checklist


PR-Codex overview

This PR introduces a new type NotType for type safety in TypeScript and modifies various client functions to ensure that specific transport types are not used with certain clients. It also adds tests for the createSMAV2AccountClient function, ensuring proper behavior with Alchemy transport.

Detailed summary

  • Added NotType type to enforce type constraints.
  • Updated parameters in createLightAccountClient, createMultiOwnerLightAccountClient, createMultiOwnerModularAccountClient, and createMultisigModularAccountClient to use NotType.
  • Added tests for createSMAV2AccountClient to validate Alchemy transport behavior.
  • Enhanced createSMAV2AccountClient to differentiate between Alchemy and custom transports.

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

Copy link

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

Copy link
Collaborator Author

Blu-J commented Jan 10, 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.

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

@Blu-J Blu-J force-pushed the 01-07-feat_client_multi_account_light_and_alchemy_consolidation branch from d05051e to b677351 Compare January 10, 2025 20:44
@Blu-J Blu-J force-pushed the 01-10-feat_add_alchemy_transport_update_for_the_mav2_account_client branch from 0bbe272 to 05a7dca Compare January 10, 2025 20:44
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.

couple nits and just some questions for my own understanding but overall LGTM

We should probs also test the types at a minimum that with AlchemyTransport we get an Alchemy client and any other transport we get a non Alchemy Client

account-kit/smart-contracts/src/ma-v2/client/client.ts Outdated Show resolved Hide resolved
account-kit/smart-contracts/src/ma-v2/client/client.ts Outdated Show resolved Hide resolved
@@ -64,7 +97,21 @@ export function createSMAV2AccountClient<
*/
export async function createSMAV2AccountClient(
config: CreateSMAV2AccountClientParams
): Promise<SmartAccountClient> {
): Promise<SmartAccountClient | AlchemySmartAccountClient> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

for my own understanding: does it complain if this is just SmartAccountClient? technically the AlchemySmartAccountClient is a SmartAccountClient

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, just was being redundant. Good catch

@Blu-J Blu-J force-pushed the 01-07-feat_client_multi_account_light_and_alchemy_consolidation branch from b677351 to d05051e Compare January 10, 2025 21:15
@Blu-J Blu-J force-pushed the 01-10-feat_add_alchemy_transport_update_for_the_mav2_account_client branch from 05a7dca to acc1708 Compare January 10, 2025 21:15
@Blu-J Blu-J force-pushed the 01-07-feat_client_multi_account_light_and_alchemy_consolidation branch from d05051e to bfde6c0 Compare January 10, 2025 22:32
@Blu-J Blu-J force-pushed the 01-10-feat_add_alchemy_transport_update_for_the_mav2_account_client branch from acc1708 to b826ba0 Compare January 10, 2025 22:33
@Blu-J Blu-J force-pushed the 01-07-feat_client_multi_account_light_and_alchemy_consolidation branch from bfde6c0 to 136cc8f Compare January 10, 2025 22:51
@Blu-J Blu-J force-pushed the 01-10-feat_add_alchemy_transport_update_for_the_mav2_account_client branch from b826ba0 to 73e0725 Compare January 10, 2025 22:51
@Blu-J Blu-J force-pushed the 01-07-feat_client_multi_account_light_and_alchemy_consolidation branch from 136cc8f to 5d46490 Compare January 10, 2025 23:53
@Blu-J Blu-J force-pushed the 01-10-feat_add_alchemy_transport_update_for_the_mav2_account_client branch from 73e0725 to 60ebd5f Compare January 10, 2025 23:53
@Blu-J Blu-J changed the base branch from 01-07-feat_client_multi_account_light_and_alchemy_consolidation to graphite-base/1271 January 11, 2025 00:39
@Blu-J Blu-J force-pushed the graphite-base/1271 branch from 5d46490 to 18a9228 Compare January 11, 2025 00:52
@Blu-J Blu-J force-pushed the 01-10-feat_add_alchemy_transport_update_for_the_mav2_account_client branch from 429ecb6 to c198db3 Compare January 13, 2025 16:34
@Blu-J Blu-J marked this pull request as ready for review January 13, 2025 16:35
TSigner extends SmartAccountSigner = SmartAccountSigner
>(
args: CreateSMAV2AccountClientParams<TTransport, TChain, TSigner> &
NotType<TTransport, AlchemyTransport>
Copy link
Collaborator Author

@Blu-J Blu-J Jan 13, 2025

Choose a reason for hiding this comment

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

📓 So, this here was needed for the test to make sure that we didn't filter on the type alchemyTransport for the other case
Edit: W/O fix
image

Omit<
AlchemySmartAccountClientConfig<TChain, LightAccount<TSigner>>,
"account"
> & { paymasterAndData?: never };
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

📓 That without this this test fails
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 nice, I think we also need to add dummyPaymasterAndData?: never here as well

@Blu-J Blu-J force-pushed the 01-10-feat_add_alchemy_transport_update_for_the_mav2_account_client branch 2 times, most recently from f6eb7cb to 272e944 Compare January 13, 2025 16:49
moldy530
moldy530 previously approved these changes Jan 13, 2025
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.

had one comment, but LGTM otherwise!

Omit<
AlchemySmartAccountClientConfig<TChain, LightAccount<TSigner>>,
"account"
> & { paymasterAndData?: never };
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, I think we also need to add dummyPaymasterAndData?: never here as well

@Blu-J Blu-J force-pushed the 01-10-feat_add_alchemy_transport_update_for_the_mav2_account_client branch from 272e944 to 6e94f2c Compare January 13, 2025 16:55
Copy link

graphite-app bot commented Jan 13, 2025

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 introduces a new type `NotType` to prevent certain type extensions and modifies various client creation functions to utilize this type. It also enhances test coverage for the `createSMAV2AccountClient` function to validate transport behavior and policy ID specifications.

### Detailed summary
- Added `NotType` type to prevent type extensions.
- Updated `createLightAccountClient`, `createMultiOwnerLightAccountClient`, `createMultiOwnerModularAccountClient`, and `createMultisigModularAccountClient` to use `NotType`.
- Enhanced tests for `createSMAV2AccountClient` to check behavior with `AlchemyTransport`.
- Added tests for policy ID and paymaster restrictions in `createSMAV2AccountClient`.

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

<!-- end pr-codex -->
@Blu-J Blu-J force-pushed the 01-10-feat_add_alchemy_transport_update_for_the_mav2_account_client branch from 6e94f2c to 71089c4 Compare January 13, 2025 17:18
@graphite-app graphite-app bot merged commit 71089c4 into main Jan 13, 2025
8 checks passed
@graphite-app graphite-app bot deleted the 01-10-feat_add_alchemy_transport_update_for_the_mav2_account_client branch January 13, 2025 17:32
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