Ejemplo n.º 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]

            # handle beneficiaries
            extensions = Array([])
            beneficiaries = kwargs.get('beneficiaries')
            # TODO: Explore this 2 lines
            if not beneficiaries and kwargs['extensions'] and len(kwargs['extensions'][0]) == 2:
                beneficiaries = kwargs['extensions'][0][1].get('beneficiaries')
            if beneficiaries and type(beneficiaries) == list:
                ext_obj = [0, {'beneficiaries': beneficiaries}]
                ext = CommentOptionExtensions(ext_obj)
                extensions = Array([ext])

            super().__init__(OrderedDict([
                ('author', String(kwargs["author"])),
                ('permlink', String(kwargs["permlink"])),
                ('max_accepted_payout', Amount(kwargs["max_accepted_payout"])),
                ('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),
            ]))
Ejemplo n.º 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]

            new_extensions = []

            # handle beneficiaries
            if "beneficiaries" in kwargs and kwargs["beneficiaries"]:
                new_extensions.append(
                    [0, {
                        "beneficiaries": kwargs["beneficiaries"]
                    }])

            if "auction_window_reward_destination" in kwargs and kwargs[
                    "auction_window_reward_destination"]:
                new_extensions.append([
                    1, {
                        "destination":
                        kwargs["auction_window_reward_destination"]
                    }
                ])

            if "curation_rewards_percent" in kwargs and kwargs[
                    "curation_rewards_percent"]:
                new_extensions.append(
                    [2, {
                        "percent": kwargs["curation_rewards_percent"]
                    }])

            if new_extensions:
                kwargs["extensions"] = new_extensions

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

            super().__init__(
                OrderedDict([
                    ("author", String(kwargs["author"])),
                    ("permlink", String(kwargs["permlink"])),
                    ("max_accepted_payout",
                     Amount(kwargs["max_accepted_payout"])),
                    ("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),
                ]))
Ejemplo n.º 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]
         p = ChainProperties18(kwargs).data
         p.update(
             OrderedDict([
                 # Note that param order is critical to serialization
                 ("max_referral_interest_rate",
                  Uint16(kwargs["max_referral_interest_rate"])),
                 ("max_referral_term_sec",
                  Uint32(kwargs["max_referral_term_sec"])),
                 ("min_referral_break_fee",
                  Amount(kwargs["min_referral_break_fee"])),
                 ("max_referral_break_fee",
                  Amount(kwargs["max_referral_break_fee"])),
                 ("posts_window", Uint16(kwargs["posts_window"])),
                 ("posts_per_window", Uint16(kwargs["posts_per_window"])),
                 ("comments_window", Uint16(kwargs["comments_window"])),
                 ("comments_per_window",
                  Uint16(kwargs["comments_per_window"])),
                 ("votes_window", Uint16(kwargs["votes_window"])),
                 ("votes_per_window", Uint16(kwargs["votes_per_window"])),
                 ("auction_window_size",
                  Uint16(kwargs["auction_window_size"])),
                 ("max_delegated_vesting_interest_rate",
                  Uint16(kwargs["max_delegated_vesting_interest_rate"])),
                 ("custom_ops_bandwidth_multiplier",
                  Uint16(kwargs["custom_ops_bandwidth_multiplier"])),
                 ("min_curation_percent",
                  Uint16(kwargs["min_curation_percent"])),
                 ("max_curation_percent",
                  Uint16(kwargs["max_curation_percent"])),
                 ("curation_reward_curve",
                  Uint64(kwargs["curation_reward_curve"])),
                 ("allow_distribute_auction_reward",
                  Bool(bool(kwargs["allow_distribute_auction_reward"]))),
                 (
                     "allow_return_auction_reward_to_fund",
                     Bool(
                         bool(kwargs["allow_return_auction_reward_to_fund"])
                     ),
                 ),
             ]))
         super().__init__(p)
Ejemplo n.º 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]
         super().__init__(OrderedDict([
             ('account', String(kwargs["account"])),
             ('witness', String(kwargs["witness"])),
             ('approve', Bool(bool(kwargs["approve"]))),
         ]))
Ejemplo n.º 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]
         super().__init__(OrderedDict([
             ('from_account', String(kwargs["from_account"])),
             ('to_account', String(kwargs["to_account"])),
             ('percent', Uint16((kwargs["percent"]))),
             ('auto_vest', Bool(kwargs["auto_vest"])),
         ]))
Ejemplo n.º 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([
             ('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"])),
         ]))
Ejemplo n.º 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([
                 ("from", String(kwargs["from"])),
                 ("to", String(kwargs["to"])),
                 ("amount", Amount(kwargs["amount"])),
                 ("to_vesting", Bool(bool(kwargs["to_vesting"]))),
                 ("extensions", Array([])),
             ]))