Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

truffle console can't handle statement with nested await #1546

Open
d10r opened this issue Dec 15, 2018 · 3 comments
Open

truffle console can't handle statement with nested await #1546

d10r opened this issue Dec 15, 2018 · 3 comments

Comments

@d10r
Copy link
Contributor

d10r commented Dec 15, 2018

Because of the switch to web3.js 1.0, more functions do now return a Promise.
The console of truffle 5 supports the await keyword, making it much more convenient to interact with Promise-returning functions. However the support is limited. This for example doesn't work yet:

truffle(sigma1)> web3.utils.fromWei((await web3.eth.getBalance(addr)))
evalmachine.<anonymous>:0
web3.utils.fromWei((await web3.eth.getBalance(addr)))
                          ^^^^

SyntaxError: Unexpected identifier

When executed in a non-interactive environment (e.g. as a truffle js test), this statement would work.

@CruzMolina
Copy link
Contributor

CruzMolina commented Dec 17, 2018

Citing this as a potentially relevant solution: nodejs/node#13209 (comment)

@gnidan
Copy link
Contributor

gnidan commented Feb 27, 2019

Closing this as won't fix. Getting this to work right is tricky, better just wait until Node 10 when support here is much improved. Thanks for raising the concern!

@gnidan gnidan closed this as completed Feb 27, 2019
@haltman-at
Copy link
Contributor

haltman-at commented Sep 3, 2019

Reopening this now that Node 10 support is indeed much improved. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants