diff --git a/steempy/notify.py b/steempy/notify.py index 8447338726416e93154266b74c28e3196208fccc..523d0b2e241500e63a180cb94ad097e074ef9f8f 100644 --- a/steempy/notify.py +++ b/steempy/notify.py @@ -27,9 +27,7 @@ class Notify(Events): notify = Notify( accounts=["test"], - on_account=print, on_block=print, - on_tx=print ) notify.listen() diff --git a/steempy/steem.py b/steempy/steem.py index 71ffb3d324c38d5a83a3382590812f63e6969094..fbb978d088089bba2785b7f3c69f4c332b02b2ab 100644 --- a/steempy/steem.py +++ b/steempy/steem.py @@ -544,26 +544,6 @@ class Steem(object): op = operations.Account_create(**op) return self.finalizeOp(op, creator, "active", **kwargs) - def upgrade_account(self, account=None, **kwargs): - """ Upgrade an account to Lifetime membership - - :param str account: (optional) the account to allow access - to (defaults to ``default_account``) - """ - if not account: - if "default_account" in config: - account = config["default_account"] - if not account: - raise ValueError("You need to provide an account") - account = Account(account, steem_instance=self) - op = operations.Account_upgrade(**{ - "fee": {"amount": 0, "asset_id": "SBD"}, - "account_to_upgrade": account["id"], - "upgrade_to_lifetime_member": True, - "prefix": self.prefix - }) - return self.finalizeOp(op, account["name"], "active", **kwargs) - def _test_weights_treshold(self, authority): """ This method raises an error if the threshold of an authority cannot be reached by the weights. @@ -613,6 +593,14 @@ class Steem(object): ) account = Account(account, steem_instance=self) + if permission not in account: + account = Account(account, steem_instance=self, lazy=False, full=True) + account.clear_cache() + account.refresh() + if permission not in account: + account = Account(account, steem_instance=self.steem) + assert permission in account, "Could not access permission" + if not weight: weight = account[permission]["weight_threshold"] @@ -627,7 +615,7 @@ class Steem(object): try: foreign_account = Account(foreign, steem_instance=self) authority["account_auths"].append([ - foreign_account["id"], + foreign_account["name"], weight ]) except: @@ -643,7 +631,6 @@ class Steem(object): permission: authority, "memo_key": account["memo_key"], "json_metadata": account["json_metadata"], - "prefix": self.prefix }) if permission == "owner": return self.finalizeOp(op, account["name"], "owner", **kwargs) @@ -691,10 +678,10 @@ class Steem(object): try: foreign_account = Account(foreign, steem_instance=self) affected_items = list( - filter(lambda x: x[0] == foreign_account["id"], + filter(lambda x: x[0] == foreign_account["name"], authority["account_auths"])) authority["account_auths"] = list(filter( - lambda x: x[0] != foreign_account["id"], + lambda x: x[0] != foreign_account["name"], authority["account_auths"] )) except: @@ -713,14 +700,14 @@ class Steem(object): # Correct threshold (at most by the amount removed from the # authority) try: - self._test_weights_treshold(authority) + self.self.cm(authority) except: log.critical( "The account's threshold will be reduced by %d" % (removed_weight) ) authority["weight_threshold"] -= removed_weight - self._test_weights_treshold(authority) + self.self.cm(authority) op = operations.Account_update(**{ "account": account["name"], @@ -783,8 +770,8 @@ class Steem(object): # for witness in witnesses: # witness = Witness(witness, steem_instance=self) - op = operations.Account_Witness_Vote(**{ - "account": account["id"], + op = operations.Account_witness_vote(**{ + "account": account["name"], "witness": witness, "approve": approve }) diff --git a/steempy/storage.py b/steempy/storage.py index 92b01552b953deec8bbe1a63c50a9d8ea7549a12..7352e26bffd4d8c481d5136813b6051862c2f36b 100644 --- a/steempy/storage.py +++ b/steempy/storage.py @@ -38,7 +38,7 @@ class DataDir(object): in the `backups/` directory every now and then. """ appname = "steempy" - appauthor = "Holger Nahrstaedt" + appauthor = "steempy" storageDatabase = "steempy.sqlite" data_dir = user_data_dir(appname, appauthor) @@ -218,7 +218,7 @@ class Configuration(DataDir): #: Default configuration config_defaults = { - "node": "wss://gtg.steem.house:8090", + "node": "wss://steemd.pevo.science", "rpcpassword": "", "rpcuser": "", "order-expiration": 7 * 24 * 60 * 60, diff --git a/steempybase/objects.py b/steempybase/objects.py index b0c47b09855bb5fb4ae9345775c7d77f75ea4449..10238b627285cb3da5563945a8fddf87261cfe99 100644 --- a/steempybase/objects.py +++ b/steempybase/objects.py @@ -167,7 +167,12 @@ class Permission(GrapheneObject): # Key and not located here) kwargs["key_auths"] = sorted( kwargs["key_auths"], - key=lambda x: repr(PublicKey(x[0], prefix=prefix).address), + key=lambda x: repr(PublicKey(x[0], prefix=prefix)), + reverse=False, + ) + kwargs["account_auths"] = sorted( + kwargs["account_auths"], + key=lambda x: x[0], reverse=False, ) accountAuths = Map([ @@ -211,30 +216,6 @@ class AccountOptions(GrapheneObject): ])) -class SpecialAuthority(Static_variant): - def __init__(self, o): - - class No_special_authority(GrapheneObject): - def __init__(self, kwargs): - super().__init__(OrderedDict([])) - - class Top_holders_special_authority(GrapheneObject): - def __init__(self, kwargs): - super().__init__(OrderedDict([ - ('asset', ObjectId(kwargs["asset"], "asset")), - ('num_top_holders', Uint8(kwargs["num_top_holders"])), - ])) - - id = o[0] - if id == 0: - data = No_special_authority(o[1]) - elif id == 1: - data = Top_holders_special_authority(o[1]) - else: - raise Exception("Unknown SpecialAuthority") - super().__init__(data, id) - - class Extension(Array): def __str__(self): """ We overload the __str__ function because the json @@ -243,75 +224,66 @@ class Extension(Array): return json.dumps(self.json) -class AccountCreateExtensions(Extension): +class ExchangeRate(GrapheneObject): def __init__(self, *args, **kwargs): - # Extensions ################################# - class Null_ext(GrapheneObject): - def __init__(self, kwargs): - super().__init__(OrderedDict([])) - - class Owner_special_authority(SpecialAuthority): - def __init__(self, kwargs): - super().__init__(kwargs) - - class Active_special_authority(SpecialAuthority): - def __init__(self, kwargs): - super().__init__(kwargs) - - class Buyback_options(GrapheneObject): - def __init__(self, kwargs): - if isArgsThisClass(self, args): - self.data = args[0].data - else: - if len(args) == 1 and len(kwargs) == 0: - kwargs = args[0] -# assert "1.3.0" in kwargs["markets"], "CORE asset must be in 'markets' to pay fees" - super().__init__(OrderedDict([ - ('asset_to_buy', ObjectId(kwargs["asset_to_buy"], "asset")), - ('asset_to_buy_issuer', ObjectId(kwargs["asset_to_buy_issuer"], "account")), - ('markets', Array([ - ObjectId(x, "asset") for x in kwargs["markets"] - ])), - ])) - # End of Extensions definition ################ if isArgsThisClass(self, args): self.data = args[0].data else: if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] - self.json = dict() - a = [] - sorted_options = [ - "null_ext", - "owner_special_authority", - "active_special_authority", - "buyback_options" - ] - sorting = sorted(kwargs.items(), key=lambda x: sorted_options.index(x[0])) - for key, value in sorting: - self.json.update({key: value}) - if key == "null_ext": - a.append(Static_variant( - Null_ext({key: value}), - sorted_options.index(key)) - ) - elif key == "owner_special_authority": - a.append(Static_variant( - Owner_special_authority(value), - sorted_options.index(key)) - ) - elif key == "active_special_authority": - a.append(Static_variant( - Active_special_authority(value), - sorted_options.index(key)) - ) - elif key == "buyback_options": - a.append(Static_variant( - Buyback_options(value), - sorted_options.index(key)) - ) - else: - raise NotImplementedError("Extension {} is unknown".format(key)) + super().__init__( + OrderedDict([ + ('base', Amount(kwargs["base"])), + ('quote', Amount(kwargs["quote"])), + ])) + + +class Beneficiary(GrapheneObject): + def __init__(self, *args, **kwargs): + if isArgsThisClass(self, args): + self.data = args[0].data + else: + if len(args) == 1 and len(kwargs) == 0: + kwargs = args[0] + super().__init__( + OrderedDict([ + ('account', String(kwargs["account"])), + ('weight', Int16(kwargs["weight"])), + ])) + + +class Beneficiaries(GrapheneObject): + def __init__(self, *args, **kwargs): + if isArgsThisClass(self, args): + self.data = args[0].data + else: + if len(args) == 1 and len(kwargs) == 0: + kwargs = args[0] + + super().__init__( + OrderedDict([ + ('beneficiaries', + Array([Beneficiary(o) for o in kwargs["beneficiaries"]])), + ])) - super().__init__(a) + +class CommentOptionExtensions(Static_variant): + """ Serialize Comment Payout Beneficiaries. + Args: + beneficiaries (list): A static_variant containing beneficiaries. + Example: + :: + [0, + {'beneficiaries': [ + {'account': 'furion', 'weight': 10000} + ]} + ] + """ + def __init__(self, o): + type_id, data = o + if type_id == 0: + data = (Beneficiaries(data)) + else: + raise Exception("Unknown CommentOptionExtension") + super().__init__(data, type_id) diff --git a/steempybase/operations.py b/steempybase/operations.py index 1571392297e0c324925b780115b0c0abb2f425f8..f1d8d989ddb56842b0786cdcc3d6ba2c65063943 100644 --- a/steempybase/operations.py +++ b/steempybase/operations.py @@ -20,8 +20,10 @@ from .objects import ( Permission, AccountOptions, ObjectId, - SpecialAuthority, - AccountCreateExtensions + ExchangeRate, + Beneficiaries, + Beneficiary, + CommentOptionExtensions, ) default_prefix = "STM" @@ -71,15 +73,41 @@ class Vote(GrapheneObject): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] super().__init__(OrderedDict([ - ('Voter', (kwargs["voter"])), - ('author', ObjectId(kwargs["author"], "account")), - ('permlink', (kwargs["permlink"])), - ('weight', Int16(kwargs["feed"])), - ('extensions', Set([])), + ('Voter', String(kwargs["voter"])), + ('author', String(kwargs["author"])), + ('permlink', String(kwargs["permlink"])), + ('weight', Int16(kwargs["weight"])), ])) -class Account_Witness_Vote(GrapheneObject): +class Transfer_to_vesting(GrapheneObject): + def __init__(self, *args, **kwargs): + if isArgsThisClass(self, args): + self.data = args[0].data + else: + if len(args) == 1 and len(kwargs) == 0: + kwargs = args[0] + super().__init__(OrderedDict([ + ('from', String(kwargs["from"])), + ('to', String(kwargs["to"])), + ('amount', Amount(kwargs["amount"])), + ])) + + +class Withdraw_vesting(GrapheneObject): + def __init__(self, *args, **kwargs): + if isArgsThisClass(self, args): + self.data = args[0].data + else: + if len(args) == 1 and len(kwargs) == 0: + kwargs = args[0] + super().__init__(OrderedDict([ + ('account', String(kwargs["account"])), + ('vesting_shares', Amount(kwargs["vesting_shares"])), + ])) + + +class Account_witness_vote(GrapheneObject): def __init__(self, *args, **kwargs): if isArgsThisClass(self, args): self.data = args[0].data @@ -119,6 +147,13 @@ class Account_create(GrapheneObject): assert len(kwargs["new_account_name"] ) <= 16, "Account name must be at most 16 chars long" + meta = "" + if "json_metadata" in kwargs and kwargs["json_metadata"]: + if isinstance(kwargs["json_metadata"], dict): + meta = json.dumps(kwargs["json_metadata"]) + else: + meta = kwargs["json_metadata"] + super().__init__(OrderedDict([ ('fee', Amount(kwargs["fee"])), ('creator', String(kwargs["creator"])), @@ -126,8 +161,8 @@ class Account_create(GrapheneObject): ('owner', Permission(kwargs["owner"], prefix=prefix)), ('active', Permission(kwargs["active"], prefix=prefix)), ('posting', Permission(kwargs["posting"], prefix=prefix)), - ('memo_key', String(kwargs["memo_key"])), - ('json_metadata', Set(kwargs["json_metadata"])), + ('memo_key', PublicKey(kwargs["memo_key"], prefix=prefix)), + ('json_metadata', String(meta)), ])) @@ -156,18 +191,20 @@ class Account_update(GrapheneObject): else: posting = Optional(None) - if "memo_key" in kwargs: - memo_key = Optional(Permission(kwargs["memo_key"], prefix=prefix)) - else: - memo_key = Optional(None) + meta = "" + if "json_metadata" in kwargs and kwargs["json_metadata"]: + if isinstance(kwargs["json_metadata"], dict): + meta = json.dumps(kwargs["json_metadata"]) + else: + meta = kwargs["json_metadata"] super().__init__(OrderedDict([ - ('account', (kwargs["account"])), + ('account', String(kwargs["account"])), ('owner', owner), ('active', active), ('posting', posting), - ('memo_key', memo_key), - ('json_metadata', Set(kwargs["json_metadata"])), + ('memo_key', PublicKey(kwargs["memo_key"], prefix=prefix)), + ('json_metadata', String(meta)), ])) @@ -179,20 +216,265 @@ class Witness_update(GrapheneObject): if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.pop("prefix", default_prefix) - if "url" in kwargs and kwargs["url"]: - url = Optional(String(kwargs["url"])) - else: - url = Optional(None) if "block_signing_key" in kwargs and kwargs["block_signing_key"]: - block_signing_key = Optional(PublicKey(kwargs["block_signing_key"], prefix=prefix)) + block_signing_key = (PublicKey(kwargs["block_signing_key"], prefix=prefix)) else: - block_signing_key = Optional(None) + block_signing_key = PublicKey( + "STM1111111111111111111111111111111114T1Anm", prefix=prefix) super().__init__(OrderedDict([ - ('owner', ObjectId(kwargs["owner"], "account")), - ('url', url), + ('owner', String(kwargs["owner"])), + ('url', String(kwargs["url"])), ('block_signing_key', block_signing_key), ('props', WitnessProps(kwargs["props"])), ('fee', Amount(kwargs["fee"])), ])) + + +class Comment(GrapheneObject): + def __init__(self, *args, **kwargs): + if isArgsThisClass(self, args): + self.data = args[0].data + else: + if len(args) == 1 and len(kwargs) == 0: + kwargs = args[0] + meta = "" + if "json_metadata" in kwargs and kwargs["json_metadata"]: + if (isinstance(kwargs["json_metadata"], dict) or + isinstance(kwargs["json_metadata"], list)): + meta = json.dumps(kwargs["json_metadata"]) + else: + meta = kwargs["json_metadata"] + + super().__init__( + OrderedDict([ + ('parent_author', String(kwargs["parent_author"])), + ('parent_permlink', String(kwargs["parent_permlink"])), + ('author', String(kwargs["author"])), + ('permlink', String(kwargs["permlink"])), + ('title', String(kwargs["title"])), + ('body', String(kwargs["body"])), + ('json_metadata', String(meta)), + ])) + + +class Custom_json(GrapheneObject): + def __init__(self, *args, **kwargs): + if isArgsThisClass(self, args): + self.data = args[0].data + else: + if len(args) == 1 and len(kwargs) == 0: + kwargs = args[0] + if "json" in kwargs and kwargs["json"]: + if (isinstance(kwargs["json"], dict) or + isinstance(kwargs["json"], list)): + js = json.dumps(kwargs["json"]) + else: + js = kwargs["json"] + + if len(kwargs["id"]) > 32: + raise Exception("'id' too long") + + super().__init__( + OrderedDict([ + ('required_auths', + Array([String(o) for o in kwargs["required_auths"]])), + ('required_posting_auths', + Array([ + String(o) for o in kwargs["required_posting_auths"] + ])), + ('id', String(kwargs["id"])), + ('json', String(js)), + ])) + + +class Comment_options(GrapheneObject): + def __init__(self, *args, **kwargs): + if isArgsThisClass(self, args): + self.data = args[0].data + else: + if len(args) == 1 and len(kwargs) == 0: + kwargs = args[0] + + # handle beneficiaries + extensions = Array([]) + beneficiaries = kwargs.get('beneficiaries') + if beneficiaries and type(beneficiaries) == list: + ext_obj = [0, {'beneficiaries': beneficiaries}] + ext = CommentOptionExtensions(ext_obj) + extensions = Array([ext]) + + super().__init__( + OrderedDict([ + ('author', String(kwargs["author"])), + ('permlink', String(kwargs["permlink"])), + ('max_accepted_payout', + Amount(kwargs["max_accepted_payout"])), + ('percent_steem_dollars', + Uint16(int(kwargs["percent_steem_dollars"]))), + ('allow_votes', Bool(bool(kwargs["allow_votes"]))), + ('allow_curation_rewards', + Bool(bool(kwargs["allow_curation_rewards"]))), + ('extensions', extensions), + ])) + + +class Feed_publish(GrapheneObject): + def __init__(self, *args, **kwargs): + if isArgsThisClass(self, args): + self.data = args[0].data + else: + if len(args) == 1 and len(kwargs) == 0: + kwargs = args[0] + super().__init__( + OrderedDict([ + ('publisher', String(kwargs["publisher"])), + ('exchange_rate', ExchangeRate(kwargs["exchange_rate"])), + ])) + + +class Convert(GrapheneObject): + def __init__(self, *args, **kwargs): + if isArgsThisClass(self, args): + self.data = args[0].data + else: + if len(args) == 1 and len(kwargs) == 0: + kwargs = args[0] + super().__init__( + OrderedDict([ + ('owner', String(kwargs["owner"])), + ('requestid', Uint32(kwargs["requestid"])), + ('amount', Amount(kwargs["amount"])), + ])) + + +class Set_withdraw_vesting_route(GrapheneObject): + def __init__(self, *args, **kwargs): + if isArgsThisClass(self, args): + self.data = args[0].data + else: + if len(args) == 1 and len(kwargs) == 0: + kwargs = args[0] + super().__init__( + OrderedDict([ + ('from_account', String(kwargs["from_account"])), + ('to_account', String(kwargs["to_account"])), + ('percent', Uint16((kwargs["percent"]))), + ('auto_vest', Bool(kwargs["auto_vest"])), + ])) + + +class Limit_order_cancel(GrapheneObject): + def __init__(self, *args, **kwargs): + if isArgsThisClass(self, args): + self.data = args[0].data + else: + if len(args) == 1 and len(kwargs) == 0: + kwargs = args[0] + super().__init__( + OrderedDict([ + ('owner', String(kwargs["owner"])), + ('orderid', Uint32(int(kwargs["orderid"]))), + ])) + + +class Delegate_vesting_shares(GrapheneObject): + def __init__(self, *args, **kwargs): + if isArgsThisClass(self, args): + self.data = args[0].data + else: + if len(args) == 1 and len(kwargs) == 0: + kwargs = args[0] + super().__init__( + OrderedDict([ + ('delegator', String(kwargs["delegator"])), + ('delegatee', String(kwargs["delegatee"])), + ('vesting_shares', Amount(kwargs["vesting_shares"])), + ])) + + +class Limit_order_create(GrapheneObject): + def __init__(self, *args, **kwargs): + if isArgsThisClass(self, args): + self.data = args[0].data + else: + if len(args) == 1 and len(kwargs) == 0: + kwargs = args[0] + super().__init__( + OrderedDict([ + ('owner', String(kwargs["owner"])), + ('orderid', Uint32(int(kwargs["orderid"]))), + ('amount_to_sell', Amount(kwargs["amount_to_sell"])), + ('min_to_receive', Amount(kwargs["min_to_receive"])), + ('fill_or_kill', Bool(kwargs["fill_or_kill"])), + ('expiration', PointInTime(kwargs["expiration"])), + ])) + + +class Transfer_from_savings(GrapheneObject): + def __init__(self, *args, **kwargs): + if isArgsThisClass(self, args): + self.data = args[0].data + else: + if len(args) == 1 and len(kwargs) == 0: + kwargs = args[0] + if "memo" not in kwargs: + kwargs["memo"] = "" + + super().__init__( + OrderedDict([ + ('from', String(kwargs["from"])), + ('request_id', Uint32(int(kwargs["request_id"]))), + ('to', String(kwargs["to"])), + ('amount', Amount(kwargs["amount"])), + ('memo', String(kwargs["memo"])), + ])) + + +class Cancel_transfer_from_savings(GrapheneObject): + def __init__(self, *args, **kwargs): + if isArgsThisClass(self, args): + self.data = args[0].data + else: + if len(args) == 1 and len(kwargs) == 0: + kwargs = args[0] + super().__init__( + OrderedDict([ + ('from', String(kwargs["from"])), + ('request_id', Uint32(int(kwargs["request_id"]))), + ])) + + +class Claim_reward_balance(GrapheneObject): + def __init__(self, *args, **kwargs): + if isArgsThisClass(self, args): + self.data = args[0].data + else: + if len(args) == 1 and len(kwargs) == 0: + kwargs = args[0] + super().__init__( + OrderedDict([ + ('account', String(kwargs["account"])), + ('reward_steem', Amount(kwargs["reward_steem"])), + ('reward_sbd', Amount(kwargs["reward_sbd"])), + ('reward_vests', Amount(kwargs["reward_vests"])), + ])) + + +class Transfer_to_savings(GrapheneObject): + def __init__(self, *args, **kwargs): + if isArgsThisClass(self, args): + self.data = args[0].data + else: + if len(args) == 1 and len(kwargs) == 0: + kwargs = args[0] + if "memo" not in kwargs: + kwargs["memo"] = "" + super().__init__( + OrderedDict([ + ('from', String(kwargs["from"])), + ('to', String(kwargs["to"])), + ('amount', Amount(kwargs["amount"])), + ('memo', String(kwargs["memo"])), + ])) diff --git a/tests/test_account.py b/tests/test_account.py index 3b6bab9b898598354e125d8dcea68fbbcd785804..3d41be8e0e8a875e67724506bef7210d280541fc 100644 --- a/tests/test_account.py +++ b/tests/test_account.py @@ -9,6 +9,8 @@ from steempy.instance import set_shared_steem_instance from steempybase.operationids import getOperationNameForId wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3" +# steem_node = "wss://gtg.steem.house:8090" +steem_node = "wss://steemd.pevo.science" class Testcases(unittest.TestCase): @@ -17,7 +19,7 @@ class Testcases(unittest.TestCase): super().__init__(*args, **kwargs) self.bts = Steem( - "wss://testnet.steem.vc", + steem_node, nobroadcast=True, # We want to bundle many operations into a single transaction bundle=True, diff --git a/tests/test_amount.py b/tests/test_amount.py index 00914601627497cea70796f7e62d87aa95a7436c..9b131c0c209f273b8fe035dcc9df505b7bd7f78f 100644 --- a/tests/test_amount.py +++ b/tests/test_amount.py @@ -3,6 +3,8 @@ from steempy import Steem from steempy.amount import Amount from steempy.asset import Asset from steempy.instance import set_shared_steem_instance, SharedInstance +# steem_node = "wss://gtg.steem.house:8090" +steem_node = "wss://steemd.pevo.science" class Testcases(unittest.TestCase): @@ -11,7 +13,7 @@ class Testcases(unittest.TestCase): super().__init__(*args, **kwargs) self.bts = Steem( - "wss://testnet.steem.vc", + steem_node, nobroadcast=True, ) set_shared_steem_instance(self.bts) diff --git a/tests/test_asset.py b/tests/test_asset.py index 6d90aa62ba7f30908286ec7ecd1ba06f64fde7ff..8690b024eacc9fb3a2cf02cc9e338ac59e931147 100644 --- a/tests/test_asset.py +++ b/tests/test_asset.py @@ -3,6 +3,8 @@ from steempy import Steem from steempy.asset import Asset from steempy.instance import set_shared_steem_instance from steempy.exceptions import AssetDoesNotExistsException +# steem_node = "wss://gtg.steem.house:8090" +steem_node = "wss://steemd.pevo.science" class Testcases(unittest.TestCase): @@ -11,6 +13,7 @@ class Testcases(unittest.TestCase): super().__init__(*args, **kwargs) self.bts = Steem( + steem_node, nobroadcast=True, ) set_shared_steem_instance(self.bts) diff --git a/tests/test_base_objects.py b/tests/test_base_objects.py index 20b2ee53f7dc291cbd166af383ae46e1fdaa6c63..bbadf39149b73a510d9e4e30e7b49128d81146a3 100644 --- a/tests/test_base_objects.py +++ b/tests/test_base_objects.py @@ -3,6 +3,7 @@ from steempy import Steem, exceptions from steempy.instance import set_shared_steem_instance from steempy.account import Account from steempy.witness import Witness +steem_node = "wss://steemd.pevo.science" class Testcases(unittest.TestCase): @@ -11,6 +12,7 @@ class Testcases(unittest.TestCase): super().__init__(*args, **kwargs) self.bts = Steem( + steem_node, nobroadcast=True, ) set_shared_steem_instance(self.bts) diff --git a/tests/test_message.py b/tests/test_message.py index c377d881b09e52018211571ea7b56093f8994bf3..40e815b90fd929ef27f54f15fb189249f654d2c4 100644 --- a/tests/test_message.py +++ b/tests/test_message.py @@ -7,6 +7,8 @@ from steempy.instance import set_shared_steem_instance wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3" core_unit = "STM" +# steem_node = "wss://gtg.steem.house:8090" +steem_node = "wss://steemd.pevo.science" class Testcases(unittest.TestCase): @@ -15,6 +17,7 @@ class Testcases(unittest.TestCase): super().__init__(*args, **kwargs) self.bts = Steem( + steem_node, nobroadcast=True, wif=[wif] ) diff --git a/tests/test_objectcache.py b/tests/test_objectcache.py index cc323bc46fbfb1f9181f6c932da4af0e1e3926d3..550312100c15fa1b93e7be4c8e123ff7adc34e03 100644 --- a/tests/test_objectcache.py +++ b/tests/test_objectcache.py @@ -3,6 +3,8 @@ import unittest from steempy import Steem, exceptions from steempy.instance import set_shared_steem_instance from steempy.blockchainobject import ObjectCache +# steem_node = "wss://gtg.steem.house:8090" +steem_node = "wss://steemd.pevo.science" class Testcases(unittest.TestCase): @@ -11,6 +13,7 @@ class Testcases(unittest.TestCase): super().__init__(*args, **kwargs) self.bts = Steem( + steem_node, nobroadcast=True, ) set_shared_steem_instance(self.bts) diff --git a/tests/test_price.py b/tests/test_price.py index 5e78ad960628e512af9d459ac1acd15eb1b318a9..59996318b68b2a91ad782887a32877d4386b57cc 100644 --- a/tests/test_price.py +++ b/tests/test_price.py @@ -4,6 +4,8 @@ from steempy.amount import Amount from steempy.price import Price from steempy.asset import Asset import unittest +# steem_node = "wss://gtg.steem.house:8090" +steem_node = "wss://steemd.pevo.science" class Testcases(unittest.TestCase): @@ -11,7 +13,7 @@ class Testcases(unittest.TestCase): def __init__(self, *args, **kwargs): super(Testcases, self).__init__(*args, **kwargs) steem = Steem( - "wss://testnet.steem.vc", + steem_node, nobroadcast=True, ) set_shared_steem_instance(steem) diff --git a/tests/test_proposals.py b/tests/test_proposals.py index 1bf1e7a136b5f7ec67587d7d24e3307c9c05ed0a..a3e0caeb17284e4ae6391462a8e7da16aea1f40f 100644 --- a/tests/test_proposals.py +++ b/tests/test_proposals.py @@ -5,6 +5,8 @@ from steempybase.operationids import getOperationNameForId from steempy.instance import set_shared_steem_instance wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3" +# steem_node = "wss://gtg.steem.house:8090" +steem_node = "wss://steemd.pevo.science" class Testcases(unittest.TestCase): @@ -13,7 +15,7 @@ class Testcases(unittest.TestCase): super().__init__(*args, **kwargs) self.bts = Steem( - "wss://testnet.steem.vc", + steem_node, nobroadcast=True, keys={"active": wif}, ) diff --git a/tests/test_steem.py b/tests/test_steem.py index 6a7b4e478b9d38ad0b9cf131c46d90c4fe4f1bc5..c71c45ae27814aa84687c6f705a6a63c60afceb6 100644 --- a/tests/test_steem.py +++ b/tests/test_steem.py @@ -11,6 +11,8 @@ from steempy.instance import set_shared_steem_instance wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3" core_unit = "STM" +# steem_node = "wss://gtg.steem.house:8090" +steem_node = "wss://steemd.pevo.science" class Testcases(unittest.TestCase): @@ -19,7 +21,7 @@ class Testcases(unittest.TestCase): super().__init__(*args, **kwargs) self.bts = Steem( - # "wss://testnet.steem.vc", + steem_node, nobroadcast=True, keys={"active": wif, "owner": wif, "memo": wif}, ) @@ -44,8 +46,56 @@ class Testcases(unittest.TestCase): amount = Amount(op["amount"]) self.assertEqual(float(amount), 1.33) + def test_create_account(self): + bts = self.bts + name = ''.join(random.choice(string.ascii_lowercase) for _ in range(12)) + key1 = PrivateKey() + key2 = PrivateKey() + key3 = PrivateKey() + key4 = PrivateKey() + key5 = PrivateKey() + tx = bts.create_account( + name, + creator="test", # 1.2.7 + owner_key=format(key1.pubkey, core_unit), + active_key=format(key2.pubkey, core_unit), + posting_key=format(key3.pubkey, core_unit), + memo_key=format(key4.pubkey, core_unit), + additional_owner_keys=[format(key5.pubkey, core_unit)], + additional_active_keys=[format(key5.pubkey, core_unit)], + additional_owner_accounts=["test1"], # 1.2.0 + additional_active_accounts=["test1"], + storekeys=False + ) + self.assertEqual( + tx["operations"][0][0], + "account_create" + ) + op = tx["operations"][0][1] + role = "active" + self.assertIn( + format(key5.pubkey, core_unit), + [x[0] for x in op[role]["key_auths"]]) + self.assertIn( + format(key5.pubkey, core_unit), + [x[0] for x in op[role]["key_auths"]]) + self.assertIn( + "test1", + [x[0] for x in op[role]["account_auths"]]) + role = "owner" + self.assertIn( + format(key5.pubkey, core_unit), + [x[0] for x in op[role]["key_auths"]]) + self.assertIn( + format(key5.pubkey, core_unit), + [x[0] for x in op[role]["key_auths"]]) + self.assertIn( + "test1", + [x[0] for x in op[role]["account_auths"]]) + self.assertEqual( + op["creator"], + "test") -""" def test_connect(self): self.bts.connect() @@ -59,8 +109,8 @@ class Testcases(unittest.TestCase): 'head_block_number', 'id', 'last_irreversible_block_num', - 'next_maintenance_time', - 'recently_missed_count', + 'current_witness', + 'total_pow', 'time']: self.assertTrue(key in info) @@ -68,9 +118,9 @@ class Testcases(unittest.TestCase): bts = self.bts tx1 = bts.new_tx() tx2 = bts.new_tx() - self.bts.transfer("init1", 1, core_unit, append_to=tx1) - self.bts.transfer("init1", 2, core_unit, append_to=tx2) - self.bts.transfer("init1", 3, core_unit, append_to=tx1) + self.bts.transfer("test1", 1, "STEEM", append_to=tx1) + self.bts.transfer("test1", 2, "STEEM", append_to=tx2) + self.bts.transfer("test1", 3, "STEEM", append_to=tx1) tx1 = tx1.json() tx2 = tx2.json() ops1 = tx1["operations"] @@ -81,18 +131,18 @@ class Testcases(unittest.TestCase): def test_weight_threshold(self): bts = self.bts - auth = {'account_auths': [['1.2.0', '1']], + auth = {'account_auths': [['test', 1]], 'extensions': [], 'key_auths': [ - ['TEST55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n', 1], - ['TEST7GM9YXcsoAJAgKbqW2oVj7bnNXFNL4pk9NugqKWPmuhoEDbkDv', 1]], + ['STM55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n', 1], + ['STM7GM9YXcsoAJAgKbqW2oVj7bnNXFNL4pk9NugqKWPmuhoEDbkDv', 1]], 'weight_threshold': 3} # threshold fine bts._test_weights_treshold(auth) - auth = {'account_auths': [['1.2.0', '1']], + auth = {'account_auths': [['test', 1]], 'extensions': [], 'key_auths': [ - ['TEST55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n', 1], - ['TEST7GM9YXcsoAJAgKbqW2oVj7bnNXFNL4pk9NugqKWPmuhoEDbkDv', 1]], + ['STM55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n', 1], + ['STM7GM9YXcsoAJAgKbqW2oVj7bnNXFNL4pk9NugqKWPmuhoEDbkDv', 1]], 'weight_threshold': 4} # too high with self.assertRaises(ValueError): @@ -100,20 +150,22 @@ class Testcases(unittest.TestCase): def test_allow(self): bts = self.bts + self.assertIn(bts.prefix, "STM") tx = bts.allow( - "TEST55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n", + "STM55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n", + account="test", weight=1, threshold=1, - permission="owner" + permission="owner", ) self.assertEqual( - getOperationNameForId(tx["operations"][0][0]), + (tx["operations"][0][0]), "account_update" ) op = tx["operations"][0][1] self.assertIn("owner", op) self.assertIn( - ["TEST55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n", '1'], + ["STM55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n", '1'], op["owner"]["key_auths"]) self.assertEqual(op["owner"]["weight_threshold"], 1) @@ -121,14 +173,14 @@ class Testcases(unittest.TestCase): bts = self.bts with self.assertRaisesRegex(ValueError, ".*Changes nothing.*"): bts.disallow( - "TEST55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n", + "STM55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n", weight=1, threshold=1, permission="owner" ) with self.assertRaisesRegex(ValueError, ".*Changes nothing!.*"): bts.disallow( - "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", + "STM6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", weight=1, threshold=1, permission="owner" @@ -136,25 +188,24 @@ class Testcases(unittest.TestCase): def test_update_memo_key(self): bts = self.bts - tx = bts.update_memo_key("TEST55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n") + tx = bts.update_memo_key("STM55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n") self.assertEqual( - getOperationNameForId(tx["operations"][0][0]), + (tx["operations"][0][0]), "account_update" ) op = tx["operations"][0][1] self.assertEqual( - op["new_options"]["memo_key"], - "TEST55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n") + op["memo_key"], + "STM55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n") def test_approvewitness(self): bts = self.bts - tx = bts.approvewitness("init0") + tx = bts.approvewitness("test1") self.assertEqual( - getOperationNameForId(tx["operations"][0][0]), - "account_update" + (tx["operations"][0][0]), + "account_witness_vote" ) op = tx["operations"][0][1] self.assertIn( - "1:0", - op["new_options"]["votes"]) -""" + "test1", + op["witness"]) diff --git a/tests/test_steem_testnet.py b/tests/test_steem_testnet.py deleted file mode 100644 index abccbc9caa6806e8f90917c272b1a8363ff59dca..0000000000000000000000000000000000000000 --- a/tests/test_steem_testnet.py +++ /dev/null @@ -1,195 +0,0 @@ -import mock -import string -import unittest -import random -from pprint import pprint -from steempy import Steem -from steempybase.operationids import getOperationNameForId -from steempy.amount import Amount -from steempybase.account import PrivateKey -from steempy.instance import set_shared_steem_instance - -wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3" -core_unit = "STM" - - -class Testcases(unittest.TestCase): - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - self.bts = Steem( - "wss://testnet.steem.vc", - nobroadcast=True, - # unsigned = True, - keys={"active": wif, "owner": wif, "memo": wif}, - ) - # from getpass import getpass - # self.bts.wallet.unlock(getpass()) - set_shared_steem_instance(self.bts) - self.bts.set_default_account("test") - - def test_create_account(self): - bts = self.bts - name = ''.join(random.choice(string.ascii_lowercase) for _ in range(12)) - key1 = PrivateKey() - key2 = PrivateKey() - key3 = PrivateKey() - key4 = PrivateKey() - key5 = PrivateKey() - tx = bts.create_account( - name, - creator="test", # 1.2.7 - owner_key=format(key1.pubkey, core_unit), - active_key=format(key2.pubkey, core_unit), - posting_key=format(key3.pubkey, core_unit), - memo_key=format(key4.pubkey, core_unit), - additional_owner_keys=[format(key5.pubkey, core_unit)], - additional_active_keys=[format(key5.pubkey, core_unit)], - additional_owner_accounts=["test1"], # 1.2.0 - additional_active_accounts=["test1"], - storekeys=False - ) - self.assertEqual( - tx["operations"][0][0], - "account_create" - ) - op = tx["operations"][0][1] - role = "active" - self.assertIn( - format(key5.pubkey, core_unit), - [x[0] for x in op[role]["key_auths"]]) - self.assertIn( - format(key5.pubkey, core_unit), - [x[0] for x in op[role]["key_auths"]]) - self.assertIn( - "test1", - [x[0] for x in op[role]["account_auths"]]) - role = "owner" - self.assertIn( - format(key5.pubkey, core_unit), - [x[0] for x in op[role]["key_auths"]]) - self.assertIn( - format(key5.pubkey, core_unit), - [x[0] for x in op[role]["key_auths"]]) - self.assertIn( - "test1", - [x[0] for x in op[role]["account_auths"]]) - self.assertEqual( - op["creator"], - "test") - - -""" - def test_connect(self): - self.bts.connect() - - def test_set_default_account(self): - self.bts.set_default_account("test") - - def test_info(self): - info = self.bts.info() - for key in ['current_witness', - 'head_block_id', - 'head_block_number', - 'id', - 'last_irreversible_block_num', - 'next_maintenance_time', - 'recently_missed_count', - 'time']: - self.assertTrue(key in info) - - def test_finalizeOps(self): - bts = self.bts - tx1 = bts.new_tx() - tx2 = bts.new_tx() - self.bts.transfer("init1", 1, core_unit, append_to=tx1) - self.bts.transfer("init1", 2, core_unit, append_to=tx2) - self.bts.transfer("init1", 3, core_unit, append_to=tx1) - tx1 = tx1.json() - tx2 = tx2.json() - ops1 = tx1["operations"] - ops2 = tx2["operations"] - self.assertEqual(len(ops1), 2) - self.assertEqual(len(ops2), 1) - - def test_weight_threshold(self): - bts = self.bts - - auth = {'account_auths': [['1.2.0', '1']], - 'extensions': [], - 'key_auths': [ - ['TEST55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n', 1], - ['TEST7GM9YXcsoAJAgKbqW2oVj7bnNXFNL4pk9NugqKWPmuhoEDbkDv', 1]], - 'weight_threshold': 3} # threshold fine - bts._test_weights_treshold(auth) - auth = {'account_auths': [['1.2.0', '1']], - 'extensions': [], - 'key_auths': [ - ['TEST55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n', 1], - ['TEST7GM9YXcsoAJAgKbqW2oVj7bnNXFNL4pk9NugqKWPmuhoEDbkDv', 1]], - 'weight_threshold': 4} # too high - - with self.assertRaises(ValueError): - bts._test_weights_treshold(auth) - - def test_allow(self): - bts = self.bts - tx = bts.allow( - "TEST55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n", - weight=1, - threshold=1, - permission="owner" - ) - self.assertEqual( - getOperationNameForId(tx["operations"][0][0]), - "account_update" - ) - op = tx["operations"][0][1] - self.assertIn("owner", op) - self.assertIn( - ["TEST55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n", '1'], - op["owner"]["key_auths"]) - self.assertEqual(op["owner"]["weight_threshold"], 1) - - def test_disallow(self): - bts = self.bts - with self.assertRaisesRegex(ValueError, ".*Changes nothing.*"): - bts.disallow( - "TEST55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n", - weight=1, - threshold=1, - permission="owner" - ) - with self.assertRaisesRegex(ValueError, ".*Changes nothing!.*"): - bts.disallow( - "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - weight=1, - threshold=1, - permission="owner" - ) - - def test_update_memo_key(self): - bts = self.bts - tx = bts.update_memo_key("TEST55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n") - self.assertEqual( - getOperationNameForId(tx["operations"][0][0]), - "account_update" - ) - op = tx["operations"][0][1] - self.assertEqual( - op["new_options"]["memo_key"], - "TEST55VCzsb47NZwWe5F3qyQKedX9iHBHMVVFSc96PDvV7wuj7W86n") - - def test_approvewitness(self): - bts = self.bts - tx = bts.approvewitness("init0") - self.assertEqual( - getOperationNameForId(tx["operations"][0][0]), - "account_update" - ) - op = tx["operations"][0][1] - self.assertIn( - "1:0", - op["new_options"]["votes"]) -""" diff --git a/tests/test_transactions.py b/tests/test_transactions.py index 748f7d5431c63b38a8aab7a23656fc09c1c3f43b..64107ae24d9a937a0669ef160c0045202e4f7d16 100644 --- a/tests/test_transactions.py +++ b/tests/test_transactions.py @@ -5,6 +5,7 @@ from steempybase import ( operations, objects ) +from collections import OrderedDict from steempybase.objects import Operation from steempybase.signedtransactions import Signed_Transaction from steempybase.account import PrivateKey @@ -23,6 +24,8 @@ wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3" ref_block_num = 34294 ref_block_prefix = 3707022213 expiration = "2016-04-06T08:29:27" +# steem_node = "wss://gtg.steem.house:8090" +steem_node = "wss://steemd.pevo.science" class Testcases(unittest.TestCase): @@ -72,6 +75,588 @@ class Testcases(unittest.TestCase): "3e") self.doit() + def test_create_account(self): + self.op = operations.Account_create( + **{ + 'creator': + 'xeroc', + 'fee': + '10.000 STEEM', + 'json_metadata': + '', + 'memo_key': + 'STM6zLNtyFVToBsBZDsgMhgjpwysYVbsQD6YhP3kRkQhANUB4w7Qp', + 'new_account_name': + 'fsafaasf', + 'owner': { + 'account_auths': [], + 'key_auths': [[ + 'STM5jYVokmZHdEpwo5oCG3ES2Ca4VYz' + 'y6tM8pWWkGdgVnwo2mFLFq', 1 + ], [ + 'STM6zLNtyFVToBsBZDsgMhgjpwysYVb' + 'sQD6YhP3kRkQhANUB4w7Qp', 1 + ]], + 'weight_threshold': + 1 + }, + 'active': { + 'account_auths': [], + 'key_auths': [[ + 'STM6pbVDAjRFiw6fkiKYCrkz7PFeL7' + 'XNAfefrsREwg8MKpJ9VYV9x', 1 + ], [ + 'STM6zLNtyFVToBsBZDsgMhgjpwysYV' + 'bsQD6YhP3kRkQhANUB4w7Qp', 1 + ]], + 'weight_threshold': + 1 + }, + 'posting': { + 'account_auths': [], + 'key_auths': [[ + 'STM8CemMDjdUWSV5wKotEimhK6c4d' + 'Y7p2PdzC2qM1HpAP8aLtZfE7', 1 + ], [ + 'STM6zLNtyFVToBsBZDsgMhgjpwys' + 'YVbsQD6YhP3kRkQhANUB4w7Qp', 1 + ], [ + 'STM6pbVDAjRFiw6fkiKYCrkz7PFeL' + '7XNAfefrsREwg8MKpJ9VYV9x', 1 + ]], + 'weight_threshold': + 1 + } + }) + + self.cm = ("f68585abf4dce7c804570109102700000000000003535445454d000" + "0057865726f63086673616661617366010000000002026f6231b8ed" + "1c5e964b42967759757f8bb879d68e7b09d9ea6eedec21de6fa4c40" + "1000314aa202c9158990b3ec51a1aa49b2ab5d300c97b391df3beb3" + "4bb74f3c62699e010001000000000202fe8cc11cc8251de6977636b" + "55c1ab8a9d12b0b26154ac78e56e7c4257d8bcf6901000314aa202c" + "9158990b3ec51a1aa49b2ab5d300c97b391df3beb34bb74f3c62699" + "e010001000000000302fe8cc11cc8251de6977636b55c1ab8a9d12b" + "0b26154ac78e56e7c4257d8bcf6901000314aa202c9158990b3ec51" + "a1aa49b2ab5d300c97b391df3beb34bb74f3c62699e010003b453f4" + "6013fdbccb90b09ba169c388c34d84454a3b9fbec68d5a7819a734f" + "ca001000314aa202c9158990b3ec51a1aa49b2ab5d300c97b391df3" + "beb34bb74f3c62699e0000012031827ea70b06e413d124d14ed8db3" + "99597fa5f94566e031b706533a9090395be1c0ed317c8af01d12ca7" + "9258ac4d800adff92a84630b567e5ff48cd4b5f716d6") + self.doit() + + def test_Transfer_to_vesting(self): + self.op = operations.Transfer_to_vesting(**{ + "from": "foo", + "to": "baar", + "amount": "111.110 STEEM", + }) + + self.cm = ("f68585abf4dce7c80457010303666f6f046261617206b201000000" + "000003535445454d00000001203a34cd45fb4a2585514614be2c1" + "ba2365257ce5470d20c6c6abda39204eeba0b7e057d889ca8b1b1" + "406f1441520a25d32df2ab9fdb532c3377dc66d0fe41bb3d") + self.doit() + + def test_withdraw_vesting(self): + self.op = operations.Withdraw_vesting(**{ + "account": "foo", + "vesting_shares": "100 VESTS", + }) + + self.cm = ( + "f68585abf4dce7c80457010403666f6f00e1f5050000000006564553545300000" + "00120772da57b15b62780ee3d8afedd8d46ffafb8c62788eab5ce01435df99e1d" + "36de549f260444866ff4e228cac445548060e018a872e7ee99ace324af9844f4c" + "50a") + self.doit() + + def test_Comment(self): + self.op = operations.Comment( + **{ + "parent_author": "foobara", + "parent_permlink": "foobarb", + "author": "foobarc", + "permlink": "foobard", + "title": "foobare", + "body": "foobarf", + "json_metadata": { + "foo": "bar" + } + }) + + self.cm = ("f68585abf4dce7c80457010107666f6f6261726107666f6f626172620" + "7666f6f6261726307666f6f6261726407666f6f6261726507666f6f62" + "6172660e7b22666f6f223a2022626172227d00011f34a882f3b06894c" + "29f52e06b8a28187b84b817c0e40f124859970b32511a778736d682f2" + "4d3a6e6da124b340668d25bbcf85ffa23ca622b307ffe10cf182bb82") + self.doit() + + def test_Vote(self): + self.op = operations.Vote( + **{ + "voter": "foobara", + "author": "foobarc", + "permlink": "foobard", + "weight": 1000 + }) + self.cm = ("f68585abf4dce7c80457010007666f6f6261726107666f6f62617263" + "07666f6f62617264e8030001202e09123f732a438ef6d6138484d7ad" + "edfdcf4a4f3d171f7fcafe836efa2a3c8877290bd34c67eded824ac0" + "cc39e33d154d0617f64af936a83c442f62aef08fec") + self.doit() + + def test_Transfer_to_savings(self): + self.op = operations.Transfer_to_savings( + **{ + "from": "testuser", + "to": "testuser", + "amount": "1.000 STEEM", + "memo": "testmemo", + }) + self.cm = ( + "f68585abf4dce7c804570120087465737475736572087465737475736572e8030" + "0000000000003535445454d000008746573746d656d6f00011f4df74457bf8824" + "c02da6a722a7c604676c97aad1a51ebcfb7086b0b7c1f19f9257388a06b3c24ae" + "51d97c9eee5e0ecb7b6c32a29af6f56697f0c7516e70a75ce") + self.doit() + + def test_Transfer_from_savings(self): + self.op = operations.Transfer_from_savings( + **{ + "from": "testuser", + "request_id": 9001, + "to": "testser", + "amount": "100.000 SBD", + "memo": "memohere", + }) + self.cm = ( + "f68585abf4dce7c804570121087465737475736572292300000774657374736" + "572a0860100000000000353424400000000086d656d6f6865726500012058760" + "45f4869b6459438019d71d25bdea461899e0a96635c05f19caf424fa1453fc1fe" + "103d9ca6470d629b9971adddf757c829bb47cc96b29662f294bebb4fb2") + self.doit() + + def test_Cancel_transfer_from_savings(self): + self.op = operations.Cancel_transfer_from_savings(**{ + "from": "tesuser", + "request_id": 9001, + }) + + self.cm = ( + "f68585abf4dce7c8045701220774657375736572292300000001200942474f672" + "3937b88e19fb8cade26cc97f68cb626362d0764d134fe837df5262200b5e71bec" + "13a0673995a584a47674897e959d8c1f83389505895fb64ceda5") + self.doit() + + def test_order_create(self): + self.op = operations.Limit_order_create( + **{ + "owner": "", + "orderid": 0, + "amount_to_sell": "0.000 STEEM", + "min_to_receive": "0.000 STEEM", + "fill_or_kill": False, + "expiration": "2016-12-31T23:59:59" + }) + + self.cm = ("f68585abf4dce7c8045701050000000000000000000000000003535" + "445454d0000000000000000000003535445454d0000007f46685800" + "011f28a2fc52dcfc19378c5977917b158dfab93e7760259aab7ecdb" + "cb82df7b22e1a5527e02fd3aab7d64302ec550c3edcbba29d73226c" + "f088273e4fafda89eb7de8") + self.doit() + + def test_account_update(self): + self.op = operations.Account_update( + **{ + "account": + "streemian", + "posting": { + "weight_threshold": + 1, + "account_auths": [["xeroc", 1], ["fabian", 1]], + "key_auths": [[ + "STM6KChDK2sns9MwugxkoRvPEnyju" + "TxHN5upGsZ1EtanCffqBVVX3", 1 + ], [ + "STM7sw22HqsXbz7D2CmJfmMwt9ri" + "mtk518dRzsR1f8Cgw52dQR1pR", 1 + ]] + }, + "owner": { + "weight_threshold": + 1, + "account_auths": [], + "key_auths": [[ + "STM7sw22HqsXbz7D2CmJfmMwt9r" + "imtk518dRzsR1f8Cgw52dQR1pR", 1 + ], [ + "STM6KChDK2sns9MwugxkoRvPEn" + "yjuTxHN5upGsZ1EtanCffqBVVX3", 1 + ]] + }, + "active": { + "weight_threshold": + 2, + "account_auths": [], + "key_auths": [[ + "STM6KChDK2sns9MwugxkoRvPEnyju" + "TxHN5upGsZ1EtanCffqBVVX3", 1 + ], [ + "STM7sw22HqsXbz7D2CmJfmMwt9ri" + "mtk518dRzsR1f8Cgw52dQR1pR", 1 + ]] + }, + "memo_key": + "STM728uLvStTeAkYJsQefks3FX8yfmpFHp8wXw3RY3kwey2JGDooR", + "json_metadata": + "" + }) + + self.cm = ("f68585abf4dce7c80457010a0973747265656d69616e01010000" + "00000202bbcf38855c9ae9d55704ee50ff56552af1242266c105" + "44a75b61005e17fa78a601000389d28937022880a7f0c7deaa6f" + "46b4d87ce08bd5149335cb39b5a8e9b04981c201000102000000" + "000202bbcf38855c9ae9d55704ee50ff56552af1242266c10544" + "a75b61005e17fa78a601000389d28937022880a7f0c7deaa6f46" + "b4d87ce08bd5149335cb39b5a8e9b04981c20100010100000002" + "0666616269616e0100057865726f6301000202bbcf38855c9ae9" + "d55704ee50ff56552af1242266c10544a75b61005e17fa78a601" + "000389d28937022880a7f0c7deaa6f46b4d87ce08bd5149335cb" + "39b5a8e9b04981c201000318c1ae46b3e98b26684c87737a04ec" + "b1a390efdc7671ced448a92b745372deff000001206a8896c0ce" + "0c949d901c44232694252348004cf9a74ec2f391c0e0b7a4108e" + "7f71522c186a92c17e23a07cdb108a745b9760316daf16f20434" + "53fbeccb331067") + self.doit() + + def test_order_cancel(self): + self.op = operations.Limit_order_cancel(**{ + "owner": "", + "orderid": 2141244, + }) + + self.cm = ("f68585abf4dce7c804570106003cac20000001206c9888d0c2c3" + "1dba1302566f524dfac01a15760b93a8726241a7ae6ba00edfd" + "e5b83edaf94a4bd35c2957ded6023576dcbe936338fb9d340e2" + "1b5dad6f0028f6") + self.doit() + + def test_set_route(self): + self.op = operations.Set_withdraw_vesting_route( + **{ + "from_account": "xeroc", + "to_account": "xeroc", + "percent": 1000, + "auto_vest": False + }) + + self.cm = ("f68585abf4dce7c804570114057865726f63057865726f63e803" + "0000011f12d2b8f93f9528f31979e0e1f59a6d45346a88c02ab2" + "c4115b10c9e273fc1e99621af0c2188598c84762b7e99ca63f6b" + "6be6fca318dd85b0d7a4f09f95579290") + self.doit() + + def test_convert(self): + self.op = operations.Convert(**{ + "owner": "xeroc", + "requestid": 2342343235, + "amount": "100.000 SBD" + }) + + self.cm = ("f68585abf4dce7c804570108057865726f6343529d8ba0860100000" + "00000035342440000000000011f3d22eb66e5cddcc90f5d6ca0bd7a" + "43e0ab811ecd480022af8a847c45eac720b342188d55643d8cb1711" + "f516e9879be2fa7dfa329b518f19df4afaaf4f41f7715") + self.doit() + + def test_utf8tests(self): + self.op = operations.Comment( + **{ + "parent_author": "", + "parent_permlink": "", + "author": "a", + "permlink": "a", + "title": "-", + "body": "".join([chr(i) for i in range(0, 2048)]), + "json_metadata": {} + }) + + self.cm = ("f68585abf4dce7c804570101000001610161012dec1f75303030307" + "5303030317530303032753030303375303030347530303035753030" + "3036753030303762090a7530303062660d753030306575303030667" + "5303031307530303131753030313275303031337530303134753030" + "3135753030313675303031377530303138753030313975303031617" + "5303031627530303163753030316475303031657530303166202122" + "232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3" + "e3f404142434445464748494a4b4c4d4e4f50515253545556575859" + "5a5b5c5d5e5f606162636465666768696a6b6c6d6e6f70717273747" + "5767778797a7b7c7d7e7fc280c281c282c283c284c285c286c287c2" + "88c289c28ac28bc28cc28dc28ec28fc290c291c292c293c294c295c" + "296c297c298c299c29ac29bc29cc29dc29ec29fc2a0c2a1c2a2c2a3" + "c2a4c2a5c2a6c2a7c2a8c2a9c2aac2abc2acc2adc2aec2afc2b0c2b" + "1c2b2c2b3c2b4c2b5c2b6c2b7c2b8c2b9c2bac2bbc2bcc2bdc2bec2" + "bfc380c381c382c383c384c385c386c387c388c389c38ac38bc38cc" + "38dc38ec38fc390c391c392c393c394c395c396c397c398c399c39a" + "c39bc39cc39dc39ec39fc3a0c3a1c3a2c3a3c3a4c3a5c3a6c3a7c3a" + "8c3a9c3aac3abc3acc3adc3aec3afc3b0c3b1c3b2c3b3c3b4c3b5c3" + "b6c3b7c3b8c3b9c3bac3bbc3bcc3bdc3bec3bfc480c481c482c483c" + "484c485c486c487c488c489c48ac48bc48cc48dc48ec48fc490c491" + "c492c493c494c495c496c497c498c499c49ac49bc49cc49dc49ec49" + "fc4a0c4a1c4a2c4a3c4a4c4a5c4a6c4a7c4a8c4a9c4aac4abc4acc4" + "adc4aec4afc4b0c4b1c4b2c4b3c4b4c4b5c4b6c4b7c4b8c4b9c4bac" + "4bbc4bcc4bdc4bec4bfc580c581c582c583c584c585c586c587c588" + "c589c58ac58bc58cc58dc58ec58fc590c591c592c593c594c595c59" + "6c597c598c599c59ac59bc59cc59dc59ec59fc5a0c5a1c5a2c5a3c5" + "a4c5a5c5a6c5a7c5a8c5a9c5aac5abc5acc5adc5aec5afc5b0c5b1c" + "5b2c5b3c5b4c5b5c5b6c5b7c5b8c5b9c5bac5bbc5bcc5bdc5bec5bf" + "c680c681c682c683c684c685c686c687c688c689c68ac68bc68cc68" + "dc68ec68fc690c691c692c693c694c695c696c697c698c699c69ac6" + "9bc69cc69dc69ec69fc6a0c6a1c6a2c6a3c6a4c6a5c6a6c6a7c6a8c" + "6a9c6aac6abc6acc6adc6aec6afc6b0c6b1c6b2c6b3c6b4c6b5c6b6" + "c6b7c6b8c6b9c6bac6bbc6bcc6bdc6bec6bfc780c781c782c783c78" + "4c785c786c787c788c789c78ac78bc78cc78dc78ec78fc790c791c7" + "92c793c794c795c796c797c798c799c79ac79bc79cc79dc79ec79fc" + "7a0c7a1c7a2c7a3c7a4c7a5c7a6c7a7c7a8c7a9c7aac7abc7acc7ad" + "c7aec7afc7b0c7b1c7b2c7b3c7b4c7b5c7b6c7b7c7b8c7b9c7bac7b" + "bc7bcc7bdc7bec7bfc880c881c882c883c884c885c886c887c888c8" + "89c88ac88bc88cc88dc88ec88fc890c891c892c893c894c895c896c" + "897c898c899c89ac89bc89cc89dc89ec89fc8a0c8a1c8a2c8a3c8a4" + "c8a5c8a6c8a7c8a8c8a9c8aac8abc8acc8adc8aec8afc8b0c8b1c8b" + "2c8b3c8b4c8b5c8b6c8b7c8b8c8b9c8bac8bbc8bcc8bdc8bec8bfc9" + "80c981c982c983c984c985c986c987c988c989c98ac98bc98cc98dc" + "98ec98fc990c991c992c993c994c995c996c997c998c999c99ac99b" + "c99cc99dc99ec99fc9a0c9a1c9a2c9a3c9a4c9a5c9a6c9a7c9a8c9a" + "9c9aac9abc9acc9adc9aec9afc9b0c9b1c9b2c9b3c9b4c9b5c9b6c9" + "b7c9b8c9b9c9bac9bbc9bcc9bdc9bec9bfca80ca81ca82ca83ca84c" + "a85ca86ca87ca88ca89ca8aca8bca8cca8dca8eca8fca90ca91ca92" + "ca93ca94ca95ca96ca97ca98ca99ca9aca9bca9cca9dca9eca9fcaa" + "0caa1caa2caa3caa4caa5caa6caa7caa8caa9caaacaabcaaccaadca" + "aecaafcab0cab1cab2cab3cab4cab5cab6cab7cab8cab9cabacabbc" + "abccabdcabecabfcb80cb81cb82cb83cb84cb85cb86cb87cb88cb89" + "cb8acb8bcb8ccb8dcb8ecb8fcb90cb91cb92cb93cb94cb95cb96cb9" + "7cb98cb99cb9acb9bcb9ccb9dcb9ecb9fcba0cba1cba2cba3cba4cb" + "a5cba6cba7cba8cba9cbaacbabcbaccbadcbaecbafcbb0cbb1cbb2c" + "bb3cbb4cbb5cbb6cbb7cbb8cbb9cbbacbbbcbbccbbdcbbecbbfcc80" + "cc81cc82cc83cc84cc85cc86cc87cc88cc89cc8acc8bcc8ccc8dcc8" + "ecc8fcc90cc91cc92cc93cc94cc95cc96cc97cc98cc99cc9acc9bcc" + "9ccc9dcc9ecc9fcca0cca1cca2cca3cca4cca5cca6cca7cca8cca9c" + "caaccabccacccadccaeccafccb0ccb1ccb2ccb3ccb4ccb5ccb6ccb7" + "ccb8ccb9ccbaccbbccbcccbdccbeccbfcd80cd81cd82cd83cd84cd8" + "5cd86cd87cd88cd89cd8acd8bcd8ccd8dcd8ecd8fcd90cd91cd92cd" + "93cd94cd95cd96cd97cd98cd99cd9acd9bcd9ccd9dcd9ecd9fcda0c" + "da1cda2cda3cda4cda5cda6cda7cda8cda9cdaacdabcdaccdadcdae" + "cdafcdb0cdb1cdb2cdb3cdb4cdb5cdb6cdb7cdb8cdb9cdbacdbbcdb" + "ccdbdcdbecdbfce80ce81ce82ce83ce84ce85ce86ce87ce88ce89ce" + "8ace8bce8cce8dce8ece8fce90ce91ce92ce93ce94ce95ce96ce97c" + "e98ce99ce9ace9bce9cce9dce9ece9fcea0cea1cea2cea3cea4cea5" + "cea6cea7cea8cea9ceaaceabceacceadceaeceafceb0ceb1ceb2ceb" + "3ceb4ceb5ceb6ceb7ceb8ceb9cebacebbcebccebdcebecebfcf80cf" + "81cf82cf83cf84cf85cf86cf87cf88cf89cf8acf8bcf8ccf8dcf8ec" + "f8fcf90cf91cf92cf93cf94cf95cf96cf97cf98cf99cf9acf9bcf9c" + "cf9dcf9ecf9fcfa0cfa1cfa2cfa3cfa4cfa5cfa6cfa7cfa8cfa9cfa" + "acfabcfaccfadcfaecfafcfb0cfb1cfb2cfb3cfb4cfb5cfb6cfb7cf" + "b8cfb9cfbacfbbcfbccfbdcfbecfbfd080d081d082d083d084d085d" + "086d087d088d089d08ad08bd08cd08dd08ed08fd090d091d092d093" + "d094d095d096d097d098d099d09ad09bd09cd09dd09ed09fd0a0d0a" + "1d0a2d0a3d0a4d0a5d0a6d0a7d0a8d0a9d0aad0abd0acd0add0aed0" + "afd0b0d0b1d0b2d0b3d0b4d0b5d0b6d0b7d0b8d0b9d0bad0bbd0bcd" + "0bdd0bed0bfd180d181d182d183d184d185d186d187d188d189d18a" + "d18bd18cd18dd18ed18fd190d191d192d193d194d195d196d197d19" + "8d199d19ad19bd19cd19dd19ed19fd1a0d1a1d1a2d1a3d1a4d1a5d1" + "a6d1a7d1a8d1a9d1aad1abd1acd1add1aed1afd1b0d1b1d1b2d1b3d" + "1b4d1b5d1b6d1b7d1b8d1b9d1bad1bbd1bcd1bdd1bed1bfd280d281" + "d282d283d284d285d286d287d288d289d28ad28bd28cd28dd28ed28" + "fd290d291d292d293d294d295d296d297d298d299d29ad29bd29cd2" + "9dd29ed29fd2a0d2a1d2a2d2a3d2a4d2a5d2a6d2a7d2a8d2a9d2aad" + "2abd2acd2add2aed2afd2b0d2b1d2b2d2b3d2b4d2b5d2b6d2b7d2b8" + "d2b9d2bad2bbd2bcd2bdd2bed2bfd380d381d382d383d384d385d38" + "6d387d388d389d38ad38bd38cd38dd38ed38fd390d391d392d393d3" + "94d395d396d397d398d399d39ad39bd39cd39dd39ed39fd3a0d3a1d" + "3a2d3a3d3a4d3a5d3a6d3a7d3a8d3a9d3aad3abd3acd3add3aed3af" + "d3b0d3b1d3b2d3b3d3b4d3b5d3b6d3b7d3b8d3b9d3bad3bbd3bcd3b" + "dd3bed3bfd480d481d482d483d484d485d486d487d488d489d48ad4" + "8bd48cd48dd48ed48fd490d491d492d493d494d495d496d497d498d" + "499d49ad49bd49cd49dd49ed49fd4a0d4a1d4a2d4a3d4a4d4a5d4a6" + "d4a7d4a8d4a9d4aad4abd4acd4add4aed4afd4b0d4b1d4b2d4b3d4b" + "4d4b5d4b6d4b7d4b8d4b9d4bad4bbd4bcd4bdd4bed4bfd580d581d5" + "82d583d584d585d586d587d588d589d58ad58bd58cd58dd58ed58fd" + "590d591d592d593d594d595d596d597d598d599d59ad59bd59cd59d" + "d59ed59fd5a0d5a1d5a2d5a3d5a4d5a5d5a6d5a7d5a8d5a9d5aad5a" + "bd5acd5add5aed5afd5b0d5b1d5b2d5b3d5b4d5b5d5b6d5b7d5b8d5" + "b9d5bad5bbd5bcd5bdd5bed5bfd680d681d682d683d684d685d686d" + "687d688d689d68ad68bd68cd68dd68ed68fd690d691d692d693d694" + "d695d696d697d698d699d69ad69bd69cd69dd69ed69fd6a0d6a1d6a" + "2d6a3d6a4d6a5d6a6d6a7d6a8d6a9d6aad6abd6acd6add6aed6afd6" + "b0d6b1d6b2d6b3d6b4d6b5d6b6d6b7d6b8d6b9d6bad6bbd6bcd6bdd" + "6bed6bfd780d781d782d783d784d785d786d787d788d789d78ad78b" + "d78cd78dd78ed78fd790d791d792d793d794d795d796d797d798d79" + "9d79ad79bd79cd79dd79ed79fd7a0d7a1d7a2d7a3d7a4d7a5d7a6d7" + "a7d7a8d7a9d7aad7abd7acd7add7aed7afd7b0d7b1d7b2d7b3d7b4d" + "7b5d7b6d7b7d7b8d7b9d7bad7bbd7bcd7bdd7bed7bfd880d881d882" + "d883d884d885d886d887d888d889d88ad88bd88cd88dd88ed88fd89" + "0d891d892d893d894d895d896d897d898d899d89ad89bd89cd89dd8" + "9ed89fd8a0d8a1d8a2d8a3d8a4d8a5d8a6d8a7d8a8d8a9d8aad8abd" + "8acd8add8aed8afd8b0d8b1d8b2d8b3d8b4d8b5d8b6d8b7d8b8d8b9" + "d8bad8bbd8bcd8bdd8bed8bfd980d981d982d983d984d985d986d98" + "7d988d989d98ad98bd98cd98dd98ed98fd990d991d992d993d994d9" + "95d996d997d998d999d99ad99bd99cd99dd99ed99fd9a0d9a1d9a2d" + "9a3d9a4d9a5d9a6d9a7d9a8d9a9d9aad9abd9acd9add9aed9afd9b0" + "d9b1d9b2d9b3d9b4d9b5d9b6d9b7d9b8d9b9d9bad9bbd9bcd9bdd9b" + "ed9bfda80da81da82da83da84da85da86da87da88da89da8ada8bda" + "8cda8dda8eda8fda90da91da92da93da94da95da96da97da98da99d" + "a9ada9bda9cda9dda9eda9fdaa0daa1daa2daa3daa4daa5daa6daa7" + "daa8daa9daaadaabdaacdaaddaaedaafdab0dab1dab2dab3dab4dab" + "5dab6dab7dab8dab9dabadabbdabcdabddabedabfdb80db81db82db" + "83db84db85db86db87db88db89db8adb8bdb8cdb8ddb8edb8fdb90d" + "b91db92db93db94db95db96db97db98db99db9adb9bdb9cdb9ddb9e" + "db9fdba0dba1dba2dba3dba4dba5dba6dba7dba8dba9dbaadbabdba" + "cdbaddbaedbafdbb0dbb1dbb2dbb3dbb4dbb5dbb6dbb7dbb8dbb9db" + "badbbbdbbcdbbddbbedbbfdc80dc81dc82dc83dc84dc85dc86dc87d" + "c88dc89dc8adc8bdc8cdc8ddc8edc8fdc90dc91dc92dc93dc94dc95" + "dc96dc97dc98dc99dc9adc9bdc9cdc9ddc9edc9fdca0dca1dca2dca" + "3dca4dca5dca6dca7dca8dca9dcaadcabdcacdcaddcaedcafdcb0dc" + "b1dcb2dcb3dcb4dcb5dcb6dcb7dcb8dcb9dcbadcbbdcbcdcbddcbed" + "cbfdd80dd81dd82dd83dd84dd85dd86dd87dd88dd89dd8add8bdd8c" + "dd8ddd8edd8fdd90dd91dd92dd93dd94dd95dd96dd97dd98dd99dd9" + "add9bdd9cdd9ddd9edd9fdda0dda1dda2dda3dda4dda5dda6dda7dd" + "a8dda9ddaaddabddacddadddaeddafddb0ddb1ddb2ddb3ddb4ddb5d" + "db6ddb7ddb8ddb9ddbaddbbddbcddbdddbeddbfde80de81de82de83" + "de84de85de86de87de88de89de8ade8bde8cde8dde8ede8fde90de9" + "1de92de93de94de95de96de97de98de99de9ade9bde9cde9dde9ede" + "9fdea0dea1dea2dea3dea4dea5dea6dea7dea8dea9deaadeabdeacd" + "eaddeaedeafdeb0deb1deb2deb3deb4deb5deb6deb7deb8deb9deba" + "debbdebcdebddebedebfdf80df81df82df83df84df85df86df87df8" + "8df89df8adf8bdf8cdf8ddf8edf8fdf90df91df92df93df94df95df" + "96df97df98df99df9adf9bdf9cdf9ddf9edf9fdfa0dfa1dfa2dfa3d" + "fa4dfa5dfa6dfa7dfa8dfa9dfaadfabdfacdfaddfaedfafdfb0dfb1" + "dfb2dfb3dfb4dfb5dfb6dfb7dfb8dfb9dfbadfbbdfbcdfbddfbedfb" + "f0000011f45c8e1ed9289f5ec7d4f6d7ce891a30ede7470e28d4639" + "8e0dc15c41c784b1862f132378382230d68b59e3592e72a32f310f8" + "8ea4baddb361a3709b664ba7375") + self.doit() + + def test_feed_publish(self): + self.op = operations.Feed_publish( + **{ + "publisher": "xeroc", + "exchange_rate": { + "base": "1.000 SBD", + "quote": "4.123 STEEM" + } + }) + + self.cm = ("f68585abf4dce7c804570107057865726f63e803000000000" + "00003534244000000001b1000000000000003535445454d00" + "000001203847a02aa76964cacfb41565c23286cc64b18f6bb" + "9260832823839b3b90dff18738e1b686ad22f79c42fca73e6" + "1bf633505a2a66cac65555b0ac535ca5ee5a61") + self.doit() + + def test_witness_update(self): + self.op = operations.Witness_update( + **{ + "owner": + "xeroc", + "url": + "foooobar", + "block_signing_key": + "STM6zLNtyFVToBsBZDsgMhgjpwysYVbsQD6YhP3kRkQhANUB4w7Qp", + "props": { + "account_creation_fee": "10.000 STEEM", + "maximum_block_size": 1111111, + "sbd_interest_rate": 1000 + }, + "fee": + "10.000 STEEM", + }) + + self.cm = ("f68585abf4dce7c80457010b057865726f6308666f6f6f6f6261" + "720314aa202c9158990b3ec51a1aa49b2ab5d300c97b391df3be" + "b34bb74f3c62699e102700000000000003535445454d000047f4" + "1000e803102700000000000003535445454d00000001206adca4" + "bebc872e8d792caeb3b729e9a5e8af90c07ab3f744fb4d0f19d5" + "7b3bec32f5a43f5acdfc065f0227e45e599745c46e41c023d69f" + "b9f2405478badadb4c") + self.doit() + + def test_witness_vote(self): + self.op = operations.Account_witness_vote(**{ + "account": "xeroc", + "witness": "chainsquad", + "approve": True, + }) + + self.cm = ("f68585abf4dce7c80457010c057865726f630a636" + "861696e73717561640100011f16b43411e11f4739" + "4c1624a3c4d3cf4daba700b8690f494e6add7ad9b" + "ac735ce7775d823aa66c160878cb3348e6857c531" + "114d229be0202dc0857f8f03a00369") + self.doit() + + def test_custom_json(self): + self.op = operations.Custom_json( + **{ + "json": [ + "reblog", + OrderedDict( + [ # need an ordered dict to keep order for the test + ("account", "xeroc"), ("author", "chainsquad"), ( + "permlink", "streemian-com-to-open-its-doors-" + "and-offer-a-20-discount") + ]) + ], + "required_auths": [], + "required_posting_auths": ["xeroc"], + "id": + "follow" + }) + + self.cm = ("f68585abf4dce7c8045701120001057865726f6306666f6c6c" + "6f777f5b227265626c6f67222c207b226163636f756e74223a" + "20227865726f63222c2022617574686f72223a202263686169" + "6e7371756164222c20227065726d6c696e6b223a2022737472" + "65656d69616e2d636f6d2d746f2d6f70656e2d6974732d646f" + "6f72732d616e642d6f666665722d612d32302d646973636f75" + "6e74227d5d00011f0cffad16cfd8ea4b84c06d412e93a9fc10" + "0bf2fac5f9a40d37d5773deef048217db79cabbf15ef29452d" + "e4ed1c5face51d998348188d66eb9fc1ccef79a0c0d4") + self.doit() + + def test_comment_options(self): + self.op = operations.Comment_options( + **{ + "author": + "xeroc", + "permlink": + "piston", + "max_accepted_payout": + "1000000.000 SBD", + "percent_steem_dollars": + 10000, + "allow_votes": + True, + "allow_curation_rewards": + True, + "beneficiaries": [{ + "weight": 2000, + "account": "good-karma" + }, { + "weight": 5000, + "account": "null" + }], + }) + + self.cm = ("f68585abf4dce7c804570113057865726f6306706973746f6e" + "00ca9a3b000000000353424400000000102701010100020a67" + "6f6f642d6b61726d61d007046e756c6c881300011f59634e65" + "55fec7c01cb7d4921601c37c250c6746022cc35eaefdd90405" + "d7771b2f65b44e97b7f3159a6d52cb20640502d2503437215f" + "0907b2e2213940f34f2c") + self.doit() + """ def test_call_update(self): @@ -644,7 +1229,7 @@ class Testcases(unittest.TestCase): "528677e4") self.doit() - def compareConstructedTX(self): + def self.cmConstructedTX(self): self.maxDiff = None self.op = operations.Bid_collateral(**{ 'fee': {'amount': 100, @@ -683,5 +1268,5 @@ class Testcases(unittest.TestCase): if __name__ == '__main__': t = Testcases() - t.compareConstructedTX() + t.self.cmConstructedTX() """ diff --git a/tests/test_wallet.py b/tests/test_wallet.py index 6d30c913e6840b17d3e18cbcb0fed58759958a59..fe2baf243fa76fadc89f17ba5e5a858446288f03 100644 --- a/tests/test_wallet.py +++ b/tests/test_wallet.py @@ -9,6 +9,8 @@ from steempy.instance import set_shared_steem_instance from steempybase.operationids import getOperationNameForId wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3" +# steem_node = "wss://gtg.steem.house:8090" +steem_node = "wss://steemd.pevo.science" class Testcases(unittest.TestCase): @@ -17,7 +19,7 @@ class Testcases(unittest.TestCase): super().__init__(*args, **kwargs) self.stm = Steem( - "wss://testnet.steem.vc", + steem_node, nobroadcast=True, # We want to bundle many operations into a single transaction bundle=True,