changed event filter method for os compatibility

This commit is contained in:
Alexander 2024-08-23 18:54:47 -04:00
parent 02abf1d349
commit faae7cd463
2 changed files with 7 additions and 2 deletions

View file

@ -30,7 +30,7 @@ def preload_chat(earliest_block, latest_block):
event_logs = web3.eth.get_logs({ event_logs = web3.eth.get_logs({
"fromBlock": int(earliest_block), "fromBlock": int(earliest_block),
"toBlock": int(latest_block), "toBlock": int(latest_block),
"topics": ["0x6b81130c485ac9b98332fa40c2e57900867815b0fe1497e1a168caf930fc9c9d"], "topics": [os.getenv('LOG_TOPIC')],
"address": os.getenv('LOG_CONTRACT_ADDRESS') "address": os.getenv('LOG_CONTRACT_ADDRESS')
}) })
for log in event_logs: for log in event_logs:
@ -38,7 +38,11 @@ def preload_chat(earliest_block, latest_block):
def load_chat(latest_block): def load_chat(latest_block):
event_filter = log_contract.events.LogEvent.create_filter(fromBlock=latest_block) event_filter = web3.eth.filter({
"fromBlock": int(latest_block),
"topics": [os.getenv('LOG_TOPIC')],
"address": os.getenv('LOG_CONTRACT_ADDRESS')
})
loop = asyncio.new_event_loop() loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop) asyncio.set_event_loop(loop)
try: try:

View file

@ -2,4 +2,5 @@ DATA_FOLDER=./data
RPC_SERVER=https://rpc.pulsechain.com RPC_SERVER=https://rpc.pulsechain.com
LOG_CONTRACT_ADDRESS=0x7aE73C498A308247BE73688c09c96B3fd06dDB84 LOG_CONTRACT_ADDRESS=0x7aE73C498A308247BE73688c09c96B3fd06dDB84
LOG_CONTRACT_ABI_FILE=SHIO.json LOG_CONTRACT_ABI_FILE=SHIO.json
LOG_TOPIC=0x6b81130c485ac9b98332fa40c2e57900867815b0fe1497e1a168caf930fc9c9d
CHANNEL_NAME=VOID CHANNEL_NAME=VOID