@@ -280,10 +280,14 @@ async def return_agent_with_wallet_details(self, agent: AgentResponse):
280280 async with aiohttp .ClientSession () as session :
281281 async with asyncio .TaskGroup () as group :
282282 agent_configurations = group .create_task (self .trigger_service .list_triggers_by_agent_id (agent .id ))
283- wallet_balance = group .create_task (self .fetch_balance (wallet .stake_key_hash , session ))
284- drep_details = group .create_task (self .fetch_drep_details (wallet .stake_key_hash , session ))
283+ wallet_balance = group .create_task (
284+ self .fetch_balance (convert_stake_key_hash_to_address (wallet .stake_key_hash ), session )
285+ )
286+ drep_details = group .create_task (
287+ self .fetch_drep_details (convert_stake_key_hash_to_address (wallet .stake_key_hash ), session )
288+ )
285289 delegation_details = group .create_task (
286- self .fetch_delegation_details (wallet .stake_key_hash , session )
290+ self .fetch_delegation_details (convert_stake_key_hash_to_address ( wallet .stake_key_hash ) , session )
287291 )
288292 stake_address_details = group .create_task (
289293 self .fetch_stake_address_details (wallet .stake_key_hash , session )
@@ -303,3 +307,13 @@ async def return_agent_with_wallet_details(self, agent: AgentResponse):
303307 is_stake_registered = stake_address_details .result ().get ("is_stake_registered" ),
304308 stake_last_registered = stake_address_details .result ().get ("last_registered" ),
305309 )
310+
311+
312+ def convert_stake_key_hash_to_address (stake_key_hash ):
313+ if stake_key_hash .startswith ("e0" ) or stake_key_hash .startswith ("e1" ):
314+ return stake_key_hash
315+ else :
316+ if api_settings .APP_ENV == "mainnet" :
317+ return "e1" + stake_key_hash
318+ else :
319+ return "e0" + stake_key_hash
0 commit comments