コード例 #1
0
    def constructTx(self):
        """ Construct the actual transaction and store it in the class's dict
            store
        """
        if self.bitshares.proposer:
            ops = [operations.Op_wrapper(op=o) for o in list(self.ops)]
            proposer = Account(self.bitshares.proposer,
                               bitshares_instance=self.bitshares)
            ops = operations.Proposal_create(
                **{
                    "fee": {
                        "amount": 0,
                        "asset_id": "1.3.0"
                    },
                    "fee_paying_account":
                    proposer["id"],
                    "expiration_time":
                    transactions.formatTimeFromNow(
                        self.bitshares.proposal_expiration),
                    "proposed_ops": [o.json() for o in ops],
                    "extensions": []
                })
            ops = [Operation(ops)]
        else:
            ops = [Operation(o) for o in list(self.ops)]

        ops = transactions.addRequiredFees(self.bitshares.rpc, ops)
        expiration = transactions.formatTimeFromNow(self.bitshares.expiration)
        ref_block_num, ref_block_prefix = transactions.getBlockParams(
            self.bitshares.rpc)
        tx = Signed_Transaction(ref_block_num=ref_block_num,
                                ref_block_prefix=ref_block_prefix,
                                expiration=expiration,
                                operations=ops)
        super(TransactionBuilder, self).__init__(tx.json())
コード例 #2
0
    def constructTx(self):
        """ Construct the actual transaction and store it in the class's dict
            store
        """
        ops = list()
        for op in self.ops:
            if isinstance(op, ProposalBuilder):
                # This operation is a proposal an needs to be deal with
                # differently
                proposals = op.get_raw()
                if proposals:
                    ops.append(proposals)
            else:
                # otherwise, we simply wrap ops into Operations
                ops.extend([Operation(op)])

        # We no wrap everything into an actual transaction
        ops = transactions.addRequiredFees(self.bitshares.rpc, ops)
        expiration = transactions.formatTimeFromNow(self.bitshares.expiration)
        ref_block_num, ref_block_prefix = transactions.getBlockParams(
            self.bitshares.rpc)
        self.tx = Signed_Transaction(ref_block_num=ref_block_num,
                                     ref_block_prefix=ref_block_prefix,
                                     expiration=expiration,
                                     operations=ops)
        super(TransactionBuilder, self).__init__(self.tx.json())
        self._unset_require_reconstruction()