【问题标题】:Metamask complaining about synchronous method even with callback parameter即使使用回调参数,Metamask 也会抱怨同步方法
【发布时间】:2018-07-21 00:55:36
【问题描述】:

我得到了一个

MetaMask Web3 对象不支持没有回调参数的同步方法,例如 eth_gasPrice。

即使我提供了回调参数:

web3.eth.gasPrice((err, gasPrice) => {
  if (err) {
    console.log(err)
  } else {
    store.dispatch('pollWeb3', {gasPrice: gasPrice})
  }
})

根据the doc,这应该可以工作。我弄错了吗?

【问题讨论】:

    标签: web3 web3js metamask


    【解决方案1】:

    我提交问题的那一刻......

    如果与回调一起使用,方法名称必须是 web3.eth。getGasPrice(...

    【讨论】:

      猜你喜欢
      • 2015-07-17
      • 1970-01-01
      • 1970-01-01
      • 2019-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-17
      相关资源
      最近更新 更多