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.

BN.js vs BigNumber.js in Truffle target

See original GitHub issue

What

The typings in the output typings use BigNumber.js but an assertion in our test cases comparing the output against an equivalent bignumber.js is failing. Converting the test data to BN.js causes the test to pass. Not sure how it’s slipping through, but maybe its worth being explicit in using BN.js.

Based on this article, seems like Truffle migrated from bignumber.js to BN.js in v5 https://medium.com/coinmonks/upgrading-to-truffle-5-22aedc7c2a4d

Happy to help if you can point me in the right direction

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
krzkaczorcommented, Feb 11, 2020

@alsco77 yeah I am aware of this regression, thanks for reporting.

1reaction
alsco77commented, Feb 10, 2020

Confirm working with:

  • @typechain/truffle-v5
  • typechain@1.0.4

cmd: typechain --target 'truffle-v5'

Caveat: Only works with 1.0.4. When using typechain@1.0.3, 1.0.5 or beta, the target only searches packages prefixed with typechain-target- and not @typechain/.

Read more comments on GitHub >

github_iconTop Results From Across the Web

BN.js vs BigNumber.js in Truffle target · Issue #211
The typings in the output typings use BigNumber.js but an assertion in our test cases comparing the output against an equivalent bignumber.js is ......
Read more >
A comparison of BigNumber libraries in JavaScript
Both BigInteger.js and JSBI can act as some sort of polyfill for the ECMAScript BigInt proposal, although their approaches differ.
Read more >
big.js vs bignumber.js vs bn.js vs decimal.js vs mathjs
Comparing trends for .
Read more >
(intermediate value).toBigNumber is not a function
javascript - (intermediate value). toBigNumber is not a function - Stack Overflow. Stack Overflow for Teams – Start collaborating and sharing ...
Read more >
laborx/typechain-truffle-target
Start using @laborx/typechain-truffle-target in your project by running ... (only for Truffle 5) type of bignumber "BigNumber" or "BN" ;.
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