Exemple #1
0
    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)

        # handle beneficiaries
        if "beneficiaries" in kwargs and kwargs['beneficiaries']:
            kwargs['extensions'] = [[0, {'beneficiaries': kwargs['beneficiaries']}]]

        extensions = Array([])
        if "extensions" in kwargs and kwargs["extensions"]:
            extensions = Array([CommentOptionExtensions(o) for o in kwargs["extensions"]])

        super(Comment_options, self).__init__(
            OrderedDict([
                ('author', String(kwargs["author"])),
                ('permlink', String(kwargs["permlink"])),
                ('max_accepted_payout',
                 Amount(kwargs["max_accepted_payout"], prefix=prefix)),
                ('percent_steem_dollars',
                 Uint16(int(kwargs["percent_steem_dollars"]))),
                ('allow_votes', Bool(bool(kwargs["allow_votes"]))),
                ('allow_curation_rewards',
                 Bool(bool(kwargs["allow_curation_rewards"]))),
                ('extensions', extensions),
            ]))
Exemple #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]

            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)),
                ]))
Exemple #3
0
 def __init__(self, *args, **kwargs):
     if check_for_class(self, args):
         return
     if len(args) == 1 and len(kwargs) == 0:
         kwargs = args[0]
     super(Decline_voting_rights, self).__init__(
         OrderedDict([
             ('account', String(kwargs["account"])),
             ('decline', Bool(kwargs["decline"])),
         ]))
Exemple #4
0
 def __init__(self, *args, **kwargs):
     if check_for_class(self, args):
         return
     if len(args) == 1 and len(kwargs) == 0:
         kwargs = args[0]
     super(Account_witness_vote, self).__init__(OrderedDict([
         ('account', String(kwargs["account"])),
         ('witness', String(kwargs["witness"])),
         ('approve', Bool(bool(kwargs["approve"]))),
     ]))
Exemple #5
0
 def __init__(self, *args, **kwargs):
     if check_for_class(self, args):
         return
     if len(args) == 1 and len(kwargs) == 0:
         kwargs = args[0]
     super(Set_withdraw_vesting_route, self).__init__(
         OrderedDict([
             ('from_account', String(kwargs["from_account"])),
             ('to_account', String(kwargs["to_account"])),
             ('percent', Uint16((kwargs["percent"]))),
             ('auto_vest', Bool(kwargs["auto_vest"])),
         ]))
Exemple #6
0
 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_approve, self).__init__(
         OrderedDict([
             ('from', String(kwargs["from"])),
             ('to', String(kwargs["to"])),
             ('agent', String(kwargs["agent"])),
             ('who', String(kwargs["who"])),
             ('escrow_id', Uint32(kwargs["escrow_id"])),
             ('approve', Bool(kwargs["approve"])),
         ]))
Exemple #7
0
 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"])),
         ]))
Exemple #8
0
    def __init__(self, *args, **kwargs):
        if check_for_class(self, args):
            return
        if len(args) == 1 and len(kwargs) == 0:
            kwargs = args[0]
        extensions = Array([])
        proposal_ids = []
        for e in kwargs["proposal_ids"]:
            proposal_ids.append(Uint64(e))

        super(Update_proposal_votes, self).__init__(
            OrderedDict([
                ('voter', String(kwargs["voter"])),
                ('proposal_ids', Array(proposal_ids)),          
                ('approve', Bool(kwargs["approve"])),
                ('extensions', extensions)
            ]))