简体   繁体   English

web3 getAccounts 没有得到解决

[英]web3 getAccounts doesn't get resolved

web3.eth.getAccounts() is not working for me. web3.eth.getAccounts() 对我不起作用。 The code below shows "error" on execution (gets rejected).下面的代码显示了执行时的“错误”(被拒绝)。 I am using web3 1.0.0 beta-46.我正在使用 web3 1.0.0 beta-46。 I am learning from Stephen Grider's tutorial videos and he used beta-26, is it version related issue or am i doing something wrong?我正在从 Stephen Grider 的教程视频中学习,他使用了 beta-26,是版本相关的问题还是我做错了什么?

const assert = require('assert');
const ganache = require('ganache-cli');
const Web3 = require('web3');
const web3 = new Web3(ganache.provider());

web3.eth.getAccounts()
    .then(fetchedAccounts => {
      console.log(fetchedAccounts);
    },() => {
      console.log("error");
    });

Haven't tried it myself but this seems to be a bug with the latest versions of web3 .自己还没有尝试过,但这似乎是最新版本的web3的错误。 Try with 1.0.0 beta-37 ?尝试使用 1.0.0 beta-37 ?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM