def delegate(self, delegator_account_name, last_idx, expiration=60, dry_run=True, wifs=[]): accounts, last_idx = self.get_delegated_accounts( delegator_account_name, last_idx=last_idx) if not accounts: return ([], last_idx) deltas = self.get_delegation_deltas(delegator_account_name, accounts) delegation_ops = [] for delta in deltas: delegation_ops.append( operations.DelegateVestingShares( delegator=delegator_account_name, vesting_shares=delta['new_vests'], delegatee=delta['name'])) if len(delegation_ops) == 0: self.logger.info('no operations in this group to broadcast.') return ([], last_idx) tx = TransactionBuilder(steemd_instance=self.steem, expiration=expiration) tx.appendOps(delegation_ops) [tx.appendWif(wif) for wif in wifs] if len(wifs): tx.sign() if not dry_run: result = tx.broadcast() self.logger.info('transaction broadcast. result: %s', result) return (deltas, last_idx)
def delegate( self, delegator, last_idx, expiration=60, dry_run=True, wifs=[]): accounts, last_idx = self.get_delegated_accounts(delegator, last_idx) if not accounts: return ([], last_idx) deltas = self.get_delegation_deltas(accounts) if not deltas: return ([], last_idx) delegation_ops = [] for delta in deltas: delegation_ops.append(operations.DelegateVestingShares( delegator=delegator, vesting_shares=delta['new_vests'], delegatee=delta['name'] )) tx = TransactionBuilder( steemd_instance=self.steem, expiration=expiration) tx.appendOps(delegation_ops) [tx.appendWif(wif) for wif in wifs] if wifs: tx.sign() if not dry_run: result = tx.broadcast() self.logger.info('transaction broadcast. result: %s', result) pause = 3 * len(deltas) / 100 # rate limit: max 100 ops per 3s time.sleep(pause) # avoid steem#1973 & drastic bandwidth adjustments return (deltas, last_idx)