def compute_cost(self, type=1, tx_size=1000, perm_len=10, pperm_len=0): rc = RC() if type == 1: cost = rc.comment(tx_size=tx_size, permlink_length=perm_len, parent_permlink_length=pperm_len) elif type == 2: cost = rc.vote(tx_size=tx_size) elif type == 3: cost = rc.transfer(tx_size=tx_size, market_op_count=perm_len) elif type == 4: cost = rc.custom_json(tx_size=tx_size) else: return False return cost
def compute_cost(self, type=1, tx_size=1000, perm_len=10, pperm_len=0): rc = RC() if type == 1: cost = rc.comment(tx_size=tx_size, permlink_length=perm_len, parent_permlink_length=pperm_len) elif type == 2: cost = rc.vote(tx_size=tx_size) elif type == 3: cost = rc.transfer(tx_size=tx_size, market_op_count=perm_len) elif type == 4: cost = rc.custom_json(tx_size=tx_size) else: print("Invalid type.") return print("RC costs for a comment: %.2f G RC" % (cost))
def refresh_account(self): if self.hist_account is None: return self.hist_account.refresh() self.accountInfoGroupBox.setTitle("%s (%.3f)" % (self.hist_account["name"], self.hist_account.rep)) with self.redrawLock: self.votePowerProgressBar.setValue(int(self.hist_account.vp)) if self.hist_account.vp == 100: self.votePowerProgressBar.setFormat("%.2f %%" % (self.hist_account.vp)) else: self.votePowerProgressBar.setFormat("%.2f %%, full in %s" % (self.hist_account.vp, self.hist_account.get_recharge_time_str())) down_vp = self.hist_account.get_downvoting_power() with self.redrawLock: self.downvotePowerProgressBar.setValue(int(down_vp)) if down_vp == 100: self.downvotePowerProgressBar.setFormat("%.2f %%" % (down_vp)) else: self.downvotePowerProgressBar.setFormat("%.2f %%, full in %s" % (down_vp, self.hist_account.get_recharge_time(starting_voting_power=down_vp))) self.votePowerLabel.setText("Vote Power, a 100%% vote is %.3f $" % (self.hist_account.get_voting_value_SBD())) self.downvotePowerLabel.setText("DownVote Power") self.STEEMLabel.setText(str(self.hist_account["balance"])) self.SBDLabel.setText(str(self.hist_account["sbd_balance"])) self.SPLabel.setText("%.3f HP" % self.stm.vests_to_sp(self.hist_account["vesting_shares"])) try: rc_manabar = self.hist_account.get_rc_manabar() with self.redrawLock: self.RCProgressBar.setValue(int(rc_manabar["current_pct"])) self.RCProgressBar.setFormat("%.2f %%, full in %s" % (rc_manabar["current_pct"], self.hist_account.get_manabar_recharge_time_str(rc_manabar))) rc = self.hist_account.get_rc() estimated_rc = int(rc["max_rc"]) * rc_manabar["current_pct"] / 100 rc_calc = RC(steem_instance=self.stm) self.RCLabel.setText("RC (%.0f G RC of %.0f G RC)" % (estimated_rc / 10**9, int(rc["max_rc"]) / 10**9)) ret = "--- Approx Costs ---\n" ret += "comment - %.2f G RC - enough RC for %d comments\n" % (rc_calc.comment() / 10**9, int(estimated_rc / rc_calc.comment())) ret += "vote - %.2f G RC - enough RC for %d votes\n" % (rc_calc.vote() / 10**9, int(estimated_rc / rc_calc.vote())) ret += "transfer - %.2f G RC - enough RC for %d transfers\n" % (rc_calc.transfer() / 10**9, int(estimated_rc / rc_calc.transfer())) ret += "custom_json - %.2f G RC - enough RC for %d custom_json\n" % (rc_calc.custom_json() / 10**9, int(estimated_rc / rc_calc.custom_json())) self.text.setText(ret) except: rc_manabar = None