![](/img/trans.png)
[英]Web3 getAccounts doesn't update when I switch Metamask addresses in browser
[英]web3 getAccounts doesn't get resolved
web3.eth.getAccounts() 对我不起作用。 下面的代码显示了执行时的“错误”(被拒绝)。 我正在使用 web3 1.0.0 beta-46。 我正在从 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");
});
自己还没有尝试过,但这似乎是最新版本的web3
的错误。 尝试使用 1.0.0 beta-37 ?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.