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.

signTypedData presents uint as hexadecimal in MetaMask UI

See original GitHub issue

Hi @ricmoo thank you for the EIP712 integration,

I’m currently looking to move my projects to Signer.signTypedData, everything I need works as expected, except I’m facing a presentational issue when signing data containing uint type with MetaMask.

  • uint,…,uint256 are presented to MetaMask’s users in hexadecimal format.
  • uint are displayed human readable when calling Web3Provider.send('eth_signTypedData_v4', args).

The issue seems to be only presentational as the resulting signature is the same in both cases.

Here is a demo of the issue: https://codesandbox.io/s/gracious-raman-id9cg?file=/src/index.js

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
PierreJeanjacquotcommented, Mar 11, 2021

Looks great, thank you @ricmoo! 🎉

1reaction
ricmoocommented, Dec 14, 2020

The JSON-RPC definition of signTypedData is a bit loose in explaining what the payload should look like for values. Currently, I convert everything to a value compatible with results (e.g. quantity for numbers, which is a hex string without any leading zeros). I can make the payload generator return decimal numbers easy enough, but that should be something I would expect the client (i.e. MetaMask) to handle for display logic.

I’ll ping them for their opinions and maybe they have better docs as to input value formats. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Signing Data - MetaMask Docs
# Sign Typed Data Message Parameters · Will only be accepted for a specific website/contract. · Makes sure signatures are valid only where...
Read more >
EIP-712: Signing and Verifying Typed Ethereum messages
Currently signed messages are an opaque hex string displayed to the user with little context about the items that make up the message....
Read more >
Documentation - Ethers.js
A connection to the Ethereum network (a Provider); Holds your private key and can sign things (a Signer). Connecting to MetaMask. // A...
Read more >
Populus Documentation - Web3.py
Allow hex for value field when validating via validate_payable() contracts method ... Add documentation for web3.py unit tests - #1324.
Read more >
Changelog - metamask-extension - GitCode
The MetaMask browser extension enables browsing Ethereum blockchain ... #11153: Prevent UI crash when the transaction being retried or canceled is missing.
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