diff --git a/README.rst b/README.rst index 96fce782eda78e351428a9fb692a9b9d8e56d529..635e996ab4ae095a5884d7ac949ba36562a0b1c4 100644 --- a/README.rst +++ b/README.rst @@ -156,6 +156,14 @@ before transmitting the packed file. Please check the hash-sum after downloading Changelog ========= +0.19.53 +------- +* Add userdata and featureflags to beempy +* steemd.pevo.science and steemd.steemgigs.org removed from Nodelist +* bug fixed in allow and disallow for CLI +* Issue #52 closed thanks to crokkon +* Issue #64 fixed + 0.19.52 ------- * appbase.buildtime.io node added diff --git a/beem/block.py b/beem/block.py index 2deeb8e4f82107aad4e681a160fe090b909e35e7..2421b4e86a4542854b1a9dddb3630ce27a31b518 100644 --- a/beem/block.py +++ b/beem/block.py @@ -166,7 +166,7 @@ class Block(BlockchainObject): return None def time(self): - """Return a datatime instance for the timestamp of this block""" + """Return a datetime instance for the timestamp of this block""" return self['timestamp'] @property @@ -342,7 +342,7 @@ class BlockHeader(BlockchainObject): ) def time(self): - """ Return a datatime instance for the timestamp of this block + """ Return a datetime instance for the timestamp of this block """ return self['timestamp'] diff --git a/beem/blockchain.py b/beem/blockchain.py index b287bc5042d582ebb0699be98f624afa5d64e996..4495a21ae4cea121f6cd0c5aacc1ee0a9468201d 100644 --- a/beem/blockchain.py +++ b/beem/blockchain.py @@ -255,7 +255,7 @@ class Blockchain(object): raise OfflineHasNoRPCException("No RPC available in offline mode!") self.steem.rpc.set_next_node_on_empty_reply(False) if self.steem.rpc.get_use_appbase(): - ret = self.steem.rpc.get_transaction({'id': transaction_id}, api="database") + ret = self.steem.rpc.get_transaction({'id': transaction_id}, api="account_history") else: ret = self.steem.rpc.get_transaction(transaction_id, api="database") return ret diff --git a/beem/cli.py b/beem/cli.py index d24292d310f7843d49a628fdf6562da4511162d2..7bccb6dcb81c10f3733ce12af3f49da6b319adca 100644 --- a/beem/cli.py +++ b/beem/cli.py @@ -41,6 +41,7 @@ from beembase import operations from beemgraphenebase.account import PrivateKey, PublicKey, BrainKey from beemgraphenebase.base58 import Base58 from beem.nodelist import NodeList +from beem.conveyor import Conveyor click.disable_unicode_literals_warning = True @@ -1145,6 +1146,8 @@ def allow(foreign_account, permission, account, weight, threshold): from beemgraphenebase.account import PasswordKey pwd = click.prompt("Password for Key Derivation", confirmation_prompt=True, hide_input=True) foreign_account = format(PasswordKey(account, pwd, permission).get_public(), stm.prefix) + if threshold is not None: + threshold = int(threshold) tx = acc.allow(foreign_account, weight=weight, permission=permission, threshold=threshold) if stm.unsigned and stm.nobroadcast and stm.steemconnect is not None: tx = stm.steemconnect.url_from_tx(tx) @@ -1170,6 +1173,8 @@ def disallow(foreign_account, permission, account, threshold): if permission not in ["posting", "active", "owner"]: print("Wrong permission, please use: posting, active or owner!") return + if threshold is not None: + threshold = int(threshold) acc = Account(account, steem_instance=stm) if not foreign_account: from beemgraphenebase.account import PasswordKey @@ -2988,6 +2993,64 @@ def info(objects): print("Couldn't identify object to read") +@cli.command() +@click.argument('account', nargs=1, required=False) +@click.option('--signing-account', '-s', help='Signing account, when empty account is used.') +def userdata(account, signing_account): + """ Get the account's email address and phone number. + + The request has to be signed by the requested account or an admin account. + """ + stm = shared_steem_instance() + if stm.rpc is not None: + stm.rpc.rpcconnect() + if not unlock_wallet(stm): + return + if not account: + if "default_account" in stm.config: + account = stm.config["default_account"] + account = Account(account, steem_instance=stm) + if signing_account is not None: + signing_account = Account(signing_account, steem_instance=stm) + c = Conveyor(steem_instance=stm) + user_data = c.get_user_data(account, signing_account=signing_account) + t = PrettyTable(["Key", "Value"]) + t.align = "l" + for key in user_data: + # hide internal config data + t.add_row([key, user_data[key]]) + print(t) + + +@cli.command() +@click.argument('account', nargs=1, required=False) +@click.option('--signing-account', '-s', help='Signing account, when empty account is used.') +def featureflags(account, signing_account): + """ Get the account's feature flags. + + The request has to be signed by the requested account or an admin account. + """ + stm = shared_steem_instance() + if stm.rpc is not None: + stm.rpc.rpcconnect() + if not unlock_wallet(stm): + return + if not account: + if "default_account" in stm.config: + account = stm.config["default_account"] + account = Account(account, steem_instance=stm) + if signing_account is not None: + signing_account = Account(signing_account, steem_instance=stm) + c = Conveyor(steem_instance=stm) + user_data = c.get_feature_flags(account, signing_account=signing_account) + t = PrettyTable(["Key", "Value"]) + t.align = "l" + for key in user_data: + # hide internal config data + t.add_row([key, user_data[key]]) + print(t) + + if __name__ == "__main__": if getattr(sys, 'frozen', False): os.environ['SSL_CERT_FILE'] = os.path.join(sys._MEIPASS, 'lib', 'cert.pem') diff --git a/beem/conveyor.py b/beem/conveyor.py index 9a2bb80071154c110497bb0b9e0f72fd1c264377..cdabe01f400ea0b96c8f7645363d58144e06882b 100644 --- a/beem/conveyor.py +++ b/beem/conveyor.py @@ -163,9 +163,13 @@ class Conveyor(object): """ account = Account(account, steem_instance=self.steem) - return self._conveyor_method(account, signing_account, - "conveyor.get_user_data", - [account['name']]) + user_data = self._conveyor_method(account, signing_account, + "conveyor.get_user_data", + [account['name']]) + if "result" in user_data: + return user_data["result"] + else: + return user_data def set_user_data(self, account, params, signing_account=None): """ Set the account's email address and phone number. The request has to be @@ -212,9 +216,13 @@ class Conveyor(object): """ account = Account(account, steem_instance=self.steem) - return self._conveyor_method(account, signing_account, - "conveyor.get_feature_flags", - [account['name']]) + feature_flags = self._conveyor_method(account, signing_account, + "conveyor.get_feature_flags", + [account['name']]) + if "result" in feature_flags: + return feature_flags["result"] + else: + return feature_flags def get_feature_flag(self, account, flag, signing_account=None): """ Test if a specific feature flag is set for an account. The request diff --git a/beem/nodelist.py b/beem/nodelist.py index bf7172794306867c278342c87d1d8038b453245e..aabfd82539faa11f24026e487d2b28581fcce437 100644 --- a/beem/nodelist.py +++ b/beem/nodelist.py @@ -143,14 +143,14 @@ class NodeList(list): "version": "0.19.2", "type": "normal", "owner": "pharesim", - "score": 10 + "score": -10 }, { "url": "https://steemd.pevo.science", "version": "0.19.3", "type": "normal", "owner": "pharesim", - "score": 10 + "score": -10 }, { "url": "wss://rpc.steemliberator.com", @@ -185,14 +185,14 @@ class NodeList(list): "version": "0.19.3", "type": "normal", "owner": "steemgigs", - "score": 10 + "score": -10 }, { "url": "https://steemd.steemgigs.org", "version": "0.19.3", "type": "normal", "owner": "steemgigs", - "score": 10 + "score": -10 }, { "url": "wss://steemd.minnowsupportproject.org", diff --git a/beem/version.py b/beem/version.py index bb55b1ea38b5d1a22dabadfda9b551156ef40742..d2caabe618072940372b6b93b505eb3143abee20 100644 --- a/beem/version.py +++ b/beem/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.19.52' +version = '0.19.53' diff --git a/beemapi/version.py b/beemapi/version.py index bb55b1ea38b5d1a22dabadfda9b551156ef40742..d2caabe618072940372b6b93b505eb3143abee20 100644 --- a/beemapi/version.py +++ b/beemapi/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.19.52' +version = '0.19.53' diff --git a/beembase/version.py b/beembase/version.py index bb55b1ea38b5d1a22dabadfda9b551156ef40742..d2caabe618072940372b6b93b505eb3143abee20 100644 --- a/beembase/version.py +++ b/beembase/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.19.52' +version = '0.19.53' diff --git a/beemgraphenebase/version.py b/beemgraphenebase/version.py index bb55b1ea38b5d1a22dabadfda9b551156ef40742..d2caabe618072940372b6b93b505eb3143abee20 100644 --- a/beemgraphenebase/version.py +++ b/beemgraphenebase/version.py @@ -1,2 +1,2 @@ """THIS FILE IS GENERATED FROM beem SETUP.PY.""" -version = '0.19.52' +version = '0.19.53' diff --git a/setup.py b/setup.py index 48e215d4c89e3865beae636b06ab94931095e5c4..4a990bffd975e5c07693e13258139aa6ed22a518 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.19.52' +VERSION = '0.19.53' tests_require = ['mock >= 2.0.0', 'pytest', 'pytest-mock', 'parameterized']