diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d4d3a7b23880fad28c5ec3368900ea1ce4645b62..da3e8819a4a0b94422a5b070cdddbdb3f83c138d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,5 +1,9 @@ Changelog ========= +0.24.5 +------ +* replace percent_hive_dollars by percent_hbd + 0.24.4 ------ * add get_replace_hive_by_steem() to Hive(), for transition from HF23 to HF24 on HIVE diff --git a/beem/blockchaininstance.py b/beem/blockchaininstance.py index 3ef312056c06d8013e9b326ab49a9ba08ae2fe1d..8a5a83a94cacc5009c7599f993bfe3a1b968789e 100644 --- a/beem/blockchaininstance.py +++ b/beem/blockchaininstance.py @@ -2106,7 +2106,7 @@ class BlockChainInstance(object): def _build_comment_options_op(self, author, permlink, options, beneficiaries): options = remove_from_dict(options or {}, [ - 'max_accepted_payout', 'percent_steem_dollars', 'percent_hive_dollars', + 'max_accepted_payout', 'percent_steem_dollars', 'percent_hbd', 'allow_votes', 'allow_curation_rewards', 'extensions' ], keep_keys=True) # override beneficiaries extension @@ -2143,7 +2143,7 @@ class BlockChainInstance(object): 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: + if not replace_hive_by_steem and self.is_hive: comment_op = operations.Comment_options( **{ "author": @@ -2152,8 +2152,8 @@ class BlockChainInstance(object): permlink, "max_accepted_payout": options.get("max_accepted_payout", default_max_payout), - "percent_hive_dollars": - int(options.get("percent_hive_dollars", STEEM_100_PERCENT)), + "percent_hbd": + int(options.get("percent_hbd", STEEM_100_PERCENT)), "allow_votes": options.get("allow_votes", True), "allow_curation_rewards": diff --git a/beem/cli.py b/beem/cli.py index 81039fb5e624a493afea069912b383fe8a2d0f54..e8a0603d6c8b9b61029c6f897d4ab5786af193bf 100644 --- a/beem/cli.py +++ b/beem/cli.py @@ -2433,7 +2433,7 @@ def download(permlink, account, save, export): if "percent_steem_dollars" in comment: yaml_prefix += 'percent_steem_dollars: %s\n' % str(comment["percent_steem_dollars"]) else: - yaml_prefix += 'percent_hive_dollars: %s\n' % str(comment["percent_hive_dollars"]) + yaml_prefix += 'percent_hbd: %s\n' % str(comment["percent_hbd"]) if "tags" in comment.json_metadata: if len(comment.json_metadata["tags"]) > 0 and comment["category"] != comment.json_metadata["tags"][0] and len(comment["category"]) > 0: yaml_prefix += 'community: %s\n' % comment["category"] @@ -2467,10 +2467,10 @@ def download(permlink, account, save, export): @click.option('--community', '-c', help=' Name of the community (optional)') @click.option('--beneficiaries', '-b', help='Post beneficiaries (komma separated, e.g. a:10%,b:20%)') @click.option('--percent-steem-dollars', '-d', help='50% SBD /50% SP is 10000 (default), 100% SP is 0') -@click.option('--percent-hive-dollars', '-d', help='50% SBD /50% SP is 10000 (default), 100% SP is 0') +@click.option('--percent-hbd', '-h', help='50% HBD /50% HP is 10000 (default), 100% HP is 0') @click.option('--max-accepted-payout', '-m', help='Default is 1000000.000 [SBD]') @click.option('--no-parse-body', '-n', help='Disable parsing of links, tags and images', is_flag=True, default=False) -def createpost(markdown_file, account, title, tags, community, beneficiaries, percent_steem_dollars, percent_hive_dollars, max_accepted_payout, no_parse_body): +def createpost(markdown_file, account, title, tags, community, beneficiaries, percent_steem_dollars, percent_hbd, max_accepted_payout, no_parse_body): """Creates a new markdown file with YAML header""" stm = shared_blockchain_instance() if stm.rpc is not None: @@ -2486,7 +2486,7 @@ def createpost(markdown_file, account, title, tags, community, beneficiaries, pe community = input("community account:") if beneficiaries is None: beneficiaries = input("beneficiaries (komma separated, e.g. a:10%,b:20%):") - if percent_steem_dollars is None and percent_hive_dollars is None: + if percent_steem_dollars is None and percent_hbd is None: ret = None while ret is None: ret = input("50% or 100% Steem/Hive Power as post reward [50 or 100]? ") @@ -2494,16 +2494,16 @@ def createpost(markdown_file, account, title, tags, community, beneficiaries, pe ret = None if ret == "50": percent_steem_dollars = 10000 - percent_hive_dollars = 10000 + percent_hbd = 10000 else: percent_steem_dollars = 0 - percent_hive_dollars = 0 - elif percent_steem_dollars is not None and percent_hive_dollars is not None: - raise ValueError("percent_hive_dollars and percent_steem_dollars cannot be both set.") + percent_hbd = 0 + elif percent_steem_dollars is not None and percent_hbd is not None: + raise ValueError("percent_hbd and percent_steem_dollars cannot be both set.") elif percent_steem_dollars is None: - percent_steem_dollars = percent_hive_dollars - elif percent_hive_dollars is None: - percent_hive_dollars = percent_steem_dollars + percent_steem_dollars = percent_hbd + elif percent_hbd is None: + percent_hbd = percent_steem_dollars if max_accepted_payout is None: max_accepted_payout = input("max accepted payout [return to skip]: ") @@ -2512,7 +2512,7 @@ def createpost(markdown_file, account, title, tags, community, beneficiaries, pe yaml_prefix += 'author: %s\n' % account yaml_prefix += 'tags: %s\n' % tags if stm.is_hive and not stm.get_replace_hive_by_steem(): - yaml_prefix += 'percent_hive_dollars: %d\n' % percent_hive_dollars + yaml_prefix += 'percent_hbd: %d\n' % percent_hbd else: yaml_prefix += 'percent_steem_dollars: %d\n' % percent_steem_dollars if community is not None and community != "": @@ -2537,12 +2537,12 @@ def createpost(markdown_file, account, title, tags, community, beneficiaries, pe @click.option('--canonical-url', '-u', help='Canonical url, can also set to https://hive.blog or https://peakd.com (optional)') @click.option('--beneficiaries', '-b', help='Post beneficiaries (komma separated, e.g. a:10%,b:20%)') @click.option('--percent-steem-dollars', '-d', help='50% SBD /50% SP is 10000 (default), 100% SP is 0') -@click.option('--percent-hive-dollars', '-d', help='50% SBD /50% SP is 10000 (default), 100% SP is 0') +@click.option('--percent-hbd', '-h', help='50% SBD /50% SP is 10000 (default), 100% SP is 0') @click.option('--max-accepted-payout', '-m', help='Default is 1000000.000 [SBD]') @click.option('--no-parse-body', '-n', help='Disable parsing of links, tags and images', is_flag=True, default=False) @click.option('--no-patch-on-edit', '-e', help='Disable patch posting on edits (when the permlink already exists)', is_flag=True, default=False) @click.option('--export', help='When set, transaction is stored in a file') -def post(markdown_file, account, title, permlink, tags, reply_identifier, community, canonical_url, beneficiaries, percent_steem_dollars, percent_hive_dollars, max_accepted_payout, no_parse_body, no_patch_on_edit, export): +def post(markdown_file, account, title, permlink, tags, reply_identifier, community, canonical_url, beneficiaries, percent_steem_dollars, percent_hbd, max_accepted_payout, no_parse_body, no_patch_on_edit, export): """broadcasts a post/comment. All image links which links to a file will be uploaded. The yaml header can contain: @@ -2579,10 +2579,10 @@ def post(markdown_file, account, title, permlink, tags, reply_identifier, commun parameter["percent_steem_dollars"] = percent_steem_dollars elif "percent-steem-dollars" in parameter: parameter["percent_steem_dollars"] = parameter["percent-steem-dollars"] - if percent_hive_dollars is not None: - parameter["percent_hive_dollars"] = percent_hive_dollars - elif "percent-hive-dollars" in parameter: - parameter["percent_hive_dollars"] = parameter["percent-hive-dollars"] + if percent_hbd is not None: + parameter["percent_hbd"] = percent_hbd + elif "percent-hbd" in parameter: + parameter["percent_hbd"] = parameter["percent-hbd"] if max_accepted_payout is not None: parameter["max_accepted_payout"] = max_accepted_payout elif "max-accepted-payout" in parameter: @@ -2621,28 +2621,27 @@ def post(markdown_file, account, title, permlink, tags, reply_identifier, commun percent_steem_dollars = None if "percent_steem_dollars" in parameter: percent_steem_dollars = parameter["percent_steem_dollars"] - percent_hive_dollars = None - if "percent_hive_dollars" in parameter: - percent_hive_dollars = parameter["percent_hive_dollars"] + percent_hbd = None + if "percent_hbd" in parameter: + percent_hbd = parameter["percent_hbd"] max_accepted_payout = None if "max_accepted_payout" in parameter: max_accepted_payout = parameter["max_accepted_payout"] comment_options = None - if max_accepted_payout is not None or percent_steem_dollars is not None: + if max_accepted_payout is not None or percent_steem_dollars is not None or percent_hbd is not None: comment_options = {} if max_accepted_payout is not None: 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_hive_dollars is not None and stm.is_hive and not stm.get_replace_hive_by_steem(): - comment_options["percent_hive_dollars"] = percent_hive_dollars + if percent_hbd is not None and stm.is_hive and not stm.get_replace_hive_by_steem(): + 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(): - comment_options["percent_hive_dollars"] = percent_steem_dollars + comment_options["percent_hbd"] = percent_steem_dollars elif percent_steem_dollars is not None: comment_options["percent_steem_dollars"] = percent_steem_dollars - elif percent_hive_dollars is not None: - comment_options["percent_steem_dollars"] = percent_hive_dollars - + elif percent_hbd is not None: + comment_options["percent_steem_dollars"] = percent_hbd beneficiaries = None if "beneficiaries" in parameter: beneficiaries = derive_beneficiaries(parameter["beneficiaries"]) diff --git a/beem/version.py b/beem/version.py index 5d831152dcf569797b1e73f40975fd74c989f9ce..f8f6618211df855e628228ee3f591608a0667cbe 100644 --- a/beem/version.py +++ b/beem/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.24.4' +version = '0.24.5' diff --git a/beemapi/version.py b/beemapi/version.py index 5d831152dcf569797b1e73f40975fd74c989f9ce..f8f6618211df855e628228ee3f591608a0667cbe 100644 --- a/beemapi/version.py +++ b/beemapi/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.24.4' +version = '0.24.5' diff --git a/beembase/operations.py b/beembase/operations.py index ce4df03adc5258a404802b36b5e1ef6024b170cd..9a83c86529239425bcf85b54a990fc132af44913 100644 --- a/beembase/operations.py +++ b/beembase/operations.py @@ -558,7 +558,6 @@ class Comment_options(GrapheneObject): # handle beneficiaries if "beneficiaries" in kwargs and kwargs['beneficiaries']: kwargs['extensions'] = [[0, {'beneficiaries': kwargs['beneficiaries']}]] - extensions = Array([]) if "extensions" in kwargs and kwargs["extensions"]: extensions = Array([CommentOptionExtensions(o) for o in kwargs["extensions"]]) @@ -583,8 +582,8 @@ class Comment_options(GrapheneObject): ('permlink', String(kwargs["permlink"])), ('max_accepted_payout', Amount(kwargs["max_accepted_payout"], prefix=prefix, replace_hive_by_steem=False)), - ('percent_hive_dollars', - Uint16(int(kwargs["percent_hive_dollars"]))), + ('percent_hbd', + Uint16(int(kwargs["percent_hbd"]))), ('allow_votes', Bool(bool(kwargs["allow_votes"]))), ('allow_curation_rewards', Bool(bool(kwargs["allow_curation_rewards"]))), diff --git a/beembase/version.py b/beembase/version.py index 5d831152dcf569797b1e73f40975fd74c989f9ce..f8f6618211df855e628228ee3f591608a0667cbe 100644 --- a/beembase/version.py +++ b/beembase/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.24.4' +version = '0.24.5' diff --git a/beemgraphenebase/version.py b/beemgraphenebase/version.py index 5d831152dcf569797b1e73f40975fd74c989f9ce..f8f6618211df855e628228ee3f591608a0667cbe 100644 --- a/beemgraphenebase/version.py +++ b/beemgraphenebase/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.24.4' +version = '0.24.5' diff --git a/setup.py b/setup.py index 8bbb71c6e30a0e6c596d7a553f0e5533d20e5d1a..4c22d642157542b06f1af8df827b30758339febc 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.4' +VERSION = '0.24.5' tests_require = ['mock >= 2.0.0', 'pytest', 'pytest-mock', 'parameterized']