@@ -188,10 +188,6 @@ async def _graphql_request(
188188
189189 response = await self ._request ("POST" , "/_api/graphql" , data = payload )
190190
191- # Debug: print raw response
192- import sys
193- print (f"[DEBUG] Raw GraphQL response: { response } " , file = sys .stderr )
194-
195191 # Check for GraphQL errors
196192 if "errors" in response :
197193 error_messages = [error .get ("message" , "Unknown error" ) for error in response ["errors" ]]
@@ -302,20 +298,14 @@ async def get_user_balance(self) -> Dict[str, Dict[str, float]]:
302298 }
303299
304300 if "user" in data and data ["user" ] and "balances" in data ["user" ]:
305- balances = data ["user" ]["balances" ]
306-
307- # Process available balances
308- if "available" in balances :
309- for balance in balances ["available" ]:
310- currency = balance .get ("currency" , "" ).lower ()
311- amount = float (balance .get ("amount" , 0 ))
301+ for entry in data ["user" ]["balances" ]:
302+ if "available" in entry :
303+ currency = entry ["available" ].get ("currency" , "" ).lower ()
304+ amount = float (entry ["available" ].get ("amount" , 0 ))
312305 result ["available" ][currency ] = amount
313-
314- # Process vault balances
315- if "vault" in balances :
316- for balance in balances ["vault" ]:
317- currency = balance .get ("currency" , "" ).lower ()
318- amount = float (balance .get ("amount" , 0 ))
306+ if "vault" in entry :
307+ currency = entry ["vault" ].get ("currency" , "" ).lower ()
308+ amount = float (entry ["vault" ].get ("amount" , 0 ))
319309 result ["vault" ][currency ] = amount
320310
321311 return result
0 commit comments