简体   繁体   English

如何在 web3.py 中跟踪令牌的最后传输

[英]How to track the last transfers of a token in web3.py

I'm using web3.py.我正在使用 web3.py。 There is something i want to learn.有东西我想学。 How can I track the latest transfers of a token?如何跟踪令牌的最新转移?

Latest Transfer最新转会

I need to follow the part seen in the picture above live.我需要按照上图中看到的部分进行直播。 New transfers do not appear unless the page is refreshed.Being able to do it over Web3 is my priority.除非刷新页面,否则不会出现新的转移。能够通过 Web3 进行转移是我的首要任务。 I'm open to alternative suggestions.我愿意接受其他建议。

https://bscscan.com/token/0x5774b2fc3e91af89f89141eacf76545e74265982 https://bscscan.com/token/0x5774b2fc3e91af89f89141eacf76545e74265982

The thing you can do is create a filter and track contract events.您可以做的是创建一个过滤器并跟踪合同事件。

filter = web3.eth.filter({'address': token_address, 'topics': ['0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',]})
while True:
    print(filter.get_new_entries())

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM