def constructTx(self): if isinstance(self.op, list): ops = [Operation(o) for o in self.op] else: ops = [Operation(self.op)] expiration = fmt_time_from_now(self.expiration) ref_block_num, ref_block_prefix = get_block_params(self.steemd) tx = SignedTransaction(ref_block_num=ref_block_num, ref_block_prefix=ref_block_prefix, expiration=expiration, operations=ops) super(TransactionBuilder, self).__init__(tx.json())
def __init__(self, *args, **kwargs): if isArgsThisClass(self, args): self.data = args[0].data else: if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] if "extensions" not in kwargs: kwargs["extensions"] = Set([]) elif not kwargs.get("extensions"): kwargs["extensions"] = Set([]) if "signatures" not in kwargs: kwargs["signatures"] = Array([]) else: kwargs["signatures"] = Array( [Signature(unhexlify(a)) for a in kwargs["signatures"]]) if "operations" in kwargs: if all([ not isinstance(a, Operation) for a in kwargs["operations"] ]): kwargs['operations'] = Array( [Operation(a) for a in kwargs["operations"]]) else: kwargs['operations'] = Array(kwargs["operations"]) super().__init__( OrderedDict([ ('ref_block_num', Uint16(kwargs['ref_block_num'])), ('ref_block_prefix', Uint32(kwargs['ref_block_prefix'])), ('expiration', PointInTime(kwargs['expiration'])), ('operations', kwargs['operations']), ('extensions', kwargs['extensions']), ('signatures', kwargs['signatures']), ]))