BN.js vs BigNumber.js in Truffle target
See original GitHub issueWhat
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:
- Created 4 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top 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 >(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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@alsco77 yeah I am aware of this regression, thanks for reporting.
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 withtypechain-target-
and not@typechain/
.