diff --git a/silkaj/blockchain_tools.py b/silkaj/blockchain_tools.py index 67c98710753caa576907c594187e8a66f9d8dddb..71429585b7f2dff034e25d8471a1e6b162cb8771 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 66155119779c0d8f30879ca6c948d55c6d0b62e8..60e30d1e803e524ad693666655c5a992497cbf7b 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)