diff --git a/steem/blog.py b/steem/blog.py index ea15e02..4bf8cd5 100644 --- a/steem/blog.py +++ b/steem/blog.py @@ -46,7 +46,7 @@ def __init__(self, steemd_instance=None): self.steem = steemd_instance or shared_steemd_instance() self.comments_only = comments_only - self.account = Account(account_name) + self.account = Account(account_name, steemd_instance=self.steem) self.history = self.account.history_reverse(filter_by='comment') self.seen_items = set() @@ -79,7 +79,8 @@ def ensure_unique(post): unique = filter(ensure_unique, hist2) - serialized = filter(bool, map(silent(Post), unique)) + postmap = map(silent(lambda u: Post(u, self.steem)), unique) + serialized = filter(bool, postmap) batch = take(limit, serialized) return batch diff --git a/steem/cli.py b/steem/cli.py index c43d525..3a6bd9c 100644 --- a/steem/cli.py +++ b/steem/cli.py @@ -793,7 +793,7 @@ def legacyentry(): if not args.objects: t = PrettyTable(["Key", "Value"]) t.align = "l" - blockchain = Blockchain(mode="head") + blockchain = Blockchain(mode="head", steemd_instance=steem) info = blockchain.info() median_price = steem.get_current_median_history_price() steem_per_mvest = ( @@ -810,7 +810,7 @@ def legacyentry(): for obj in args.objects: # Block if re.match("^[0-9]*$", obj): - block = Block(obj) + block = Block(obj, steemd_instance=steem) if block: t = PrettyTable(["Key", "Value"]) t.align = "l" @@ -825,7 +825,7 @@ def legacyentry(): # Account name elif re.match("^[a-zA-Z0-9\-\._]{2,16}$", obj): from math import log10 - account = Account(obj) + account = Account(obj, steemd_instance=steem) t = PrettyTable(["Key", "Value"]) t.align = "l" for key in sorted(account): @@ -867,7 +867,7 @@ def legacyentry(): print("Public Key not known" % obj) # Post identifier elif re.match(".*@.{3,16}/.*$", obj): - post = Post(obj) + post = Post(obj, steemd_instance=steem) if post: t = PrettyTable(["Key", "Value"]) t.align = "l" @@ -961,7 +961,7 @@ def legacyentry(): print(t) elif args.command == "upvote" or args.command == "downvote": - post = Post(args.post) + post = Post(args.post, steemd_instance=steem) if args.command == "downvote": weight = -float(args.weight) else: @@ -1009,7 +1009,7 @@ def legacyentry(): elif args.command == "balance": if args.account and isinstance(args.account, list): for account in args.account: - a = Account(account) + a = Account(account, steemd_instance=steem) print("\n@%s" % a.name) t = PrettyTable(["Account", "STEEM", "SBD", "VESTS"]) @@ -1063,7 +1063,7 @@ def legacyentry(): print(t) elif args.command == "permissions": - account = Account(args.account) + account = Account(args.account, steemd_instance=steem) print_permissions(account) elif args.command == "allow": @@ -1132,7 +1132,7 @@ def legacyentry(): from steembase.account import PasswordKey import getpass password = getpass.getpass("Account Passphrase: ") - account = Account(args.account) + account = Account(args.account, steemd_instance=steem) imported = False if "owner" in args.roles: @@ -1257,7 +1257,7 @@ def legacyentry(): profile = Profile(keys, values) - account = Account(args.account) + account = Account(args.account, steemd_instance=steem) account["json_metadata"] = Profile(account["json_metadata"] if account["json_metadata"] else {}) account["json_metadata"].update(profile) @@ -1268,7 +1268,7 @@ def legacyentry(): elif args.command == "delprofile": from .profile import Profile - account = Account(args.account) + account = Account(args.account, steemd_instance=steem) account["json_metadata"] = Profile(account["json_metadata"]) for var in args.variable: diff --git a/steem/commit.py b/steem/commit.py index 44b087d..d1beeb0 100644 --- a/steem/commit.py +++ b/steem/commit.py @@ -589,7 +589,7 @@ def create_account( remaining_fee = required_fee_steem - delegation_fee_steem if remaining_fee > 0: required_sp = remaining_fee * delegated_sp_fee_mult - required_fee_vests = Converter().sp_to_vests(required_sp) + 1 + required_fee_vests = Converter(self.steemd).sp_to_vests(required_sp) + 1 s = { 'creator': creator, @@ -898,7 +898,7 @@ def claim_reward_balance(self, if none( int(first(x.split(' '))) for x in [reward_sbd, reward_steem, reward_vests]): - a = Account(account) + a = Account(account, steemd_instance=self.steemd) reward_steem = a['reward_steem_balance'] reward_sbd = a['reward_sbd_balance'] reward_vests = a['reward_vesting_balance'] diff --git a/steem/post.py b/steem/post.py index 8fa7552..113301a 100644 --- a/steem/post.py +++ b/steem/post.py @@ -150,7 +150,8 @@ def get_replies(self): """ post_author, post_permlink = resolve_identifier(self.identifier) replies = self.steemd.get_content_replies(post_author, post_permlink) - return map(silent(Post), replies) + return map(silent(lambda r: Post(r, steemd_instance=self.steemd)), + replies) @staticmethod def get_all_replies(root_post=None, comments=list(), all_comments=list()): diff --git a/steem/wallet.py b/steem/wallet.py index e8bfcbf..5129fab 100644 --- a/steem/wallet.py +++ b/steem/wallet.py @@ -335,7 +335,7 @@ def getAccount(self, pub): return {"name": None, "type": None, "pubkey": pub} else: try: - account = Account(name) + account = Account(name, steemd_instance=self.steemd) except: # noqa FIXME(sneak) return keyType = self.getKeyType(account, pub)