Example #1
0
    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),
                ]))
Example #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]
         super(Price, self).__init__(
             OrderedDict([('base', Amount(kwargs["base"])),
                          ('quote', Amount(kwargs["quote"]))]))
Example #3
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(Beneficiary, self).__init__(
         OrderedDict([
             ('account', String(kwargs["account"])),
             ('weight', Int16(kwargs["weight"])),
         ]))
Example #4
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(Beneficiaries, self).__init__(
            OrderedDict([
                ('beneficiaries',
                 Array([Beneficiary(o) for o in kwargs["beneficiaries"]])),
            ]))
Example #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]
         super(WitnessProps, self).__init__(
             OrderedDict([
                 ('account_creation_fee',
                  Amount(kwargs["account_creation_fee"])),
                 ('maximum_block_size',
                  Uint32(kwargs["maximum_block_size"])),
                 ('bbd_interest_rate', Uint16(kwargs["bbd_interest_rate"])),
             ]))
Example #6
0
 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"]))
                     ]))