Replies: 6 comments
-
The reason all addresses are set to lower case is some backends used to fail if they were checksummed in the JSON-RPC api. I don't know which, if any, still do, but it is safer to do in case you are talking to services that use older Geth/Parity/Ganache/etc. backends that failed... I seem to recall some backends would throw an error and others would simply "hang", never resolving or rejecting. So, now I lowercase all addresses that are sent over JSON-RPC... :) Why do you want them not-lower-cased? |
Beta Was this translation helpful? Give feedback.
-
Thank you. Now I got it why it is in lowercase. But everything started when in my frontend ( it was hardhat frontend example - https://github.com/nomiclabs/hardhat-hackathon-boilerplate) I tried to signed a message and it wasn't working. I used same data in the EIP 712 and etherjs documentation to try to get the same result (signature) and I couldn't. But now I noticed the difference. I got different results because I used JsonRpcSigner instead of Wallet. const signer = this._provider.getSigner(0);
let signature = await signer._signTypedData(domain, types, value); I just don't know how to sign it using Wallet right now, but I will read docs again to learn and check if it is possible. thanks. |
Beta Was this translation helpful? Give feedback.
-
Should be the same: |
Beta Was this translation helpful? Give feedback.
-
Actually I didn't t want to deal with a private key in my frontend. But since it isn't a bug, I need to figure it out how other projects solve this issue. Thanks |
Beta Was this translation helpful? Give feedback.
-
Oh. Sorry, I don’t think I understand the issue. What is the the problem you are having? |
Beta Was this translation helpful? Give feedback.
-
I noticed something weird here. In the v5 documentation, we have an example of how to use Signer and EIP712. https://github.com/ethers-io/ethers.js/blob/master/docs/v5/api/signer/README.md#L153
I got this signature: And to make things worse, Signer example data is the same in the Wallet.sign test case (ethers.js/packages/tests/src.ts/test-utils.ts) and the signature is different. Wallet.sign test case gets this signature, which is the signature in EIP712 (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md) example that also gets: And testcase also has the signature from EIP712: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I was trying to sign a message following EIP 712 and I bumped this line in the ethers.js documentation:
https://github.com/ethers-io/ethers.js/blame/master/docs/v5/api/utils/hashing/README.md#L287
It is in lowercase:
verifyingContract: '0xcccccccccccccccccccccccccccccccccccccccc',
It had to be like this:
verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
I checked tests and if I am not wrong, we don't have a test for
ethers.utils._TypedDataEncoder.getPayload
I added a simple test here and it failed:
ethers.js/packages/tests/src.ts/test-utils.ts
Line 769 in bcda16d
For some reason it is setting verifyingContract to lower case in this line:
ethers.js/packages/hash/src.ts/typed-data.ts
Line 66 in bcda16d
and all address types to lowercase here
ethers.js/packages/hash/src.ts/typed-data.ts
Line 498 in bcda16d
Is there any reason to return in lowercase?
Beta Was this translation helpful? Give feedback.
All reactions