@glamsystems/glam-sdk 0.1.20 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1422 @@
1
+ import { Keypair, PublicKey, Transaction, TransactionVersion, VersionedTransaction } from "@solana/web3.js";
2
+ import { BN } from "@coral-xyz/anchor";
3
+ export declare const ZERO: any;
4
+ export type MappedRecord<A extends Record<string, any>, B> = {
5
+ [K in keyof A]: B;
6
+ };
7
+ export declare enum ExchangeStatus {
8
+ ACTIVE = 0,
9
+ DEPOSIT_PAUSED = 1,
10
+ WITHDRAW_PAUSED = 2,
11
+ AMM_PAUSED = 4,
12
+ FILL_PAUSED = 8,
13
+ LIQ_PAUSED = 16,
14
+ FUNDING_PAUSED = 32,
15
+ SETTLE_PNL_PAUSED = 64,
16
+ AMM_IMMEDIATE_FILL_PAUSED = 128,
17
+ PAUSED = 255
18
+ }
19
+ export declare class MarketStatus {
20
+ static readonly INITIALIZED: {
21
+ initialized: {};
22
+ };
23
+ static readonly ACTIVE: {
24
+ active: {};
25
+ };
26
+ static readonly FUNDING_PAUSED: {
27
+ fundingPaused: {};
28
+ };
29
+ static readonly AMM_PAUSED: {
30
+ ammPaused: {};
31
+ };
32
+ static readonly FILL_PAUSED: {
33
+ fillPaused: {};
34
+ };
35
+ static readonly WITHDRAW_PAUSED: {
36
+ withdrawPaused: {};
37
+ };
38
+ static readonly REDUCE_ONLY: {
39
+ reduceOnly: {};
40
+ };
41
+ static readonly SETTLEMENT: {
42
+ settlement: {};
43
+ };
44
+ static readonly DELISTED: {
45
+ delisted: {};
46
+ };
47
+ }
48
+ export declare enum PerpOperation {
49
+ UPDATE_FUNDING = 1,
50
+ AMM_FILL = 2,
51
+ FILL = 4,
52
+ SETTLE_PNL = 8,
53
+ SETTLE_PNL_WITH_POSITION = 16,
54
+ LIQUIDATION = 32
55
+ }
56
+ export declare enum SpotOperation {
57
+ UPDATE_CUMULATIVE_INTEREST = 1,
58
+ FILL = 2,
59
+ DEPOSIT = 4,
60
+ WITHDRAW = 8,
61
+ LIQUIDATION = 16
62
+ }
63
+ export declare enum InsuranceFundOperation {
64
+ INIT = 1,
65
+ ADD = 2,
66
+ REQUEST_REMOVE = 4,
67
+ REMOVE = 8
68
+ }
69
+ export declare enum UserStatus {
70
+ BEING_LIQUIDATED = 1,
71
+ BANKRUPT = 2,
72
+ REDUCE_ONLY = 4,
73
+ ADVANCED_LP = 8,
74
+ PROTECTED_MAKER = 16
75
+ }
76
+ export declare class MarginMode {
77
+ static readonly DEFAULT: {
78
+ default: {};
79
+ };
80
+ static readonly HIGH_LEVERAGE: {
81
+ highLeverage: {};
82
+ };
83
+ }
84
+ export declare class ContractType {
85
+ static readonly PERPETUAL: {
86
+ perpetual: {};
87
+ };
88
+ static readonly FUTURE: {
89
+ future: {};
90
+ };
91
+ static readonly PREDICTION: {
92
+ prediction: {};
93
+ };
94
+ }
95
+ export declare class ContractTier {
96
+ static readonly A: {
97
+ a: {};
98
+ };
99
+ static readonly B: {
100
+ b: {};
101
+ };
102
+ static readonly C: {
103
+ c: {};
104
+ };
105
+ static readonly SPECULATIVE: {
106
+ speculative: {};
107
+ };
108
+ static readonly HIGHLY_SPECULATIVE: {
109
+ highlySpeculative: {};
110
+ };
111
+ static readonly ISOLATED: {
112
+ isolated: {};
113
+ };
114
+ }
115
+ export declare class AssetTier {
116
+ static readonly COLLATERAL: {
117
+ collateral: {};
118
+ };
119
+ static readonly PROTECTED: {
120
+ protected: {};
121
+ };
122
+ static readonly CROSS: {
123
+ cross: {};
124
+ };
125
+ static readonly ISOLATED: {
126
+ isolated: {};
127
+ };
128
+ static readonly UNLISTED: {
129
+ unlisted: {};
130
+ };
131
+ }
132
+ export declare class SwapDirection {
133
+ static readonly ADD: {
134
+ add: {};
135
+ };
136
+ static readonly REMOVE: {
137
+ remove: {};
138
+ };
139
+ }
140
+ export declare class SpotBalanceType {
141
+ static readonly DEPOSIT: {
142
+ deposit: {};
143
+ };
144
+ static readonly BORROW: {
145
+ borrow: {};
146
+ };
147
+ }
148
+ export declare class PositionDirection {
149
+ static readonly LONG: {
150
+ long: {};
151
+ };
152
+ static readonly SHORT: {
153
+ short: {};
154
+ };
155
+ }
156
+ export declare class DepositDirection {
157
+ static readonly DEPOSIT: {
158
+ deposit: {};
159
+ };
160
+ static readonly WITHDRAW: {
161
+ withdraw: {};
162
+ };
163
+ }
164
+ export declare class OracleSource {
165
+ static readonly PYTH: {
166
+ pyth: {};
167
+ };
168
+ static readonly PYTH_1K: {
169
+ pyth1K: {};
170
+ };
171
+ static readonly PYTH_1M: {
172
+ pyth1M: {};
173
+ };
174
+ static readonly PYTH_PULL: {
175
+ pythPull: {};
176
+ };
177
+ static readonly PYTH_1K_PULL: {
178
+ pyth1KPull: {};
179
+ };
180
+ static readonly PYTH_1M_PULL: {
181
+ pyth1MPull: {};
182
+ };
183
+ static readonly SWITCHBOARD: {
184
+ switchboard: {};
185
+ };
186
+ static readonly QUOTE_ASSET: {
187
+ quoteAsset: {};
188
+ };
189
+ static readonly PYTH_STABLE_COIN: {
190
+ pythStableCoin: {};
191
+ };
192
+ static readonly PYTH_STABLE_COIN_PULL: {
193
+ pythStableCoinPull: {};
194
+ };
195
+ static readonly Prelaunch: {
196
+ prelaunch: {};
197
+ };
198
+ static readonly SWITCHBOARD_ON_DEMAND: {
199
+ switchboardOnDemand: {};
200
+ };
201
+ static readonly PYTH_LAZER: {
202
+ pythLazer: {};
203
+ };
204
+ static readonly PYTH_LAZER_1K: {
205
+ pythLazer1K: {};
206
+ };
207
+ static readonly PYTH_LAZER_1M: {
208
+ pythLazer1M: {};
209
+ };
210
+ static readonly PYTH_LAZER_STABLE_COIN: {
211
+ pythLazerStableCoin: {};
212
+ };
213
+ static get(n: Number): any;
214
+ }
215
+ export declare class OracleSourceNum {
216
+ static readonly PYTH = 0;
217
+ static readonly PYTH_1K = 1;
218
+ static readonly PYTH_1M = 2;
219
+ static readonly PYTH_PULL = 3;
220
+ static readonly PYTH_1K_PULL = 4;
221
+ static readonly PYTH_1M_PULL = 5;
222
+ static readonly SWITCHBOARD = 6;
223
+ static readonly QUOTE_ASSET = 7;
224
+ static readonly PYTH_STABLE_COIN = 8;
225
+ static readonly PYTH_STABLE_COIN_PULL = 9;
226
+ static readonly PRELAUNCH = 10;
227
+ static readonly SWITCHBOARD_ON_DEMAND = 11;
228
+ static readonly PYTH_LAZER = 12;
229
+ static readonly PYTH_LAZER_1K = 13;
230
+ static readonly PYTH_LAZER_1M = 14;
231
+ static readonly PYTH_LAZER_STABLE_COIN = 15;
232
+ }
233
+ export declare class OrderType {
234
+ static readonly LIMIT: {
235
+ limit: {};
236
+ };
237
+ static readonly TRIGGER_MARKET: {
238
+ triggerMarket: {};
239
+ };
240
+ static readonly TRIGGER_LIMIT: {
241
+ triggerLimit: {};
242
+ };
243
+ static readonly MARKET: {
244
+ market: {};
245
+ };
246
+ static readonly ORACLE: {
247
+ oracle: {};
248
+ };
249
+ }
250
+ export declare type MarketTypeStr = "perp" | "spot";
251
+ export declare class MarketType {
252
+ static readonly SPOT: {
253
+ spot: {};
254
+ };
255
+ static readonly PERP: {
256
+ perp: {};
257
+ };
258
+ }
259
+ export declare class OrderStatus {
260
+ static readonly INIT: {
261
+ init: {};
262
+ };
263
+ static readonly OPEN: {
264
+ open: {};
265
+ };
266
+ static readonly FILLED: {
267
+ filled: {};
268
+ };
269
+ static readonly CANCELED: {
270
+ canceled: {};
271
+ };
272
+ }
273
+ export declare class OrderAction {
274
+ static readonly PLACE: {
275
+ place: {};
276
+ };
277
+ static readonly CANCEL: {
278
+ cancel: {};
279
+ };
280
+ static readonly EXPIRE: {
281
+ expire: {};
282
+ };
283
+ static readonly FILL: {
284
+ fill: {};
285
+ };
286
+ static readonly TRIGGER: {
287
+ trigger: {};
288
+ };
289
+ }
290
+ export declare class OrderActionExplanation {
291
+ static readonly NONE: {
292
+ none: {};
293
+ };
294
+ static readonly INSUFFICIENT_FREE_COLLATERAL: {
295
+ insufficientFreeCollateral: {};
296
+ };
297
+ static readonly ORACLE_PRICE_BREACHED_LIMIT_PRICE: {
298
+ oraclePriceBreachedLimitPrice: {};
299
+ };
300
+ static readonly MARKET_ORDER_FILLED_TO_LIMIT_PRICE: {
301
+ marketOrderFilledToLimitPrice: {};
302
+ };
303
+ static readonly ORDER_EXPIRED: {
304
+ orderExpired: {};
305
+ };
306
+ static readonly LIQUIDATION: {
307
+ liquidation: {};
308
+ };
309
+ static readonly ORDER_FILLED_WITH_AMM: {
310
+ orderFilledWithAmm: {};
311
+ };
312
+ static readonly ORDER_FILLED_WITH_AMM_JIT: {
313
+ orderFilledWithAmmJit: {};
314
+ };
315
+ static readonly ORDER_FILLED_WITH_AMM_JIT_LP_SPLIT: {
316
+ orderFilledWithAmmJitLpSplit: {};
317
+ };
318
+ static readonly ORDER_FILLED_WITH_LP_JIT: {
319
+ orderFilledWithLpJit: {};
320
+ };
321
+ static readonly ORDER_FILLED_WITH_MATCH: {
322
+ orderFilledWithMatch: {};
323
+ };
324
+ static readonly ORDER_FILLED_WITH_MATCH_JIT: {
325
+ orderFilledWithMatchJit: {};
326
+ };
327
+ static readonly MARKET_EXPIRED: {
328
+ marketExpired: {};
329
+ };
330
+ static readonly RISK_INCREASING_ORDER: {
331
+ riskingIncreasingOrder: {};
332
+ };
333
+ static readonly ORDER_FILLED_WITH_SERUM: {
334
+ orderFillWithSerum: {};
335
+ };
336
+ static readonly ORDER_FILLED_WITH_OPENBOOK_V2: {
337
+ orderFilledWithOpenbookV2: {};
338
+ };
339
+ static readonly ORDER_FILLED_WITH_PHOENIX: {
340
+ orderFillWithPhoenix: {};
341
+ };
342
+ static readonly REDUCE_ONLY_ORDER_INCREASED_POSITION: {
343
+ reduceOnlyOrderIncreasedPosition: {};
344
+ };
345
+ static readonly DERISK_LP: {
346
+ deriskLp: {};
347
+ };
348
+ static readonly TRANSFER_PERP_POSITION: {
349
+ transferPerpPosition: {};
350
+ };
351
+ }
352
+ export declare class OrderTriggerCondition {
353
+ static readonly ABOVE: {
354
+ above: {};
355
+ };
356
+ static readonly BELOW: {
357
+ below: {};
358
+ };
359
+ static readonly TRIGGERED_ABOVE: {
360
+ triggeredAbove: {};
361
+ };
362
+ static readonly TRIGGERED_BELOW: {
363
+ triggeredBelow: {};
364
+ };
365
+ }
366
+ export declare class SpotFulfillmentType {
367
+ static readonly EXTERNAL: {
368
+ external: {};
369
+ };
370
+ static readonly MATCH: {
371
+ match: {};
372
+ };
373
+ }
374
+ export declare class SpotFulfillmentStatus {
375
+ static readonly ENABLED: {
376
+ enabled: {};
377
+ };
378
+ static readonly DISABLED: {
379
+ disabled: {};
380
+ };
381
+ }
382
+ export declare class DepositExplanation {
383
+ static readonly NONE: {
384
+ none: {};
385
+ };
386
+ static readonly TRANSFER: {
387
+ transfer: {};
388
+ };
389
+ static readonly BORROW: {
390
+ borrow: {};
391
+ };
392
+ static readonly REPAY_BORROW: {
393
+ repayBorrow: {};
394
+ };
395
+ }
396
+ export declare class SettlePnlExplanation {
397
+ static readonly NONE: {
398
+ none: {};
399
+ };
400
+ static readonly EXPIRED_POSITION: {
401
+ expiredPosition: {};
402
+ };
403
+ }
404
+ export declare class SpotFulfillmentConfigStatus {
405
+ static readonly ENABLED: {
406
+ enabled: {};
407
+ };
408
+ static readonly DISABLED: {
409
+ disabled: {};
410
+ };
411
+ }
412
+ export declare class StakeAction {
413
+ static readonly STAKE: {
414
+ stake: {};
415
+ };
416
+ static readonly UNSTAKE_REQUEST: {
417
+ unstakeRequest: {};
418
+ };
419
+ static readonly UNSTAKE_CANCEL_REQUEST: {
420
+ unstakeCancelRequest: {};
421
+ };
422
+ static readonly UNSTAKE: {
423
+ unstake: {};
424
+ };
425
+ static readonly UNSTAKE_TRANSFER: {
426
+ unstakeTransfer: {};
427
+ };
428
+ static readonly STAKE_TRANSFER: {
429
+ stakeTransfer: {};
430
+ };
431
+ }
432
+ export declare class SettlePnlMode {
433
+ static readonly TRY_SETTLE: {
434
+ trySettle: {};
435
+ };
436
+ static readonly MUST_SETTLE: {
437
+ mustSettle: {};
438
+ };
439
+ }
440
+ export declare function isVariant(object: any, type: string): any;
441
+ export declare function isOneOfVariant(object: any, types: string[]): any;
442
+ export declare function getVariant(object: any): string;
443
+ export declare enum TradeSide {
444
+ None = 0,
445
+ Buy = 1,
446
+ Sell = 2
447
+ }
448
+ export type CandleResolution = "1" | "5" | "15" | "60" | "240" | "D" | "W" | "M";
449
+ export type NewUserRecord = {
450
+ ts: BN;
451
+ userAuthority: PublicKey;
452
+ user: PublicKey;
453
+ subAccountId: number;
454
+ name: number[];
455
+ referrer: PublicKey;
456
+ };
457
+ export type DepositRecord = {
458
+ ts: BN;
459
+ userAuthority: PublicKey;
460
+ user: PublicKey;
461
+ direction: {
462
+ deposit?: any;
463
+ withdraw?: any;
464
+ };
465
+ marketIndex: number;
466
+ amount: BN;
467
+ oraclePrice: BN;
468
+ marketDepositBalance: BN;
469
+ marketWithdrawBalance: BN;
470
+ marketCumulativeDepositInterest: BN;
471
+ marketCumulativeBorrowInterest: BN;
472
+ totalDepositsAfter: BN;
473
+ totalWithdrawsAfter: BN;
474
+ depositRecordId: BN;
475
+ explanation: DepositExplanation;
476
+ transferUser?: PublicKey;
477
+ };
478
+ export type SpotInterestRecord = {
479
+ ts: BN;
480
+ marketIndex: number;
481
+ depositBalance: BN;
482
+ cumulativeDepositInterest: BN;
483
+ borrowBalance: BN;
484
+ cumulativeBorrowInterest: BN;
485
+ optimalUtilization: number;
486
+ optimalBorrowRate: number;
487
+ maxBorrowRate: number;
488
+ };
489
+ export type CurveRecord = {
490
+ ts: BN;
491
+ recordId: BN;
492
+ marketIndex: number;
493
+ pegMultiplierBefore: BN;
494
+ baseAssetReserveBefore: BN;
495
+ quoteAssetReserveBefore: BN;
496
+ sqrtKBefore: BN;
497
+ pegMultiplierAfter: BN;
498
+ baseAssetReserveAfter: BN;
499
+ quoteAssetReserveAfter: BN;
500
+ sqrtKAfter: BN;
501
+ baseAssetAmountLong: BN;
502
+ baseAssetAmountShort: BN;
503
+ baseAssetAmountWithAmm: BN;
504
+ totalFee: BN;
505
+ totalFeeMinusDistributions: BN;
506
+ adjustmentCost: BN;
507
+ numberOfUsers: BN;
508
+ oraclePrice: BN;
509
+ fillRecord: BN;
510
+ };
511
+ export declare type InsuranceFundRecord = {
512
+ ts: BN;
513
+ spotMarketIndex: number;
514
+ perpMarketIndex: number;
515
+ userIfFactor: number;
516
+ totalIfFactor: number;
517
+ vaultAmountBefore: BN;
518
+ insuranceVaultAmountBefore: BN;
519
+ totalIfSharesBefore: BN;
520
+ totalIfSharesAfter: BN;
521
+ amount: BN;
522
+ };
523
+ export declare type InsuranceFundStakeRecord = {
524
+ ts: BN;
525
+ userAuthority: PublicKey;
526
+ action: StakeAction;
527
+ amount: BN;
528
+ marketIndex: number;
529
+ insuranceVaultAmountBefore: BN;
530
+ ifSharesBefore: BN;
531
+ userIfSharesBefore: BN;
532
+ totalIfSharesBefore: BN;
533
+ ifSharesAfter: BN;
534
+ userIfSharesAfter: BN;
535
+ totalIfSharesAfter: BN;
536
+ };
537
+ export type LPRecord = {
538
+ ts: BN;
539
+ user: PublicKey;
540
+ action: LPAction;
541
+ nShares: BN;
542
+ marketIndex: number;
543
+ deltaBaseAssetAmount: BN;
544
+ deltaQuoteAssetAmount: BN;
545
+ pnl: BN;
546
+ };
547
+ export declare class LPAction {
548
+ static readonly ADD_LIQUIDITY: {
549
+ addLiquidity: {};
550
+ };
551
+ static readonly REMOVE_LIQUIDITY: {
552
+ removeLiquidity: {};
553
+ };
554
+ static readonly SETTLE_LIQUIDITY: {
555
+ settleLiquidity: {};
556
+ };
557
+ static readonly REMOVE_LIQUIDITY_DERISK: {
558
+ removeLiquidityDerisk: {};
559
+ };
560
+ }
561
+ export type FundingRateRecord = {
562
+ ts: BN;
563
+ recordId: BN;
564
+ marketIndex: number;
565
+ fundingRate: BN;
566
+ fundingRateLong: BN;
567
+ fundingRateShort: BN;
568
+ cumulativeFundingRateLong: BN;
569
+ cumulativeFundingRateShort: BN;
570
+ oraclePriceTwap: BN;
571
+ markPriceTwap: BN;
572
+ periodRevenue: BN;
573
+ baseAssetAmountWithAmm: BN;
574
+ baseAssetAmountWithUnsettledLp: BN;
575
+ };
576
+ export type FundingPaymentRecord = {
577
+ ts: BN;
578
+ userAuthority: PublicKey;
579
+ user: PublicKey;
580
+ marketIndex: number;
581
+ fundingPayment: BN;
582
+ baseAssetAmount: BN;
583
+ userLastCumulativeFunding: BN;
584
+ ammCumulativeFundingLong: BN;
585
+ ammCumulativeFundingShort: BN;
586
+ };
587
+ export type LiquidationRecord = {
588
+ ts: BN;
589
+ user: PublicKey;
590
+ liquidator: PublicKey;
591
+ liquidationType: LiquidationType;
592
+ marginRequirement: BN;
593
+ totalCollateral: BN;
594
+ marginFreed: BN;
595
+ liquidationId: number;
596
+ bankrupt: boolean;
597
+ canceledOrderIds: BN[];
598
+ liquidatePerp: LiquidatePerpRecord;
599
+ liquidateSpot: LiquidateSpotRecord;
600
+ liquidateBorrowForPerpPnl: LiquidateBorrowForPerpPnlRecord;
601
+ liquidatePerpPnlForDeposit: LiquidatePerpPnlForDepositRecord;
602
+ perpBankruptcy: PerpBankruptcyRecord;
603
+ spotBankruptcy: SpotBankruptcyRecord;
604
+ };
605
+ export declare class LiquidationType {
606
+ static readonly LIQUIDATE_PERP: {
607
+ liquidatePerp: {};
608
+ };
609
+ static readonly LIQUIDATE_BORROW_FOR_PERP_PNL: {
610
+ liquidateBorrowForPerpPnl: {};
611
+ };
612
+ static readonly LIQUIDATE_PERP_PNL_FOR_DEPOSIT: {
613
+ liquidatePerpPnlForDeposit: {};
614
+ };
615
+ static readonly PERP_BANKRUPTCY: {
616
+ perpBankruptcy: {};
617
+ };
618
+ static readonly SPOT_BANKRUPTCY: {
619
+ spotBankruptcy: {};
620
+ };
621
+ static readonly LIQUIDATE_SPOT: {
622
+ liquidateSpot: {};
623
+ };
624
+ }
625
+ export type LiquidatePerpRecord = {
626
+ marketIndex: number;
627
+ oraclePrice: BN;
628
+ baseAssetAmount: BN;
629
+ quoteAssetAmount: BN;
630
+ lpShares: BN;
631
+ userOrderId: BN;
632
+ liquidatorOrderId: BN;
633
+ fillRecordId: BN;
634
+ liquidatorFee: BN;
635
+ ifFee: BN;
636
+ };
637
+ export type LiquidateSpotRecord = {
638
+ assetMarketIndex: number;
639
+ assetPrice: BN;
640
+ assetTransfer: BN;
641
+ liabilityMarketIndex: number;
642
+ liabilityPrice: BN;
643
+ liabilityTransfer: BN;
644
+ ifFee: BN;
645
+ };
646
+ export type LiquidateBorrowForPerpPnlRecord = {
647
+ perpMarketIndex: number;
648
+ marketOraclePrice: BN;
649
+ pnlTransfer: BN;
650
+ liabilityMarketIndex: number;
651
+ liabilityPrice: BN;
652
+ liabilityTransfer: BN;
653
+ };
654
+ export type LiquidatePerpPnlForDepositRecord = {
655
+ perpMarketIndex: number;
656
+ marketOraclePrice: BN;
657
+ pnlTransfer: BN;
658
+ assetMarketIndex: number;
659
+ assetPrice: BN;
660
+ assetTransfer: BN;
661
+ };
662
+ export type PerpBankruptcyRecord = {
663
+ marketIndex: number;
664
+ pnl: BN;
665
+ ifPayment: BN;
666
+ clawbackUser: PublicKey | null;
667
+ clawbackUserPayment: BN | null;
668
+ cumulativeFundingRateDelta: BN;
669
+ };
670
+ export type SpotBankruptcyRecord = {
671
+ marketIndex: number;
672
+ borrowAmount: BN;
673
+ cumulativeDepositInterestDelta: BN;
674
+ ifPayment: BN;
675
+ };
676
+ export type SettlePnlRecord = {
677
+ ts: BN;
678
+ user: PublicKey;
679
+ marketIndex: number;
680
+ pnl: BN;
681
+ baseAssetAmount: BN;
682
+ quoteAssetAmountAfter: BN;
683
+ quoteEntryAmount: BN;
684
+ settlePrice: BN;
685
+ explanation: SettlePnlExplanation;
686
+ };
687
+ export type SignedMsgOrderRecord = {
688
+ ts: BN;
689
+ user: PublicKey;
690
+ hash: string;
691
+ matchingOrderParams: OrderParams;
692
+ signedMsgOrderMaxSlot: BN;
693
+ signedMsgOrderUuid: Uint8Array;
694
+ userOrderId: number;
695
+ };
696
+ export type OrderRecord = {
697
+ ts: BN;
698
+ user: PublicKey;
699
+ order: Order;
700
+ };
701
+ export type OrderActionRecord = {
702
+ ts: BN;
703
+ action: OrderAction;
704
+ actionExplanation: OrderActionExplanation;
705
+ marketIndex: number;
706
+ marketType: MarketType;
707
+ filler: PublicKey | null;
708
+ fillerReward: BN | null;
709
+ fillRecordId: BN | null;
710
+ baseAssetAmountFilled: BN | null;
711
+ quoteAssetAmountFilled: BN | null;
712
+ takerFee: BN | null;
713
+ makerFee: BN | null;
714
+ referrerReward: number | null;
715
+ quoteAssetAmountSurplus: BN | null;
716
+ spotFulfillmentMethodFee: BN | null;
717
+ taker: PublicKey | null;
718
+ takerOrderId: number | null;
719
+ takerOrderDirection: PositionDirection | null;
720
+ takerOrderBaseAssetAmount: BN | null;
721
+ takerOrderCumulativeBaseAssetAmountFilled: BN | null;
722
+ takerOrderCumulativeQuoteAssetAmountFilled: BN | null;
723
+ maker: PublicKey | null;
724
+ makerOrderId: number | null;
725
+ makerOrderDirection: PositionDirection | null;
726
+ makerOrderBaseAssetAmount: BN | null;
727
+ makerOrderCumulativeBaseAssetAmountFilled: BN | null;
728
+ makerOrderCumulativeQuoteAssetAmountFilled: BN | null;
729
+ oraclePrice: BN;
730
+ };
731
+ export type SwapRecord = {
732
+ ts: BN;
733
+ user: PublicKey;
734
+ amountOut: BN;
735
+ amountIn: BN;
736
+ outMarketIndex: number;
737
+ inMarketIndex: number;
738
+ outOraclePrice: BN;
739
+ inOraclePrice: BN;
740
+ fee: BN;
741
+ };
742
+ export type SpotMarketVaultDepositRecord = {
743
+ ts: BN;
744
+ marketIndex: number;
745
+ depositBalance: BN;
746
+ cumulativeDepositInterestBefore: BN;
747
+ cumulativeDepositInterestAfter: BN;
748
+ depositTokenAmountBefore: BN;
749
+ amount: BN;
750
+ };
751
+ export type DeleteUserRecord = {
752
+ ts: BN;
753
+ userAuthority: PublicKey;
754
+ user: PublicKey;
755
+ subAccountId: number;
756
+ keeper: PublicKey | null;
757
+ };
758
+ export type FuelSeasonRecord = {
759
+ ts: BN;
760
+ authority: PublicKey;
761
+ fuelInsurance: BN;
762
+ fuelDeposits: BN;
763
+ fuelBorrows: BN;
764
+ fuelPositions: BN;
765
+ fuelTaker: BN;
766
+ fuelMaker: BN;
767
+ fuelTotal: BN;
768
+ };
769
+ export type FuelSweepRecord = {
770
+ ts: BN;
771
+ authority: PublicKey;
772
+ userStatsFuelInsurance: BN;
773
+ userStatsFuelDeposits: BN;
774
+ userStatsFuelBorrows: BN;
775
+ userStatsFuelPositions: BN;
776
+ userStatsFuelTaker: BN;
777
+ userStatsFuelMaker: BN;
778
+ fuelOverflowFuelInsurance: BN;
779
+ fuelOverflowFuelDeposits: BN;
780
+ fuelOverflowFuelBorrows: BN;
781
+ fuelOverflowFuelPositions: BN;
782
+ fuelOverflowFuelTaker: BN;
783
+ fuelOverflowFuelMaker: BN;
784
+ };
785
+ export type PerpMarketAccount = {
786
+ status: MarketStatus;
787
+ contractType: ContractType;
788
+ contractTier: ContractTier;
789
+ expiryTs: BN;
790
+ expiryPrice: BN;
791
+ marketIndex: number;
792
+ pubkey: PublicKey;
793
+ name: number[];
794
+ amm: AMM;
795
+ numberOfUsersWithBase: number;
796
+ numberOfUsers: number;
797
+ marginRatioInitial: number;
798
+ marginRatioMaintenance: number;
799
+ nextFillRecordId: BN;
800
+ nextFundingRateRecordId: BN;
801
+ nextCurveRecordId: BN;
802
+ pnlPool: PoolBalance;
803
+ liquidatorFee: number;
804
+ ifLiquidationFee: number;
805
+ imfFactor: number;
806
+ unrealizedPnlImfFactor: number;
807
+ unrealizedPnlMaxImbalance: BN;
808
+ unrealizedPnlInitialAssetWeight: number;
809
+ unrealizedPnlMaintenanceAssetWeight: number;
810
+ insuranceClaim: {
811
+ revenueWithdrawSinceLastSettle: BN;
812
+ maxRevenueWithdrawPerPeriod: BN;
813
+ lastRevenueWithdrawTs: BN;
814
+ quoteSettledInsurance: BN;
815
+ quoteMaxInsurance: BN;
816
+ };
817
+ quoteSpotMarketIndex: number;
818
+ feeAdjustment: number;
819
+ pausedOperations: number;
820
+ fuelBoostTaker: number;
821
+ fuelBoostMaker: number;
822
+ fuelBoostPosition: number;
823
+ highLeverageMarginRatioInitial: number;
824
+ highLeverageMarginRatioMaintenance: number;
825
+ };
826
+ export type HistoricalOracleData = {
827
+ lastOraclePrice: BN;
828
+ lastOracleDelay: BN;
829
+ lastOracleConf: BN;
830
+ lastOraclePriceTwap: BN;
831
+ lastOraclePriceTwap5Min: BN;
832
+ lastOraclePriceTwapTs: BN;
833
+ };
834
+ export type HistoricalIndexData = {
835
+ lastIndexBidPrice: BN;
836
+ lastIndexAskPrice: BN;
837
+ lastIndexPriceTwap: BN;
838
+ lastIndexPriceTwap5Min: BN;
839
+ lastIndexPriceTwapTs: BN;
840
+ };
841
+ export type SpotMarketAccount = {
842
+ status: MarketStatus;
843
+ assetTier: AssetTier;
844
+ name: number[];
845
+ marketIndex: number;
846
+ pubkey: PublicKey;
847
+ mint: PublicKey;
848
+ vault: PublicKey;
849
+ oracle: PublicKey;
850
+ oracleSource: OracleSource;
851
+ historicalOracleData: HistoricalOracleData;
852
+ historicalIndexData: HistoricalIndexData;
853
+ insuranceFund: {
854
+ vault: PublicKey;
855
+ totalShares: BN;
856
+ userShares: BN;
857
+ sharesBase: BN;
858
+ unstakingPeriod: BN;
859
+ lastRevenueSettleTs: BN;
860
+ revenueSettlePeriod: BN;
861
+ totalFactor: number;
862
+ userFactor: number;
863
+ };
864
+ revenuePool: PoolBalance;
865
+ ifLiquidationFee: number;
866
+ decimals: number;
867
+ optimalUtilization: number;
868
+ optimalBorrowRate: number;
869
+ maxBorrowRate: number;
870
+ cumulativeDepositInterest: BN;
871
+ cumulativeBorrowInterest: BN;
872
+ totalSocialLoss: BN;
873
+ totalQuoteSocialLoss: BN;
874
+ depositBalance: BN;
875
+ borrowBalance: BN;
876
+ maxTokenDeposits: BN;
877
+ lastInterestTs: BN;
878
+ lastTwapTs: BN;
879
+ initialAssetWeight: number;
880
+ maintenanceAssetWeight: number;
881
+ initialLiabilityWeight: number;
882
+ maintenanceLiabilityWeight: number;
883
+ liquidatorFee: number;
884
+ imfFactor: number;
885
+ scaleInitialAssetWeightStart: BN;
886
+ withdrawGuardThreshold: BN;
887
+ depositTokenTwap: BN;
888
+ borrowTokenTwap: BN;
889
+ utilizationTwap: BN;
890
+ nextDepositRecordId: BN;
891
+ orderStepSize: BN;
892
+ orderTickSize: BN;
893
+ minOrderSize: BN;
894
+ maxPositionSize: BN;
895
+ nextFillRecordId: BN;
896
+ spotFeePool: PoolBalance;
897
+ totalSpotFee: BN;
898
+ totalSwapFee: BN;
899
+ flashLoanAmount: BN;
900
+ flashLoanInitialTokenAmount: BN;
901
+ ordersEnabled: boolean;
902
+ pausedOperations: number;
903
+ ifPausedOperations: number;
904
+ maxTokenBorrowsFraction: number;
905
+ minBorrowRate: number;
906
+ fuelBoostDeposits: number;
907
+ fuelBoostBorrows: number;
908
+ fuelBoostTaker: number;
909
+ fuelBoostMaker: number;
910
+ fuelBoostInsurance: number;
911
+ tokenProgram: number;
912
+ poolId: number;
913
+ };
914
+ export type PoolBalance = {
915
+ scaledBalance: BN;
916
+ marketIndex: number;
917
+ };
918
+ export type AMM = {
919
+ baseAssetReserve: BN;
920
+ sqrtK: BN;
921
+ cumulativeFundingRate: BN;
922
+ lastFundingRate: BN;
923
+ lastFundingRateTs: BN;
924
+ lastMarkPriceTwap: BN;
925
+ lastMarkPriceTwap5Min: BN;
926
+ lastMarkPriceTwapTs: BN;
927
+ lastTradeTs: BN;
928
+ oracle: PublicKey;
929
+ oracleSource: OracleSource;
930
+ historicalOracleData: HistoricalOracleData;
931
+ lastOracleReservePriceSpreadPct: BN;
932
+ lastOracleConfPct: BN;
933
+ fundingPeriod: BN;
934
+ quoteAssetReserve: BN;
935
+ pegMultiplier: BN;
936
+ cumulativeFundingRateLong: BN;
937
+ cumulativeFundingRateShort: BN;
938
+ last24HAvgFundingRate: BN;
939
+ lastFundingRateShort: BN;
940
+ lastFundingRateLong: BN;
941
+ totalLiquidationFee: BN;
942
+ totalFeeMinusDistributions: BN;
943
+ totalFeeWithdrawn: BN;
944
+ totalFee: BN;
945
+ totalFeeEarnedPerLp: BN;
946
+ userLpShares: BN;
947
+ baseAssetAmountWithUnsettledLp: BN;
948
+ orderStepSize: BN;
949
+ orderTickSize: BN;
950
+ maxFillReserveFraction: number;
951
+ maxSlippageRatio: number;
952
+ baseSpread: number;
953
+ curveUpdateIntensity: number;
954
+ baseAssetAmountWithAmm: BN;
955
+ baseAssetAmountLong: BN;
956
+ baseAssetAmountShort: BN;
957
+ quoteAssetAmount: BN;
958
+ terminalQuoteAssetReserve: BN;
959
+ concentrationCoef: BN;
960
+ feePool: PoolBalance;
961
+ totalExchangeFee: BN;
962
+ totalMmFee: BN;
963
+ netRevenueSinceLastFunding: BN;
964
+ lastUpdateSlot: BN;
965
+ lastOracleNormalisedPrice: BN;
966
+ lastOracleValid: boolean;
967
+ lastBidPriceTwap: BN;
968
+ lastAskPriceTwap: BN;
969
+ longSpread: number;
970
+ shortSpread: number;
971
+ maxSpread: number;
972
+ baseAssetAmountPerLp: BN;
973
+ quoteAssetAmountPerLp: BN;
974
+ targetBaseAssetAmountPerLp: number;
975
+ ammJitIntensity: number;
976
+ maxOpenInterest: BN;
977
+ maxBaseAssetReserve: BN;
978
+ minBaseAssetReserve: BN;
979
+ totalSocialLoss: BN;
980
+ quoteBreakEvenAmountLong: BN;
981
+ quoteBreakEvenAmountShort: BN;
982
+ quoteEntryAmountLong: BN;
983
+ quoteEntryAmountShort: BN;
984
+ markStd: BN;
985
+ oracleStd: BN;
986
+ longIntensityCount: number;
987
+ longIntensityVolume: BN;
988
+ shortIntensityCount: number;
989
+ shortIntensityVolume: BN;
990
+ volume24H: BN;
991
+ minOrderSize: BN;
992
+ maxPositionSize: BN;
993
+ bidBaseAssetReserve: BN;
994
+ bidQuoteAssetReserve: BN;
995
+ askBaseAssetReserve: BN;
996
+ askQuoteAssetReserve: BN;
997
+ perLpBase: number;
998
+ netUnsettledFundingPnl: BN;
999
+ quoteAssetAmountWithUnsettledLp: BN;
1000
+ referencePriceOffset: number;
1001
+ };
1002
+ export type PerpPosition = {
1003
+ baseAssetAmount: BN;
1004
+ lastCumulativeFundingRate: BN;
1005
+ marketIndex: number;
1006
+ quoteAssetAmount: BN;
1007
+ quoteEntryAmount: BN;
1008
+ quoteBreakEvenAmount: BN;
1009
+ openOrders: number;
1010
+ openBids: BN;
1011
+ openAsks: BN;
1012
+ settledPnl: BN;
1013
+ lpShares: BN;
1014
+ remainderBaseAssetAmount: number;
1015
+ lastBaseAssetAmountPerLp: BN;
1016
+ lastQuoteAssetAmountPerLp: BN;
1017
+ perLpBase: number;
1018
+ };
1019
+ export type UserStatsAccount = {
1020
+ numberOfSubAccounts: number;
1021
+ numberOfSubAccountsCreated: number;
1022
+ makerVolume30D: BN;
1023
+ takerVolume30D: BN;
1024
+ fillerVolume30D: BN;
1025
+ lastMakerVolume30DTs: BN;
1026
+ lastTakerVolume30DTs: BN;
1027
+ lastFillerVolume30DTs: BN;
1028
+ fees: {
1029
+ totalFeePaid: BN;
1030
+ totalFeeRebate: BN;
1031
+ totalTokenDiscount: BN;
1032
+ totalRefereeDiscount: BN;
1033
+ totalReferrerReward: BN;
1034
+ current_epoch_referrer_reward: BN;
1035
+ };
1036
+ referrer: PublicKey;
1037
+ referrerStatus: number;
1038
+ authority: PublicKey;
1039
+ ifStakedQuoteAssetAmount: BN;
1040
+ lastFuelIfBonusUpdateTs: number;
1041
+ fuelOverflowStatus: number;
1042
+ fuelInsurance: number;
1043
+ fuelDeposits: number;
1044
+ fuelBorrows: number;
1045
+ fuelPositions: number;
1046
+ fuelTaker: number;
1047
+ fuelMaker: number;
1048
+ ifStakedGovTokenAmount: BN;
1049
+ };
1050
+ export type FuelOverflowAccount = {
1051
+ authority: PublicKey;
1052
+ fuelInsurance: BN;
1053
+ fuelDeposits: BN;
1054
+ fuelBorrows: BN;
1055
+ fuelPositions: BN;
1056
+ fuelTaker: BN;
1057
+ fuelMaker: BN;
1058
+ lastFuelSweepTs: number;
1059
+ lastResetTs: number;
1060
+ padding: number[];
1061
+ };
1062
+ export type UserAccount = {
1063
+ authority: PublicKey;
1064
+ delegate: PublicKey;
1065
+ name: number[];
1066
+ subAccountId: number;
1067
+ spotPositions: SpotPosition[];
1068
+ perpPositions: PerpPosition[];
1069
+ orders: Order[];
1070
+ status: number;
1071
+ nextLiquidationId: number;
1072
+ nextOrderId: number;
1073
+ maxMarginRatio: number;
1074
+ lastAddPerpLpSharesTs: BN;
1075
+ settledPerpPnl: BN;
1076
+ totalDeposits: BN;
1077
+ totalWithdraws: BN;
1078
+ totalSocialLoss: BN;
1079
+ cumulativePerpFunding: BN;
1080
+ cumulativeSpotFees: BN;
1081
+ liquidationMarginFreed: BN;
1082
+ lastActiveSlot: BN;
1083
+ isMarginTradingEnabled: boolean;
1084
+ idle: boolean;
1085
+ openOrders: number;
1086
+ hasOpenOrder: boolean;
1087
+ openAuctions: number;
1088
+ hasOpenAuction: boolean;
1089
+ lastFuelBonusUpdateTs: number;
1090
+ marginMode: MarginMode;
1091
+ poolId: number;
1092
+ };
1093
+ export type SpotPosition = {
1094
+ marketIndex: number;
1095
+ balanceType: SpotBalanceType;
1096
+ scaledBalance: BN;
1097
+ openOrders: number;
1098
+ openBids: BN;
1099
+ openAsks: BN;
1100
+ cumulativeDeposits: BN;
1101
+ };
1102
+ export type Order = {
1103
+ status: OrderStatus;
1104
+ orderType: OrderType;
1105
+ marketType: MarketType;
1106
+ slot: BN;
1107
+ orderId: number;
1108
+ userOrderId: number;
1109
+ marketIndex: number;
1110
+ price: BN;
1111
+ baseAssetAmount: BN;
1112
+ quoteAssetAmount: BN;
1113
+ baseAssetAmountFilled: BN;
1114
+ quoteAssetAmountFilled: BN;
1115
+ direction: PositionDirection;
1116
+ reduceOnly: boolean;
1117
+ triggerPrice: BN;
1118
+ triggerCondition: OrderTriggerCondition;
1119
+ existingPositionDirection: PositionDirection;
1120
+ postOnly: boolean;
1121
+ immediateOrCancel: boolean;
1122
+ oraclePriceOffset: number;
1123
+ auctionDuration: number;
1124
+ auctionStartPrice: BN;
1125
+ auctionEndPrice: BN;
1126
+ maxTs: BN;
1127
+ bitFlags: number;
1128
+ postedSlotTail: number;
1129
+ };
1130
+ export type OrderParams = {
1131
+ orderType: OrderType;
1132
+ marketType: MarketType;
1133
+ userOrderId: number;
1134
+ direction: PositionDirection;
1135
+ baseAssetAmount: BN;
1136
+ price: BN;
1137
+ marketIndex: number;
1138
+ reduceOnly: boolean;
1139
+ postOnly: PostOnlyParams;
1140
+ immediateOrCancel: boolean;
1141
+ triggerPrice: BN | null;
1142
+ triggerCondition: OrderTriggerCondition;
1143
+ oraclePriceOffset: number | null;
1144
+ auctionDuration: number | null;
1145
+ maxTs: BN | null;
1146
+ auctionStartPrice: BN | null;
1147
+ auctionEndPrice: BN | null;
1148
+ };
1149
+ export declare class PostOnlyParams {
1150
+ static readonly NONE: {
1151
+ none: {};
1152
+ };
1153
+ static readonly MUST_POST_ONLY: {
1154
+ mustPostOnly: {};
1155
+ };
1156
+ static readonly TRY_POST_ONLY: {
1157
+ tryPostOnly: {};
1158
+ };
1159
+ static readonly SLIDE: {
1160
+ slide: {};
1161
+ };
1162
+ }
1163
+ export type NecessaryOrderParams = {
1164
+ orderType: OrderType;
1165
+ marketIndex: number;
1166
+ baseAssetAmount: BN;
1167
+ direction: PositionDirection;
1168
+ };
1169
+ export type OptionalOrderParams = {
1170
+ [Property in keyof OrderParams]?: OrderParams[Property];
1171
+ } & NecessaryOrderParams;
1172
+ export type ModifyOrderParams = {
1173
+ [Property in keyof OrderParams]?: OrderParams[Property] | null;
1174
+ } & {
1175
+ policy?: ModifyOrderPolicy;
1176
+ };
1177
+ export declare enum ModifyOrderPolicy {
1178
+ MustModify = 1,
1179
+ ExcludePreviousFill = 2
1180
+ }
1181
+ export declare const DefaultOrderParams: OrderParams;
1182
+ export type SignedMsgOrderParamsMessage = {
1183
+ signedMsgOrderParams: OptionalOrderParams;
1184
+ subAccountId: number;
1185
+ slot: BN;
1186
+ uuid: Uint8Array;
1187
+ takeProfitOrderParams: SignedMsgTriggerOrderParams | null;
1188
+ stopLossOrderParams: SignedMsgTriggerOrderParams | null;
1189
+ };
1190
+ export type SignedMsgTriggerOrderParams = {
1191
+ triggerPrice: BN;
1192
+ baseAssetAmount: BN;
1193
+ };
1194
+ export type MakerInfo = {
1195
+ maker: PublicKey;
1196
+ makerStats: PublicKey;
1197
+ makerUserAccount: UserAccount;
1198
+ order?: Order;
1199
+ };
1200
+ export type TakerInfo = {
1201
+ taker: PublicKey;
1202
+ takerStats: PublicKey;
1203
+ takerUserAccount: UserAccount;
1204
+ order: Order;
1205
+ };
1206
+ export type ReferrerInfo = {
1207
+ referrer: PublicKey;
1208
+ referrerStats: PublicKey;
1209
+ };
1210
+ export declare enum ReferrerStatus {
1211
+ IsReferrer = 1,
1212
+ IsReferred = 2
1213
+ }
1214
+ export declare enum FuelOverflowStatus {
1215
+ Exists = 1
1216
+ }
1217
+ export declare enum PlaceAndTakeOrderSuccessCondition {
1218
+ PartialFill = 1,
1219
+ FullFill = 2
1220
+ }
1221
+ type ExactType<T> = Pick<T, keyof T>;
1222
+ export type BaseTxParams = ExactType<{
1223
+ computeUnits?: number;
1224
+ computeUnitsPrice?: number;
1225
+ }>;
1226
+ export type ProcessingTxParams = {
1227
+ useSimulatedComputeUnits?: boolean;
1228
+ computeUnitsBufferMultiplier?: number;
1229
+ useSimulatedComputeUnitsForCUPriceCalculation?: boolean;
1230
+ getCUPriceFromComputeUnits?: (computeUnits: number) => number;
1231
+ lowerBoundCu?: number;
1232
+ };
1233
+ export type TxParams = BaseTxParams & ProcessingTxParams;
1234
+ export declare class SwapReduceOnly {
1235
+ static readonly In: {
1236
+ in: {};
1237
+ };
1238
+ static readonly Out: {
1239
+ out: {};
1240
+ };
1241
+ }
1242
+ export interface IWallet {
1243
+ signTransaction(tx: Transaction): Promise<Transaction>;
1244
+ signAllTransactions(txs: Transaction[]): Promise<Transaction[]>;
1245
+ publicKey: PublicKey;
1246
+ payer?: Keypair;
1247
+ supportedTransactionVersions?: ReadonlySet<TransactionVersion> | null | undefined;
1248
+ }
1249
+ export interface IVersionedWallet {
1250
+ signVersionedTransaction(tx: VersionedTransaction): Promise<VersionedTransaction>;
1251
+ signAllVersionedTransactions(txs: VersionedTransaction[]): Promise<VersionedTransaction[]>;
1252
+ publicKey: PublicKey;
1253
+ payer?: Keypair;
1254
+ }
1255
+ export type FeeTier = {
1256
+ feeNumerator: number;
1257
+ feeDenominator: number;
1258
+ makerRebateNumerator: number;
1259
+ makerRebateDenominator: number;
1260
+ referrerRewardNumerator: number;
1261
+ referrerRewardDenominator: number;
1262
+ refereeFeeNumerator: number;
1263
+ refereeFeeDenominator: number;
1264
+ };
1265
+ export type OrderFillerRewardStructure = {
1266
+ rewardNumerator: BN;
1267
+ rewardDenominator: BN;
1268
+ timeBasedRewardLowerBound: BN;
1269
+ };
1270
+ export type OracleGuardRails = {
1271
+ priceDivergence: {
1272
+ markOraclePercentDivergence: BN;
1273
+ oracleTwap5MinPercentDivergence: BN;
1274
+ };
1275
+ validity: {
1276
+ slotsBeforeStaleForAmm: BN;
1277
+ slotsBeforeStaleForMargin: BN;
1278
+ confidenceIntervalMaxSize: BN;
1279
+ tooVolatileRatio: BN;
1280
+ };
1281
+ };
1282
+ export type PrelaunchOracle = {
1283
+ price: BN;
1284
+ maxPrice: BN;
1285
+ confidence: BN;
1286
+ ammLastUpdateSlot: BN;
1287
+ lastUpdateSlot: BN;
1288
+ perpMarketIndex: number;
1289
+ };
1290
+ export type MarginCategory = "Initial" | "Maintenance";
1291
+ export type InsuranceFundStake = {
1292
+ costBasis: BN;
1293
+ marketIndex: number;
1294
+ authority: PublicKey;
1295
+ ifShares: BN;
1296
+ ifBase: BN;
1297
+ lastWithdrawRequestShares: BN;
1298
+ lastWithdrawRequestValue: BN;
1299
+ lastWithdrawRequestTs: BN;
1300
+ };
1301
+ export type SerumV3FulfillmentConfigAccount = {
1302
+ fulfillmentType: SpotFulfillmentType;
1303
+ status: SpotFulfillmentStatus;
1304
+ pubkey: PublicKey;
1305
+ marketIndex: number;
1306
+ serumProgramId: PublicKey;
1307
+ serumMarket: PublicKey;
1308
+ serumRequestQueue: PublicKey;
1309
+ serumEventQueue: PublicKey;
1310
+ serumBids: PublicKey;
1311
+ serumAsks: PublicKey;
1312
+ serumBaseVault: PublicKey;
1313
+ serumQuoteVault: PublicKey;
1314
+ serumOpenOrders: PublicKey;
1315
+ serumSignerNonce: BN;
1316
+ };
1317
+ export type PhoenixV1FulfillmentConfigAccount = {
1318
+ pubkey: PublicKey;
1319
+ phoenixProgramId: PublicKey;
1320
+ phoenixLogAuthority: PublicKey;
1321
+ phoenixMarket: PublicKey;
1322
+ phoenixBaseVault: PublicKey;
1323
+ phoenixQuoteVault: PublicKey;
1324
+ marketIndex: number;
1325
+ fulfillmentType: SpotFulfillmentType;
1326
+ status: SpotFulfillmentStatus;
1327
+ };
1328
+ export type OpenbookV2FulfillmentConfigAccount = {
1329
+ pubkey: PublicKey;
1330
+ openbookV2ProgramId: PublicKey;
1331
+ openbookV2Market: PublicKey;
1332
+ openbookV2MarketAuthority: PublicKey;
1333
+ openbookV2EventHeap: PublicKey;
1334
+ openbookV2Bids: PublicKey;
1335
+ openbookV2Asks: PublicKey;
1336
+ openbookV2BaseVault: PublicKey;
1337
+ openbookV2QuoteVault: PublicKey;
1338
+ marketIndex: number;
1339
+ fulfillmentType: SpotFulfillmentType;
1340
+ status: SpotFulfillmentStatus;
1341
+ remainingAccounts?: PublicKey[];
1342
+ };
1343
+ export type ReferrerNameAccount = {
1344
+ name: number[];
1345
+ user: PublicKey;
1346
+ authority: PublicKey;
1347
+ userStats: PublicKey;
1348
+ };
1349
+ export type PerpMarketExtendedInfo = {
1350
+ marketIndex: number;
1351
+ /**
1352
+ * Min order size measured in base asset, using base precision
1353
+ */
1354
+ minOrderSize: BN;
1355
+ /**
1356
+ * Margin maintenance percentage, using margin precision (1e4)
1357
+ */
1358
+ marginMaintenance: number;
1359
+ /**
1360
+ * Max insurance available, measured in quote asset, using quote preicision
1361
+ */
1362
+ availableInsurance: BN;
1363
+ /**
1364
+ * Pnl pool available, this is measured in quote asset, using quote precision.
1365
+ * Should be generated by using getTokenAmount and passing in the scaled balance of the base asset + quote spot account
1366
+ */
1367
+ pnlPoolValue: BN;
1368
+ contractTier: ContractTier;
1369
+ };
1370
+ export type HealthComponents = {
1371
+ deposits: HealthComponent[];
1372
+ borrows: HealthComponent[];
1373
+ perpPositions: HealthComponent[];
1374
+ perpPnl: HealthComponent[];
1375
+ };
1376
+ export type HealthComponent = {
1377
+ marketIndex: number;
1378
+ size: BN;
1379
+ value: BN;
1380
+ weight: BN;
1381
+ weightedValue: BN;
1382
+ };
1383
+ export interface DriftClientMetricsEvents {
1384
+ txSigned: SignedTxData[];
1385
+ preTxSigned: void;
1386
+ }
1387
+ export type SignedTxData = {
1388
+ txSig: string;
1389
+ signedTx: Transaction | VersionedTransaction;
1390
+ lastValidBlockHeight?: number;
1391
+ blockHash: string;
1392
+ };
1393
+ export type HighLeverageModeConfig = {
1394
+ maxUsers: number;
1395
+ currentUsers: number;
1396
+ reduceOnly: boolean;
1397
+ };
1398
+ export type ProtectedMakerModeConfig = {
1399
+ maxUsers: number;
1400
+ currentUsers: number;
1401
+ reduceOnly: boolean;
1402
+ };
1403
+ export interface SignedMsgOrderParams {
1404
+ /**
1405
+ * The encoded order params that were signed (borsh encoded then hexified).
1406
+ */
1407
+ orderParams: Buffer;
1408
+ /**
1409
+ * The signature generated for the orderParams
1410
+ */
1411
+ signature: Buffer;
1412
+ }
1413
+ export type SignedMsgOrderId = {
1414
+ maxSlot: BN;
1415
+ uuid: Uint8Array;
1416
+ orderId: number;
1417
+ };
1418
+ export type SignedMsgUserOrdersAccount = {
1419
+ authorityPubkey: PublicKey;
1420
+ signedMsgOrderData: SignedMsgOrderId[];
1421
+ };
1422
+ export {};