From 1ca889edddcfca87e540799d5384907b7db2c0c9 Mon Sep 17 00:00:00 2001 From: pharesim <pharesim@protonmail.com> Date: Fri, 16 Oct 2020 13:50:32 +0200 Subject: [PATCH] v0.10 --- docs/conf.py | 4 +- hive/__init__.py | 2 +- hive/account.py | 7 ---- hive/cli.py | 4 -- hive/commit.py | 101 ++++++++++++--------------------------------- hive/converter.py | 4 -- hive/dex.py | 21 ++++------ hive/hived.py | 4 -- hivebase/chains.py | 2 +- setup.py | 2 +- 10 files changed, 39 insertions(+), 112 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index f19d808..d0cd16d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -66,9 +66,9 @@ author = 'pharesim@protonmail.com' # built documents. # # The short X.Y version. -version = '0.9' +version = '0.10' # The full version, including alpha/beta/rc tags. -release = '0.9.10001' +release = '0.10' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/hive/__init__.py b/hive/__init__.py index 9ff5921..c53e78f 100644 --- a/hive/__init__.py +++ b/hive/__init__.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- from .hive import Hive -__version__ = '0.9.10001' +__version__ = '0.10' diff --git a/hive/account.py b/hive/account.py index 81f9c6e..5ab0714 100644 --- a/hive/account.py +++ b/hive/account.py @@ -77,13 +77,6 @@ class Account(dict): return self.get_balances() def get_balances(self): - # temporarily allow both steem and hive symbols until after HF24 - if 'sbd_balance' in self: - self['hbd_balance'] = self['sbd_balance'] - self['savings_hbd_balance'] = self['savings_sbd_balance'] - self['reward_hive_balance'] = self['reward_steem_balance'] - self['reward_hbd_balance'] = self['reward_sbd_balance'] - available = { 'HIVE': Amount(self['balance']).amount, 'HBD': Amount(self['hbd_balance']).amount, diff --git a/hive/cli.py b/hive/cli.py index 688020b..bb75f71 100644 --- a/hive/cli.py +++ b/hive/cli.py @@ -797,10 +797,6 @@ def legacyentry(): blockchain = Blockchain(mode="head") info = blockchain.info() - # temporarily allow both steem and hive symbols until after HF24 - if 'total_vesting_fund_steem' in info: - info['total_vesting_fund_hive'] = info['total_vesting_fund_steem'] - median_price = hive.get_current_median_history_price() hive_per_mvest = ( Amount(info["total_vesting_fund_hive"]).amount / diff --git a/hive/commit.py b/hive/commit.py index 329d5fb..3d620c0 100644 --- a/hive/commit.py +++ b/hive/commit.py @@ -641,17 +641,10 @@ class Commit(object): if not account: raise ValueError("You need to provide an account") - # temporarily allow both steem and hive symbols until after HF24 - legacy_symbols = 0 - a = Account(account,hived_instance=self.hived) - if 'reward_steem_balance' in a: - legacy_symbols = 1 - if legacy_symbols == 1: - assert asset in ['HIVE', 'HBD', 'STEEM', 'SBD'] - if asset == 'HIVE': - asset = 'STEEM' - if asset == 'HBD': - asset = 'SBD' + if asset == 'HIVE': + asset = 'STEEM' + if asset == 'HBD': + asset = 'SBD' if memo and memo[0] == "#": from hivebase import memo as Memo @@ -730,12 +723,7 @@ class Commit(object): if not to: to = account # powerup on the same account - # temporarily allow both steem and hive symbols until after HF24 - asset_symbol = 'HIVE' - a = Account(account, hived_instance=self.hived) - if 'reward_steem_balance' in a: - asset_symbol = 'STEEM' - + asset_symbol = 'STEEM' op = operations.TransferToVesting( **{ "from": @@ -795,17 +783,10 @@ class Commit(object): if not ``default_account`` """ - # temporarily allow both steem and hive symbols until after HF24 - legacy_symbols = 0 - a = Account(account, hived_instance=self.hived) - if 'reward_steem_balance' in a: - legacy_symbols = 1 - if legacy_symbols == 1: - assert asset in ['HIVE', 'HBD', 'STEEM', 'SBD'] - if asset == 'HIVE': - asset = 'STEEM' - if asset == 'HBD': - asset = 'SBD' + if asset == 'HIVE': + asset = 'STEEM' + if asset == 'HBD': + asset = 'SBD' if not account: account = configStorage.get("default_account") @@ -849,17 +830,10 @@ class Commit(object): if not ``default_account`` """ - # temporarily allow both steem and hive symbols until after HF24 - legacy_symbols = 0 - a = Account(account, hived_instance=self.hived) - if 'reward_steem_balance' in a: - legacy_symbols = 1 - if legacy_symbols == 1: - assert asset in ['HIVE', 'HBD', 'STEEM', 'SBD'] - if asset == 'HIVE': - asset = 'STEEM' - if asset == 'HBD': - asset = 'SBD' + if asset == 'HIVE': + asset = 'STEEM' + if asset == 'HBD': + asset = 'SBD' if not account: account = configStorage.get("default_account") @@ -940,40 +914,24 @@ class Commit(object): float(first(x.split(' '))) for x in [reward_hbd, reward_hive, reward_vests]): a = Account(account, hived_instance=self.hived) - # temporarily allow both steem and hive symbols until after HF24 - if 'sbd_balance' in a: - a['hbd_balance'] = a['sbd_balance'] - a['savings_hbd_balance'] = a['savings_sbd_balance'] - a['reward_hive_balance'] = a['reward_steem_balance'] - a['reward_hbd_balance'] = a['reward_sbd_balance'] reward_hive = a['reward_hive_balance'] reward_hbd = a['reward_hbd_balance'] reward_vests = a['reward_vesting_balance'] - # temporarily allow both steem and hive symbols until after HF24 - a = Account(account, hived_instance=self.hived) - if 'sbd_balance' in a: - if reward_hive[-4:] == 'HIVE': - reward_hive = reward_hive[:-4]+'STEEM' - if reward_hbd[-3:] == 'HBD': - reward_hbd = reward_hbd[:-3]+'SBD' - op = operations.ClaimRewardBalance( - **{ - "account": account, - "reward_steem": reward_hive, - "reward_sbd": reward_hbd, - "reward_vests": reward_vests, - }) - else: - op = operations.ClaimRewardBalance( - **{ - "account": account, - "reward_hive": reward_hive, - "reward_hbd": reward_hbd, - "reward_vests": reward_vests, - }) + if reward_hive[-4:] == 'HIVE': + reward_hive = reward_hive[:-4]+'STEEM' + if reward_hbd[-3:] == 'HBD': + reward_hbd = reward_hbd[:-3]+'SBD' + + op = operations.ClaimRewardBalance( + **{ + "account": account, + "reward_hive": reward_hive, + "reward_hbd": reward_hbd, + "reward_vests": reward_vests, + }) return self.finalizeOp(op, account, "posting") def delegate_vesting_shares(self, to_account, vesting_shares, @@ -1087,17 +1045,10 @@ class Commit(object): if not account: raise ValueError("You need to provide an account") - # temporarily allow both steem and hive symbols until after HF24 - legacy_symbols = 0 - a = Account(account, hived_instance=self.hived) - if 'reward_steem_balance' in a: - legacy_symbols = 1 - props_list = [["key", repr(PrivateKey(signing_key, prefix=self.hived.chain_params["prefix"]).pubkey)]] for k in props: if k == 'account_creation_fee': - # temporarily allow both steem and hive symbols until after HF24 - if props[k][-4:] == 'HIVE' and legacy_symbols == 1: + if props[k][-4:] == 'HIVE': props[k] = props[k][:-4]+'STEEM' props_list.append([k, props[k]]) diff --git a/hive/converter.py b/hive/converter.py index 8dedc01..495456a 100644 --- a/hive/converter.py +++ b/hive/converter.py @@ -31,10 +31,6 @@ class Converter(object): """ info = self.hived.get_dynamic_global_properties() - # temporarily allow both steem and hive symbols until after HF24 - if 'total_vesting_fund_steem' in info: - info['total_vesting_fund_hive'] = info['total_vesting_fund_steem'] - return (Amount(info["total_vesting_fund_hive"]).amount / (Amount(info["total_vesting_shares"]).amount / 1e6)) diff --git a/hive/dex.py b/hive/dex.py index 49694eb..0eed603 100644 --- a/hive/dex.py +++ b/hive/dex.py @@ -28,19 +28,14 @@ class Dex(object): VESTS) """ - # temporarily allow both steem and hive symbols until after HF24 - precision = 3 - if symbol == 'VESTS': - precision = 6 - return {"symbol":symbol,"precision": precision} -# if symbol == "HIVE" or symbol == "STEEM": -# return {"symbol": "HIVE", "precision": 3} -# elif symbol == "HBD" or symbol == "SBD": -# return {"symbol": "HBD", "precision": 3} -# elif symbol == "VESTS": -# return {"symbol": "VESTS", "precision": 6} -# else: -# return None + if symbol == "HIVE" or symbol == "STEEM": + return {"symbol": "STEEM", "precision": 3} + elif symbol == "HBD" or symbol == "SBD": + return {"symbol": "SBD", "precision": 3} + elif symbol == "VESTS": + return {"symbol": "VESTS", "precision": 6} + else: + return None def _get_assets(self, quote): """ Given the `quote` asset, return base. If quote is HBD, then diff --git a/hive/hived.py b/hive/hived.py index c2ef280..0b00501 100644 --- a/hive/hived.py +++ b/hive/hived.py @@ -70,10 +70,6 @@ class Hived(HttpClient): #return known_chains.get(chain) # temporarily use chain_id from get_version until after HF24 chain = known_chains.get(chain) - version = self.get_version() - if version['chain_id'] != '0000000000000000000000000000000000000000000000000000000000000000': - print('Switching to chain_id '+version['chain_id']) - chain['chain_id'] = version['chain_id'] return chain def get_replies(self, author, skip_own=True): diff --git a/hivebase/chains.py b/hivebase/chains.py index 1ae87dc..15a8eb3 100644 --- a/hivebase/chains.py +++ b/hivebase/chains.py @@ -2,7 +2,7 @@ default_prefix = "STM" known_chains = { "HIVE": { - "chain_id": "0" * int(256 / 4), + "chain_id": "beeab0de00000000000000000000000000000000000000000000000000000000", "prefix": "STM", "hive_symbol": "HIVE", "hbd_symbol": "HBD", diff --git a/setup.py b/setup.py index 4ddf777..fa84142 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ from setuptools.command.test import test as TestCommand # Package meta-data. NAME = 'hivepy' -VERSION = '0.9.10001' +VERSION = '0.10' DESCRIPTION = 'A python hive library.' URL = 'https://github.com/pharesim/hive-python' EMAIL = 'pharesim@protonmail.com' -- GitLab