Exemple #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([
             ('max_supply', Int64(kwargs["max_supply"])),
             ('market_fee_percent', Uint16(kwargs["market_fee_percent"])),
             ('max_market_fee', Int64(kwargs["max_market_fee"])),
             ('issuer_permissions', Uint16(kwargs["issuer_permissions"])),
             ('flags', Uint16(kwargs["flags"])),
             ('core_exchange_rate', Price(kwargs["core_exchange_rate"])),
             ('whitelist_authorities',
                 Array([ObjectId(x, "account") for x in kwargs["whitelist_authorities"]])),
             ('blacklist_authorities',
                 Array([ObjectId(x, "account") for x in kwargs["blacklist_authorities"]])),
             ('whitelist_markets',
                 Array([ObjectId(x, "asset") for x in kwargs["whitelist_markets"]])),
             ('blacklist_markets',
                 Array([ObjectId(x, "asset") for x in kwargs["blacklist_markets"]])),
             ('description', String(kwargs["description"])),
             ('extensions', Set([])),
         ]))
Exemple #2
0
    def __init__(self, *args, **kwargs):
        # Allow for overwrite of prefix
        prefix = kwargs.pop("prefix", default_prefix)

        if isArgsThisClass(self, args):
                self.data = args[0].data
        else:
            if len(args) == 1 and len(kwargs) == 0:
                kwargs = args[0]
            # remove dublicates
            kwargs["votes"] = list(set(kwargs["votes"]))
            # Sort votes
            kwargs["votes"] = sorted(
                kwargs["votes"],
                key=lambda x: float(x.split(":")[1]),
            )
            super().__init__(OrderedDict([
                ('memo_key', PublicKey(kwargs["memo_key"], prefix=prefix)),
                ('voting_account', ObjectId(kwargs["voting_account"], "account")),
                ('num_witness', Uint16(kwargs["num_witness"])),
                ('num_committee', Uint16(kwargs["num_committee"])),
                ('votes', Array([VoteId(o) for o in kwargs["votes"]])),
                ('extensions', Set([])),
            ]))
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]

            super().__init__(
                OrderedDict(
                    [
                        ("fee", Asset(kwargs["fee"])),
                        (
                            "authorizing_account",
                            ObjectId(kwargs["authorizing_account"], "account"),
                        ),
                        (
                            "account_to_list",
                            ObjectId(kwargs["account_to_list"], "account"),
                        ),
                        ("new_listing", Uint8(kwargs["new_listing"])),
                        ("extensions", Set([])),
                    ]
                )
            )
Exemple #4
0
    def __init__(self, *args, **kwargs):
        # Allow for overwrite of prefix
        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 "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 "new_options" in kwargs:
                options = Optional(AccountOptions(kwargs["new_options"], prefix=prefix))
            else:
                options = Optional(None)

            super().__init__(
                OrderedDict(
                    [
                        ("fee", Asset(kwargs["fee"])),
                        ("account", ObjectId(kwargs["account"], "account")),
                        ("owner", owner),
                        ("active", active),
                        ("new_options", options),
                        ("extensions", Set([])),
                    ]
                )
            )
Exemple #5
0
    def __init__(self, *args, **kwargs):
        if isArgsThisClass(self, args):
            self.data = args[0].data
        else:
            prefix = kwargs.get("prefix", default_prefix)

            if len(args) == 1 and len(kwargs) == 0:
                kwargs = args[0]
            if "memo" in kwargs and kwargs["memo"]:
                memo = Optional(Memo(prefix=prefix, **kwargs["memo"]))
            else:
                memo = Optional(None)
            super().__init__(
                OrderedDict([
                    ("fee", Asset(kwargs["fee"])),
                    ("issuer", ObjectId(kwargs["issuer"], "account")),
                    ("asset_to_issue", Asset(kwargs["asset_to_issue"])),
                    (
                        "issue_to_account",
                        ObjectId(kwargs["issue_to_account"], "account"),
                    ),
                    ("memo", memo),
                    ("extensions", Set([])),
                ]))
Exemple #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]

            for o in [
                    "active_approvals_to_add",
                    "active_approvals_to_remove",
                    "owner_approvals_to_add",
                    "owner_approvals_to_remove",
                    "key_approvals_to_add",
                    "key_approvals_to_remove",
            ]:
                if o not in kwargs:
                    kwargs[o] = []

            super().__init__(
                OrderedDict([
                    ("fee", Asset(kwargs["fee"])),
                    (
                        "fee_paying_account",
                        ObjectId(kwargs["fee_paying_account"], "account"),
                    ),
                    ("proposal", ObjectId(kwargs["proposal"], "proposal")),
                    (
                        "active_approvals_to_add",
                        Array([
                            ObjectId(o, "account")
                            for o in kwargs["active_approvals_to_add"]
                        ]),
                    ),
                    (
                        "active_approvals_to_remove",
                        Array([
                            ObjectId(o, "account")
                            for o in kwargs["active_approvals_to_remove"]
                        ]),
                    ),
                    (
                        "owner_approvals_to_add",
                        Array([
                            ObjectId(o, "account")
                            for o in kwargs["owner_approvals_to_add"]
                        ]),
                    ),
                    (
                        "owner_approvals_to_remove",
                        Array([
                            ObjectId(o, "account")
                            for o in kwargs["owner_approvals_to_remove"]
                        ]),
                    ),
                    (
                        "key_approvals_to_add",
                        Array([
                            PublicKey(o)
                            for o in kwargs["key_approvals_to_add"]
                        ]),
                    ),
                    (
                        "key_approvals_to_remove",
                        Array([
                            PublicKey(o)
                            for o in kwargs["key_approvals_to_remove"]
                        ]),
                    ),
                    ("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]

            if "new_name" in kwargs:
                # Sort names by countrycode
                kwargs["new_name"] = sorted(kwargs.get("new_name", []),
                                            key=lambda x: repr(x[0]),
                                            reverse=False)
                name = Optional(
                    Map([[String(e[0]), String(e[1])]
                         for e in kwargs.get("new_name", [])]))
            else:
                name = Optional(None)

            if "new_season" in kwargs:
                # Sort season by countrycode
                kwargs["new_season"] = sorted(
                    kwargs.get("new_season", []),
                    key=lambda x: repr(x[0]),
                    reverse=False,
                )
                season = Optional(
                    Map([[String(e[0]), String(e[1])]
                         for e in kwargs.get("new_season", [])]))
            else:
                season = Optional(None)

            if "new_name" in kwargs:
                # Sort name by countrycode
                kwargs["new_name"] = sorted(kwargs.get("new_name", []),
                                            key=lambda x: repr(x[0]),
                                            reverse=False)
                name = Optional(
                    Map([[String(e[0]), String(e[1])]
                         for e in kwargs.get("new_name", [])]))
            else:
                name = Optional(None)

            if "new_start_time" in kwargs:
                start_time = Optional(PointInTime(kwargs["new_start_time"]))
            else:
                start_time = Optional(None)

            if "new_status" in kwargs:
                status = Optional(EventStatus(kwargs["new_status"]))
            else:
                status = Optional(None)

            if "new_event_group_id" in kwargs:
                new_event_group_id = Optional(
                    FullObjectId(kwargs["new_event_group_id"]))
            else:
                new_event_group_id = Optional(None)

            super().__init__(
                OrderedDict([
                    ("fee", Asset(kwargs["fee"])),
                    ("event_id", ObjectId(kwargs["event_id"], "event")),
                    ("new_event_group_id", new_event_group_id),
                    ("new_name", name),
                    ("new_season", season),
                    ("new_start_time", start_time),
                    ("new_status", status),
                    ("extensions", Set([])),
                ]))