def handle_get_signatures_for_address(client: Client, index: int): endpoint = self.endpoints[index] num_retries = retries while num_retries > 0: try: logger.info( f"solana_client_manager.py | handle_get_signatures_for_address | Fetching {before} {endpoint}" ) transactions: ConfirmedSignatureForAddressResponse = ( client.get_signatures_for_address( account, before, until, limit, Commitment("finalized"))) logger.info( f"solana_client_manager.py | handle_get_signatures_for_address | Finished fetching {before} {endpoint}" ) return transactions except Exception as e: logger.error( f"solana_client_manager.py | handle_get_signatures_for_address | \ Error fetching account {account} from endpoint {endpoint}, {e}", exc_info=True, ) num_retries -= 1 time.sleep(DELAY_SECONDS) logger.error( f"solana_client_manager.py | handle_get_signatures_for_address | Retrying account fetch: {account} with endpoint {endpoint}" ) raise Exception( f"solana_client_manager.py | handle_get_signatures_for_address | Failed to fetch account {account} with endpoint {endpoint}" )
], ['Vote111111111111111111111111111111111111111', dict()], ['fake address', dict()]] #endpoint = 'https://api.devnet.solana.com' # for `developing` #endpoint = 'https://api.testnet.solana.com' # for `testing` endpoint = 'https://api.mainnet-beta.solana.com' # real data #endpoint = 'https://solana-api.projectserum.com' solana_client = Client(endpoint) for address, params in all_addresses: print('address:', address) print('params:', params) #result = solana_client.get_confirmed_signature_for_address2(address, limit=1) result = solana_client.get_signatures_for_address(address, **params) if 'result' in result: print('len:', len(result['result'])) # `[:5]` to display only first 5 items for number, item in enumerate(result['result'][:5], 1): print(number, 'signature:', item['signature']) # check if there is "4SNQ4h1vL9GkmSnojQsf8SZyFvQsaq62RCgops2UXFYag1Jc4MoWrjTg2ELwMqM1tQbn9qUcNc4tqX19EGHBqC5u" for number, item in enumerate(result['result'], 1): if item['signature'].startswith('4SNQ'): print('found at', number, '>>>', item['signature']) else: # error
'fake address', ] #endpoint = 'https://api.devnet.solana.com' # probably for `developing` #endpoint = 'https://api.testnet.solana.com' # probably for `testing` endpoint = 'https://api.mainnet-beta.solana.com' #endpoint = 'https://solana-api.projectserum.com' solana_client = Client(endpoint) for address in all_addresses: print('address:', address) #result = solana_client.get_confirmed_signature_for_address2(address, limit=1) result = solana_client.get_signatures_for_address(address, before='89Tv9s2uMGaoxB8ZF1LV9nGa72GQ9RbkeyCDvfPviWesZ6ajZBFeHsTPfgwjGEnH7mpZa7jQBXAqjAfMrPirHt2') if 'result' in result: print('len:', len(result['result'])) # `[:5]` to display only first 5 items for number, item in enumerate(result['result'][:5], 1): print(number, 'signature:', item['signature']) # check if there is "4SNQ4h1vL9GkmSnojQsf8SZyFvQsaq62RCgops2UXFYag1Jc4MoWrjTg2ELwMqM1tQbn9qUcNc4tqX19EGHBqC5u" for number, item in enumerate(result['result'], 1): if item['signature'].startswith('4SNQ'): print('found at', number, '>>>', item['signature']) else: # error