Skip to main content
added 119 characters in body
Source Link
ReyHaynes
  • 1.5k
  • 7
  • 12

If you are just expecting an array return, try console.logging: result.args.c, result.args.c[0]

The actual response usually ends up in c.


Update #1

If you were getting a return of arrays, then your overall response should be something like (with BigNumber instead of String):

[ [ BigNumber { s: 1, e: 0, c: [Array] },
    BigNumber { s: 1, e: 0, c: [Array] } ],
  [ BigNumber { s: 1, e: 0, c: [Array] },
    BigNumber { s: 1, e: 0, c: [Array] } ] ]

From that, you have to map the array in order to make the array desired:

let arr = result.map(res => {
  return res.map(res => res.c[0])
})

You should get the array you want with arr.

Since c in your case is an [Object], you'd have to see what is in that object and replace res.c[0] with the map to that object value you want. I assume its .value...but I don't have code to verify that right now. Hopefully this helps.

And just for reference result.valueOf()[0][0].toString() would actually be result.valueOf()[0].c[0].toString().

If you are just expecting an array return, try console.logging: result.args.c, result.args.c[0]

The actual response usually ends up in c.


Update #1

If you were getting a return of arrays, then your overall response should be something like (with BigNumber instead of String):

[ [ BigNumber { s: 1, e: 0, c: [Array] },
    BigNumber { s: 1, e: 0, c: [Array] } ],
  [ BigNumber { s: 1, e: 0, c: [Array] },
    BigNumber { s: 1, e: 0, c: [Array] } ] ]

From that, you have to map the array in order to make the array desired:

let arr = result.map(res => {
  return res.map(res => res.c[0])
})

You should get the array you want with arr.

Since c in your case is an [Object], you'd have to see what is in that object and replace res.c[0] with the map to that object value you want. I assume its .value...but I don't have code to verify that right now. Hopefully this helps.

If you are just expecting an array return, try console.logging: result.args.c, result.args.c[0]

The actual response usually ends up in c.


Update #1

If you were getting a return of arrays, then your overall response should be something like (with BigNumber instead of String):

[ [ BigNumber { s: 1, e: 0, c: [Array] },
    BigNumber { s: 1, e: 0, c: [Array] } ],
  [ BigNumber { s: 1, e: 0, c: [Array] },
    BigNumber { s: 1, e: 0, c: [Array] } ] ]

From that, you have to map the array in order to make the array desired:

let arr = result.map(res => {
  return res.map(res => res.c[0])
})

You should get the array you want with arr.

Since c in your case is an [Object], you'd have to see what is in that object and replace res.c[0] with the map to that object value you want. I assume its .value...but I don't have code to verify that right now. Hopefully this helps.

And just for reference result.valueOf()[0][0].toString() would actually be result.valueOf()[0].c[0].toString().

added 659 characters in body
Source Link
ReyHaynes
  • 1.5k
  • 7
  • 12

If you are just expecting an array return, try console.logging: result.args.c, result.args.c[0]

The actual response usually ends up in c.


Update #1

If you were getting a return of arrays, then your overall response should be something like (with BigNumber instead of String):

[ [ BigNumber { s: 1, e: 0, c: [Array] },
    BigNumber { s: 1, e: 0, c: [Array] } ],
  [ BigNumber { s: 1, e: 0, c: [Array] },
    BigNumber { s: 1, e: 0, c: [Array] } ] ]

From that, you have to map the array in order to make the array desired:

let arr = result.map(res => {
  return res.map(res => res.c[0])
})

You should get the array you want with arr.

Since c in your case is an [Object], you'd have to see what is in that object and replace res.c[0] with the map to that object value you want. I assume its .value...but I don't have code to verify that right now. Hopefully this helps.

If you are just expecting an array return, try console.logging: result.args.c, result.args.c[0]

The actual response usually ends up in c.

If you are just expecting an array return, try console.logging: result.args.c, result.args.c[0]

The actual response usually ends up in c.


Update #1

If you were getting a return of arrays, then your overall response should be something like (with BigNumber instead of String):

[ [ BigNumber { s: 1, e: 0, c: [Array] },
    BigNumber { s: 1, e: 0, c: [Array] } ],
  [ BigNumber { s: 1, e: 0, c: [Array] },
    BigNumber { s: 1, e: 0, c: [Array] } ] ]

From that, you have to map the array in order to make the array desired:

let arr = result.map(res => {
  return res.map(res => res.c[0])
})

You should get the array you want with arr.

Since c in your case is an [Object], you'd have to see what is in that object and replace res.c[0] with the map to that object value you want. I assume its .value...but I don't have code to verify that right now. Hopefully this helps.

Source Link
ReyHaynes
  • 1.5k
  • 7
  • 12

If you are just expecting an array return, try console.logging: result.args.c, result.args.c[0]

The actual response usually ends up in c.