Details
After cloning the repo, i've added a private key to the .env file in the root folder and run "yarn test".
All the tests including the meta-tx are failing with the error
"MethodNotSupportedError: Method eth_signTypedData is not supported"
Code to reproduce
Clone the repo, build the code with yarn build, add this Private Key to the .env file: PRIVATE_KEY=075546cddad7ce53ac599a1f264cbbe0ba59832b28ee24af7bd168fcfce47802
We've had a couple people test this internally in response to your issue and it seems the tests are running green. Best guess is you are not pulling in latest version of the dependencies, but it is hard to tell without further information.
Hello there. Sorry to hear this was an issue, but after stumbling my way through the same error, I've got your fix:
In the tests, the signer.js script tries to determine which function to use (eth_signTypedData or eth_signTypedData_v4) based on the wallet provider--Hardhat, Metamask, etc. It does this in a roundabout way by checking to see if hardhat's local dev chain is being used by checking the chainId. If it's a local Hardhat test being run, the chainId will be 31337.
However, hardhat.config pulls in your PRIVATE_KEY under the networks section (Hardhat is the local network). If your private key came from a Metamask wallet, and the request in signer.js during testing the eth_signTypedData function will be selected instead of the correct function for Metamask wallets, eth_signTypedData_v4.
A super quick and dirty fix for this is to set the isHardhat variable to false, and the tests should pass with your Metamask private key.