有了特松露,我们就有了一个很好的合同包装。但它有一个让我头疼的特点:
来自文档的示例
MetaCoin.at(contract_address).then(function(instance) {
coin = instance;
return coin.sendCoin(account_two, 3, {from: account_one});
}).then(function(result) {
// This code block will not be executed until truffle-contract has verified
// the transaction has been processed and it is included in a mined block.
// truffle-contract will error if the transaction hasn't been processed in 120 seconds.
})这就提出了四个问题:
function(result, error))或整件事(.then( function(result) {...} ).catch(e))的回调中?我不能用假名在本地测试。尤其是第一个问题让我头疼。
问候
发布于 2018-07-29 22:10:17
超时仅仅是一种松露。网络不会超时,当使用web3或类似的包装器开发应用程序时,您只需继续监听,直到tx成为矿工,或者页面关闭。
当您在web3中进行事务处理时,您将接收tx散列作为响应的一部分,甚至在它被挖掘之前。您可以将其显示给用户,以及挂起的状态,并使用Web3 3的筛选器在挖掘回调时为其设置侦听器,而不会遇到超时问题。
https://stackoverflow.com/questions/51583800
复制相似问题