Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion api/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ AGENT_MNEMONIC=
KAFKA_ENABLED=true
METADATA_BASE_URL='https://metadata.drep.id/api'
DB_SYNC_BASE_URL=
KAFKA_PREFIX=
KAFKA_PREFIX=
#preview , mainnet , prepod ... defaults to mainnet
NETWORK=''
20 changes: 17 additions & 3 deletions api/backend/app/services/agent_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,14 @@ async def return_agent_with_wallet_details(self, agent: AgentResponse):
async with aiohttp.ClientSession() as session:
async with asyncio.TaskGroup() as group:
agent_configurations = group.create_task(self.trigger_service.list_triggers_by_agent_id(agent.id))
wallet_balance = group.create_task(self.fetch_balance(wallet.stake_key_hash, session))
drep_details = group.create_task(self.fetch_drep_details(wallet.stake_key_hash, session))
wallet_balance = group.create_task(
self.fetch_balance(convert_stake_key_hash_to_address(wallet.stake_key_hash), session)
)
drep_details = group.create_task(
self.fetch_drep_details(convert_stake_key_hash_to_address(wallet.stake_key_hash), session)
)
delegation_details = group.create_task(
self.fetch_delegation_details(wallet.stake_key_hash, session)
self.fetch_delegation_details(convert_stake_key_hash_to_address(wallet.stake_key_hash), session)
)
stake_address_details = group.create_task(
self.fetch_stake_address_details(wallet.stake_key_hash, session)
Expand All @@ -303,3 +307,13 @@ async def return_agent_with_wallet_details(self, agent: AgentResponse):
is_stake_registered=stake_address_details.result().get("is_stake_registered"),
stake_last_registered=stake_address_details.result().get("last_registered"),
)


def convert_stake_key_hash_to_address(stake_key_hash):
if stake_key_hash.startswith("e0") or stake_key_hash.startswith("e1"):
return stake_key_hash
else:
if api_settings.APP_ENV == "mainnet":
return "e1" + stake_key_hash
else:
return "e0" + stake_key_hash
1 change: 1 addition & 0 deletions api/backend/config/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Application(BaseSettings):
KAFKA_BROKERS: str = "localhost:9092"
KAFKA_ENABLED: bool = False
KUBER_URL: str = ""
NETWORK: str = "mainnet"
# All your additional application configuration should go either here or in
# separate file in this submodule.

Expand Down