diff --git a/beem/comment.py b/beem/comment.py index 0bca1bd76151079c3f3622364b8d0067ac66369d..941228811f158004fcc0ccfb92bc3a18c12dc896 100644 --- a/beem/comment.py +++ b/beem/comment.py @@ -88,9 +88,13 @@ class Comment(BlockchainObject): "total_pending_payout_value", "promoted", ] + if self.steem.sbd_symbol is not None: + symbol = self.steem.sbd_symbol + else: + symbol = self.steem.steem_symbol for p in sbd_amounts: - if p in comment and isinstance(comment.get(p), (string_types, list, dict)): - comment[p] = Amount(comment.get(p, "0.000 %s" % (self.steem.sbd_symbol)), steem_instance=self.steem) + if p in comment and isinstance(comment.get(p), (string_types, list, dict)) and symbol is not None: + comment[p] = Amount(comment.get(p, "0.000 %s" % (symbol)), steem_instance=self.steem) # turn json_metadata into python dict meta_str = comment.get("json_metadata", "{}") @@ -276,7 +280,11 @@ class Comment(BlockchainObject): def reward(self): """ Return the estimated total SBD reward. """ - a_zero = Amount(0, self.steem.sbd_symbol, steem_instance=self.steem) + if self.steem.sbd_symbol is not None: + symbol = self.steem.sbd_symbol + else: + symbol = self.steem.steem_symbol + a_zero = Amount(0, symbol, steem_instance=self.steem) total = Amount(self.get("total_payout_value", a_zero), steem_instance=self.steem) pending = Amount(self.get("pending_payout_value", a_zero), steem_instance=self.steem) return total + pending @@ -285,7 +293,11 @@ class Comment(BlockchainObject): """ Return if the payout is pending (the post/comment is younger than 7 days) """ - a_zero = Amount(0, self.steem.sbd_symbol, steem_instance=self.steem) + if self.steem.sbd_symbol is not None: + symbol = self.steem.sbd_symbol + else: + symbol = self.steem.steem_symbol + a_zero = Amount(0, symbol, steem_instance=self.steem) total = Amount(self.get("total_payout_value", a_zero), steem_instance=self.steem) post_age_days = self.time_elapsed().total_seconds() / 60 / 60 / 24 return post_age_days < 7.0 and float(total) == 0 diff --git a/beem/snapshot.py b/beem/snapshot.py index b4d7431cc6af48296939d4174dc73722086aeece..6da80d90a6e683cfadbbbb409db0827f75606a2a 100644 --- a/beem/snapshot.py +++ b/beem/snapshot.py @@ -40,7 +40,7 @@ class AccountSnapshot(list): """ self.own_vests = [Amount(0, self.steem.vests_symbol, steem_instance=self.steem)] self.own_steem = [Amount(0, self.steem.steem_symbol, steem_instance=self.steem)] - self.own_sbd = [Amount(0, self.steem.steem_symbol, steem_instance=self.steem)] + self.own_sbd = [Amount(0, self.steem.sbd_symbol, steem_instance=self.steem)] self.delegated_vests_in = [{}] self.delegated_vests_out = [{}] self.timestamps = [addTzInfo(datetime(1970, 1, 1, 0, 0, 0, 0))] diff --git a/beem/steem.py b/beem/steem.py index 80e6765722717344c317c37bb280b49cb42afb7e..34b556a03deac68109129c8e154da6a936460363 100644 --- a/beem/steem.py +++ b/beem/steem.py @@ -1907,6 +1907,8 @@ class Steem(object): for asset in self.chain_params['chain_assets']: if asset['id'] == asset_id: return asset['symbol'] + if asset_id < 3: + return None raise KeyError("asset ID not found in chain assets") @property