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

fix(aa-core): add back eip-1193 method handling to the client #425

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

moldy530
Copy link
Collaborator

@moldy530 moldy530 commented Feb 3, 2024

Pull Request Checklist


PR-Codex overview

This PR focuses on updating the IncompatibleClientError class in the codebase. The notable changes include:

  • Adding the client parameter to the IncompatibleClientError constructor.
  • Updating the error message to include the type of the client that caused the error.
  • Adding a new smartAccountClientMethodKeys constant to check for supported RPC methods in a smart account client.

The following files were skipped due to too many changes: packages/core/src/client/smartAccountClient.ts

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

@@ -22,9 +30,13 @@ export function isSmartAccountClient<
>(
client: Client<TTransport, TChain, TAccount>
): client is SmartAccountClient<TTransport, TChain, TAccount> {
return (
client && "middleware" in client && client.type === "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.

this check of the type was causing an E2E alchemy test to fail. So had to change this. The goal of the test is really to test what's going on on the right anyways: does this client support the actions we expect it to

Copy link
Contributor

Choose a reason for hiding this comment

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

huh why was it failing? what was client.type referring to?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah because the AlchemyClient sets the type to AlchemySmartAccountClient which results in this not passing in the core methods. So instead I changed this to make sure the methods on it match the expectation instead


return client
return custom({
async request({ method, 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.

adding these handlers back because I forgot to handle them after the refactor

@moldy530 moldy530 force-pushed the moldy/eip1193-fixes branch from ead447c to 4e6d7a9 Compare February 3, 2024 02:54
@moldy530
Copy link
Collaborator Author

moldy530 commented Feb 3, 2024

I also caught a broken e2e test here.... we really need the rundler-js bit in here so we can move our e2e tests as part of the PR pipeline

@moldy530 moldy530 force-pushed the moldy/eip1193-fixes branch from 4e6d7a9 to e43f219 Compare February 5, 2024 16:30
@@ -22,9 +30,13 @@ export function isSmartAccountClient<
>(
client: Client<TTransport, TChain, TAccount>
): client is SmartAccountClient<TTransport, TChain, TAccount> {
return (
client && "middleware" in client && client.type === "SmartAccountClient"
Copy link
Contributor

Choose a reason for hiding this comment

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

huh why was it failing? what was client.type referring to?

@moldy530 moldy530 merged commit 48b5943 into main Feb 5, 2024
2 checks passed
@moldy530 moldy530 deleted the moldy/eip1193-fixes branch February 5, 2024 21:16
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