1

I want to do something individually with the BigNumbers that are returned here, but I am having trouble assigning them to variables.

truffle(develop)> reg.getProviderCurve(addr,spec)
[ BigNumber { s: 1, e: 0, c: [ 1 ] },
  BigNumber { s: 1, e: 0, c: [ 1 ] },
  BigNumber { s: 1, e: 0, c: [ 2 ] } ]
truffle(develop)> [n,m,p] = reg.getProviderCurve(addr,spec)
TypeError: reg.getProviderCurve is not a function

1 Answer 1

1

Depending on what you are trying to do, the default truffle syntax has bluebird included, and there you can replace

.then(...) with

.spread(function(bigNumber1, bigNumber2){

   someVar = bigNumber1.toString();
   someOtherVar = bigNumber2.toNumber();
})

if a contract has multiple return values. If you are just playing around with BigNumber objects, it might be that you need to instantiate n,m and p as BigNumber objects first.

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.