以前获取Metamask账号地址,突然无法获取账号,出现这个错误。
Uncaught (in promise) Error: No valid "from" address specified in neither the given options, nor the default options.
我这样指定地址
const accounts = await web3.eth.getAccounts()
this.setState({ account: accounts[0] })
错误发生在此代码中
createPlace(name) {
this.setState({ loading: true })
this.state.placeList.methods.createPlace(name).send({ from: this.state.account })
.once('receipt', (receipt) => {
this.setState({ loading: false })
})
}
我的代码有问题吗?
请给我一些建议好吗?