コード例 #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),
                ]))
コード例 #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]
         prefix = kwargs.get("prefix", default_prefix)
         if "sbd_interest_rate" in kwargs:
             super(WitnessProps, self).__init__(
                 OrderedDict([
                     ('account_creation_fee',
                      Amount(kwargs["account_creation_fee"],
                             prefix=prefix)),
                     ('maximum_block_size',
                      Uint32(kwargs["maximum_block_size"])),
                     ('sbd_interest_rate',
                      Uint16(kwargs["sbd_interest_rate"])),
                 ]))
         else:
             super(WitnessProps, self).__init__(
                 OrderedDict([
                     ('account_creation_fee',
                      Amount(kwargs["account_creation_fee"],
                             prefix=prefix)),
                     ('maximum_block_size',
                      Uint32(kwargs["maximum_block_size"])),
                 ]))
コード例 #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]

            meta = Optional(None)
            if "json_metadata" in kwargs and kwargs["json_metadata"]:
                if (isinstance(kwargs["json_metadata"], dict)
                        or isinstance(kwargs["json_metadata"], list)):
                    meta = json.dumps(kwargs["json_metadata"])
                else:
                    if "json_metadata" in kwargs:
                        meta = kwargs["json_metadata"]

            title = kwargs["title"] if "title" in kwargs else None
            body = kwargs["body"] if "body" in kwargs else None

            super(SocialActionCommentUpdate, self).__init__(
                OrderedDict([
                    ('permlink', String(kwargs["permlink"])),
                    ('title', Optional(String(kwargs["title"]))),
                    ('body', Optional(String(kwargs["body"]))),
                    ('json_metadata', meta),
                ]))
コード例 #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(SocialActionCommentDelete, self).__init__(
                OrderedDict([('permlink', String(kwargs["permlink"]))]))
コード例 #5
0
ファイル: objects.py プロジェクト: hobbit19/beem
 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"]))]))
コード例 #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]
     super(Beneficiary, self).__init__(
         OrderedDict([
             ('account', String(kwargs["account"])),
             ('weight', Int16(kwargs["weight"])),
         ]))
コード例 #7
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.get("prefix", default_prefix)
         super(Price, self).__init__(
             OrderedDict([('base', Amount(kwargs["base"], prefix=prefix)),
                          ('quote', Amount(kwargs["quote"],
                                           prefix=prefix))]))
コード例 #8
0
ファイル: objects.py プロジェクト: symbiotes/beem
    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(UpdateProposalEndDate, self).__init__(
                OrderedDict([
                    ('end_date', PointInTime(kwargs['end_date'])),
                ]))
コード例 #9
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"]])),
            ]))
コード例 #10
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]

            meta = ""
            if "json_metadata" in kwargs and kwargs["json_metadata"]:
                if (isinstance(kwargs["json_metadata"], dict)
                        or isinstance(kwargs["json_metadata"], list)):
                    meta = json.dumps(kwargs["json_metadata"])
                else:
                    meta = kwargs["json_metadata"]

            pod = String(kwargs["pod"]) if "pod" in kwargs else None
            max_accepted_payout = Amount(
                kwargs["max_accepted_payout"]
            ) if "max_accepted_payout" in kwargs else None
            allow_replies = Bool(
                kwargs["allow_replies"]) if "allow_replies" in kwargs else None
            allow_votes = Bool(
                kwargs["allow_votes"]) if "allow_votes" in kwargs else None
            allow_curation_rewards = Bool(
                kwargs["allow_curation_rewards"]
            ) if "allow_curation_rewards" in kwargs else None
            allow_friends = Bool(
                kwargs["allow_friends"]) if "allow_friends" in kwargs else None

            super(SocialActionCommentCreate, self).__init__(
                OrderedDict([
                    ('permlink', String(kwargs["permlink"])),
                    ('parent_author', String(kwargs["parent_author"])),
                    ('parent_permlink', String(kwargs["parent_permlink"])),
                    ('pod', Optional(pod)),
                    ('max_accepted_payout', Optional(max_accepted_payout)),
                    ('allow_replies', Optional(allow_replies)),
                    ('allow_votes', Optional(allow_votes)),
                    ('allow_curation_rewards',
                     Optional(allow_curation_rewards)),
                    ('allow_friends', Optional(allow_friends)),
                    ('title', String(kwargs["title"])),
                    ('body', String(kwargs["body"])),
                    ('json_metadata', String(meta)),
                ]))
コード例 #11
0
ファイル: objects.py プロジェクト: DoctorLai/beem
 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"]))
                 ]))
コード例 #12
0
ファイル: objects.py プロジェクト: photobook-hive/mybeem
    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)
            replace_hive_by_steem = kwargs.get("replace_hive_by_steem", True)
            super(ExchangeRate, self).__init__(
                OrderedDict([
                    ('base',
                     Amount(kwargs["base"],
                            prefix=prefix,
                            replace_hive_by_steem=replace_hive_by_steem)),
                    ('quote',
                     Amount(kwargs["quote"],
                            prefix=prefix,
                            replace_hive_by_steem=replace_hive_by_steem)),
                ]))