예제 #1
0
 def detail(self, *args, **kwargs):
     # New pygraphene interface!
     return OrderedDict(
         [
             ("fee", Asset(kwargs["fee"])),
             ("account", ObjectId(kwargs["account"], "account")),
             ("amount", Asset(kwargs["amount"])),
             ("extensions", Set([])),
         ]
     )
예제 #2
0
 def detail(self, *args, **kwargs):
     return OrderedDict(
         [
             ("fee", Asset(kwargs["fee"])),
             ("htlc_id", ObjectId(kwargs["htlc_id"], "htlc")),
             ("update_issuer", ObjectId(kwargs["update_issuer"], "account")),
             ("seconds_to_add", Uint32(kwargs["seconds_to_add"])),
             ("extensions", Set([])),
         ]
     )
예제 #3
0
 def detail(self, *args, **kwargs):
     return OrderedDict(
         [
             ("fee", Asset(kwargs["fee"])),
             ("htlc_id", ObjectId(kwargs["htlc_id"], "htlc")),
             ("redeemer", ObjectId(kwargs["redeemer"], "account")),
             ("preimage", Bytes(kwargs["preimage"])),
             ("extensions", Set([])),
         ]
     )
예제 #4
0
 def detail(self, *args, **kwargs):
     # New pygraphene interface!
     return OrderedDict(
         [
             ("fee", Asset(kwargs["fee"])),
             ("bidder", ObjectId(kwargs["bidder"], "account")),
             ("additional_collateral", Asset(kwargs["additional_collateral"])),
             ("debt_covered", Asset(kwargs["debt_covered"])),
             ("extensions", Set([])),
         ]
     )
예제 #5
0
 def detail(self, *args, **kwargs):
     return OrderedDict([
         ("fee", Asset(kwargs["fee"])),
         ("from", ObjectId(kwargs["from"], "account")),
         ("to", ObjectId(kwargs["to"], "account")),
         ("amount", Asset(kwargs["amount"])),
         ("preimage_hash", HtlcHash(kwargs["preimage_hash"])),
         ("preimage_size", Uint16(kwargs["preimage_size"])),
         ("claim_period_seconds", Uint32(kwargs["claim_period_seconds"])),
         ("extensions", Set([])),
     ])
예제 #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().__init__(OrderedDict([
             ('fee', Asset(kwargs['fee'])),
             ('event_group_id', ObjectId(kwargs["event_group_id"], "event_group")),
             ('extensions', Set([])),
         ]))
예제 #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]
         super().__init__(OrderedDict([
             ('fee', Asset(kwargs["fee"])),
             ('account_to_upgrade', ObjectId(kwargs["account_to_upgrade"], "account")),
             ('upgrade_to_lifetime_member', Bool(kwargs["upgrade_to_lifetime_member"])),
             ('extensions', Set([])),
         ]))
예제 #8
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"])),
             ('betting_market_id', ObjectId(kwargs["betting_market_id"], "betting_market")),
             ('resolution', BettingMarketResolution(kwargs["resolution"])),
             ('extensions', Set([])),
         ]))
예제 #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().__init__(OrderedDict([
             ('fee', Asset(kwargs["fee"])),
             ('event_id', FullObjectId(kwargs["event_id"])),
             ('options', BettingMarketOptions(kwargs["options"])),
             ('extensions', Set([])),
         ]))
예제 #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]
         super().__init__(
             OrderedDict([
                 ('fee', Asset(kwargs["fee"])),
                 ('issuer', ObjectId(kwargs["issuer"], "account")),
                 ('extensions', Set([])),
             ]))
예제 #11
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"])),
                 ("sport_id", ObjectId(kwargs["sport_id"], "sport")),
                 ("extensions", Set([])),
             ]))
예제 #12
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(Proposal_update, self).__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([])),
                ]))
예제 #13
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"])),
             ('game_id', ObjectId(kwargs["game_id"], "game")),
             ('player_account_id', ObjectId(kwargs["player_account_id"], "account")),
             ('move', GameSpecificMoves(kwargs["move"])),
             ('extensions', Set([])),
         ]))
예제 #14
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"])),
             ('canceling_account_id', ObjectId(kwargs["canceling_account_id"], "account")),
             ('player_account_id', ObjectId(kwargs["player_account_id"], "account")),
             ('tournament_id', ObjectId(kwargs["tournament_id"], "tournament")),
             ('extensions', Set([])),
         ]))
예제 #15
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"])),
             ('funding_account', ObjectId(kwargs["funding_account"], "account")),
             ('delta_collateral', Asset(kwargs["delta_collateral"])),
             ('delta_debt', Asset(kwargs["delta_debt"])),
             ('extensions', Set([])),
         ]))
예제 #16
0
 def detail(self, *args, **kwargs):
     return OrderedDict(
         [
             ("fee", Asset(kwargs["fee"])),
             ("htlc_id", ObjectId(kwargs["htlc_id"], "htlc")),
             ("redeemer", ObjectId(kwargs["redeemer"], "account")),
             (
                 "preimage",  # Bytes(kwargs["preimage"])
                 Array([Uint8(o) for o in unhexlify(kwargs["preimage"])]),
             ),
             ("extensions", Set([])),
         ]
     )
예제 #17
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"])),
                 ("creator", ObjectId(kwargs["creator"], "account")),
                 ("options", TournamentOptions(kwargs["options"])),
                 ("extensions", Set([])),
             ]))
예제 #18
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]

            # Sorting
            for key in [
                    "whitelist_authorities", "blacklist_authorities",
                    "whitelist_markets", "blacklist_markets"
            ]:
                kwargs[key] = sorted(
                    set(kwargs[key]),
                    key=lambda x: int(x.split(".")[2]),
                )

            super().__init__(
                OrderedDict([
                    ('max_supply', Uint64(kwargs["max_supply"])),
                    ('market_fee_percent',
                     Uint16(kwargs["market_fee_percent"])),
                    ('max_market_fee', Uint64(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(o, "account")
                         for o in kwargs["whitelist_authorities"]
                     ])),
                    ('blacklist_authorities',
                     Array([
                         ObjectId(o, "account")
                         for o in kwargs["blacklist_authorities"]
                     ])),
                    ('whitelist_markets',
                     Array([
                         ObjectId(o, "asset")
                         for o in kwargs["whitelist_markets"]
                     ])),
                    ('blacklist_markets',
                     Array([
                         ObjectId(o, "asset")
                         for o in kwargs["blacklist_markets"]
                     ])),
                    ('description', String(kwargs["description"])),
                    ('extensions', Set([])),
                ]))
예제 #19
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"])),
                    ("payer", ObjectId(kwargs["payer"], "account")),
                    ("amount_to_reserve", Asset(kwargs["amount_to_reserve"])),
                    ("extensions", Set([])),
                ]))
예제 #20
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(Asset_publish_feed, self).__init__(
             OrderedDict([
                 ('fee', Asset(kwargs["fee"])),
                 ('publisher', ObjectId(kwargs["publisher"], "account")),
                 ('asset_id', ObjectId(kwargs["asset_id"], "asset")),
                 ('feed', PriceFeed(kwargs["feed"])),
                 ('extensions', Set([])),
             ]))
예제 #21
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(Limit_order_cancel, self).__init__(
             OrderedDict([
                 ('fee', Asset(kwargs["fee"])),
                 ('fee_paying_account',
                  ObjectId(kwargs["fee_paying_account"], "account")),
                 ('order', ObjectId(kwargs["order"], "limit_order")),
                 ('extensions', Set([])),
             ]))
예제 #22
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]

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

            super().__init__(OrderedDict([
                ('fee', Asset(kwargs["fee"])),
                ('name', name),
                ('season', season),
                ('start_time', start_time),
                ('event_group_id', FullObjectId(kwargs["event_group_id"])),
                ('extensions', Set([])),
            ]))
예제 #23
0
def CybexExtension(o):
   if isinstance(o,cybex_ext_vesting):
       return o
 
   if isinstance(o,list):
      a=[]
      for e in o:
         if e[0]==1:
             a.append( cybex_ext_vesting(e[1]["public_key"],e[1]["vesting_period"]))
         else:
             raise ValueError("not implemented yet.")
      return Set(a)
   else:
      raise ValueError("Cybex extension")
예제 #24
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([])),
            ]))
예제 #25
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]

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

            if "freeze" in kwargs:
                freeze = Optional(Bool(kwargs["freeze"]))
            else:
                freeze = Optional(None)

            if "delay_bets" in kwargs:
                delay_bets = Optional(Bool(kwargs["delay_bets"]))
            else:
                delay_bets = Optional(None)

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

            super().__init__(OrderedDict([
                ('fee', Asset(kwargs["fee"])),
                ('betting_market_group_id', ObjectId(kwargs["betting_market_group_id"], "betting_market_group")),
                ('new_description', description),
                ('new_rules_id', new_rules_id),
                ('freeze', freeze),
                ('delay_bets', delay_bets),
                ('extensions', Set([])),
            ]))
예제 #26
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(Asset_fund_fee_pool, self).__init__(
             OrderedDict([
                 ('fee', Asset(kwargs["fee"])),
                 ('from_account', ObjectId(kwargs["from_account"],
                                           "account")),
                 ('asset_id', ObjectId(kwargs["asset_id"], "asset")),
                 ('amount', Int64(kwargs["amount"])),
                 ('extensions', Set([])),
             ]))
예제 #27
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(Asset_update_bitasset, self).__init__(
             OrderedDict([
                 ('fee', Asset(kwargs["fee"])),
                 ('issuer', ObjectId(kwargs["issuer"], "account")),
                 ('asset_to_update',
                  ObjectId(kwargs["asset_to_update"], "asset")),
                 ('new_options', BitAssetOptions(kwargs["new_options"])),
                 ('extensions', Set([])),
             ]))
예제 #28
0
 def __init__(self, *args, **kwargs):
     if isArgsThisClass(self, args):
         self.data = args[0].data
     else:
         super().__init__(
             OrderedDict([
                 ("fee", Asset(kwargs["fee"])),
                 ("issuer", ObjectId(kwargs["issuer"], "account")),
                 (
                     "asset_to_update",
                     ObjectId(kwargs["asset_to_update"], "asset"),
                 ),
                 ("new_issuer", ObjectId(kwargs["new_issuer"], "account")),
                 ("extensions", Set([])),
             ]))
예제 #29
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"])),
             ('bettor_id', ObjectId(kwargs["bettor_id"], "account")),
             ('betting_market_id', ObjectId(kwargs["betting_market_id"], "betting_market")),
             ('amount_to_bet', Asset(kwargs["amount_to_bet"])),
             ('backer_multiplier', Uint32(int(kwargs["backer_multiplier"]))),
             ('back_or_lay', BetType(kwargs["back_or_lay"])),
             ('extensions', Set([])),
         ]))
예제 #30
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"])),
             ('seller', ObjectId(kwargs["seller"], "account")),
             ('amount_to_sell', Asset(kwargs["amount_to_sell"])),
             ('min_to_receive', Asset(kwargs["min_to_receive"])),
             ('expiration', PointInTime(kwargs["expiration"])),
             ('fill_or_kill', Bool(kwargs["fill_or_kill"])),
             ('extensions', Set([])),
         ]))