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

Account abstraction #110

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Account abstraction #110

wants to merge 5 commits into from

Conversation

eerkaijun
Copy link
Contributor

Context (Problem, Motivation, Solution)

#31 and #32 (Issue 31 is dependent on issue 32 as account abstraction toolings cannot work on Anvil node)

Describe Your Changes

  1. Use rollop to be the dev node rather than Anvil. Include Makefile commands to start rollop node and account abstraction toolings.
  2. Integrate permissionlessjs to deal with smart contract account
  3. Users can opt to use a burner account which generates a private key and store on browser. The private key is then used as the signer of the smart contract account. Transactions are sponsored by the paymaster. (So the notion of "accounts" are abstracted away from end users)

Checklist

  • I have performed a self-review of my code
  • I ran make check and fixed resulting issues
  • I ran the relevant tests and they all pass
  • I wrote tests for my new features, or added regression tests for the bug I fixed

Testing

If you didn't write tests, explain how you made sure the code was correct and working as intended.

@eerkaijun
Copy link
Contributor Author

Just opening this as a draft PR - there are still a bunch of things to be done. Will be easier to collaborate and might need some help too.

Currently main thing to figure out is how to connect smartAccountClient (defined here) to wagmi config. I think the idea is make it into a connector, though there are some typing incompatibility issues.

Once that is figured out and tested, a bunch of other things to be done are:

  • Clean up all use of Anvil
  • Remove hardcoded values of localhost port (probably better to manage them through environment variables)
  • Private key management and storage on the browser
  • Some other clean up

@norswap
Copy link
Member

norswap commented Jan 22, 2024

In the BurnerConnector, the wallet client is set here: https://github.com/0xFableOrg/0xFable/blob/master/packages/webapp/src/wagmi/BurnerConnector.ts#L63-L67

So you could assign the client there for that connector.

Connectors are set here: https://github.com/0xFableOrg/0xFable/blob/account-abstraction/packages/webapp/src/chain.ts#L78-L79

getDefaultConnectors in ConnectKit: https://github.com/family/connectkit/blob/35aeecd0cf12ef265beba724ae9b01fdc34b19b6/packages/connectkit/src/defaultConnectors.ts, populates them with a bunch of connectors defined in wagmi itself.

Here's the one used for Metamask: https://github.com/wevm/wagmi/blob/1.x/packages/connectors/src/injected.ts#L167-L181

The one from Coinbase Wallet is identical, but does not inherit InjectedConnector: https://github.com/wevm/wagmi/blob/1.x/packages/connectors/src/injected.ts#L167-L181 (the other ones, WalletConnect, Safe, ... seem similar, though maybe there's some slight subtlety I missed).

I think the move might be to monkey patch those to replace their getWalletClient function to return the original when not using account abstraction, and the AA one otherwise.

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