我正在寻找一种解决方案,在Binance智能链上获得所有可用和新的BEP-20代币。我尝试用web3py分析所有事务并从输入字段中提取令牌,但看起来不正确。我尝试了BSCscan API、Pancakeswap API和Web3py,但没有人提供该端点
以下是我当前获取所有事务的解决方案:
from web3 import Web3
import time
web3 = Web3(Web3.HTTPProvider('https://bsc-dataseed.binance.org/'))
def handle_event(event):
try:
transaction = web3.eth.getTransactionReceipt(event)
print ('\n****************TRANSACTION****************')
print (transaction)
print ('*******************************************\n')
except:
pass
def log_loop(event_filter, poll_interval):
while True:
for event in event_filter.get_new_entries():
handle_event(event)
time.sleep(poll_interval)
def main():
transactions = web3.eth.filter('pending')
log_loop(transactions, 1)
if __name__ == '__main__':
main()
通过transaction.input和内部日志,我将看到传输的令牌
顺便说一句:这里有谁有一个有效的解决方案,可以从输入中提取令牌,而不用手动切片字符串
有人知道一个更好的方法来获得所有的BEP-20代币吗?我的目标类似于:https://poocoin.app/ape
我已经成功地使用了BitQuery API—您可以免费使用它处理X个请求:https://graphql.bitquery.io/ide/WQfM3F2ZSz
上面的链接适用于所有新的基于以太坊的令牌,但您可以查看共享查询,或编写自己的查询,以获取BSC令牌
相关问题 更多 >
编程相关推荐