carbon-drift-v2-decoder 1.0.0

Drift v2 Decoder
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
//! This code was AUTOGENERATED using the Codama library.
pub mod add_amm_constituent_mapping_data_schema;
pub mod add_insurance_fund_stake_schema;
pub mod add_market_to_amm_cache_schema;
pub mod admin_deposit_schema;
pub mod admin_update_user_stats_paused_operations_schema;
pub mod admin_withdraw_from_insurance_fund_vault_schema;
pub mod begin_insurance_fund_swap_schema;
pub mod begin_lp_swap_schema;
pub mod begin_swap_schema;
pub mod cancel_order_by_user_id_schema;
pub mod cancel_order_schema;
pub mod cancel_orders_by_ids_schema;
pub mod cancel_orders_schema;
pub mod cancel_request_remove_insurance_fund_stake_schema;
pub mod change_approved_builder_schema;
pub mod change_signed_msg_ws_delegate_status_schema;
pub mod cpi_event_schema;
pub mod delete_amm_cache_schema;
pub mod delete_initialized_perp_market_schema;
pub mod delete_initialized_spot_market_schema;
pub mod delete_openbook_v2_fulfillment_config_schema;
pub mod delete_prelaunch_oracle_schema;
pub mod delete_serum_fulfillment_config_schema;
pub mod delete_signed_msg_user_orders_schema;
pub mod delete_user_schema;
pub mod deposit_into_insurance_fund_stake_schema;
pub mod deposit_into_isolated_perp_position_schema;
pub mod deposit_into_perp_market_fee_pool_schema;
pub mod deposit_into_spot_market_revenue_pool_schema;
pub mod deposit_into_spot_market_vault_schema;
pub mod deposit_schema;
pub mod deposit_to_program_vault_schema;
pub mod disable_user_high_leverage_mode_schema;
pub mod enable_user_high_leverage_mode_schema;
pub mod end_insurance_fund_swap_schema;
pub mod end_lp_swap_schema;
pub mod end_swap_schema;
pub mod fill_perp_order_schema;
pub mod fill_spot_order_schema;
pub mod force_cancel_orders_schema;
pub mod force_delete_user_schema;
pub mod initialize_amm_cache_schema;
pub mod initialize_constituent_schema;
pub mod initialize_fuel_overflow_schema;
pub mod initialize_high_leverage_mode_config_schema;
pub mod initialize_if_rebalance_config_schema;
pub mod initialize_insurance_fund_stake_schema;
pub mod initialize_lp_pool_schema;
pub mod initialize_openbook_v2_fulfillment_config_schema;
pub mod initialize_perp_market_schema;
pub mod initialize_phoenix_fulfillment_config_schema;
pub mod initialize_prediction_market_schema;
pub mod initialize_prelaunch_oracle_schema;
pub mod initialize_protected_maker_mode_config_schema;
pub mod initialize_pyth_lazer_oracle_schema;
pub mod initialize_pyth_pull_oracle_schema;
pub mod initialize_referrer_name_schema;
pub mod initialize_revenue_share_escrow_schema;
pub mod initialize_revenue_share_schema;
pub mod initialize_schema;
pub mod initialize_serum_fulfillment_config_schema;
pub mod initialize_signed_msg_user_orders_schema;
pub mod initialize_signed_msg_ws_delegates_schema;
pub mod initialize_spot_market_schema;
pub mod initialize_user_schema;
pub mod initialize_user_stats_schema;
pub mod liquidate_borrow_for_perp_pnl_schema;
pub mod liquidate_perp_pnl_for_deposit_schema;
pub mod liquidate_perp_schema;
pub mod liquidate_perp_with_fill_schema;
pub mod liquidate_spot_schema;
pub mod liquidate_spot_with_swap_begin_schema;
pub mod liquidate_spot_with_swap_end_schema;
pub mod log_user_balances_schema;
pub mod lp_pool_add_liquidity_schema;
pub mod lp_pool_remove_liquidity_schema;
pub mod lp_pool_swap_schema;
pub mod modify_order_by_user_id_schema;
pub mod modify_order_schema;
pub mod move_amm_price_schema;
pub mod openbook_v2_fulfillment_config_status_schema;
pub mod override_amm_cache_info_schema;
pub mod pause_spot_market_deposit_withdraw_schema;
pub mod phoenix_fulfillment_config_status_schema;
pub mod place_and_make_perp_order_schema;
pub mod place_and_make_signed_msg_perp_order_schema;
pub mod place_and_make_spot_order_schema;
pub mod place_and_take_perp_order_schema;
pub mod place_and_take_spot_order_schema;
pub mod place_orders_schema;
pub mod place_perp_order_schema;
pub mod place_scale_orders_schema;
pub mod place_signed_msg_taker_order_schema;
pub mod place_spot_order_schema;
pub mod post_multi_pyth_pull_oracle_updates_atomic_schema;
pub mod post_pyth_lazer_oracle_update_schema;
pub mod post_pyth_pull_oracle_update_atomic_schema;
pub mod recenter_perp_market_amm_crank_schema;
pub mod recenter_perp_market_amm_schema;
pub mod reclaim_rent_schema;
pub mod remove_amm_constituent_mapping_data_schema;
pub mod remove_insurance_fund_stake_schema;
pub mod repeg_amm_curve_schema;
pub mod request_remove_insurance_fund_stake_schema;
pub mod reset_fuel_season_schema;
pub mod reset_perp_market_amm_oracle_twap_schema;
pub mod resize_revenue_share_escrow_orders_schema;
pub mod resize_signed_msg_user_orders_schema;
pub mod resolve_perp_bankruptcy_schema;
pub mod resolve_perp_pnl_deficit_schema;
pub mod resolve_spot_bankruptcy_schema;
pub mod revert_fill_schema;
pub mod set_user_status_to_being_liquidated_schema;
pub mod settle_expired_market_pools_to_revenue_pool_schema;
pub mod settle_expired_market_schema;
pub mod settle_funding_payment_schema;
pub mod settle_multiple_pnls_schema;
pub mod settle_perp_to_lp_pool_schema;
pub mod settle_pnl_schema;
pub mod settle_revenue_to_insurance_fund_schema;
pub mod sweep_fuel_schema;
pub mod transfer_deposit_schema;
pub mod transfer_isolated_perp_position_deposit_schema;
pub mod transfer_perp_position_schema;
pub mod transfer_pools_schema;
pub mod transfer_protocol_if_shares_to_revenue_pool_schema;
pub mod trigger_order_schema;
pub mod update_admin_schema;
pub mod update_amm_cache_schema;
pub mod update_amm_constituent_mapping_data_schema;
pub mod update_amm_jit_intensity_schema;
pub mod update_amms_schema;
pub mod update_constituent_correlation_data_schema;
pub mod update_constituent_oracle_info_schema;
pub mod update_constituent_params_schema;
pub mod update_constituent_paused_operations_schema;
pub mod update_constituent_status_schema;
pub mod update_delegate_user_gov_token_insurance_stake_schema;
pub mod update_discount_mint_schema;
pub mod update_exchange_status_schema;
pub mod update_feature_bit_flags_builder_codes_schema;
pub mod update_feature_bit_flags_median_trigger_price_schema;
pub mod update_feature_bit_flags_mint_redeem_lp_pool_schema;
pub mod update_feature_bit_flags_mm_oracle_schema;
pub mod update_feature_bit_flags_settle_lp_pool_schema;
pub mod update_feature_bit_flags_swap_lp_pool_schema;
pub mod update_funding_rate_schema;
pub mod update_high_leverage_mode_config_schema;
pub mod update_if_rebalance_config_schema;
pub mod update_initial_amm_cache_info_schema;
pub mod update_initial_pct_to_liquidate_schema;
pub mod update_insurance_fund_unstaking_period_schema;
pub mod update_k_schema;
pub mod update_liquidation_duration_schema;
pub mod update_liquidation_margin_buffer_ratio_schema;
pub mod update_lp_constituent_target_base_schema;
pub mod update_lp_pool_aum_schema;
pub mod update_lp_pool_params_schema;
pub mod update_oracle_guard_rails_schema;
pub mod update_perp_auction_duration_schema;
pub mod update_perp_bid_ask_twap_schema;
pub mod update_perp_fee_structure_schema;
pub mod update_perp_market_amm_oracle_twap_schema;
pub mod update_perp_market_amm_spread_adjustment_schema;
pub mod update_perp_market_amm_summary_stats_schema;
pub mod update_perp_market_base_spread_schema;
pub mod update_perp_market_concentration_coef_schema;
pub mod update_perp_market_config_schema;
pub mod update_perp_market_contract_tier_schema;
pub mod update_perp_market_curve_update_intensity_schema;
pub mod update_perp_market_expiry_schema;
pub mod update_perp_market_fee_adjustment_schema;
pub mod update_perp_market_funding_period_schema;
pub mod update_perp_market_high_leverage_margin_ratio_schema;
pub mod update_perp_market_imf_factor_schema;
pub mod update_perp_market_liquidation_fee_schema;
pub mod update_perp_market_lp_pool_fee_transfer_scalar_schema;
pub mod update_perp_market_lp_pool_id_schema;
pub mod update_perp_market_lp_pool_paused_operations_schema;
pub mod update_perp_market_lp_pool_status_schema;
pub mod update_perp_market_margin_ratio_schema;
pub mod update_perp_market_max_fill_reserve_fraction_schema;
pub mod update_perp_market_max_imbalances_schema;
pub mod update_perp_market_max_open_interest_schema;
pub mod update_perp_market_max_slippage_ratio_schema;
pub mod update_perp_market_max_spread_schema;
pub mod update_perp_market_min_order_size_schema;
pub mod update_perp_market_name_schema;
pub mod update_perp_market_number_of_users_schema;
pub mod update_perp_market_oracle_low_risk_slot_delay_override_schema;
pub mod update_perp_market_oracle_schema;
pub mod update_perp_market_oracle_slot_delay_override_schema;
pub mod update_perp_market_paused_operations_schema;
pub mod update_perp_market_pnl_pool_schema;
pub mod update_perp_market_protected_maker_params_schema;
pub mod update_perp_market_reference_price_offset_deadband_pct_schema;
pub mod update_perp_market_status_schema;
pub mod update_perp_market_step_size_and_tick_size_schema;
pub mod update_perp_market_unrealized_asset_weight_schema;
pub mod update_prelaunch_oracle_params_schema;
pub mod update_prelaunch_oracle_schema;
pub mod update_protected_maker_mode_config_schema;
pub mod update_pyth_pull_oracle_schema;
pub mod update_serum_fulfillment_config_status_schema;
pub mod update_spot_auction_duration_schema;
pub mod update_spot_fee_structure_schema;
pub mod update_spot_market_asset_tier_schema;
pub mod update_spot_market_borrow_rate_schema;
pub mod update_spot_market_cumulative_interest_schema;
pub mod update_spot_market_expiry_schema;
pub mod update_spot_market_fee_adjustment_schema;
pub mod update_spot_market_if_factor_schema;
pub mod update_spot_market_if_paused_operations_schema;
pub mod update_spot_market_liquidation_fee_schema;
pub mod update_spot_market_margin_weights_schema;
pub mod update_spot_market_max_token_borrows_schema;
pub mod update_spot_market_max_token_deposits_schema;
pub mod update_spot_market_min_order_size_schema;
pub mod update_spot_market_name_schema;
pub mod update_spot_market_oracle_schema;
pub mod update_spot_market_orders_enabled_schema;
pub mod update_spot_market_paused_operations_schema;
pub mod update_spot_market_pool_id_schema;
pub mod update_spot_market_revenue_settle_period_schema;
pub mod update_spot_market_scale_initial_asset_weight_start_schema;
pub mod update_spot_market_status_schema;
pub mod update_spot_market_step_size_and_tick_size_schema;
pub mod update_state_max_initialize_user_fee_schema;
pub mod update_state_max_number_of_sub_accounts_schema;
pub mod update_state_settlement_duration_schema;
pub mod update_user_custom_margin_ratio_schema;
pub mod update_user_delegate_schema;
pub mod update_user_gov_token_insurance_stake_schema;
pub mod update_user_idle_schema;
pub mod update_user_margin_trading_enabled_schema;
pub mod update_user_name_schema;
pub mod update_user_perp_position_custom_margin_ratio_schema;
pub mod update_user_pool_id_schema;
pub mod update_user_protected_maker_orders_schema;
pub mod update_user_quote_asset_insurance_stake_schema;
pub mod update_user_reduce_only_schema;
pub mod update_user_stats_referrer_status_schema;
pub mod update_withdraw_guard_threshold_schema;
pub mod view_lp_pool_add_liquidity_fees_schema;
pub mod view_lp_pool_remove_liquidity_fees_schema;
pub mod view_lp_pool_swap_fees_schema;
pub mod withdraw_from_isolated_perp_position_schema;
pub mod withdraw_from_program_vault_schema;
pub mod withdraw_schema;
pub mod zero_mm_oracle_fields_schema;

use juniper::GraphQLObject;
pub use {
    add_amm_constituent_mapping_data_schema::*, add_insurance_fund_stake_schema::*,
    add_market_to_amm_cache_schema::*, admin_deposit_schema::*,
    admin_update_user_stats_paused_operations_schema::*,
    admin_withdraw_from_insurance_fund_vault_schema::*, begin_insurance_fund_swap_schema::*,
    begin_lp_swap_schema::*, begin_swap_schema::*, cancel_order_by_user_id_schema::*,
    cancel_order_schema::*, cancel_orders_by_ids_schema::*, cancel_orders_schema::*,
    cancel_request_remove_insurance_fund_stake_schema::*, change_approved_builder_schema::*,
    change_signed_msg_ws_delegate_status_schema::*, cpi_event_schema::*,
    delete_amm_cache_schema::*, delete_initialized_perp_market_schema::*,
    delete_initialized_spot_market_schema::*, delete_openbook_v2_fulfillment_config_schema::*,
    delete_prelaunch_oracle_schema::*, delete_serum_fulfillment_config_schema::*,
    delete_signed_msg_user_orders_schema::*, delete_user_schema::*,
    deposit_into_insurance_fund_stake_schema::*, deposit_into_isolated_perp_position_schema::*,
    deposit_into_perp_market_fee_pool_schema::*, deposit_into_spot_market_revenue_pool_schema::*,
    deposit_into_spot_market_vault_schema::*, deposit_schema::*,
    deposit_to_program_vault_schema::*, disable_user_high_leverage_mode_schema::*,
    enable_user_high_leverage_mode_schema::*, end_insurance_fund_swap_schema::*,
    end_lp_swap_schema::*, end_swap_schema::*, fill_perp_order_schema::*,
    fill_spot_order_schema::*, force_cancel_orders_schema::*, force_delete_user_schema::*,
    initialize_amm_cache_schema::*, initialize_constituent_schema::*,
    initialize_fuel_overflow_schema::*, initialize_high_leverage_mode_config_schema::*,
    initialize_if_rebalance_config_schema::*, initialize_insurance_fund_stake_schema::*,
    initialize_lp_pool_schema::*, initialize_openbook_v2_fulfillment_config_schema::*,
    initialize_perp_market_schema::*, initialize_phoenix_fulfillment_config_schema::*,
    initialize_prediction_market_schema::*, initialize_prelaunch_oracle_schema::*,
    initialize_protected_maker_mode_config_schema::*, initialize_pyth_lazer_oracle_schema::*,
    initialize_pyth_pull_oracle_schema::*, initialize_referrer_name_schema::*,
    initialize_revenue_share_escrow_schema::*, initialize_revenue_share_schema::*,
    initialize_schema::*, initialize_serum_fulfillment_config_schema::*,
    initialize_signed_msg_user_orders_schema::*, initialize_signed_msg_ws_delegates_schema::*,
    initialize_spot_market_schema::*, initialize_user_schema::*, initialize_user_stats_schema::*,
    liquidate_borrow_for_perp_pnl_schema::*, liquidate_perp_pnl_for_deposit_schema::*,
    liquidate_perp_schema::*, liquidate_perp_with_fill_schema::*, liquidate_spot_schema::*,
    liquidate_spot_with_swap_begin_schema::*, liquidate_spot_with_swap_end_schema::*,
    log_user_balances_schema::*, lp_pool_add_liquidity_schema::*,
    lp_pool_remove_liquidity_schema::*, lp_pool_swap_schema::*, modify_order_by_user_id_schema::*,
    modify_order_schema::*, move_amm_price_schema::*,
    openbook_v2_fulfillment_config_status_schema::*, override_amm_cache_info_schema::*,
    pause_spot_market_deposit_withdraw_schema::*, phoenix_fulfillment_config_status_schema::*,
    place_and_make_perp_order_schema::*, place_and_make_signed_msg_perp_order_schema::*,
    place_and_make_spot_order_schema::*, place_and_take_perp_order_schema::*,
    place_and_take_spot_order_schema::*, place_orders_schema::*, place_perp_order_schema::*,
    place_scale_orders_schema::*, place_signed_msg_taker_order_schema::*,
    place_spot_order_schema::*, post_multi_pyth_pull_oracle_updates_atomic_schema::*,
    post_pyth_lazer_oracle_update_schema::*, post_pyth_pull_oracle_update_atomic_schema::*,
    recenter_perp_market_amm_crank_schema::*, recenter_perp_market_amm_schema::*,
    reclaim_rent_schema::*, remove_amm_constituent_mapping_data_schema::*,
    remove_insurance_fund_stake_schema::*, repeg_amm_curve_schema::*,
    request_remove_insurance_fund_stake_schema::*, reset_fuel_season_schema::*,
    reset_perp_market_amm_oracle_twap_schema::*, resize_revenue_share_escrow_orders_schema::*,
    resize_signed_msg_user_orders_schema::*, resolve_perp_bankruptcy_schema::*,
    resolve_perp_pnl_deficit_schema::*, resolve_spot_bankruptcy_schema::*, revert_fill_schema::*,
    set_user_status_to_being_liquidated_schema::*,
    settle_expired_market_pools_to_revenue_pool_schema::*, settle_expired_market_schema::*,
    settle_funding_payment_schema::*, settle_multiple_pnls_schema::*,
    settle_perp_to_lp_pool_schema::*, settle_pnl_schema::*,
    settle_revenue_to_insurance_fund_schema::*, sweep_fuel_schema::*, transfer_deposit_schema::*,
    transfer_isolated_perp_position_deposit_schema::*, transfer_perp_position_schema::*,
    transfer_pools_schema::*, transfer_protocol_if_shares_to_revenue_pool_schema::*,
    trigger_order_schema::*, update_admin_schema::*, update_amm_cache_schema::*,
    update_amm_constituent_mapping_data_schema::*, update_amm_jit_intensity_schema::*,
    update_amms_schema::*, update_constituent_correlation_data_schema::*,
    update_constituent_oracle_info_schema::*, update_constituent_params_schema::*,
    update_constituent_paused_operations_schema::*, update_constituent_status_schema::*,
    update_delegate_user_gov_token_insurance_stake_schema::*, update_discount_mint_schema::*,
    update_exchange_status_schema::*, update_feature_bit_flags_builder_codes_schema::*,
    update_feature_bit_flags_median_trigger_price_schema::*,
    update_feature_bit_flags_mint_redeem_lp_pool_schema::*,
    update_feature_bit_flags_mm_oracle_schema::*,
    update_feature_bit_flags_settle_lp_pool_schema::*,
    update_feature_bit_flags_swap_lp_pool_schema::*, update_funding_rate_schema::*,
    update_high_leverage_mode_config_schema::*, update_if_rebalance_config_schema::*,
    update_initial_amm_cache_info_schema::*, update_initial_pct_to_liquidate_schema::*,
    update_insurance_fund_unstaking_period_schema::*, update_k_schema::*,
    update_liquidation_duration_schema::*, update_liquidation_margin_buffer_ratio_schema::*,
    update_lp_constituent_target_base_schema::*, update_lp_pool_aum_schema::*,
    update_lp_pool_params_schema::*, update_oracle_guard_rails_schema::*,
    update_perp_auction_duration_schema::*, update_perp_bid_ask_twap_schema::*,
    update_perp_fee_structure_schema::*, update_perp_market_amm_oracle_twap_schema::*,
    update_perp_market_amm_spread_adjustment_schema::*,
    update_perp_market_amm_summary_stats_schema::*, update_perp_market_base_spread_schema::*,
    update_perp_market_concentration_coef_schema::*, update_perp_market_config_schema::*,
    update_perp_market_contract_tier_schema::*,
    update_perp_market_curve_update_intensity_schema::*, update_perp_market_expiry_schema::*,
    update_perp_market_fee_adjustment_schema::*, update_perp_market_funding_period_schema::*,
    update_perp_market_high_leverage_margin_ratio_schema::*,
    update_perp_market_imf_factor_schema::*, update_perp_market_liquidation_fee_schema::*,
    update_perp_market_lp_pool_fee_transfer_scalar_schema::*,
    update_perp_market_lp_pool_id_schema::*,
    update_perp_market_lp_pool_paused_operations_schema::*,
    update_perp_market_lp_pool_status_schema::*, update_perp_market_margin_ratio_schema::*,
    update_perp_market_max_fill_reserve_fraction_schema::*,
    update_perp_market_max_imbalances_schema::*, update_perp_market_max_open_interest_schema::*,
    update_perp_market_max_slippage_ratio_schema::*, update_perp_market_max_spread_schema::*,
    update_perp_market_min_order_size_schema::*, update_perp_market_name_schema::*,
    update_perp_market_number_of_users_schema::*,
    update_perp_market_oracle_low_risk_slot_delay_override_schema::*,
    update_perp_market_oracle_schema::*, update_perp_market_oracle_slot_delay_override_schema::*,
    update_perp_market_paused_operations_schema::*, update_perp_market_pnl_pool_schema::*,
    update_perp_market_protected_maker_params_schema::*,
    update_perp_market_reference_price_offset_deadband_pct_schema::*,
    update_perp_market_status_schema::*, update_perp_market_step_size_and_tick_size_schema::*,
    update_perp_market_unrealized_asset_weight_schema::*, update_prelaunch_oracle_params_schema::*,
    update_prelaunch_oracle_schema::*, update_protected_maker_mode_config_schema::*,
    update_pyth_pull_oracle_schema::*, update_serum_fulfillment_config_status_schema::*,
    update_spot_auction_duration_schema::*, update_spot_fee_structure_schema::*,
    update_spot_market_asset_tier_schema::*, update_spot_market_borrow_rate_schema::*,
    update_spot_market_cumulative_interest_schema::*, update_spot_market_expiry_schema::*,
    update_spot_market_fee_adjustment_schema::*, update_spot_market_if_factor_schema::*,
    update_spot_market_if_paused_operations_schema::*,
    update_spot_market_liquidation_fee_schema::*, update_spot_market_margin_weights_schema::*,
    update_spot_market_max_token_borrows_schema::*,
    update_spot_market_max_token_deposits_schema::*, update_spot_market_min_order_size_schema::*,
    update_spot_market_name_schema::*, update_spot_market_oracle_schema::*,
    update_spot_market_orders_enabled_schema::*, update_spot_market_paused_operations_schema::*,
    update_spot_market_pool_id_schema::*, update_spot_market_revenue_settle_period_schema::*,
    update_spot_market_scale_initial_asset_weight_start_schema::*,
    update_spot_market_status_schema::*, update_spot_market_step_size_and_tick_size_schema::*,
    update_state_max_initialize_user_fee_schema::*,
    update_state_max_number_of_sub_accounts_schema::*, update_state_settlement_duration_schema::*,
    update_user_custom_margin_ratio_schema::*, update_user_delegate_schema::*,
    update_user_gov_token_insurance_stake_schema::*, update_user_idle_schema::*,
    update_user_margin_trading_enabled_schema::*, update_user_name_schema::*,
    update_user_perp_position_custom_margin_ratio_schema::*, update_user_pool_id_schema::*,
    update_user_protected_maker_orders_schema::*,
    update_user_quote_asset_insurance_stake_schema::*, update_user_reduce_only_schema::*,
    update_user_stats_referrer_status_schema::*, update_withdraw_guard_threshold_schema::*,
    view_lp_pool_add_liquidity_fees_schema::*, view_lp_pool_remove_liquidity_fees_schema::*,
    view_lp_pool_swap_fees_schema::*, withdraw_from_isolated_perp_position_schema::*,
    withdraw_from_program_vault_schema::*, withdraw_schema::*, zero_mm_oracle_fields_schema::*,
};

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "InstructionMetadata")]
pub struct InstructionMetadataGraphQL {
    pub signature: String,
    pub instruction_index: carbon_core::graphql::primitives::U32,
    pub stack_height: carbon_core::graphql::primitives::U32,
    pub slot: Option<carbon_core::graphql::primitives::U64>,
}

impl From<carbon_core::postgres::metadata::InstructionRowMetadata> for InstructionMetadataGraphQL {
    fn from(metadata: carbon_core::postgres::metadata::InstructionRowMetadata) -> Self {
        Self {
            signature: metadata.signature,
            instruction_index: carbon_core::graphql::primitives::U32(
                (*metadata.instruction_index) as u32,
            ),
            stack_height: carbon_core::graphql::primitives::U32((*metadata.stack_height) as u32),
            slot: metadata
                .slot
                .map(|v| carbon_core::graphql::primitives::U64(*v)),
        }
    }
}