diff --git a/07_Event/readme.md b/07_Event/readme.md index b77fd8d..265517a 100644 --- a/07_Event/readme.md +++ b/07_Event/readme.md @@ -85,6 +85,8 @@ const transferEvents = await contract.queryFilter('事件名', 起始区块, 结 4. 获取过去10个区块内的`Transfer`事件,并打印出1个。我们可以看到,`topics`中有3个数据,对应事件哈希,`from`,和`to`;而`data`中只有一个数据`amount`。另外,`ethers`还会根据`ABI`自动解析事件,结果显示在`args`成员中。 ```js + // 获取过去10个区块内的Transfer事件 + console.log("\n1. 获取过去10个区块内的Transfer事件,并打印出1个"); // 得到当前block const block = await provider.getBlockNumber() console.log(`当前区块高度: ${block}`); diff --git a/en/07_Event/readme.md b/en/07_Event/readme.md index 09dc715..e6d0bd3 100644 --- a/en/07_Event/readme.md +++ b/en/07_Event/readme.md @@ -81,6 +81,8 @@ const transferEvents = await contract.queryFilter('event name', starting block, 4. Retrieve the `Transfer` events within the last 10 blocks and print one event. We can see that the `topics` contain three pieces of data corresponding to the event hash, the `from` address, and the `to` address, while the `data` only contains one piece of data, which is the `amount`. Additionally, `ethers` automatically parses the event based on the ABI, and the parsed event is shown in the `args` member. ```js + // Get Transfer events within the past 10 blocks + console.log("\n1. Get Transfer events within the past 10 blocks and print 1 event"); // Get the current block const block = await provider.getBlockNumber() console.log(`Current block number: ${block}`);