diff --git a/crypto/sol/app.py b/crypto/sol/app.py index 3997669..0ae7810 100644 --- a/crypto/sol/app.py +++ b/crypto/sol/app.py @@ -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}")