我无法读取 Oraclize 查询的结果,但我可以成功调用它
I cant read the result from the Oraclize query but i can call it successfully
我创建了另一个函数 return 结果也在那里 (getGameNumbers) 但我可以将它添加到 oraclizeCall 函数 enter image description here
async WinningNumbers () {
const {accounts, contract}=this.state;
this.state.contract.methods.GenerateGameNumbers().send({from: accounts[0],gas:5000000, fromBlock: 'latest', toBlock: 'latest'+1},(err,results) =>{
if(results !=null){
this.setState({
winNum: (results)
})
}
})
}
我在控制台中得到交易哈希而不是结果
因为我使用的是 oraclize,所以我应该调用回调函数而不是生成数字的函数,但是因为我使用的是枚举,所以我创建了不同的函数来获取结果并调用这些函数
我创建了另一个函数 return 结果也在那里 (getGameNumbers) 但我可以将它添加到 oraclizeCall 函数 enter image description here
async WinningNumbers () {
const {accounts, contract}=this.state;
this.state.contract.methods.GenerateGameNumbers().send({from: accounts[0],gas:5000000, fromBlock: 'latest', toBlock: 'latest'+1},(err,results) =>{
if(results !=null){
this.setState({
winNum: (results)
})
}
})
}
我在控制台中得到交易哈希而不是结果
因为我使用的是 oraclize,所以我应该调用回调函数而不是生成数字的函数,但是因为我使用的是枚举,所以我创建了不同的函数来获取结果并调用这些函数