Пример #1
0
    def constructTx(self, ref_block_num=None, ref_block_prefix=None):
        """ Construct the actual transaction and store it in the class's dict
            store

        """
        ops = list()
        if self.steem.is_connected() and self.steem.rpc.get_use_appbase():
            # appbase disabled by now
            # broadcasting does not work at the moment
            appbase = not self._use_condenser_api
        else:
            appbase = False
        for op in self.ops:
            # otherwise, we simply wrap ops into Operations
            ops.extend(
                [Operation(op, appbase=appbase, prefix=self.steem.prefix)])

        # We no wrap everything into an actual transaction
        expiration = formatTimeFromNow(self.expiration
                                       or self.steem.expiration)
        if ref_block_num is None or ref_block_prefix is None:
            ref_block_num, ref_block_prefix = transactions.getBlockParams(
                self.steem.rpc)
        self.tx = Signed_Transaction(ref_block_prefix=ref_block_prefix,
                                     expiration=expiration,
                                     operations=ops,
                                     ref_block_num=ref_block_num,
                                     custom_chains=self.steem.custom_chains,
                                     prefix=self.steem.prefix)

        super(TransactionBuilder, self).update(self.tx.json())
        self._unset_require_reconstruction()
Пример #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:
            # otherwise, we simply wrap ops into Operations
            ops.extend([Operation(op)])

        # We no wrap everything into an actual transaction
        # ops = transactions.addRequiredFees(self.steem.rpc, ops)
        expiration = formatTimeFromNow(self.expiration
                                       or self.steem.expiration)
        ref_block_num, ref_block_prefix = transactions.getBlockParams(
            self.steem.rpc)
        self.tx = Signed_Transaction(ref_block_prefix=ref_block_prefix,
                                     expiration=expiration,
                                     operations=ops,
                                     ref_block_num=ref_block_num)

        super(TransactionBuilder, self).update(self.tx.json())
        self._unset_require_reconstruction()
Пример #3
0
from beem.transactionbuilder import TransactionBuilder
from beemgraphenebase.account import PasswordKey, PrivateKey, PublicKey
from beem.steem import Steem
from beem.utils import parse_time, formatTimedelta
from beemapi.exceptions import NumRetriesReached
from beem.nodelist import NodeList
from beembase.transactions import getBlockParams
log = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)

# example wif
wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"

if __name__ == "__main__":
    stm_online = Steem()
    ref_block_num, ref_block_prefix = getBlockParams(stm_online)
    print("ref_block_num %d - ref_block_prefix %d" %
          (ref_block_num, ref_block_prefix))

    stm = Steem(offline=True)

    op = operations.Transfer({
        'from': 'beembot',
        'to': 'holger80',
        'amount': "0.001 SBD",
        'memo': ""
    })
    tb = TransactionBuilder(steem_instance=stm)

    tb.appendOps([op])
    tb.appendWif(wif)