-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wallet.SignMessage failing without catchable error #491
Comments
I had this exact issue. However, it doesn't handle other wallets. Likely the case is that those wallets do not support proper
That should fix the issue, however if you are signing a UTF-8 string, keep in mind you will have to do the decoding yourself to hex since you're calling the raw method.
@ricmoo maybe there is a better solution for handling these other wallets? It is bizarre that these wallets do not support proper eth_sign behaviour as it is in the spec. |
Thanks @mrwillis I tried your example however I still did not get any results. I am signing message that was signed by another wallet. Attempt 1: No error fail signer.provider.send("personal_sign", [message]) Attempt 2: no error fail signer.provider.send("personal_sign", [message, signerAddress]) Attempt 3 : await signer.provider.send("personal_sign", [message, signerAddress]) Attempt 4: directly sending the tx
|
I believe the order is incorrect here. You need to put the address first in the |
Also try Code for personal_sign for MM in
|
Thanks @mrwillis I got it working after recasting some variables however oddly enough now when using verify message it returns the incorrect account. I've tried changing the network id, using ethers.utils.hashMessage on the message, the address in lower case and normal case. I'm trying out all the signing functions in the web3, wallet, web3.personal, web3.eth objects but its not lining up. Essentially I'm signing the message then verifying from the same device, immediately so theres nothing happening inbetween the signing and verification in the my code. |
In ethers.js signing message you can always use: (tested in const data = ethers.utils.toUtf8Bytes('some txt message');
const signer = provider.getSigner();
const addr = await signer.getAddress();
const sig = await provider.send('personal_sign', [ethers.utils.hexlify(data), addr.toLowerCase()]); |
@BigMurry That solved it on all my browsers, thank you! :D |
The order for eth_sign vs personal_signMessage are flipped, and in MetaMask, the order can be either (with some incredibly weird and ambiguous edge cases). Does using eth_sign on nodes that prefer the personal_ variant throw anything? I can do what I do for eth_chainId, which is to fallback onto net_version if it returns an error. |
I think this was resolved? I'm going to close this now, but if not, please feel free to re-open. Thanks! :) |
@BigMurry You the man for this. Happy Holidays! |
@BigMurry it not working with my browser |
Description
When attempting to sign a message in Coinbase, Status & Cipher, wallet.signMessage throws without error crashing the parent function.
All EIP 1102 set up, providers, web3 & wallet all available and meta functions executing as expected, all user interaction based functions crash without throwing an error to investigate
The text was updated successfully, but these errors were encountered: