Beispiel #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]
            prefix = kwargs.pop("prefix", default_prefix)

            assert len(kwargs["new_account_name"]
                       ) <= 16, "Account name must be at most 16 chars long"

            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"]
            # HF 18 requires liquid steem to be multiplied by 30 for creation
            # f = Amount(kwargs["fee"])
            # fee = '{} STEEM'.format(f.amount * 30)
            # print(fee)
            super().__init__(
                OrderedDict([
                    ('fee', Amount(kwargs['fee'])),
                    ('delegation', Amount(kwargs["delegation"])),
                    ('creator', String(kwargs["creator"])),
                    ('new_account_name', String(kwargs["new_account_name"])),
                    ('owner', Permission(kwargs["owner"], prefix=prefix)),
                    ('active', Permission(kwargs["active"], prefix=prefix)),
                    ('posting', Permission(kwargs["posting"], prefix=prefix)),
                    ('memo_key', PublicKey(kwargs["memo_key"], prefix=prefix)),
                    ('json_metadata', String(meta)),
                    ('extensions', Array([])),
                ]))
    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 "extensions" not in kwargs:
                kwargs["extensions"] = Set([])
            if "signatures" not in kwargs:
                kwargs["signatures"] = Array([])
            else:
                kwargs["signatures"] = Array([Signature(unhexlify(a)) for a in kwargs["signatures"]])

            if "operations" in kwargs:
                if all([not isinstance(a, Operation) for a in kwargs["operations"]]):
                    kwargs['operations'] = Array([Operation(a) for a in kwargs["operations"]])
                else:
                    kwargs['operations'] = Array(kwargs["operations"])

            super().__init__(OrderedDict([
                ('ref_block_num', Uint16(kwargs['ref_block_num'])),
                ('ref_block_prefix', Uint32(kwargs['ref_block_prefix'])),
                ('expiration', PointInTime(kwargs['expiration'])),
                ('operations', kwargs['operations']),
                ('extensions', kwargs['extensions']),
                ('signatures', kwargs['signatures']),
            ]))
Beispiel #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]
            if "json" in kwargs and kwargs["json"]:
                if (isinstance(kwargs["json"], dict)
                        or isinstance(kwargs["json"], list)):
                    js = json.dumps(kwargs["json"])
                else:
                    js = kwargs["json"]

            if len(kwargs["id"]) > 32:
                raise Exception("'id' too long")

            super().__init__(
                OrderedDict([
                    ('required_auths',
                     Array([String(o) for o in kwargs["required_auths"]])),
                    ('required_posting_auths',
                     Array([
                         String(o) for o in kwargs["required_posting_auths"]
                     ])),
                    ('id', String(kwargs["id"])),
                    ('json', String(js)),
                ]))
Beispiel #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]
         if "message" in kwargs and kwargs["message"]:
             if "chain" not in kwargs:
                 chain = default_prefix
             else:
                 chain = kwargs["chain"]
             if isinstance(chain, str) and chain in known_chains:
                 chain_params = known_chains[chain]
             elif isinstance(chain, dict):
                 chain_params = chain
             else:
                 raise Exception(
                     "Memo() only takes a string or a dict as chain!")
             if "prefix" not in chain_params:
                 raise Exception("Memo() needs a 'prefix' in chain params!")
             prefix = chain_params["prefix"]
             super().__init__(
                 OrderedDict([('from',
                               PublicKey(kwargs["from"], prefix=prefix)),
                              ('to', PublicKey(kwargs["to"],
                                               prefix=prefix)),
                              ('nonce', Uint64(int(kwargs["nonce"]))),
                              ('message', Bytes(kwargs["message"]))]))
         else:
             super().__init__(None)
Beispiel #5
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]
            kwargs["key_auths"] = sorted(
                kwargs["key_auths"],
                key=lambda x: PublicKey(x[0], prefix=prefix),
                reverse=False,
            )
            accountAuths = Map([[ObjectId(e[0], "account"),
                                 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().__init__(
                OrderedDict([
                    ("weight_threshold",
                     Uint32(int(kwargs["weight_threshold"]))),
                    ("account_auths", accountAuths),
                    ("key_auths", keyAuths),
                    ("extensions", Set([])),
                ]))
Beispiel #6
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).address),
                reverse=False,
            )
            accountAuths = Map([
                [ObjectId(e[0], "account"), 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().__init__(OrderedDict([
                ('weight_threshold', Uint32(int(kwargs["weight_threshold"]))),
                ('account_auths', accountAuths),
                ('key_auths', keyAuths),
                ('extensions', Set([])),
            ]))
Beispiel #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]

            if 'extensions' not in kwargs or not kwargs['extensions']:
                kwargs['extensions'] = []
            elif not isinstance(kwargs['extensions'], list):
                raise TypeError(
                    'You need to provide a list as extension param')

            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([])),
                    ('extensions',
                     LimitOrderCreateExtensions(kwargs['extensions']))
                ]))
Beispiel #8
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([])),
                ]))
Beispiel #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([
                 ("feed_lifetime_sec", Uint32(kwargs["feed_lifetime_sec"])),
                 ("minimum_feeds", Uint8(kwargs["minimum_feeds"])),
                 (
                     "force_settlement_delay_sec",
                     Uint32(kwargs["force_settlement_delay_sec"]),
                 ),
                 (
                     "force_settlement_offset_percent",
                     Uint16(kwargs["force_settlement_offset_percent"]),
                 ),
                 (
                     "maximum_force_settlement_volume",
                     Uint16(kwargs["maximum_force_settlement_volume"]),
                 ),
                 (
                     "short_backing_asset",
                     ObjectId(kwargs["short_backing_asset"], "asset"),
                 ),
                 ("extensions", Set([])),
             ]))
Beispiel #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([
                 (
                     "insurance_enabled",
                     Bool(kwargs["insurance_enabled"]),
                 ),
                 (
                     "time_per_commit_move",
                     Uint32(kwargs["time_per_commit_move"]),
                 ),
                 (
                     "time_per_reveal_move",
                     Uint32(kwargs["time_per_reveal_move"]),
                 ),
                 (
                     "number_of_gestures",
                     Uint8(kwargs["number_of_gestures"]),
                 ),
             ]))
Beispiel #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]

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

            if "payout_interval" in kwargs:
                payout_interval = Optional(Uint32(kwargs["payout_interval"]))
            else:
                payout_interval = Optional(None)

            super().__init__(
                OrderedDict([
                    ("next_payout_time", next_payout_time),
                    ("payout_interval", payout_interval),
                    (
                        "minimum_fee_percentage",
                        Uint64(kwargs["minimum_fee_percentage"]),
                    ),
                    (
                        "minimum_distribution_interval",
                        Uint32(kwargs["minimum_distribution_interval"]),
                    ),
                    ("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]

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

            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().__init__(OrderedDict([
                ('weight_threshold', Uint32(int(kwargs["weight_threshold"]))),
                ('account_auths'   , accountAuths),
                ('key_auths'       , keyAuths),
            ]))
Beispiel #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]
            prefix = kwargs.pop("prefix", default_prefix)

            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"]

            owner = Permission(kwargs["owner"],
                               prefix=prefix) if "owner" in kwargs else None
            active = Permission(kwargs["active"],
                                prefix=prefix) if "active" in kwargs else None
            posting = Permission(
                kwargs["posting"],
                prefix=prefix) if "posting" in kwargs else None

            super().__init__(
                OrderedDict([
                    ('account', String(kwargs["account"])),
                    ('owner', Optional(owner)),
                    ('active', Optional(active)),
                    ('posting', Optional(posting)),
                    ('memo_key', PublicKey(kwargs["memo_key"], prefix=prefix)),
                    ('json_metadata', String(meta)),
                ]))
Beispiel #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]
            prefix = kwargs.pop("prefix", default_prefix)

            assert len(kwargs["new_account_name"]
                       ) <= 16, "Account name must be at most 16 chars long"

            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"]
            super().__init__(
                OrderedDict([
                    ('fee', Amount(kwargs["fee"])),
                    ('creator', String(kwargs["creator"])),
                    ('new_account_name', String(kwargs["new_account_name"])),
                    ('owner', Permission(kwargs["owner"], prefix=prefix)),
                    ('active', Permission(kwargs["active"], prefix=prefix)),
                    ('posting', Permission(kwargs["posting"], prefix=prefix)),
                    ('memo_key', PublicKey(kwargs["memo_key"], prefix=prefix)),
                    ('json_metadata', String(meta)),
                ]))
Beispiel #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]

            start_time = Optional(PointInTime(kwargs["start_time"])
                                  if "start_time" in kwargs else
                                  None)
            start_delay = Optional(Uint32(kwargs["start_delay"])
                                   if "start_delay" in kwargs else
                                   None)

            if "meta" in kwargs and kwargs["meta"]:
                raise NotImplementedError('"meta" cannot yet be used with this library')

            super().__init__(OrderedDict([
                ('registration_deadline',
                 PointInTime(kwargs["registration_deadline"])),
                ('number_of_players',
                 Uint32(kwargs["number_of_players"])),
                ('buy_in', Asset(kwargs["buy_in"])),
                ('whitelist',
                    Array([ObjectId(x, "account")
                           for x in kwargs["whitelist"]])),
                ('start_time', start_time),
                ('start_delay', start_delay),
                ('round_delay', Uint32(kwargs["round_delay"])),
                ('number_of_wins', Uint32(kwargs["number_of_wins"])),
                ('meta', Optional(None)),
                ('game_options', GameSpecificOptions(kwargs["game_options"])),
            ]))
Beispiel #16
0
    def __init__(self, *args, **kwargs):
        # Extensions ############################
        class Cancel_trx_id_ext(GrapheneObject):
            def __init__(self, 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([('trx_id', Ripemd160(kwargs['trx_id']))]))

        # End of Extensions definition ##########
        if isArgsThisClass(self, args):
            self.data = args[0].data
        else:
            if len(args) == 1 and len(kwargs) == 0:
                kwargs = args[0]

        if len(kwargs) == 0:
            return super().__init__([])

        a = []
        ext = kwargs[0]
        assert ext[0] == 6
        a.append(Static_variant(Cancel_trx_id_ext(ext[1]), ext[0]))
        super().__init__(a)
Beispiel #17
0
    def __init__(self, *args, **kwargs):
        # Extensions ############################
        class Order_side_ext(GrapheneObject):
            def __init__(self, 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([('is_buy', Bool(kwargs['is_buy']))]))

        # End of Extensions definition ##########
        if isArgsThisClass(self, args):
            self.data = args[0].data
        else:
            if len(args) == 1 and len(kwargs) == 0:
                kwargs = args[0]
        if len(kwargs) == 0:
            return super().__init__([])
        a = []
        ext = kwargs[0]
        assert ext[0] == 7
        a.append(Static_variant(Order_side_ext(ext[1]), ext[0]))
        super().__init__(a)
 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([("op", Operation(kwargs["op"]))]))
Beispiel #19
0
 def __init__(self, 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([('trx_id', Ripemd160(kwargs['trx_id']))]))
Beispiel #20
0
 def __init__(self, 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([('is_buy', Bool(kwargs['is_buy']))]))
 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([("account", String(kwargs["account"])), ("weight", Int16(kwargs["weight"])),])
         )
Beispiel #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]
         super(Vesting_balance_worker_initializer, self).__init__(OrderedDict([
             ('pay_vesting_period_days', Uint16(kwargs["pay_vesting_period_days"])),
         ]))
Beispiel #23
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([("base", Asset(kwargs["base"])),
                          ("quote", Asset(kwargs["quote"]))]))
Beispiel #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(
                 [
                     ("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([])),
                 ]
             )
         )
 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([
             ('account'          , String(kwargs["account"])),
             ('vesting_shares'   , Amount(kwargs["vesting_shares"])),
         ]))
 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([
             ('owner'          , String(kwargs["owner"])),
             ('orderid'        , Uint32(int(kwargs["orderid"]))),
         ]))
 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([
             ('owner', String(kwargs["owner"])),
             ('orderid', Uint32(int(kwargs["orderid"]))),
         ]))
 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([
             ('from', String(kwargs["from"])),
             ('request_id', Uint32(int(kwargs["request_id"]))),
         ]))
 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([
             ('publisher', String(kwargs["publisher"])),
             ('exchange_rate', Exchange_rate(kwargs["exchange_rate"])),
         ]))
 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([
             ('account', String(kwargs["account"])),
             ('vesting_shares', Amount(kwargs["vesting_shares"])),
         ]))
Beispiel #31
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([
             ('amount', Int64(kwargs["amount"])),
             ('asset_id', ObjectId(kwargs["asset_id"], "asset"))
         ]))
Beispiel #32
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([(
                 "pay_vesting_period_days",
                 Uint16(kwargs["pay_vesting_period_days"]),
             )]))
 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([
             ('from'          , String(kwargs["from"])),
             ('to'            , String(kwargs["to"])),
             ('amount'        , Amount(kwargs["amount"])),
         ]))
 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([
             ('account', String(kwargs["account"])),
             ('witness', String(kwargs["witness"])),
             ('approve', Bool(bool(kwargs["approve"]))),
         ]))
Beispiel #35
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]

            super().__init__(OrderedDict([
                ('account', String(kwargs["account"])),
            ]))
 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([
             ('voter'    , String(kwargs["voter"])),
             ('author'   , String(kwargs["author"])),
             ('permlink' , String(kwargs["permlink"])),
             ('weight'   , Int16(kwargs["weight"])),
         ]))
    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([
                ('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"])),
            ]))
 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([
             ('owner'          , String(kwargs["owner"])),
             ('orderid'        , Uint32(int(kwargs["orderid"]))),
             ('amount_to_sell' , Amount(kwargs["amount_to_sell"])),
             ('min_to_receive' , Amount(kwargs["min_to_receive"])),
             ('fill_or_kill'   , Bool(kwargs["fill_or_kill"])),
             ('expiration'     , PointInTime(kwargs["expiration"])),
         ]))
Beispiel #39
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([
             ('parent_author'   , String(kwargs["parent_author"])),
             ('parent_permlink' , String(kwargs["parent_permlink"])),
             ('author'          , String(kwargs["author"])),
             ('permlink'        , String(kwargs["permlink"])),
             ('title'           , String(kwargs["title"])),
             ('body'            , String(kwargs["body"])),
             ('json_metadata'   , String(kwargs["json_metadata"])),
         ]))
 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 "memo" not in kwargs:
             kwargs["memo"] = ""
         if kwargs["memo"] and kwargs["memo"][0] == "#":
             raise Exception(
                 "This library does not yet support encrypted memos!"
             )
         super().__init__(OrderedDict([
             ('from'          , String(kwargs["from"])),
             ('to'            , String(kwargs["to"])),
             ('amount'        , Amount(kwargs["amount"])),
             ('memo'          , String(kwargs["memo"])),
         ]))
    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"]:
                meta = json.dumps(kwargs["json_metadata"])
            super().__init__(OrderedDict([
                ('fee'              , Amount(kwargs["fee"])),
                ('creator'          , String(kwargs["creator"])),
                ('new_account_name' , String(kwargs["new_account_name"])),
                ('owner'            , Permission(kwargs["owner"])),
                ('active'           , Permission(kwargs["active"])),
                ('posting'          , Permission(kwargs["posting"])),
                ('memo_key'         , PublicKey(kwargs["memo_key"], prefix=prefix)),
                ('json_metadata'    , String(meta)),
            ]))
    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):
                    meta = json.dumps(kwargs["json_metadata"])
                else:
                    meta = kwargs["json_metadata"]

            super().__init__(OrderedDict([
                ('parent_author'   , String(kwargs["parent_author"])),
                ('parent_permlink' , String(kwargs["parent_permlink"])),
                ('author'          , String(kwargs["author"])),
                ('permlink'        , String(kwargs["permlink"])),
                ('title'           , String(kwargs["title"])),
                ('body'            , String(kwargs["body"])),
                ('json_metadata'   , String(meta)),
            ]))