Esempio n. 1
0
    def transfer_to_vesting(self, amount, to=None, account=None):
        """ Vest STEEM

        :param float amount: number of STEEM to vest

        :param str to: (optional) the source account for the transfer if not
        ``default_account``

        :param str account: (optional) the source account for the transfer
        if not ``default_account``

    """
        if not account:
            account = configStorage.get("default_account")
        if not account:
            raise ValueError("You need to provide an account")

        if not to:
            to = account  # powerup on the same account

        op = operations.TransferToVesting(
            **{
                "from":
                account,
                "to":
                to,
                "amount":
                '{:.{prec}f} {asset}'.format(
                    float(amount), prec=3, asset='STEEM')
            })

        return self.finalizeOp(op, account, "active")
Esempio n. 2
0
    def test_Transfer_to_vesting(self):
        op = operations.TransferToVesting(**{
            "from": "foo",
            "to": "baar",
            "amount": "111.110 STEEM",
        })
        ops = [operations.Operation(op)]
        tx = SignedTransaction(ref_block_num=ref_block_num,
                               ref_block_prefix=ref_block_prefix,
                               expiration=expiration,
                               operations=ops)
        tx = tx.sign([wif], chain=self.steem.chain_params)

        tx_wire = hexlify(bytes(tx)).decode("ascii")

        compare = ("f68585abf4dce7c80457010303666f6f046261617206b201000000"
                   "000003535445454d00000001203a34cd45fb4a2585514614be2c1"
                   "ba2365257ce5470d20c6c6abda39204eeba0b7e057d889ca8b1b1"
                   "406f1441520a25d32df2ab9fdb532c3377dc66d0fe41bb3d")
        self.assertEqual(compare[:-130], tx_wire[:-130])