From 5c942152f072294875af0fbb103a7112045cb273 Mon Sep 17 00:00:00 2001 From: Jean Demeusy <61140535+jeandemeusy@users.noreply.github.com> Date: Thu, 1 Feb 2024 08:56:39 +0100 Subject: [PATCH] Update ct-app/core/core.py Co-authored-by: Tibor <9529609+Teebor-Choka@users.noreply.github.com> --- ct-app/core/core.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ct-app/core/core.py b/ct-app/core/core.py index b82011dc..f30c8354 100644 --- a/ct-app/core/core.py +++ b/ct-app/core/core.py @@ -119,13 +119,13 @@ def subgraph_staking_url(self) -> str: @property def subgraph_wxhopr_txs_url(self) -> str: - if self.subgraph_type == SubgraphType.DEFAULT: - return self.params.subgraph.wxhopr_txs_url - - if self.subgraph_type == SubgraphType.BACKUP: - return self.params.subgraph.wxhopr_txs_url_backup - - return None + # the mapping can be a static const member of the class or module + subgraph = { + SubgraphType.DEFAULT: self.params.subgraph.wxhopr_txs_url, + SubgraphType.BACKUP: self.params.subgraph.wxhopr_txs_url_backup + } + + return subgraph.get(self.subgraph_type, None) async def _retrieve_address(self): addresses = await self.api.get_address("all")