Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix chapter7 #176

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions 07_Event/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down
2 changes: 2 additions & 0 deletions en/07_Event/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down