question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does not receive any callback after signing message.

See original GitHub issue

Im trying to sign simple message using ethers, wallet connect and metamask app on android.

      const provider = new WalletConnectProvider({
        infuraId: '--', // replace infuraId
      });
      await provider.enable();
      const web3 = new providers.Web3Provider(provider);
      const signer = web3.getSigner();
      const signature = await signer.signMessage('Hello World');
      console.log('ok')
      console.log(signature);

It did prompt on my phone to sign but I didnt receive any callback from it. This method works well for other providers such as fortmatic and metamask.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:16
  • Comments:25

github_iconTop GitHub Comments

9reactions
wslyvhcommented, Apr 29, 2021

Here’s another workaround (if you’re using web3Modal)

// configure web3Modal 
const web3 = await web3Modal.connect();
const provider = new providers.Web3Provider(web3);
const signer = provider.getSigner()
const address = await signer.getAddress();

let signedMessage;
if (web3.wc) {
    signedMessage = await provider.send(
        'personal_sign',
        [ ethers.utils.hexlify(ethers.utils.toUtf8Bytes(rawMessage)), address.toLowerCase() ]
    );
}
else { 
    signedMessage = await signer.signMessage(rawMessage)
}
9reactions
StillFantasticcommented, Dec 1, 2022

Can confirm this low-level way works.

if (connector instanceof WalletConnectConnector) {
  const messageLength = new Blob([rawMessage]).size
  const message = toUtf8Bytes(
    "\x19Ethereum Signed Message:\n" + messageLength + rawMessage
  )
  const hashedMessage = keccak256(message)
  connector.walletConnectProvider.connector.signMessage([account.toLowerCase(), hashedMessage])
    .then(response => {
      console.log(response)
    })
    .catch(error => {
      console.log(error)
    })
} else {
  // original way
Read more comments on GitHub >

github_iconTop Results From Across the Web

Callback after Sign-up Not working - Auth0 Community
This works fine, I get routed to Auth0 where I successfully sign up. I can see the new user added to Auth0 fine....
Read more >
Callback - DOCUMENT_SIGNED not triggered
When using the callback function to listen to DOCUMENT_SIGNED events, I do not receive the event if the user does not click the...
Read more >
Clickatell callback url to receive messages not working
When i call the url directly, it is working as it should and sending me the mail as well as logging to the...
Read more >
Best practices for building your listener - DocuSign Developers
If your listener received the messages, accept the message, place it into a ... As part of sending the envelope, a callback URL...
Read more >
Possible reason for why downloaded files are not signed
We suggest waiting for callback events within your app. These callback events are POSTed to your callback handler throughout different ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found