def __init__(self, *args, **kwargs): if isArgsThisClass(self, args): self.data = args[0].data else: prefix = kwargs.pop("prefix", default_prefix) if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] # Sort keys (FIXME: ideally, the sorting is part of Public # Key and not located here) kwargs["key_auths"] = sorted( kwargs["key_auths"], key=lambda x: repr(PublicKey(x[0], prefix=prefix)), reverse=False, ) kwargs["account_auths"] = sorted( kwargs["account_auths"], key=lambda x: x[0], reverse=False, ) accountAuths = Map([ [String(e[0]), Uint16(e[1])] for e in kwargs["account_auths"] ]) keyAuths = Map([ [PublicKey(e[0], prefix=prefix), Uint16(e[1])] for e in kwargs["key_auths"] ]) super(Permission, self).__init__(OrderedDict([ ('weight_threshold', Uint32(int(kwargs["weight_threshold"]))), ('account_auths', accountAuths), ('key_auths', keyAuths), ]))
def __init__(self, *args, **kwargs): if check_for_class(self, args): return if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) meta = "" if "json_meta" in kwargs and kwargs["json_meta"]: if (isinstance(kwargs["json_meta"], dict) or isinstance(kwargs["json_meta"], list)): meta = json.dumps(kwargs["json_meta"]) else: meta = kwargs["json_meta"] super(Escrow_transfer, self).__init__( OrderedDict([ ('from', String(kwargs["from"])), ('to', String(kwargs["to"])), ('agent', String(kwargs["agent"])), ('escrow_id', Uint32(kwargs["escrow_id"])), ('bbd_amount', Amount(kwargs["bbd_amount"], prefix=prefix)), ('dpay_amount', Amount(kwargs["dpay_amount"], prefix=prefix)), ('fee', Amount(kwargs["fee"], prefix=prefix)), ('ratification_deadline', PointInTime(kwargs["ratification_deadline"])), ('escrow_expiration', PointInTime(kwargs["escrow_expiration"])), ('json_meta', String(meta)), ]))
def __init__(self, *args, **kwargs): if check_for_class(self, args): return if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] super(Cancel_transfer_from_savings, self).__init__( OrderedDict([ ('from', String(kwargs["from"])), ('request_id', Uint32(kwargs["request_id"])), ]))
def __init__(self, *args, **kwargs): if check_for_class(self, args): return if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] super(Limit_order_cancel, self).__init__( OrderedDict([ ('owner', String(kwargs["owner"])), ('orderid', Uint32(kwargs["orderid"])), ]))
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] prefix = kwargs.get("prefix", default_prefix) super(WitnessProps, self).__init__(OrderedDict([ ('account_creation_fee', Amount(kwargs["account_creation_fee"], prefix=prefix)), ('maximum_block_size', Uint32(kwargs["maximum_block_size"])), ('bbd_interest_rate', Uint16(kwargs["bbd_interest_rate"])), ]))
def __init__(self, *args, **kwargs): if check_for_class(self, args): return if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] super(Escrow_dispute, self).__init__( OrderedDict([ ('from', String(kwargs["from"])), ('to', String(kwargs["to"])), ('who', String(kwargs["who"])), ('escrow_id', Uint32(kwargs["escrow_id"])), ]))
def __init__(self, *args, **kwargs): if check_for_class(self, args): return if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) super(Convert, self).__init__( OrderedDict([ ('owner', String(kwargs["owner"])), ('requestid', Uint32(kwargs["requestid"])), ('amount', Amount(kwargs["amount"], prefix=prefix)), ]))
def __init__(self, *args, **kwargs): if check_for_class(self, args): return if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) super(Escrow_release, self).__init__( OrderedDict([ ('from', String(kwargs["from"])), ('to', String(kwargs["to"])), ('who', String(kwargs["who"])), ('escrow_id', Uint32(kwargs["escrow_id"])), ('bbd_amount', Amount(kwargs["bbd_amount"], prefix=prefix)), ('dpay_amount', Amount(kwargs["dpay_amount"], prefix=prefix)), ]))
def __init__(self, *args, **kwargs): if check_for_class(self, args): return if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) if "memo" not in kwargs: kwargs["memo"] = "" super(Transfer_from_savings, self).__init__( OrderedDict([ ('from', String(kwargs["from"])), ('request_id', Uint32(kwargs["request_id"])), ('to', String(kwargs["to"])), ('amount', Amount(kwargs["amount"], prefix=prefix)), ('memo', String(kwargs["memo"])), ]))
def __init__(self, *args, **kwargs): if check_for_class(self, args): return if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.get("prefix", default_prefix) super(Limit_order_create, self).__init__( OrderedDict([ ('owner', String(kwargs["owner"])), ('orderid', Uint32(kwargs["orderid"])), ('amount_to_sell', Amount(kwargs["amount_to_sell"], prefix=prefix)), ('min_to_receive', Amount(kwargs["min_to_receive"], prefix=prefix)), ('fill_or_kill', Bool(kwargs["fill_or_kill"])), ('expiration', PointInTime(kwargs["expiration"])), ]))
def __init__(self, *args, **kwargs): if isArgsThisClass(self, args): self.data = args[0].data else: prefix = kwargs.pop("prefix", default_prefix) if "encrypted" not in kwargs or not kwargs["encrypted"]: super(Memo, self).__init__(None) else: if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] if "encrypted" in kwargs and kwargs["encrypted"]: super(Memo, self).__init__(OrderedDict([ ('from', PublicKey(kwargs["from"], prefix=prefix)), ('to', PublicKey(kwargs["to"], prefix=prefix)), ('nonce', Uint64(int(kwargs["nonce"]))), ('check', Uint32(int(kwargs["check"]))), ('encrypted', Bytes(kwargs["encrypted"])) ]))
def __init__(self, *args, **kwargs): if check_for_class(self, args): return if len(args) == 1 and len(kwargs) == 0: kwargs = args[0] prefix = kwargs.pop("prefix", default_prefix) extensions = Array([]) props = {} for k in kwargs["props"]: if "key" == k[0]: block_signing_key = (PublicKey(k[1], prefix=prefix)) props["key"] = repr(block_signing_key) elif "new_signing_key" == k[0]: new_signing_key = (PublicKey(k[1], prefix=prefix)) props["new_signing_key"] = repr(new_signing_key) for k in kwargs["props"]: if k[0] in ["key", "new_signing_key"]: continue if isinstance(k[1], str) and PY3: is_hex = re.fullmatch(r'[0-9a-fA-F]+', k[1] or '') is not None elif isinstance(k[1], str) and PY2: is_hex = re.match(r'[0-9a-fA-F]+', k[1] or '') is not None else: is_hex = False if isinstance(k[1], int) and k[0] in [ "account_subsidy_budget", "account_subsidy_decay", "maximum_block_size" ]: props[k[0]] = (hexlify(Uint32(k[1]).__bytes__())).decode() elif isinstance(k[1], int) and k[0] in ["bbd_interest_rate"]: props[k[0]] = (hexlify(Uint16(k[1]).__bytes__())).decode() elif not isinstance(k[1], str) and k[0] in [ "account_creation_fee" ]: props[k[0]] = (hexlify( Amount(k[1], prefix=prefix).__bytes__())).decode() elif not is_hex and isinstance( k[1], str) and k[0] in ["account_creation_fee"]: props[k[0]] = (hexlify( Amount(k[1], prefix=prefix).__bytes__())).decode() elif not isinstance(k[1], str) and k[0] in ["bbd_exchange_rate"]: if 'prefix' not in k[1]: k[1]['prefix'] = prefix props[k[0]] = (hexlify(ExchangeRate( k[1]).__bytes__())).decode() elif not is_hex and k[0] in ["url"]: props[k[0]] = (hexlify(String(k[1]).__bytes__())).decode() else: props[k[0]] = (k[1]) props_list = [] for k in props: props_list.append(([String(k), HexString(props[k])])) props_list = sorted( props_list, key=lambda x: str(x[0]), reverse=False, ) map_props = Map(props_list) super(Witness_set_properties, self).__init__( OrderedDict([ ('owner', String(kwargs["owner"])), ('props', map_props), ('extensions', extensions), ]))