@@ -1042,5 +1042,63 @@ def __init__(self, *args, **kwargs):
10421042 )
10431043 )
10441044
1045+ ticket_type_strings = ['liquid' , 'lock_180_days' , 'lock_360_days' , 'lock_720_days' , 'lock_forever' ]
1046+
1047+ class Ticket_create_operation (GrapheneObject ):
1048+ def __init__ (self , * args , ** kwargs ):
1049+ if isArgsThisClass (self , args ):
1050+ self .data = args [0 ].data
1051+ else :
1052+ if len (args ) == 1 and len (kwargs ) == 0 :
1053+ kwargs = args [0 ]
1054+
1055+ if isinstance (kwargs ["target_type" ], int ):
1056+ target_type = Varint32 (kwargs ["target_type" ])
1057+ else :
1058+ target_type = Varint32 (ticket_type_strings .index (kwargs ["target_type" ]))
1059+
1060+ super ().__init__ (
1061+ OrderedDict (
1062+ [
1063+ ("fee" , Asset (kwargs ["fee" ])),
1064+ ("account" , ObjectId (kwargs ["account" ], "account" )),
1065+ ("target_type" , target_type ),
1066+ ("amount" , Asset (kwargs ["amount" ])),
1067+ ("extensions" , Set ([])),
1068+ ]
1069+ )
1070+ )
1071+
1072+ class Ticket_update_operation (GrapheneObject ):
1073+ def __init__ (self , * args , ** kwargs ):
1074+ if isArgsThisClass (self , args ):
1075+ self .data = args [0 ].data
1076+ else :
1077+ if len (args ) == 1 and len (kwargs ) == 0 :
1078+ kwargs = args [0 ]
1079+
1080+ if isinstance (kwargs ["target_type" ], int ):
1081+ target_type = Varint32 (kwargs ["target_type" ])
1082+ else :
1083+ target_type = Varint32 (ticket_type_strings .index (kwargs ["target_type" ]))
1084+
1085+ if kwargs .get ("amount_for_new_target" ):
1086+ amount_for_new_target = Optional (Asset (kwargs ["amount_for_new_target" ]))
1087+ else :
1088+ amount_for_new_target = Optional (None )
1089+
1090+ super ().__init__ (
1091+ OrderedDict (
1092+ [
1093+ ("fee" , Asset (kwargs ["fee" ])),
1094+ ("ticket" , ObjectId (kwargs ["ticket" ], "ticket" )),
1095+ ("account" , ObjectId (kwargs ["account" ], "account" )),
1096+ ("target_type" , target_type ),
1097+ ("amount_for_new_target" , amount_for_new_target ),
1098+ ("extensions" , Set ([])),
1099+ ]
1100+ )
1101+ )
1102+
10451103
10461104fill_classmaps ()
0 commit comments