Esempio n. 1
0
 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]
         super().__init__(
             OrderedDict(
                 [
                     ("fee", Asset(kwargs["fee"])),
                     ("payer", ObjectId(kwargs["payer"], "account")),
                     (
                         "required_auths",
                         Array(
                             [
                                 ObjectId(o, "account")
                                 for o in kwargs["required_auths"]
                             ]
                         ),
                     ),
                     ("id", Uint16(kwargs["id"])),
                     ("data", Bytes(kwargs["data"])),
                 ]
             )
         )
Esempio n. 2
0
 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 "message" in kwargs and kwargs["message"]:
             if "chain" not in kwargs:
                 chain = default_prefix
             else:
                 chain = kwargs["chain"]
             if isinstance(chain, str) and chain in known_chains:
                 chain_params = known_chains[chain]
             elif isinstance(chain, dict):
                 chain_params = chain
             else:
                 raise Exception(
                     "Memo() only takes a string or a dict as chain!")
             if "prefix" not in chain_params:
                 raise Exception("Memo() needs a 'prefix' in chain params!")
             prefix = chain_params["prefix"]
             super().__init__(
                 OrderedDict([('from',
                               PublicKey(kwargs["from"], prefix=prefix)),
                              ('to', PublicKey(kwargs["to"],
                                               prefix=prefix)),
                              ('nonce', Uint64(int(kwargs["nonce"]))),
                              ('message', Bytes(kwargs["message"]))]))
         else:
             super().__init__(None)
Esempio n. 3
0
 def detail(self, *args, **kwargs):
     return OrderedDict([
         ("fee", Asset(kwargs["fee"])),
         ("htlc_id", ObjectId(kwargs["htlc_id"], "htlc")),
         ("redeemer", ObjectId(kwargs["redeemer"], "account")),
         ("preimage", Bytes(kwargs["preimage"])),
         ("extensions", Set([])),
     ])
    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]

            super().__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"])),
            ]))
Esempio n. 5
0
 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 "message" in kwargs and kwargs["message"]:
             prefix = kwargs.pop("prefix", default_prefix)
             super().__init__(OrderedDict([
                 ('from', PublicKey(kwargs["from"], prefix=prefix)),
                 ('to', PublicKey(kwargs["to"], prefix=prefix)),
                 ('nonce', Uint64(int(kwargs["nonce"]))),
                 ('message', Bytes(kwargs["message"]))
             ]))
         else:
             super().__init__(None)
Esempio n. 6
0
    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.pop("prefix", DEFAULT_PREFIX)

            super().__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"])),
                    ]
                )
            )