【问题标题】:web3 getAccounts doesn't get resolvedweb3 getAccounts 没有得到解决
【发布时间】:2019-07-18 17:02:29
【问题描述】:

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");
    });

【问题讨论】:

    标签: ethereum solidity web3 web3js


    【解决方案1】:

    我自己没有尝试过,但这似乎是web3 最新版本的一个错误。试试 1.0.0 beta-37 吗?

    【讨论】:

    • 天哪!它工作 XD...我刚刚安装了 beta-37,它向我展示了列表 ^_^ 但是我应该接受你的回答并关闭这个问题还是让它继续存在,因为它仍然是 beta-46 的问题!你说啥 ?我
    • 我宁愿在 web3.js 上打开一个问题,如果它还没有完成并解决这个问题,但无论如何都要等一两天,看看是否有人在之前有最新版本的解决方法将问题标记为已解决! :)
    猜你喜欢
    • 2022-10-05
    • 1970-01-01
    • 2013-09-30
    • 2011-01-14
    • 2022-01-16
    • 2021-05-14
    • 2015-04-03
    • 2014-11-07
    • 1970-01-01
    相关资源
    最近更新 更多