Open eerkaijun opened 6 months ago
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:
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.
Context (Problem, Motivation, Solution)
https://github.com/0xFableOrg/0xFable/issues/31 and https://github.com/0xFableOrg/0xFable/issues/32 (Issue 31 is dependent on issue 32 as account abstraction toolings cannot work on Anvil node)
Describe Your Changes
Checklist
make check
and fixed resulting issuesTesting
If you didn't write tests, explain how you made sure the code was correct and working as intended.