From f528e44c005f28bdfb3180cec42d52c52f1f17e4 Mon Sep 17 00:00:00 2001
From: Moul <moul@moul.re>
Date: Sun, 5 Jun 2022 16:42:52 +0200
Subject: [PATCH] [mypy] #163: Add type annotation on tools and
 blockchain_tools

---
 silkaj/blockchain_tools.py | 7 ++++---
 silkaj/tools.py            | 7 +++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/silkaj/blockchain_tools.py b/silkaj/blockchain_tools.py
index 67c98710..71429585 100644
--- a/silkaj/blockchain_tools.py
+++ b/silkaj/blockchain_tools.py
@@ -14,6 +14,7 @@
 # along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
 
 import functools
+from typing import Dict
 
 from duniterpy.api.bma import blockchain
 
@@ -21,17 +22,17 @@ from silkaj.network_tools import client_instance
 
 
 @functools.lru_cache(maxsize=1)
-def get_blockchain_parameters():
+def get_blockchain_parameters() -> Dict:
     client = client_instance()
     return client(blockchain.parameters)
 
 
 @functools.lru_cache(maxsize=1)
-def get_head_block():
+def get_head_block() -> Dict:
     client = client_instance()
     return client(blockchain.current)
 
 
 @functools.lru_cache(maxsize=1)
-def get_currency():
+def get_currency() -> str:
     return get_head_block()["currency"]
diff --git a/silkaj/tools.py b/silkaj/tools.py
index 66155119..60e30d1e 100644
--- a/silkaj/tools.py
+++ b/silkaj/tools.py
@@ -21,14 +21,13 @@ from silkaj.constants import FAILURE_EXIT_STATUS, G1_SYMBOL, GTEST_SYMBOL
 
 
 @functools.lru_cache(maxsize=1)
-def get_currency_symbol():
+def get_currency_symbol() -> str:
     params = get_blockchain_parameters()
     if params["currency"] == "g1":
         return G1_SYMBOL
-    elif params["currency"] == "g1-test":
-        return GTEST_SYMBOL
+    return GTEST_SYMBOL
 
 
-def message_exit(message):
+def message_exit(message: str) -> None:
     print(message)
     exit(FAILURE_EXIT_STATUS)
-- 
GitLab