scaffold-eth / scaffold-eth-2

Open source forkable Ethereum dev stack
https://scaffoldeth.io
MIT License
1.19k stars 745 forks source link

bug: Sigining a message doesn’t work on hardhat after migrating to wagmi v2. #841

Closed rin-st closed 2 months ago

rin-st commented 2 months ago

Is there an existing issue for this?

Which method was used to setup Scaffold-ETH 2 ?

git clone

Current Behavior

When I'm trying to sign a message on hardhat, I'm getting error. Reason . But I'm not sure if it possible to make it work. For me it's working only if I use on frontend one of 20 default hardhat accounts. Or if I pass my account to hardhat config. But it's not the case.

Tried both walletClient.signMessage(...) and signMessage/async from useSignMessage.

Error:

InvalidInputRpcError: Missing or invalid parameters.
Double check you have provided the correct parameters.

URL: http://127.0.0.1:8545
Request body: {"method":"personal_sign","params":["0xf0b2d9a201c93fe758432d7d9dc7121f669795efc6726647a0113bce6353058d","0xb56C530863048269A0a3f27459325226f2912DA5"]}

Details: unknown account 0xb56c530863048269a0a3f27459325226f2912da5
Version: viem@2.8.16
    at delay.count.count (buildRequest.js:45:31)
    at async attemptRetry (withRetry.js:24:30)

Expected Behavior

No error as it was before

Steps To Reproduce

const { signMessageAsync } = useSignMessage(); ...

      <button
        onClick={async () => {
          try {
            const a = await signMessageAsync({
              message: "hello",
              account: "Your account address", // account is not required and can be hoisted from config
            });
          } catch (err) {
            console.log(err, "err");
          }
        }}
      >
        sign
      </button>

Anything else?

Need for example for sre challenges 5 and 6

technophile-04 commented 2 months ago

Ohh I see, I think its only caused while using burner wallet ? I just tried with Metamask and I got the signature with it

Will try to fix this in burner-connector 🙌