2
2
from typing import Optional , cast
3
3
4
4
from borsh_construct .enum import _rust_enum
5
- from sumtypes import constructor
5
+ from sumtypes import constructor # type: ignore
6
6
7
- from solders .pubkey import Pubkey
7
+ from solders .pubkey import Pubkey # type: ignore
8
8
9
9
from anchorpy import Context , Program
10
10
@@ -74,7 +74,7 @@ async def jit(self, params: JitIxParams):
74
74
await self .init ()
75
75
76
76
sub_account_id = self .drift_client .get_sub_account_id_for_ix (
77
- params .sub_account_id
77
+ params .sub_account_id # type: ignore
78
78
)
79
79
80
80
order = next (
@@ -90,11 +90,11 @@ async def jit(self, params: JitIxParams):
90
90
params .taker ,
91
91
self .drift_client .get_user_account (sub_account_id ),
92
92
],
93
- writable_spot_market_indexes = [order .market_index , QUOTE_SPOT_MARKET_INDEX ]
94
- if is_variant (order .market_type , "Spot" )
93
+ writable_spot_market_indexes = [order .market_index , QUOTE_SPOT_MARKET_INDEX ] # type: ignore
94
+ if is_variant (order .market_type , "Spot" ) # type: ignore
95
95
else [],
96
- writable_perp_market_indexes = [order .market_index ]
97
- if is_variant (order .market_type , "Perp" )
96
+ writable_perp_market_indexes = [order .market_index ] # type: ignore
97
+ if is_variant (order .market_type , "Perp" ) # type: ignore
98
98
else [],
99
99
)
100
100
@@ -114,35 +114,35 @@ async def jit(self, params: JitIxParams):
114
114
)
115
115
)
116
116
117
- if is_variant (order .market_type , "Spot" ):
117
+ if is_variant (order .market_type , "Spot" ): # type: ignore
118
118
remaining_accounts .append (
119
119
AccountMeta (
120
- pubkey = self .drift_client .get_spot_market_account (
121
- order .market_index
120
+ pubkey = self .drift_client .get_spot_market_account ( # type: ignore
121
+ order .market_index # type: ignore
122
122
).vault ,
123
123
is_writable = False ,
124
124
is_signer = False ,
125
125
)
126
126
)
127
127
remaining_accounts .append (
128
128
AccountMeta (
129
- pubkey = self .drift_client .get_quote_spot_market_account ().vault ,
129
+ pubkey = self .drift_client .get_quote_spot_market_account ().vault , # type: ignore
130
130
is_writable = False ,
131
131
is_signer = False ,
132
132
)
133
133
)
134
134
135
- jit_params = self .program .type ["JitParams" ](
135
+ jit_params = self .program .type ["JitParams" ]( # type: ignore
136
136
taker_order_id = params .taker_order_id ,
137
137
max_position = cast (int , params .max_position ),
138
138
min_position = cast (int , params .min_position ),
139
139
bid = cast (int , params .bid ),
140
140
ask = cast (int , params .ask ),
141
- price_type = self .get_price_type (params .price_type ),
141
+ price_type = self .get_price_type (params .price_type ), # type: ignore
142
142
post_only = self .get_post_only (params .post_only ),
143
143
)
144
144
145
- ix = self .program .instruction ["jit" ](
145
+ ix = self .program .instruction ["jit" ]( # type: ignore
146
146
jit_params ,
147
147
ctx = Context (
148
148
accounts = {
@@ -156,7 +156,7 @@ async def jit(self, params: JitIxParams):
156
156
"authority" : self .drift_client .wallet .public_key ,
157
157
"drift_program" : self .drift_client .program_id ,
158
158
},
159
- signers = {self .drift_client .wallet },
159
+ signers = {self .drift_client .wallet }, # type: ignore
160
160
remaining_accounts = remaining_accounts ,
161
161
),
162
162
)
@@ -167,16 +167,16 @@ async def jit(self, params: JitIxParams):
167
167
168
168
def get_price_type (self , price_type : PriceType ):
169
169
if is_variant (price_type , "Oracle" ):
170
- return self .program .type ["PriceType" ].Oracle ()
170
+ return self .program .type ["PriceType" ].Oracle () # type: ignore
171
171
elif is_variant (price_type , "Limit" ):
172
- return self .program .type ["PriceType" ].Limit ()
173
- else :
172
+ return self .program .type ["PriceType" ].Limit () # type: ignore
173
+ else :
174
174
raise ValueError (f"Unknown price type: { str (price_type )} " )
175
175
176
176
def get_post_only (self , post_only : PostOnlyParams ):
177
177
if is_variant (post_only , "MustPostOnly" ):
178
- return self .program .type ["PostOnlyParam" ].MustPostOnly ()
178
+ return self .program .type ["PostOnlyParam" ].MustPostOnly () # type: ignore
179
179
elif is_variant (post_only , "TryPostOnly" ):
180
- return self .program .type ["PostOnlyParam" ].TryPostOnly ()
180
+ return self .program .type ["PostOnlyParam" ].TryPostOnly () # type: ignore
181
181
elif is_variant (post_only , "Slide" ):
182
- return self .program .type ["PostOnlyParam" ].Slide ()
182
+ return self .program .type ["PostOnlyParam" ].Slide () # type: ignore
0 commit comments