mirror of
https://github.com/autistic-symposium/web3-starter-py.git
synced 2025-05-18 06:30:23 -04:00
Update get_transfer_logs_and_wallets_balance_for_a_token.py
This commit is contained in:
parent
56bd01e32e
commit
7cb7a479f6
1 changed files with 3 additions and 5 deletions
|
@ -102,8 +102,8 @@ def get_transfer_logs(env_data: dict, address: str, decimals: int,
|
||||||
from_block=None, to_block=None, skip_chunks=False) -> list:
|
from_block=None, to_block=None, skip_chunks=False) -> list:
|
||||||
"""Get transfer logs from a given address between two blocks"""
|
"""Get transfer logs from a given address between two blocks"""
|
||||||
|
|
||||||
from_block = from_block or 'earliest'
|
from_block = from_block or 1
|
||||||
to_block = to_block or 'latest'
|
to_block = to_block or get_last_block_number(url)
|
||||||
topic = env_data['TRANSFER_EVENT_TOPIC_HASH']
|
topic = env_data['TRANSFER_EVENT_TOPIC_HASH']
|
||||||
url = env_data['RPC_PROVIDER_URL']
|
url = env_data['RPC_PROVIDER_URL']
|
||||||
|
|
||||||
|
@ -113,12 +113,10 @@ def get_transfer_logs(env_data: dict, address: str, decimals: int,
|
||||||
if not skip_chunks:
|
if not skip_chunks:
|
||||||
|
|
||||||
logs = []
|
logs = []
|
||||||
first_block = 1
|
|
||||||
c_size = int(env_data['CHUNK_SIZE'])
|
c_size = int(env_data['CHUNK_SIZE'])
|
||||||
attempts = int(env_data['NUM_ATTEMPTS'])
|
attempts = int(env_data['NUM_ATTEMPTS'])
|
||||||
last_block = get_last_block_number(url)
|
|
||||||
|
|
||||||
for block in range(first_block, last_block, c_size):
|
for block in range(from_block, to_block, c_size):
|
||||||
attempt = 0
|
attempt = 0
|
||||||
while attempt < attempts:
|
while attempt < attempts:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue