3

In the past, web3 events published numeric events like so:

BigNumber { s: 1, e: 17, c: [ 1000 ] } }

Now with web3.js 1.0, big numbers come down as objects like this:

 <BN: de0b6b3a7640000>

The problem here is that if we're collecting events for troubleshooting later, this would be indecipherable. The only solution I can think of is having some code in the event consumer convert the number before storing the event somewhere like so:

web3.utils.fromWei(new web3.utils.BN(receipt.logs[0].args.amount))

Does anyone else have any other ideas?

1 Answer 1

1

You have access to yourBigNumber.toString(10), .toString(16) and .toNumber(), no?

Look at this cheatsheet https://github.com/MikeMcl/bignumber.js

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.