stackup-wallet / userop.js

A simple JS library for building ERC-4337 UserOperations.
MIT License
117 stars 33 forks source link

Change to require a Signer so that it can be used with external wallets such as metamask #25

Closed serinuntius closed 1 year ago

hazim-j commented 1 year ago

Thanks for the PR @serinuntius. Do you have an example of where this is an issue? Or give more context on how you are using this with external wallets?

serinuntius commented 1 year ago

Thanks for the reply @hazim-j . For example the following pattern.

ex) React

import { useContract, useSigner } from 'wagmi'

function App() {
  const { data: signer, isError, isLoading } = useSigner();

  const handler = async () => {
     // metamask provides a signer but not a signingKey.
     const simpleAccount = await SimpleAccount.init(signer, bundler, entryPoint, factory);
  }
}
hazim-j commented 1 year ago

This makes sense! I will test this out and merge when we do the next release for userop.js

serinuntius commented 1 year ago

Great! Thank you!