0

I call

let inst = contract.deployed()

and then on inst I can then call

mybn = units.then(function(inst) {return inst.getBN()}

mybn looks like this

BN { negative: 0, words: [ 1, <1 empty item> ], length: 1, red: null }

and if I run mybn.toNumber() I get the error letting me know mybn.toNumber is not a function

2
1

Not sure if this is going to work because I don't understand the question fully. But Please try this.

First you can try using:

web3.utils.isBN(bn)

Then go to the following if it returns true.

var BN = web3.utils.BN;

new BN(1234).toString();

"1234"

new BN('1234').add(new BN('1')).toString();

"1235"

new BN('0xea').toString();

"234"

reference: https://web3js.readthedocs.io/en/v1.2.0/web3-utils.html#bn

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