From 505ded64f1934b6bfc755fe32e9cd379be27385a Mon Sep 17 00:00:00 2001 From: Holger Nahrstaedt <holgernahrstaedt@gmx.de> Date: Thu, 27 Aug 2020 18:12:57 +0200 Subject: [PATCH] Fix chain detection --- CHANGELOG.rst | 4 ++++ beem/cli.py | 2 +- beem/version.py | 2 +- beemapi/graphenerpc.py | 18 ++++++++++++------ beemapi/version.py | 2 +- beembase/version.py | 2 +- beemgraphenebase/version.py | 2 +- setup.py | 2 +- 8 files changed, 22 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b94bf76c..07187b28 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,5 +1,9 @@ Changelog ========= +0.24.7 +------ +* Fix chain detection + 0.24.6 ------ * Improved community selection in beempy createpost diff --git a/beem/cli.py b/beem/cli.py index 1650a796..27f18c69 100644 --- a/beem/cli.py +++ b/beem/cli.py @@ -91,7 +91,7 @@ def prompt_callback(ctx, param, value): def asset_callback(ctx, param, value): - if value not in ["STEEM", "SBD", "HIVE", "HBD", "BLURT"]: + if value not in ["STEEM", "SBD", "HIVE", "HBD", "BLURT", "TBD", "TESTS"]: print("Please STEEM/HIVE/BLURT or SBD/HBD as asset!") ctx.abort() else: diff --git a/beem/version.py b/beem/version.py index 162cfc92..e339f57d 100644 --- a/beem/version.py +++ b/beem/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.24.6' +version = '0.24.7' diff --git a/beemapi/graphenerpc.py b/beemapi/graphenerpc.py index bf535638..598f11d2 100644 --- a/beemapi/graphenerpc.py +++ b/beemapi/graphenerpc.py @@ -312,25 +312,31 @@ class GrapheneRPC(object): if key[-8:] == "CHAIN_ID": chain_id = props[key] blockchain_name = key.split("_")[0] - prefix = key[:-9] elif key[-13:] == "CHAIN_VERSION": network_version = props[key] + elif key[-14:] == "ADDRESS_PREFIX": + prefix = props[key] elif key[-6:] == "SYMBOL": value = {} value["asset"] = props[key]["nai"] - value["decimals"] = props[key]["decimals"] - value["symbol"] = key[:-7] + value["precision"] = props[key]["decimals"] + if "IS_TEST_NET" in props and props["IS_TEST_NET"] and "nai" in props[key] and props[key]["nai"] == "@@000000013": + value["symbol"] = "TBD" + elif "IS_TEST_NET" in props and props["IS_TEST_NET"] and "nai" in props[key] and props[key]["nai"] == "@@000000021": + value["symbol"] = "TESTS" + else: + value["symbol"] = key[:-7] value["id"] = -1 symbols.append(value) symbol_id = 0 if len(symbols) == 2: symbol_id = 1 - for s in sorted(symbols, key=lambda self: self['nai'], reverse=False): + for s in sorted(symbols, key=lambda self: self['asset'], reverse=False): s["id"] = symbol_id symbol_id += 1 chain_assets.append(s) - if chain_id is not None and network_version is not None and len(chain_assets) > 0: - chain_config = {"chain_id": chain_id, "min_version": network_version, "chain_assets": chain_assets} + if chain_id is not None and network_version is not None and len(chain_assets) > 0 and prefix is not None: + chain_config = {"prefix": prefix, "chain_id": chain_id, "min_version": network_version, "chain_assets": chain_assets} if chain_id is None: raise("Connecting to unknown network!") diff --git a/beemapi/version.py b/beemapi/version.py index 162cfc92..e339f57d 100644 --- a/beemapi/version.py +++ b/beemapi/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.24.6' +version = '0.24.7' diff --git a/beembase/version.py b/beembase/version.py index 162cfc92..e339f57d 100644 --- a/beembase/version.py +++ b/beembase/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.24.6' +version = '0.24.7' diff --git a/beemgraphenebase/version.py b/beemgraphenebase/version.py index 162cfc92..e339f57d 100644 --- a/beemgraphenebase/version.py +++ b/beemgraphenebase/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.24.6' +version = '0.24.7' diff --git a/setup.py b/setup.py index 1d9a6015..b71d6a6a 100755 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ except LookupError: ascii = codecs.lookup('ascii') codecs.register(lambda name, enc=ascii: {True: enc}.get(name == 'mbcs')) -VERSION = '0.24.6' +VERSION = '0.24.7' tests_require = ['mock >= 2.0.0', 'pytest', 'pytest-mock', 'parameterized'] -- GitLab