diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e0a8283e..66834fd7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,6 +9,7 @@ Changelog * add new node (fin.hive.3speak.co) and change change rpc.esteem.app to rpc.ecency.com * Replace diff_match_patch by difflib and add unit tests * Increase timeout and retry cound in beempy +* Remove obsolete replace_hive_by_steem parameter 0.24.13 ------- diff --git a/beem/account.py b/beem/account.py index 4b69fc72..62f822c2 100644 --- a/beem/account.py +++ b/beem/account.py @@ -2755,7 +2755,7 @@ def change_recovery_account(self, new_recovery_account, # ------------------------------------------------------------------------- # Simple Transfer # ------------------------------------------------------------------------- - def transfer(self, to, amount, asset, memo="", account=None, **kwargs): + def transfer(self, to, amount, asset, memo="", skip_account_check=False, account=None, **kwargs): """ Transfer an asset to another account. :param str to: Recipient @@ -2763,6 +2763,8 @@ def transfer(self, to, amount, asset, memo="", account=None, **kwargs): :param str asset: Asset to transfer :param str memo: (optional) Memo, may begin with `#` for encrypted messaging + :param bool skip_account_check: (optional) When True, the receiver + account name is not checked to speed up sending multiple transfers in a row :param str account: (optional) the source account for the transfer if not ``default_account`` @@ -2781,12 +2783,17 @@ def transfer(self, to, amount, asset, memo="", account=None, **kwargs): """ if account is None: - account = self - else: + account = self + elif not skip_account_check: account = Account(account, blockchain_instance=self.blockchain) amount = Amount(amount, asset, blockchain_instance=self.blockchain) - to = Account(to, blockchain_instance=self.blockchain) - replace_hive_by_steem = self.blockchain.get_replace_hive_by_steem() + if not skip_account_check: + to = Account(to, blockchain_instance=self.blockchain) + to_name = to["name"] + account_name = account["name"] + else: + to_name = to + account_name = account if memo and memo[0] == "#": from .memo import Memo memoObj = Memo( @@ -2795,15 +2802,14 @@ def transfer(self, to, amount, asset, memo="", account=None, **kwargs): blockchain_instance=self.blockchain ) memo = memoObj.encrypt(memo[1:])["message"] - + op = operations.Transfer(**{ "amount": amount, - "to": to["name"], + "to": to_name, "memo": memo, - "from": account["name"], + "from": account_name, "prefix": self.blockchain.prefix, "json_str": not bool(self.blockchain.config["use_condenser"]), - "replace_hive_by_steem": replace_hive_by_steem, }) return self.blockchain.finalizeOp(op, account, "active", **kwargs) @@ -2824,7 +2830,6 @@ def transfer_to_vesting(self, amount, to=None, account=None, **kwargs): else: to = Account(to, blockchain_instance=self.blockchain) amount = self._check_amount(amount, self.blockchain.token_symbol) - replace_hive_by_steem = self.blockchain.get_replace_hive_by_steem() to = Account(to, blockchain_instance=self.blockchain) op = operations.Transfer_to_vesting(**{ @@ -2833,7 +2838,6 @@ def transfer_to_vesting(self, amount, to=None, account=None, **kwargs): "amount": amount, "prefix": self.blockchain.prefix, "json_str": not bool(self.blockchain.config["use_condenser"]), - "replace_hive_by_steem": replace_hive_by_steem, }) return self.blockchain.finalizeOp(op, account, "active", **kwargs) @@ -2855,8 +2859,7 @@ def convert(self, amount, account=None, request_id=None): if request_id: request_id = int(request_id) else: - request_id = random.getrandbits(32) - replace_hive_by_steem = self.blockchain.get_replace_hive_by_steem() + request_id = random.getrandbits(32) op = operations.Convert( **{ "owner": account["name"], @@ -2864,7 +2867,6 @@ def convert(self, amount, account=None, request_id=None): "amount": amount, "prefix": self.blockchain.prefix, "json_str": not bool(self.blockchain.config["use_condenser"]), - "replace_hive_by_steem": replace_hive_by_steem, }) return self.blockchain.finalizeOp(op, account, "active") @@ -2894,7 +2896,6 @@ def transfer_to_savings(self, amount, asset, memo, to=None, account=None, **kwar to = account # move to savings on same account else: to = Account(to, blockchain_instance=self.blockchain) - replace_hive_by_steem = self.blockchain.get_replace_hive_by_steem() op = operations.Transfer_to_savings( **{ "from": account["name"], @@ -2903,7 +2904,6 @@ def transfer_to_savings(self, amount, asset, memo, to=None, account=None, **kwar "memo": memo, "prefix": self.blockchain.prefix, "json_str": not bool(self.blockchain.config["use_condenser"]), - "replace_hive_by_steem": replace_hive_by_steem, }) return self.blockchain.finalizeOp(op, account, "active", **kwargs) @@ -2944,8 +2944,6 @@ def transfer_from_savings(self, else: request_id = random.getrandbits(32) - replace_hive_by_steem = self.blockchain.get_replace_hive_by_steem() - op = operations.Transfer_from_savings( **{ "from": account["name"], @@ -2955,7 +2953,6 @@ def transfer_from_savings(self, "memo": memo, "prefix": self.blockchain.prefix, "json_str": not bool(self.blockchain.config["use_condenser"]), - "replace_hive_by_steem": replace_hive_by_steem, }) return self.blockchain.finalizeOp(op, account, "active", **kwargs) @@ -3024,13 +3021,13 @@ def claim_reward_balance(self, reward_steem = self._check_amount(reward_steem + reward_hive, self.blockchain.token_symbol) reward_sbd = self._check_amount(reward_sbd + reward_hbd, self.blockchain.backed_token_symbol) reward_vests = self._check_amount(reward_vests, self.blockchain.vest_token_symbol) - - reward_token = "reward_steem" - reward_backed_token = "reward_sbd" - replace_hive_by_steem = self.blockchain.get_replace_hive_by_steem() - if not replace_hive_by_steem: + + if self.blockchain.is_hive: reward_token = "reward_hive" reward_backed_token = "reward_hbd" + else: + reward_token = "reward_steem" + reward_backed_token = "reward_sbd" if reward_steem.amount == 0 and reward_sbd.amount == 0 and reward_vests.amount == 0: if len(account.balances["rewards"]) == 3: @@ -3044,7 +3041,6 @@ def claim_reward_balance(self, reward_backed_token: reward_sbd, "reward_vests": reward_vests, "prefix": self.blockchain.prefix, - "replace_hive_by_steem": replace_hive_by_steem }) else: reward_steem = account.balances["rewards"][0] diff --git a/beem/blockchaininstance.py b/beem/blockchaininstance.py index 549a0ab8..3af65c91 100644 --- a/beem/blockchaininstance.py +++ b/beem/blockchaininstance.py @@ -780,15 +780,6 @@ def is_steem(self): return False return 'STEEM_CHAIN_ID' in config - def get_replace_hive_by_steem(self): - if not self.is_hive: - return False - hf_version = int(self.get_blockchain_version(use_stored_data=True).split('.')[1]) - replace_hive_by_steem = True - if hf_version >= 24: - replace_hive_by_steem = False - return replace_hive_by_steem - def set_default_account(self, account): """ Set the default account to be used """ @@ -1067,14 +1058,12 @@ def claim_account(self, creator, fee=None, **kwargs): raise ValueError( "Not creator account given. Define it with " + "creator=x, or set the default_account using beempy") - creator = Account(creator, blockchain_instance=self) - replace_hive_by_steem = self.get_replace_hive_by_steem() + creator = Account(creator, blockchain_instance=self) op = { "fee": Amount(fee, blockchain_instance=self), "creator": creator["name"], "prefix": self.prefix, "json_str": not bool(self.config["use_condenser"]), - "replace_hive_by_steem": replace_hive_by_steem, } op = operations.Claim_account(**op) return self.finalizeOp(op, creator, "active", **kwargs) @@ -1248,14 +1237,12 @@ def create_claimed_account( for k in additional_posting_accounts: addaccount = Account(k, blockchain_instance=self) posting_accounts_authority.append([addaccount["name"], 1]) - if combine_with_claim_account: - replace_hive_by_steem = self.get_replace_hive_by_steem() + if combine_with_claim_account: op = { "fee": Amount(fee, blockchain_instance=self), "creator": creator["name"], "prefix": self.prefix, "json_str": not bool(self.config["use_condenser"]), - "replace_hive_by_steem": replace_hive_by_steem, } op = operations.Claim_account(**op) ops = [op] @@ -1452,8 +1439,7 @@ def create_account( if self.hardfork >= 20: required_fee_steem = Amount(props["account_creation_fee"], blockchain_instance=self) else: - required_fee_steem = Amount(props["account_creation_fee"], blockchain_instance=self) * 30 - replace_hive_by_steem = self.get_replace_hive_by_steem() + required_fee_steem = Amount(props["account_creation_fee"], blockchain_instance=self) * 30 op = { "fee": required_fee_steem, "creator": creator["name"], @@ -1474,7 +1460,6 @@ def create_account( "json_metadata": json_meta or {}, "prefix": self.prefix, "json_str": not bool(self.config["use_condenser"]), - "replace_hive_by_steem": replace_hive_by_steem, } op = operations.Account_create(**op) return self.finalizeOp(op, creator, "active", **kwargs) @@ -1683,10 +1668,8 @@ def witness_set_properties(self, wif, owner, props): props_list = [["key", repr(PrivateKey(wif, prefix=self.prefix).pubkey)]] for k in props: props_list.append([k, props[k]]) - replace_hive_by_steem = self.get_replace_hive_by_steem() op = operations.Witness_set_properties({"owner": owner["name"], "props": props_list, "prefix": self.prefix, - "json_str": not bool(self.config["use_condenser"]), - "replace_hive_by_steem": replace_hive_by_steem}) + "json_str": not bool(self.config["use_condenser"])}) tb = TransactionBuilder(blockchain_instance=self) tb.appendOps([op]) tb.appendWif(wif) @@ -1722,8 +1705,7 @@ def witness_update(self, signing_key, url, props, account=None, **kwargs): except Exception as e: raise e if "account_creation_fee" in props: - props["account_creation_fee"] = Amount(props["account_creation_fee"], blockchain_instance=self) - replace_hive_by_steem = self.get_replace_hive_by_steem() + props["account_creation_fee"] = Amount(props["account_creation_fee"], blockchain_instance=self) op = operations.Witness_update( **{ "owner": account["name"], @@ -1733,7 +1715,6 @@ def witness_update(self, signing_key, url, props, account=None, **kwargs): "fee": Amount(0, self.token_symbol, blockchain_instance=self), "prefix": self.prefix, "json_str": not bool(self.config["use_condenser"]), - "replace_hive_by_steem": replace_hive_by_steem, }) return self.finalizeOp(op, account, "active", **kwargs) @@ -2147,8 +2128,7 @@ def _build_comment_options_op(self, author, permlink, options, options['beneficiaries'] = beneficiaries default_max_payout = "1000000.000 %s" % (self.backed_token_symbol) - replace_hive_by_steem = self.get_replace_hive_by_steem() - if not replace_hive_by_steem and self.is_hive: + if self.is_hive: comment_op = operations.Comment_options( **{ "author": @@ -2168,7 +2148,6 @@ def _build_comment_options_op(self, author, permlink, options, "beneficiaries": options.get("beneficiaries", []), "prefix": self.prefix, - "replace_hive_by_steem": False, }) else: comment_op = operations.Comment_options( @@ -2190,7 +2169,6 @@ def _build_comment_options_op(self, author, permlink, options, "beneficiaries": options.get("beneficiaries", []), "prefix": self.prefix, - "replace_hive_by_steem": True, }) return comment_op diff --git a/beem/cli.py b/beem/cli.py index d18d7f49..eed75a4e 100644 --- a/beem/cli.py +++ b/beem/cli.py @@ -2634,7 +2634,7 @@ def createpost(markdown_file, account, title, tags, community, beneficiaries, pe yaml_prefix += 'title: "%s"\n' % title yaml_prefix += 'author: %s\n' % account yaml_prefix += 'tags: %s\n' % tags - if stm.is_hive and not stm.get_replace_hive_by_steem(): + if stm.is_hive: yaml_prefix += 'percent_hbd: %d\n' % percent_hbd else: yaml_prefix += 'percent_steem_dollars: %d\n' % percent_steem_dollars @@ -2757,9 +2757,9 @@ def post(markdown_file, account, title, permlink, tags, reply_identifier, commun if stm.backed_token_symbol not in max_accepted_payout: max_accepted_payout = str(Amount(float(max_accepted_payout), stm.backed_token_symbol, blockchain_instance=stm)) comment_options["max_accepted_payout"] = max_accepted_payout - if percent_hbd is not None and stm.is_hive and not stm.get_replace_hive_by_steem(): + if percent_hbd is not None and stm.is_hive: comment_options["percent_hbd"] = percent_hbd - elif percent_steem_dollars is not None and stm.is_hive and not stm.get_replace_hive_by_steem(): + elif percent_steem_dollars is not None and stm.is_hive: comment_options["percent_hbd"] = percent_steem_dollars elif percent_steem_dollars is not None: comment_options["percent_steem_dollars"] = percent_steem_dollars diff --git a/beem/hive.py b/beem/hive.py index 95fbc8a0..b2f88fc4 100644 --- a/beem/hive.py +++ b/beem/hive.py @@ -182,11 +182,6 @@ def get_hive_per_mvest(self, time_stamp=None, use_stored_data=True): else: return a2 * time_stamp + b2 global_properties = self.get_dynamic_global_properties(use_stored_data=use_stored_data) - if self.get_replace_hive_by_steem(): - return ( - float(Amount(global_properties['total_vesting_fund_steem'], blockchain_instance=self)) / - (float(Amount(global_properties['total_vesting_shares'], blockchain_instance=self)) / 1e6) - ) return ( float(Amount(global_properties['total_vesting_fund_hive'], blockchain_instance=self)) / (float(Amount(global_properties['total_vesting_shares'], blockchain_instance=self)) / 1e6) diff --git a/beem/market.py b/beem/market.py index 5f83fe2e..edb0863d 100644 --- a/beem/market.py +++ b/beem/market.py @@ -587,7 +587,6 @@ def buy( amount = Amount(amount, blockchain_instance=self.blockchain) else: amount = Amount(amount, self["quote"]["symbol"], blockchain_instance=self.blockchain) - replace_hive_by_steem = self.blockchain.get_replace_hive_by_steem() order = operations.Limit_order_create(**{ "owner": account["name"], "orderid": orderid or random.getrandbits(32), @@ -605,7 +604,6 @@ def buy( "fill_or_kill": killfill, "prefix": self.blockchain.prefix, "json_str": not bool(self.blockchain.config["use_condenser"]), - "replace_hive_by_steem": replace_hive_by_steem, }) if returnOrderId: @@ -673,7 +671,6 @@ def sell( amount = Amount(amount, blockchain_instance=self.blockchain) else: amount = Amount(amount, self["quote"]["symbol"], blockchain_instance=self.blockchain) - replace_hive_by_steem = self.blockchain.get_replace_hive_by_steem() order = operations.Limit_order_create(**{ "owner": account["name"], "orderid": orderid or random.getrandbits(32), @@ -691,7 +688,6 @@ def sell( "fill_or_kill": killfill, "prefix": self.blockchain.prefix, "json_str": not bool(self.blockchain.config["use_condenser"]), - "replace_hive_by_steem": replace_hive_by_steem, }) if returnOrderId: # Make blocking broadcasts diff --git a/beem/witness.py b/beem/witness.py index 209bd8bf..1509e9fd 100644 --- a/beem/witness.py +++ b/beem/witness.py @@ -153,7 +153,6 @@ def feed_publish(self, raise AssertionError() if not quote.symbol == self.blockchain.token_symbol: raise AssertionError() - replace_hive_by_steem = self.blockchain.get_replace_hive_by_steem() op = operations.Feed_publish( **{ "publisher": account["name"], @@ -163,7 +162,6 @@ def feed_publish(self, }, "prefix": self.blockchain.prefix, "json_str": not bool(self.blockchain.config["use_condenser"]), - "replace_hive_by_steem": replace_hive_by_steem, }) return self.blockchain.finalizeOp(op, account, "active") diff --git a/beembase/objects.py b/beembase/objects.py index 2f45d010..b117c2ba 100644 --- a/beembase/objects.py +++ b/beembase/objects.py @@ -21,8 +21,7 @@ class Amount(object): - def __init__(self, d, prefix=default_prefix, replace_hive_by_steem=True, json_str=False): - self.replace_hive_by_steem = replace_hive_by_steem + def __init__(self, d, prefix=default_prefix, json_str=False): self.json_str = json_str if isinstance(d, string_types): self.amount, self.symbol = d.strip().split(" ") @@ -46,10 +45,6 @@ def __init__(self, d, prefix=default_prefix, replace_hive_by_steem=True, json_st self.amount = floor(float(self.amount) * 10 ** self.precision) # Workaround to allow transfers in HIVE - if self.symbol == "HBD" and replace_hive_by_steem: - self.symbol = "SBD" - elif self.symbol == "HIVE" and replace_hive_by_steem: - self.symbol = "STEEM" self.str_repr = '{:.{}f} {}'.format((float(self.amount) / 10 ** self.precision), self.precision, self.symbol) elif isinstance(d, list): self.amount = d[0] @@ -83,11 +78,6 @@ def __init__(self, d, prefix=default_prefix, replace_hive_by_steem=True, json_st else: self.amount = d.amount self.symbol = d.symbol - # Workaround to allow transfers in HIVE - if self.symbol == "HBD" and replace_hive_by_steem: - self.symbol = "SBD" - elif self.symbol == "HIVE" and replace_hive_by_steem: - self.symbol = "STEEM" self.asset = d.asset["asset"] self.precision = d.asset["precision"] self.amount = floor(float(self.amount) * 10 ** self.precision) @@ -177,22 +167,21 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) if "sbd_interest_rate" in kwargs: super(WitnessProps, self).__init__(OrderedDict([ - ('account_creation_fee', Amount(kwargs["account_creation_fee"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem)), + ('account_creation_fee', Amount(kwargs["account_creation_fee"], prefix=prefix)), ('maximum_block_size', Uint32(kwargs["maximum_block_size"])), ('sbd_interest_rate', Uint16(kwargs["sbd_interest_rate"])), ])) elif "hbd_interest_rate" in kwargs: super(WitnessProps, self).__init__(OrderedDict([ - ('account_creation_fee', Amount(kwargs["account_creation_fee"], prefix=prefix, replace_hive_by_steem=False)), + ('account_creation_fee', Amount(kwargs["account_creation_fee"], prefix=prefix)), ('maximum_block_size', Uint32(kwargs["maximum_block_size"])), ('hbd_interest_rate', Uint16(kwargs["hbd_interest_rate"])), ])) else: super(WitnessProps, self).__init__(OrderedDict([ - ('account_creation_fee', Amount(kwargs["account_creation_fee"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem)), + ('account_creation_fee', Amount(kwargs["account_creation_fee"], prefix=prefix)), ('maximum_block_size', Uint32(kwargs["maximum_block_size"])), ])) @@ -205,10 +194,9 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) super(Price, self).__init__(OrderedDict([ - ('base', Amount(kwargs["base"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem)), - ('quote', Amount(kwargs["quote"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem)) + ('base', Amount(kwargs["base"], prefix=prefix)), + ('quote', Amount(kwargs["quote"], prefix=prefix)) ])) @@ -266,11 +254,10 @@ def __init__(self, *args, **kwargs): kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) super(ExchangeRate, self).__init__( OrderedDict([ - ('base', Amount(kwargs["base"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem)), - ('quote', Amount(kwargs["quote"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem)), + ('base', Amount(kwargs["base"], prefix=prefix)), + ('quote', Amount(kwargs["quote"], prefix=prefix)), ])) diff --git a/beembase/operations.py b/beembase/operations.py index e2a54e9d..9168e5c2 100644 --- a/beembase/operations.py +++ b/beembase/operations.py @@ -47,7 +47,6 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) json_str = kwargs.get("json_str", False) if "memo" not in kwargs: kwargs["memo"] = "" @@ -62,7 +61,7 @@ def __init__(self, *args, **kwargs): super(Transfer, self).__init__(OrderedDict([ ('from', String(kwargs["from"])), ('to', String(kwargs["to"])), - ('amount', Amount(kwargs["amount"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), + ('amount', Amount(kwargs["amount"], prefix=prefix, json_str=json_str)), ('memo', memo), ])) @@ -88,12 +87,11 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) json_str = kwargs.get("json_str", False) super(Transfer_to_vesting, self).__init__(OrderedDict([ ('from', String(kwargs["from"])), ('to', String(kwargs["to"])), - ('amount', Amount(kwargs["amount"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), + ('amount', Amount(kwargs["amount"], prefix=prefix, json_str=json_str)), ])) @@ -181,7 +179,6 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) json_str = kwargs.get("json_str", False) if not len(kwargs["new_account_name"]) <= 16: raise AssertionError("Account name must be at most 16 chars long") @@ -194,7 +191,7 @@ def __init__(self, *args, **kwargs): meta = kwargs["json_metadata"] super(Account_create, self).__init__(OrderedDict([ - ('fee', Amount(kwargs["fee"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), + ('fee', Amount(kwargs["fee"], prefix=prefix, json_str=json_str)), ('creator', String(kwargs["creator"])), ('new_account_name', String(kwargs["new_account_name"])), ('owner', Permission(kwargs["owner"], prefix=prefix)), @@ -213,7 +210,6 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) json_str = kwargs.get("json_str", False) if not len(kwargs["new_account_name"]) <= 16: raise AssertionError("Account name must be at most 16 chars long") @@ -226,8 +222,8 @@ def __init__(self, *args, **kwargs): meta = kwargs["json_metadata"] super(Account_create_with_delegation, self).__init__(OrderedDict([ - ('fee', Amount(kwargs["fee"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), - ('delegation', Amount(kwargs["delegation"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), + ('fee', Amount(kwargs["fee"], prefix=prefix, json_str=json_str)), + ('delegation', Amount(kwargs["delegation"], prefix=prefix, json_str=json_str)), ('creator', String(kwargs["creator"])), ('new_account_name', String(kwargs["new_account_name"])), ('owner', Permission(kwargs["owner"], prefix=prefix)), @@ -341,7 +337,6 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) json_str = kwargs.get("json_str", False) extensions = Array([]) @@ -351,7 +346,7 @@ def __init__(self, *args, **kwargs): ('receiver', String(kwargs["receiver"])), ('start_date', PointInTime(kwargs["start_date"])), ('end_date', PointInTime(kwargs["end_date"])), - ('daily_pay', Amount(kwargs["daily_pay"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), + ('daily_pay', Amount(kwargs["daily_pay"], prefix=prefix, json_str=json_str)), ('subject', String(kwargs["subject"])), ('permlink', String(kwargs["permlink"])), ('extensions', extensions) @@ -424,7 +419,6 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.pop("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) json_str = kwargs.get("json_str", False) extensions = Array([]) props = {} @@ -451,20 +445,16 @@ def __init__(self, *args, **kwargs): elif isinstance(k[1], int) and k[0] in ["hbd_interest_rate"]: props[k[0]] = (hexlify(Uint16(k[1]).__bytes__())).decode() elif not isinstance(k[1], str) and k[0] in ["account_creation_fee"]: - props[k[0]] = (hexlify(Amount(k[1], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str).__bytes__())).decode() + props[k[0]] = (hexlify(Amount(k[1], prefix=prefix, json_str=json_str).__bytes__())).decode() elif not is_hex and isinstance(k[1], str) and k[0] in ["account_creation_fee"]: - props[k[0]] = (hexlify(Amount(k[1], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str).__bytes__())).decode() + props[k[0]] = (hexlify(Amount(k[1], prefix=prefix, json_str=json_str).__bytes__())).decode() elif not isinstance(k[1], str) and k[0] in ["sbd_exchange_rate"]: if 'prefix' not in k[1]: - k[1]['prefix'] = prefix - if 'replace_hive_by_steem' not in k[1]: - k[1]['replace_hive_by_steem'] = replace_hive_by_steem + k[1]['prefix'] = prefix props[k[0]] = (hexlify(ExchangeRate(k[1]).__bytes__())).decode() elif not isinstance(k[1], str) and k[0] in ["hbd_exchange_rate"]: if 'prefix' not in k[1]: - k[1]['prefix'] = prefix - if 'replace_hive_by_steem' not in k[1]: - k[1]['replace_hive_by_steem'] = False + k[1]['prefix'] = prefix props[k[0]] = (hexlify(ExchangeRate(k[1]).__bytes__())).decode() elif not is_hex and k[0] in ["url"]: props[k[0]] = (hexlify(String(k[1]).__bytes__())).decode() @@ -494,7 +484,6 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.pop("prefix", default_prefix) - replace_hive_by_steem = kwargs.pop("replace_hive_by_steem", True) json_str = kwargs.get("json_str", False) if "block_signing_key" in kwargs and kwargs["block_signing_key"]: block_signing_key = (PublicKey(kwargs["block_signing_key"], prefix=prefix)) @@ -503,15 +492,13 @@ def __init__(self, *args, **kwargs): prefix + "1111111111111111111111111111111114T1Anm", prefix=prefix) if 'prefix' not in kwargs['props']: kwargs['props']['prefix'] = prefix - if 'replace_hive_by_steem' not in kwargs['props']: - kwargs['props']['replace_hive_by_steem'] = replace_hive_by_steem super(Witness_update, self).__init__(OrderedDict([ ('owner', String(kwargs["owner"])), ('url', String(kwargs["url"])), ('block_signing_key', block_signing_key), ('props', WitnessProps(kwargs["props"])), - ('fee', Amount(kwargs["fee"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), + ('fee', Amount(kwargs["fee"], prefix=prefix, json_str=json_str)), ])) @@ -575,7 +562,6 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) json_str = kwargs.get("json_str", False) # handle beneficiaries if "beneficiaries" in kwargs and kwargs['beneficiaries']: @@ -589,7 +575,7 @@ def __init__(self, *args, **kwargs): ('author', String(kwargs["author"])), ('permlink', String(kwargs["permlink"])), ('max_accepted_payout', - Amount(kwargs["max_accepted_payout"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), + Amount(kwargs["max_accepted_payout"], prefix=prefix, json_str=json_str)), ('percent_steem_dollars', Uint16(int(kwargs["percent_steem_dollars"]))), ('allow_votes', Bool(bool(kwargs["allow_votes"]))), @@ -603,7 +589,7 @@ def __init__(self, *args, **kwargs): ('author', String(kwargs["author"])), ('permlink', String(kwargs["permlink"])), ('max_accepted_payout', - Amount(kwargs["max_accepted_payout"], prefix=prefix, replace_hive_by_steem=False)), + Amount(kwargs["max_accepted_payout"], prefix=prefix)), ('percent_hbd', Uint16(int(kwargs["percent_hbd"]))), ('allow_votes', Bool(bool(kwargs["allow_votes"]))), @@ -633,12 +619,9 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) json_str = kwargs.get("json_str", False) if 'prefix' not in kwargs['exchange_rate']: - kwargs['exchange_rate']['prefix'] = prefix - if 'replace_hive_by_steem' not in kwargs['exchange_rate']: - kwargs['exchange_rate']['replace_hive_by_steem'] = replace_hive_by_steem + kwargs['exchange_rate']['prefix'] = prefix super(Feed_publish, self).__init__( OrderedDict([ ('publisher', String(kwargs["publisher"])), @@ -653,13 +636,12 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) json_str = kwargs.get("json_str", False) super(Convert, self).__init__( OrderedDict([ ('owner', String(kwargs["owner"])), ('requestid', Uint32(kwargs["requestid"])), - ('amount', Amount(kwargs["amount"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), + ('amount', Amount(kwargs["amount"], prefix=prefix, json_str=json_str)), ])) @@ -698,12 +680,11 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) json_str = kwargs.get("json_str", False) super(Claim_account, self).__init__( OrderedDict([ ('creator', String(kwargs["creator"])), - ('fee', Amount(kwargs["fee"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), + ('fee', Amount(kwargs["fee"], prefix=prefix, json_str=json_str)), ('extensions', Array([])), ])) @@ -761,14 +742,13 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) json_str = kwargs.get("json_str", False) super(Limit_order_create, self).__init__( OrderedDict([ ('owner', String(kwargs["owner"])), ('orderid', Uint32(kwargs["orderid"])), - ('amount_to_sell', Amount(kwargs["amount_to_sell"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), - ('min_to_receive', Amount(kwargs["min_to_receive"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), + ('amount_to_sell', Amount(kwargs["amount_to_sell"], prefix=prefix, json_str=json_str)), + ('min_to_receive', Amount(kwargs["min_to_receive"], prefix=prefix, json_str=json_str)), ('fill_or_kill', Bool(kwargs["fill_or_kill"])), ('expiration', PointInTime(kwargs["expiration"])), ])) @@ -781,17 +761,14 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) json_str = kwargs.get("json_str", False) if 'prefix' not in kwargs['exchange_rate']: - kwargs['exchange_rate']['prefix'] = prefix - if 'replace_hive_by_steem' not in kwargs['exchange_rate']: - kwargs['exchange_rate']['replace_hive_by_steem'] = replace_hive_by_steem + kwargs['exchange_rate']['prefix'] = prefix super(Limit_order_create2, self).__init__( OrderedDict([ ('owner', String(kwargs["owner"])), ('orderid', Uint32(kwargs["orderid"])), - ('amount_to_sell', Amount(kwargs["amount_to_sell"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), + ('amount_to_sell', Amount(kwargs["amount_to_sell"], prefix=prefix, json_str=json_str)), ('fill_or_kill', Bool(kwargs["fill_or_kill"])), ('exchange_rate', ExchangeRate(kwargs["exchange_rate"])), ('expiration', PointInTime(kwargs["expiration"])), @@ -819,7 +796,6 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) json_str = kwargs.get("json_str", False) if "memo" not in kwargs: kwargs["memo"] = "" @@ -829,7 +805,7 @@ def __init__(self, *args, **kwargs): ('from', String(kwargs["from"])), ('request_id', Uint32(kwargs["request_id"])), ('to', String(kwargs["to"])), - ('amount', Amount(kwargs["amount"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), + ('amount', Amount(kwargs["amount"], prefix=prefix, json_str=json_str)), ('memo', String(kwargs["memo"])), ])) @@ -854,36 +830,35 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) json_str = kwargs.get("json_str", False) if "reward_sbd" in kwargs and "reward_steem" in kwargs: super(Claim_reward_balance, self).__init__( OrderedDict([ ('account', String(kwargs["account"])), - ('reward_steem', Amount(kwargs["reward_steem"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), - ('reward_sbd', Amount(kwargs["reward_sbd"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), + ('reward_steem', Amount(kwargs["reward_steem"], prefix=prefix, json_str=json_str)), + ('reward_sbd', Amount(kwargs["reward_sbd"], prefix=prefix, json_str=json_str)), ('reward_vests', Amount(kwargs["reward_vests"], prefix=prefix)), ])) elif "reward_hbd" in kwargs and "reward_hive" in kwargs: super(Claim_reward_balance, self).__init__( OrderedDict([ ('account', String(kwargs["account"])), - ('reward_hive', Amount(kwargs["reward_hive"], prefix=prefix, replace_hive_by_steem=False)), - ('reward_hbd', Amount(kwargs["reward_hbd"], prefix=prefix, replace_hive_by_steem=False)), + ('reward_hive', Amount(kwargs["reward_hive"], prefix=prefix)), + ('reward_hbd', Amount(kwargs["reward_hbd"], prefix=prefix)), ('reward_vests', Amount(kwargs["reward_vests"], prefix=prefix)), ])) elif "reward_steem" in kwargs: super(Claim_reward_balance, self).__init__( OrderedDict([ ('account', String(kwargs["account"])), - ('reward_steem', Amount(kwargs["reward_steem"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), + ('reward_steem', Amount(kwargs["reward_steem"], prefix=prefix, json_str=json_str)), ('reward_vests', Amount(kwargs["reward_vests"], prefix=prefix)), ])) else: super(Claim_reward_balance, self).__init__( OrderedDict([ ('account', String(kwargs["account"])), - ('reward_hive', Amount(kwargs["reward_hive"], prefix=prefix, replace_hive_by_steem=False)), + ('reward_hive', Amount(kwargs["reward_hive"], prefix=prefix)), ('reward_vests', Amount(kwargs["reward_vests"], prefix=prefix)), ])) @@ -895,7 +870,6 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) json_str = kwargs.get("json_str", False) if "memo" not in kwargs: kwargs["memo"] = "" @@ -903,7 +877,7 @@ def __init__(self, *args, **kwargs): OrderedDict([ ('from', String(kwargs["from"])), ('to', String(kwargs["to"])), - ('amount', Amount(kwargs["amount"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), + ('amount', Amount(kwargs["amount"], prefix=prefix, json_str=json_str)), ('memo', String(kwargs["memo"])), ])) @@ -950,7 +924,6 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) json_str = kwargs.get("json_str", False) meta = "" if "json_meta" in kwargs and kwargs["json_meta"]: @@ -965,9 +938,9 @@ def __init__(self, *args, **kwargs): ('to', String(kwargs["to"])), ('agent', String(kwargs["agent"])), ('escrow_id', Uint32(kwargs["escrow_id"])), - ('sbd_amount', Amount(kwargs["sbd_amount"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), - ('steem_amount', Amount(kwargs["steem_amount"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), - ('fee', Amount(kwargs["fee"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), + ('sbd_amount', Amount(kwargs["sbd_amount"], prefix=prefix, json_str=json_str)), + ('steem_amount', Amount(kwargs["steem_amount"], prefix=prefix, json_str=json_str)), + ('fee', Amount(kwargs["fee"], prefix=prefix, json_str=json_str)), ('ratification_deadline', PointInTime(kwargs["ratification_deadline"])), ('escrow_expiration', PointInTime(kwargs["escrow_expiration"])), ('json_meta', String(meta)), @@ -979,9 +952,9 @@ def __init__(self, *args, **kwargs): ('to', String(kwargs["to"])), ('agent', String(kwargs["agent"])), ('escrow_id', Uint32(kwargs["escrow_id"])), - ('hbd_amount', Amount(kwargs["hbd_amount"], prefix=prefix, replace_hive_by_steem=False)), - ('hive_amount', Amount(kwargs["hive_amount"], prefix=prefix, replace_hive_by_steem=False)), - ('fee', Amount(kwargs["fee"], prefix=prefix, replace_hive_by_steem=False)), + ('hbd_amount', Amount(kwargs["hbd_amount"], prefix=prefix)), + ('hive_amount', Amount(kwargs["hive_amount"], prefix=prefix)), + ('fee', Amount(kwargs["fee"], prefix=prefix)), ('ratification_deadline', PointInTime(kwargs["ratification_deadline"])), ('escrow_expiration', PointInTime(kwargs["escrow_expiration"])), ('json_meta', String(meta)), @@ -1010,7 +983,6 @@ def __init__(self, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) - replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True) json_str = kwargs.get("json_str", False) if "steem_amount" in kwargs and "sbd_amount" in kwargs: super(Escrow_release, self).__init__( @@ -1019,8 +991,8 @@ def __init__(self, *args, **kwargs): ('to', String(kwargs["to"])), ('who', String(kwargs["who"])), ('escrow_id', Uint32(kwargs["escrow_id"])), - ('sbd_amount', Amount(kwargs["sbd_amount"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), - ('steem_amount', Amount(kwargs["steem_amount"], prefix=prefix, replace_hive_by_steem=replace_hive_by_steem, json_str=json_str)), + ('sbd_amount', Amount(kwargs["sbd_amount"], prefix=prefix, json_str=json_str)), + ('steem_amount', Amount(kwargs["steem_amount"], prefix=prefix, json_str=json_str)), ])) else: super(Escrow_release, self).__init__( @@ -1029,8 +1001,8 @@ def __init__(self, *args, **kwargs): ('to', String(kwargs["to"])), ('who', String(kwargs["who"])), ('escrow_id', Uint32(kwargs["escrow_id"])), - ('hbd_amount', Amount(kwargs["hbd_amount"], prefix=prefix, replace_hive_by_steem=False)), - ('hive_amount', Amount(kwargs["hive_amount"], prefix=prefix, replace_hive_by_steem=False)), + ('hbd_amount', Amount(kwargs["hbd_amount"], prefix=prefix)), + ('hive_amount', Amount(kwargs["hive_amount"], prefix=prefix)), ]))