def time_Vote(self):
        self.op = operations.Vote(
            **{
                "voter": "foobara",
                "author": "foobarc",
                "permlink": "foobard",
                "weight": 1000,
                "prefix": self.default_prefix
            })

        self.doit()
 def test_vote(self):
     self.op = operations.Vote(
         **{
             "voter": "nettybot",
             "author": "jrcornel",
             "permlink":
             "hive-sitting-back-at-previous-support-levels-is-this-a-buy",
             "weight": 10000
         })
     self.cm = b"0402528804049ce2ccea04047660b85e040101045000086e65747479626f74086a72636f726e656c3a686976652d73697474696e672d6261636b2d61742d70726576696f75732d737570706f72742d6c6576656c732d69732d746869732d612d6275791027040100"
     self.apdu = ([
         b"d40400009f05800000308000000d800000008000000080000000042000000000000000000000000000000000000000000000000000000000000000000402528804049ce2ccea04047660b85e040101045000086e65747479626f74086a72636f726e656c3a686976652d73697474696e672d6261636b2d61742d70726576696f75732d737570706f72742d6c6576656c732d69732d746869732d612d6275791027040100"
     ])
Пример #3
0
    def vote_dict(self, vote_dict):
        """Calc RC costs for a vote

        Example for calculating RC costs

        .. code-block:: python

            from beem.rc import RC
            vote_dict = {
                         "voter": "foobara", "author": "foobarc",
                         "permlink": "foobard", "weight": 1000
                        }

            rc = RC()
            print(rc.comment(vote_dict))

        """
        op = operations.Vote(**vote_dict)
        tx_size = self.get_tx_size(op)
        return self.vote(tx_size=tx_size)
Пример #4
0
    def vote(self, weight, account=None, identifier=None, **kwargs):
        """ Vote for a post
            :param str identifier: Identifier for the post to upvote Takes
                                   the form ``@author/permlink``
            :param float weight: Voting weight. Range: -100.0 - +100.0. May
                                 not be 0.0
            :param str account: Voter to use for voting. (Optional)
            If ``voter`` is not defines, the ``default_account`` will be taken
            or a ValueError will be raised
        """
        if not account:
            if "default_account" in self.steem.config:
                account = self.steem.config["default_account"]
        if not account:
            raise ValueError("You need to provide an account")
        account = Account(account, steem_instance=self.steem)
        if not identifier:
            post_author = self["author"]
            post_permlink = self["permlink"]
        else:
            [post_author, post_permlink] = resolve_authorperm(identifier)

        STEEMIT_100_PERCENT = 10000
        STEEMIT_1_PERCENT = (STEEMIT_100_PERCENT / 100)
        vote_weight = int(weight * STEEMIT_1_PERCENT)
        if vote_weight > STEEMIT_100_PERCENT:
            vote_weight = STEEMIT_100_PERCENT
        if vote_weight < -STEEMIT_100_PERCENT:
            vote_weight = -STEEMIT_100_PERCENT

        op = operations.Vote(
            **{
                "voter": account["name"],
                "author": post_author,
                "permlink": post_permlink,
                "weight": vote_weight
            })

        return self.steem.finalizeOp(op, account, "posting", **kwargs)
Пример #5
0
def test_post(wls):
    op1 = operations.Social_action(
        **{
            "account": "guest123",
            "social_action_comment_create": {
                "permlink": 'just-a-test-post',
                "parent_author": "",
                "parent_permlink": "test",
                "title": "just a test post",
                "body": "test post body",
                "json_metadata": '{"app":"wls_python"}'
            }
        })

    op2 = operations.Social_action(
        **{
            "account": "guest123",
            "social_action_comment_update": {
                "permlink": 'just-a-test-post',
                "title": "just a test post",
                "body": "test post body",
            }
        })

    op3 = operations.Vote(
        **{
            'voter': 'guest123',
            'author': 'wlsuser',
            'permlink': 'another-test-post',
            'weight': 10000,
        })

    privateWif = "5K..."
    tx = TransactionBuilder(use_condenser_api=True, steem_instance=wls)
    tx.appendOps(op1)
    tx.appendWif(privateWif)
    tx.sign()
    tx.broadcast()
Пример #6
0
                                  "voted_after_min": age_min, "expiration": expiration})                
     last_voter = vote["voter"]
         
 print("Building vote list: %d - %.2f s" % (len(vote_ops), time.time() - start_prep_time))
 if len(vote_ops) > 0:
     tx = TransactionBuilder(steem_instance=stm)
 else:
     tx = None
 ops = []
 broadcasted_votes = []
 for vote in vote_ops:
     
     print("broadcast voter %s votes %s" % (vote["voter"], vote["authorperm"]))
     author, permlink = resolve_authorperm(vote["authorperm"])
     op = operations.Vote(**{"voter": vote["voter"],
                             "author": author,
                             "permlink": permlink,
                             "weight": int(vote["weight"] * 100)})
     ops.append(op)      
     broadcasted_votes.append(vote)
     if len(ops) > 5:
         try:
             print("Broadcasting %d votes" % len(ops))
             tx.appendOps(ops)
             # tx.appendMissingSignatures()
             tx.appendSigner("rewarding", "posting")
             tx.sign()
             reply_message = tx.broadcast()
             # print(reply_message)
             ops = []
             #if vote["trail_vote"]:
             #    print("trail voter %s votes %s" % (vote["voter"], vote["authorperm"]))
Пример #7
0
 for c in map(Comment, account.history_reverse(only_ops=["comment"])):
     if c.permlink in c_list:
         continue
     try:
         c.refresh()
     except ContentDoesNotExistsException:
         continue
     c_list[c.permlink] = 1
     if not c.is_comment():
         counter += 1
         if voter not in c.get_votes() and c.time_elapsed() > timedelta(
                 minutes=wait) and c.time_elapsed() < timedelta(hours=2):
             op = operations.Vote(
                 **{
                     "voter": voter,
                     "author": c.author,
                     "permlink": c.permlink,
                     "weight": int(percent * 100)
                 })
             ops = []
             ops.append(op)
             stm.wallet.unlock(wallet_pw)
             tx = TransactionBuilder(steem_instance=stm)
             tx.appendOps(ops)
             tx.appendSigner(signer, 'posting')
             tx.sign()
             returncode = tx.broadcast()
             print(returncode)
             voter_vp -= percent * 2 / 100
     if counter > 10 or voter_vp < min_vp or c.time_elapsed() > timedelta(
             hours=2):