wallet works

This commit is contained in:
Dobromir Popov 2024-10-02 18:19:36 +03:00
parent 97a61e4fce
commit 59c9dd5f74

View File

@ -95,12 +95,11 @@ async def get_wallet_balances(wallet_address):
commitment=Confirmed
)
logging.debug(f"Raw response: {json.dumps(response, indent=2, cls=SolanaEncoder)}")
if response.value:
for account in response.value:
if 'parsed' in account.account.data and 'info' in account.account.data['parsed']:
mint = account.account.data['parsed']['info']['mint']
parsed_data = account.account.data.parsed
if isinstance(parsed_data, dict) and 'info' in parsed_data:
mint = parsed_data['info']['mint']
balance_response = await solana_client.get_token_account_balance(account.pubkey)
if balance_response.value:
amount = float(balance_response.value.ui_amount)
@ -119,6 +118,14 @@ async def get_wallet_balances(wallet_address):
logging.error(f"Error getting wallet balances: {str(e)}")
return balances
async def get_non_zero_token_balances(wallet_address):
non_zero_balances = {}
logging.info(f"Getting non-zero balances for wallet: {wallet_address}")