Ethereum 如何记录合同发出的所有事件,因为它';《盗梦空间》?

Ethereum 如何记录合同发出的所有事件,因为它';《盗梦空间》?,ethereum,truffle,Ethereum,Truffle,我目前正在使用Truffle框架进行检查,但所有文档都是围绕观看时事而编写的 var meta = MetaCoin.deployed(); var events = meta.allEvents(); events.watch(function(error, result) { if (error == null) { console.log(result.args); } } 您需要指定filter对象来获取从genesis(第一个块的crypto people单词)到现在

我目前正在使用Truffle框架进行检查,但所有文档都是围绕观看时事而编写的

var meta = MetaCoin.deployed();
var events = meta.allEvents();
events.watch(function(error, result) {
  if (error == null) {
    console.log(result.args);
  }
}

您需要指定filter对象来获取从genesis(第一个块的crypto people单词)到现在的所有事件

以下代码应该可以工作:

MetaCoin.deployed()。然后(meta=>{
常量allEvents=meta.allEvents({
fromBlock:0,
托布洛克:“最新的”
});
allEvents.watch((err,res)=>{
console.log(err,res);
});
});