MetaMask / eth-sig-util

A collection of functions for signing and verifying data with Ethereum keys.
ISC License
574 stars 226 forks source link

Production build error: Can't convert a BigInt value to a number #304

Open djimenezdev opened 1 year ago

djimenezdev commented 1 year ago

Hey everyone! So I am using this library to generate the signature for a meta gasless transaction for a mini game I building. And it works perfectly on localhost but when I generate the build folder and use the serve library to run this build folder on a local server I get this Cannot convert a BigInt value to a number error as seen below:

cannotConvert

I also get some warnings when I run the react app using the start command provided by the react-app. I don't know if they have anything to do with it but I'll show a few I am getting below

warnings

Also the react app is built with create-react-app and is using react version ^18.2.0

djimenezdev commented 1 year ago

I created a fresh react-app only installing the @metamask/eth-sig-util lib and I simply just import the signTypedData function without even implementing it and I get that exact same error just like in my actual project I am building

nenadV91 commented 1 year ago

I've faced the same issue

keithchew commented 1 year ago

Hi

You might want to take a look at:

https://github.com/MetaMask/eth-sig-util/issues/298

to see if pinning to v4.0.1 helps.

legobeat commented 12 months ago

@djimenezdev @nenadV91 Would you be able to try either of v6.0.2 or v7.0.1 and see if the issue persists?

Note that in general, many BigNumber instances are not safe to call toNumber() on since JavaScript number can not fit some values. In particular, users should ensure they aren't using older versions of web3, which are affected by this.

If you are a web3.js user,