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.

Tezos truffle-contract returns BigNumber instead of BN

See original GitHub issue

In the alphaTez branch, I noticed today that the Tezos version of truffle-contract returns BigNumber objects instead of BN. As a matter of standardizing our output, we should move to BN.

Steps to reproduce:

  1. Get the alphaTez branch and yarn, yarn bootstrap, etc. (referred to as truffle below)
  2. Create a new project using the truffle unbox tezos-example box. Make sure you have all the Tezos requirements (e.g., Docker) installed before continuing.
  3. In the project, fire up truffle console, then run deploy. After that, follow the commands below. You’ll see that when reading data from .storage(), we get BigNumber output for integers.
truffle(development)> let instance = await SimpleStorage.deployed()
truffle(development)> await instance.storage()
BigNumber { s: 1, e: 0, c: [ 2 ] }

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
gnidancommented, Jan 29, 2020

These are my take on requirements:

  • Truffle must respect the number reformat mechanism
  • Truffle should use the same default, no matter what chain
0reactions
BearCoodercommented, Dec 7, 2022

Hello @haltman-at & @fainashalts can you please make a statement as to why Tezos support is not a priority anymore? To be honest it leaves a bad taste after the big announcement od Tezos support in Truffle (Twitter and Blogpost) over two years ago. The funny thing is the support didnt last long, less than a year later Truffle started to ghost all issues and update requests on github or stated to do it later… why the sudden change back then?

At least make either make it official and announce that you are not supporting Tezos anymore or at least update Tezos Truffle to current protocol standard. I dont know maybe its a failure on the communication side, maybe Truffle @tcoulter and Tezos Foundation @drchrispinnock need to talk but the current state is unfortunate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Convert big number to regular number [duplicate]
But Please try this. First you can try using: web3.utils.isBN(bn). Then go to the following if it returns true.
Read more >
Contract Abstractions - Truffle Suite
This function returns a Promise that resolves into a new instance of the contract abstraction at the newly deployed address.
Read more >
(intermediate value).toBigNumber is not a function
I am following the Building your First Blockchain tutorial(https://www.youtube.com/watch?v=coQ5dg8wM2o&t=494s). I have the following in my index ...
Read more >
truffle: Versions - Openbase
Notably, @truffle/contract is now compiled with Webpack rather than ... 5.5.0-tezos.4. tezos ... now returns numbers as BN by default instead of BigNumber....
Read more >
Openzeppelin-test-helpers - npm.io
Import all required modules from openzeppelin-test-helpers const { BN, ... is the object returned by either a web3 Contract or a truffle-contract call....
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