Exemple #1
0
    def __init__(self, *args, **kwargs):
        # Allow for overwrite of prefix
        if check_for_class(self, args):
            return
        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)
        if "memo" not in kwargs:
            kwargs["memo"] = ""
        if isinstance(kwargs["memo"], dict):
            kwargs["memo"]["prefix"] = prefix
            memo = Optional(Memo(**kwargs["memo"]))
        elif isinstance(kwargs["memo"], string_types):
            memo = (String(kwargs["memo"]))
        else:
            memo = Optional(Memo(kwargs["memo"]))

        super(Transfer, self).__init__(
            OrderedDict([
                ('from', String(kwargs["from"])),
                ('to', String(kwargs["to"])),
                ('amount',
                 Amount(kwargs["amount"],
                        prefix=prefix,
                        replace_hive_by_steem=replace_hive_by_steem)),
                ('memo', memo),
            ]))
Exemple #2
0
    def __init__(self, *args, **kwargs):
        # Allow for overwrite of prefix
        if check_for_class(self, args):
            return
        if len(args) == 1 and len(kwargs) == 0:
            kwargs = args[0]
        prefix = kwargs.get("prefix", default_prefix)
        json_str = kwargs.get("json_str", False)
        if "memo" not in kwargs:
            kwargs["memo"] = ""
        if isinstance(kwargs["memo"], dict):
            kwargs["memo"]["prefix"] = prefix
            memo = Optional(Memo(**kwargs["memo"]))
        elif isinstance(kwargs["memo"], string_types):
            memo = (String(kwargs["memo"]))
        else:
            memo = Optional(Memo(kwargs["memo"]))

        super(Recurring_transfer, self).__init__(
            OrderedDict([
                ('from', String(kwargs["from"])),
                ('to', String(kwargs["to"])),
                ('amount',
                 Amount(kwargs["amount"], prefix=prefix, json_str=json_str)),
                ('memo', memo),
                ('recurrence', Int16(kwargs["recurrence"])),
                ('executions', Int16(kwargs["executions"])),
            ]))
Exemple #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),
                ]))
    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 "owner" in kwargs:
            owner = Optional(Permission(kwargs["owner"], prefix=prefix))
        else:
            owner = Optional(None)

        if "active" in kwargs:
            active = Optional(Permission(kwargs["active"], prefix=prefix))
        else:
            active = Optional(None)

        if "posting" in kwargs:
            posting = Optional(Permission(kwargs["posting"], prefix=prefix))
        else:
            posting = Optional(None)

        if "memo_key" in kwargs:
            memo_key = Optional(Permission(kwargs["memo_key"], prefix=prefix))
        else:
            memo_key = Optional(None)

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

        super(Account_update2, self).__init__(
            OrderedDict([
                ('account', String(kwargs["account"])),
                ('owner', owner),
                ('active', active),
                ('posting', posting),
                ('memo_key', memo_key),
                ('json_metadata', String(meta)),
                ('posting_json_metadata', String(posting_meta)),
            ]))
Exemple #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]

            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)),
                ]))