所以在较新版本中,查询
web3.eth.accounts;
写成:
web3.eth.getAccounts();
从一堆账户中获取特定索引的账户的查询是什么?
简单来说,什么是新的写作方式:
web3.eth.accounts[index];
它将帐户数组作为承诺返回,因此您可以像这样包装代码
web3.eth.getAccounts().then((accounts) => {
...
let a = accounts[index];
...
})