Make Results Iterable
jozanza opened this issue · 2 comments
ethjs-abi
Before opening a new issue, please take a moment to review our community guidelines to make the contribution process easy and effective for everyone involved.
Before opening a new issue, you may find an answer in already closed issues:
https://github.com/ethjs/ethjs-abi/issues?q=is%3Aissue+is%3Aclosed
Issue Type
- Bug (https://github.com/ethjs/ethjs-abi/blob/master/.github/CONTRIBUTING.md#bug-reports)
- Feature (https://github.com/ethjs/ethjs-abi/blob/master/.github/CONTRIBUTING.md#feature-requests)
Description
I'd love to have Symbol.iterator
implemented on the Result
data structure. This would enable destructuring assignment, spreads, etc, when handling values returned from contracts. Additionally, iteration should only be performed over numerically indexed keys.
Steps to reproduce
Using the decodeParams
function with any valid parameters, the following code will currently throw:
const [a, b, c] = decodeParams(...);
Only the following works currently:
const result = decodeParams(...);
const a = result[0]
const b = result[1]
const c = result[2]
Versions
- Node/NPM: 8.6.0/yarn@1.1.0
- Browser: any
@SilentCicero awesome. Keep me posted :)