flash-sdk 1.0.29 → 1.0.31

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.
@@ -1,12 +1,13 @@
1
1
  /// <reference types="bn.js" />
2
2
  /// <reference types="node" />
3
3
  import { Program, AnchorProvider, BN } from "@coral-xyz/anchor";
4
- import { PublicKey, TransactionInstruction, Commitment, Signer } from "@solana/web3.js";
4
+ import { PublicKey, TransactionInstruction, Commitment, Signer, AddressLookupTableAccount } from "@solana/web3.js";
5
5
  import { PoolAccount } from "./PoolAccount";
6
6
  import { AumCalcMode, BorrowRateParams, Fees, OracleParams, Permissions, Position, PositionSide, PricingParams, Side, TokenRatios } from "./types";
7
7
  import { OraclePrice } from "./OraclePrice";
8
8
  import { CustodyAccount } from "./CustodyAccount";
9
9
  import { Perpetuals } from "./idl/perpetuals";
10
+ import { SendTransactionOpts } from "./utils/rpc";
10
11
  import { PoolConfig } from "./PoolConfig";
11
12
  export type PerpClientOptions = {
12
13
  postSendTxCallback?: ({ txid }: {
@@ -32,10 +33,16 @@ export declare class PerpetualsClient {
32
33
  publicKey: PublicKey;
33
34
  bump: number;
34
35
  };
36
+ addressLookupTables: AddressLookupTableAccount[];
37
+ eventAuthority: {
38
+ publicKey: PublicKey;
39
+ bump: number;
40
+ };
35
41
  private postSendTxCallback?;
36
42
  private prioritizationFee;
37
43
  private txConfirmationCommitment;
38
44
  constructor(provider: AnchorProvider, programId: PublicKey, opts: PerpClientOptions);
45
+ loadAddressLookupTable: (poolConfig: PoolConfig) => Promise<void>;
39
46
  findProgramAddress: (label: string, extraSeeds?: any) => {
40
47
  publicKey: PublicKey;
41
48
  bump: number;
@@ -47,13 +54,17 @@ export declare class PerpetualsClient {
47
54
  tokenAccount: PublicKey;
48
55
  decimals: number;
49
56
  isStable: boolean;
57
+ isVirtual: boolean;
50
58
  oracle: {
51
59
  oracleAccount: PublicKey;
60
+ customOracleAccount: PublicKey;
52
61
  oracleType: {
53
62
  none?: Record<string, never>;
54
- test?: Record<string, never>;
63
+ custom?: Record<string, never>;
55
64
  pyth?: Record<string, never>;
65
+ backup?: Record<string, never>;
56
66
  };
67
+ maxDifferenceThreshold: BN;
57
68
  maxPriceError: BN;
58
69
  maxPriceAgeSec: number;
59
70
  };
@@ -66,19 +77,12 @@ export declare class PerpetualsClient {
66
77
  minInitialLeverage: BN;
67
78
  maxInitialLeverage: BN;
68
79
  maxLeverage: BN;
80
+ minCollateralUsd: BN;
81
+ minTimeSeconds: BN;
69
82
  maxPayoffMult: BN;
70
83
  maxUtilization: BN;
71
84
  maxPositionLockedUsd: BN;
72
85
  maxTotalLockedUsd: BN;
73
- } | {
74
- useEma: boolean;
75
- useUnrealizedPnlInAum: boolean;
76
- tradeSpreadLong: BN;
77
- tradeSpreadShort: BN;
78
- swapSpread: BN;
79
- minInitialLeverage: BN;
80
- maxLeverage: BN;
81
- maxPayoffMult: BN;
82
86
  };
83
87
  permissions: {
84
88
  allowSwap: boolean;
@@ -97,14 +101,45 @@ export declare class PerpetualsClient {
97
101
  };
98
102
  ratioMult: BN;
99
103
  utilizationMult: BN;
100
- swapIn: BN;
101
- swapOut: BN;
102
- stableSwapIn: BN;
103
- stableSwapOut: BN;
104
- addLiquidity: BN;
105
- removeLiquidity: BN;
104
+ swapIn: {
105
+ baseRate: BN;
106
+ slope1: BN;
107
+ constant1: BN;
108
+ slope2: BN;
109
+ constant2: BN;
110
+ minFee: BN;
111
+ maxFee: BN;
112
+ };
113
+ swapOut: {
114
+ baseRate: BN;
115
+ slope1: BN;
116
+ constant1: BN;
117
+ slope2: BN;
118
+ constant2: BN;
119
+ minFee: BN;
120
+ maxFee: BN;
121
+ };
122
+ addLiquidity: {
123
+ baseRate: BN;
124
+ slope1: BN;
125
+ constant1: BN;
126
+ slope2: BN;
127
+ constant2: BN;
128
+ minFee: BN;
129
+ maxFee: BN;
130
+ };
131
+ removeLiquidity: {
132
+ baseRate: BN;
133
+ slope1: BN;
134
+ constant1: BN;
135
+ slope2: BN;
136
+ constant2: BN;
137
+ minFee: BN;
138
+ maxFee: BN;
139
+ };
106
140
  openPosition: BN;
107
141
  closePosition: BN;
142
+ removeCollateral: BN;
108
143
  liquidation: BN;
109
144
  protocolShare: BN;
110
145
  };
@@ -139,28 +174,32 @@ export declare class PerpetualsClient {
139
174
  tradeStats: {
140
175
  profitUsd: BN;
141
176
  lossUsd: BN;
142
- oiLongUsd: BN;
143
- oiShortUsd: BN;
177
+ oiLong: BN;
178
+ oiShort: BN;
144
179
  };
145
180
  longPositions: {
146
181
  openPositions: BN;
147
182
  collateralUsd: BN;
148
183
  sizeUsd: BN;
184
+ borrowSizeUsd: BN;
149
185
  lockedAmount: BN;
150
186
  weightedPrice: BN;
151
187
  totalQuantity: BN;
152
188
  cumulativeInterestUsd: BN;
153
189
  cumulativeInterestSnapshot: BN;
190
+ collateralAmount: BN;
154
191
  };
155
192
  shortPositions: {
156
193
  openPositions: BN;
157
194
  collateralUsd: BN;
158
195
  sizeUsd: BN;
196
+ borrowSizeUsd: BN;
159
197
  lockedAmount: BN;
160
198
  weightedPrice: BN;
161
199
  totalQuantity: BN;
162
200
  cumulativeInterestUsd: BN;
163
201
  cumulativeInterestSnapshot: BN;
202
+ collateralAmount: BN;
164
203
  };
165
204
  borrowRateState: {
166
205
  currentRate: BN;
@@ -176,10 +215,11 @@ export declare class PerpetualsClient {
176
215
  instructionDataLen: number;
177
216
  instructionHash: BN;
178
217
  signers: PublicKey[];
179
- signed: boolean[];
218
+ signed: number[];
180
219
  price: BN;
181
220
  expo: number;
182
221
  conf: BN;
222
+ ema: BN;
183
223
  publishTime: BN;
184
224
  pools: PublicKey[];
185
225
  transferAuthorityBump: number;
@@ -195,7 +235,9 @@ export declare class PerpetualsClient {
195
235
  aumUsd: BN;
196
236
  lpTokenBump: number;
197
237
  owner: PublicKey;
238
+ payer: PublicKey;
198
239
  custody: PublicKey;
240
+ collateralCustody: PublicKey;
199
241
  openTime: BN;
200
242
  updateTime: BN;
201
243
  side: {
@@ -204,6 +246,7 @@ export declare class PerpetualsClient {
204
246
  short?: Record<string, never>;
205
247
  };
206
248
  sizeUsd: BN;
249
+ borrowSizeUsd: BN;
207
250
  collateralUsd: BN;
208
251
  unrealizedProfitUsd: BN;
209
252
  unrealizedLossUsd: BN;
@@ -218,13 +261,17 @@ export declare class PerpetualsClient {
218
261
  tokenAccount: PublicKey;
219
262
  decimals: number;
220
263
  isStable: boolean;
264
+ isVirtual: boolean;
221
265
  oracle: {
222
266
  oracleAccount: PublicKey;
267
+ customOracleAccount: PublicKey;
223
268
  oracleType: {
224
269
  none?: Record<string, never>;
225
- test?: Record<string, never>;
270
+ custom?: Record<string, never>;
226
271
  pyth?: Record<string, never>;
272
+ backup?: Record<string, never>;
227
273
  };
274
+ maxDifferenceThreshold: BN;
228
275
  maxPriceError: BN;
229
276
  maxPriceAgeSec: number;
230
277
  };
@@ -237,19 +284,12 @@ export declare class PerpetualsClient {
237
284
  minInitialLeverage: BN;
238
285
  maxInitialLeverage: BN;
239
286
  maxLeverage: BN;
287
+ minCollateralUsd: BN;
288
+ minTimeSeconds: BN;
240
289
  maxPayoffMult: BN;
241
290
  maxUtilization: BN;
242
291
  maxPositionLockedUsd: BN;
243
292
  maxTotalLockedUsd: BN;
244
- } | {
245
- useEma: boolean;
246
- useUnrealizedPnlInAum: boolean;
247
- tradeSpreadLong: BN;
248
- tradeSpreadShort: BN;
249
- swapSpread: BN;
250
- minInitialLeverage: BN;
251
- maxLeverage: BN;
252
- maxPayoffMult: BN;
253
293
  };
254
294
  permissions: {
255
295
  allowSwap: boolean;
@@ -268,14 +308,45 @@ export declare class PerpetualsClient {
268
308
  };
269
309
  ratioMult: BN;
270
310
  utilizationMult: BN;
271
- swapIn: BN;
272
- swapOut: BN;
273
- stableSwapIn: BN;
274
- stableSwapOut: BN;
275
- addLiquidity: BN;
276
- removeLiquidity: BN;
311
+ swapIn: {
312
+ baseRate: BN;
313
+ slope1: BN;
314
+ constant1: BN;
315
+ slope2: BN;
316
+ constant2: BN;
317
+ minFee: BN;
318
+ maxFee: BN;
319
+ };
320
+ swapOut: {
321
+ baseRate: BN;
322
+ slope1: BN;
323
+ constant1: BN;
324
+ slope2: BN;
325
+ constant2: BN;
326
+ minFee: BN;
327
+ maxFee: BN;
328
+ };
329
+ addLiquidity: {
330
+ baseRate: BN;
331
+ slope1: BN;
332
+ constant1: BN;
333
+ slope2: BN;
334
+ constant2: BN;
335
+ minFee: BN;
336
+ maxFee: BN;
337
+ };
338
+ removeLiquidity: {
339
+ baseRate: BN;
340
+ slope1: BN;
341
+ constant1: BN;
342
+ slope2: BN;
343
+ constant2: BN;
344
+ minFee: BN;
345
+ maxFee: BN;
346
+ };
277
347
  openPosition: BN;
278
348
  closePosition: BN;
349
+ removeCollateral: BN;
279
350
  liquidation: BN;
280
351
  protocolShare: BN;
281
352
  };
@@ -310,28 +381,32 @@ export declare class PerpetualsClient {
310
381
  tradeStats: {
311
382
  profitUsd: BN;
312
383
  lossUsd: BN;
313
- oiLongUsd: BN;
314
- oiShortUsd: BN;
384
+ oiLong: BN;
385
+ oiShort: BN;
315
386
  };
316
387
  longPositions: {
317
388
  openPositions: BN;
318
389
  collateralUsd: BN;
319
390
  sizeUsd: BN;
391
+ borrowSizeUsd: BN;
320
392
  lockedAmount: BN;
321
393
  weightedPrice: BN;
322
394
  totalQuantity: BN;
323
395
  cumulativeInterestUsd: BN;
324
396
  cumulativeInterestSnapshot: BN;
397
+ collateralAmount: BN;
325
398
  };
326
399
  shortPositions: {
327
400
  openPositions: BN;
328
401
  collateralUsd: BN;
329
402
  sizeUsd: BN;
403
+ borrowSizeUsd: BN;
330
404
  lockedAmount: BN;
331
405
  weightedPrice: BN;
332
406
  totalQuantity: BN;
333
407
  cumulativeInterestUsd: BN;
334
408
  cumulativeInterestSnapshot: BN;
409
+ collateralAmount: BN;
335
410
  };
336
411
  borrowRateState: {
337
412
  currentRate: BN;
@@ -347,10 +422,11 @@ export declare class PerpetualsClient {
347
422
  instructionDataLen: number;
348
423
  instructionHash: BN;
349
424
  signers: PublicKey[];
350
- signed: boolean[];
425
+ signed: number[];
351
426
  price: BN;
352
427
  expo: number;
353
428
  conf: BN;
429
+ ema: BN;
354
430
  publishTime: BN;
355
431
  pools: PublicKey[];
356
432
  transferAuthorityBump: number;
@@ -366,7 +442,9 @@ export declare class PerpetualsClient {
366
442
  aumUsd: BN;
367
443
  lpTokenBump: number;
368
444
  owner: PublicKey;
445
+ payer: PublicKey;
369
446
  custody: PublicKey;
447
+ collateralCustody: PublicKey;
370
448
  openTime: BN;
371
449
  updateTime: BN;
372
450
  side: {
@@ -375,6 +453,7 @@ export declare class PerpetualsClient {
375
453
  short?: Record<string, never>;
376
454
  };
377
455
  sizeUsd: BN;
456
+ borrowSizeUsd: BN;
378
457
  collateralUsd: BN;
379
458
  unrealizedProfitUsd: BN;
380
459
  unrealizedLossUsd: BN;
@@ -388,13 +467,17 @@ export declare class PerpetualsClient {
388
467
  tokenAccount: PublicKey;
389
468
  decimals: number;
390
469
  isStable: boolean;
470
+ isVirtual: boolean;
391
471
  oracle: {
392
472
  oracleAccount: PublicKey;
473
+ customOracleAccount: PublicKey;
393
474
  oracleType: {
394
475
  none?: Record<string, never>;
395
- test?: Record<string, never>;
476
+ custom?: Record<string, never>;
396
477
  pyth?: Record<string, never>;
478
+ backup?: Record<string, never>;
397
479
  };
480
+ maxDifferenceThreshold: BN;
398
481
  maxPriceError: BN;
399
482
  maxPriceAgeSec: number;
400
483
  };
@@ -407,19 +490,12 @@ export declare class PerpetualsClient {
407
490
  minInitialLeverage: BN;
408
491
  maxInitialLeverage: BN;
409
492
  maxLeverage: BN;
493
+ minCollateralUsd: BN;
494
+ minTimeSeconds: BN;
410
495
  maxPayoffMult: BN;
411
496
  maxUtilization: BN;
412
497
  maxPositionLockedUsd: BN;
413
498
  maxTotalLockedUsd: BN;
414
- } | {
415
- useEma: boolean;
416
- useUnrealizedPnlInAum: boolean;
417
- tradeSpreadLong: BN;
418
- tradeSpreadShort: BN;
419
- swapSpread: BN;
420
- minInitialLeverage: BN;
421
- maxLeverage: BN;
422
- maxPayoffMult: BN;
423
499
  };
424
500
  permissions: {
425
501
  allowSwap: boolean;
@@ -438,14 +514,45 @@ export declare class PerpetualsClient {
438
514
  };
439
515
  ratioMult: BN;
440
516
  utilizationMult: BN;
441
- swapIn: BN;
442
- swapOut: BN;
443
- stableSwapIn: BN;
444
- stableSwapOut: BN;
445
- addLiquidity: BN;
446
- removeLiquidity: BN;
517
+ swapIn: {
518
+ baseRate: BN;
519
+ slope1: BN;
520
+ constant1: BN;
521
+ slope2: BN;
522
+ constant2: BN;
523
+ minFee: BN;
524
+ maxFee: BN;
525
+ };
526
+ swapOut: {
527
+ baseRate: BN;
528
+ slope1: BN;
529
+ constant1: BN;
530
+ slope2: BN;
531
+ constant2: BN;
532
+ minFee: BN;
533
+ maxFee: BN;
534
+ };
535
+ addLiquidity: {
536
+ baseRate: BN;
537
+ slope1: BN;
538
+ constant1: BN;
539
+ slope2: BN;
540
+ constant2: BN;
541
+ minFee: BN;
542
+ maxFee: BN;
543
+ };
544
+ removeLiquidity: {
545
+ baseRate: BN;
546
+ slope1: BN;
547
+ constant1: BN;
548
+ slope2: BN;
549
+ constant2: BN;
550
+ minFee: BN;
551
+ maxFee: BN;
552
+ };
447
553
  openPosition: BN;
448
554
  closePosition: BN;
555
+ removeCollateral: BN;
449
556
  liquidation: BN;
450
557
  protocolShare: BN;
451
558
  };
@@ -480,28 +587,32 @@ export declare class PerpetualsClient {
480
587
  tradeStats: {
481
588
  profitUsd: BN;
482
589
  lossUsd: BN;
483
- oiLongUsd: BN;
484
- oiShortUsd: BN;
590
+ oiLong: BN;
591
+ oiShort: BN;
485
592
  };
486
593
  longPositions: {
487
594
  openPositions: BN;
488
595
  collateralUsd: BN;
489
596
  sizeUsd: BN;
597
+ borrowSizeUsd: BN;
490
598
  lockedAmount: BN;
491
599
  weightedPrice: BN;
492
600
  totalQuantity: BN;
493
601
  cumulativeInterestUsd: BN;
494
602
  cumulativeInterestSnapshot: BN;
603
+ collateralAmount: BN;
495
604
  };
496
605
  shortPositions: {
497
606
  openPositions: BN;
498
607
  collateralUsd: BN;
499
608
  sizeUsd: BN;
609
+ borrowSizeUsd: BN;
500
610
  lockedAmount: BN;
501
611
  weightedPrice: BN;
502
612
  totalQuantity: BN;
503
613
  cumulativeInterestUsd: BN;
504
614
  cumulativeInterestSnapshot: BN;
615
+ collateralAmount: BN;
505
616
  };
506
617
  borrowRateState: {
507
618
  currentRate: BN;
@@ -517,10 +628,11 @@ export declare class PerpetualsClient {
517
628
  instructionDataLen: number;
518
629
  instructionHash: BN;
519
630
  signers: PublicKey[];
520
- signed: boolean[];
631
+ signed: number[];
521
632
  price: BN;
522
633
  expo: number;
523
634
  conf: BN;
635
+ ema: BN;
524
636
  publishTime: BN;
525
637
  pools: PublicKey[];
526
638
  transferAuthorityBump: number;
@@ -536,7 +648,9 @@ export declare class PerpetualsClient {
536
648
  aumUsd: BN;
537
649
  lpTokenBump: number;
538
650
  owner: PublicKey;
651
+ payer: PublicKey;
539
652
  custody: PublicKey;
653
+ collateralCustody: PublicKey;
540
654
  openTime: BN;
541
655
  updateTime: BN;
542
656
  side: {
@@ -545,6 +659,7 @@ export declare class PerpetualsClient {
545
659
  short?: Record<string, never>;
546
660
  };
547
661
  sizeUsd: BN;
662
+ borrowSizeUsd: BN;
548
663
  collateralUsd: BN;
549
664
  unrealizedProfitUsd: BN;
550
665
  unrealizedLossUsd: BN;
@@ -563,13 +678,17 @@ export declare class PerpetualsClient {
563
678
  tokenAccount: PublicKey;
564
679
  decimals: number;
565
680
  isStable: boolean;
681
+ isVirtual: boolean;
566
682
  oracle: {
567
683
  oracleAccount: PublicKey;
684
+ customOracleAccount: PublicKey;
568
685
  oracleType: {
569
686
  none?: Record<string, never>;
570
- test?: Record<string, never>;
687
+ custom?: Record<string, never>;
571
688
  pyth?: Record<string, never>;
689
+ backup?: Record<string, never>;
572
690
  };
691
+ maxDifferenceThreshold: BN;
573
692
  maxPriceError: BN;
574
693
  maxPriceAgeSec: number;
575
694
  };
@@ -582,19 +701,12 @@ export declare class PerpetualsClient {
582
701
  minInitialLeverage: BN;
583
702
  maxInitialLeverage: BN;
584
703
  maxLeverage: BN;
704
+ minCollateralUsd: BN;
705
+ minTimeSeconds: BN;
585
706
  maxPayoffMult: BN;
586
707
  maxUtilization: BN;
587
708
  maxPositionLockedUsd: BN;
588
709
  maxTotalLockedUsd: BN;
589
- } | {
590
- useEma: boolean;
591
- useUnrealizedPnlInAum: boolean;
592
- tradeSpreadLong: BN;
593
- tradeSpreadShort: BN;
594
- swapSpread: BN;
595
- minInitialLeverage: BN;
596
- maxLeverage: BN;
597
- maxPayoffMult: BN;
598
710
  };
599
711
  permissions: {
600
712
  allowSwap: boolean;
@@ -613,14 +725,45 @@ export declare class PerpetualsClient {
613
725
  };
614
726
  ratioMult: BN;
615
727
  utilizationMult: BN;
616
- swapIn: BN;
617
- swapOut: BN;
618
- stableSwapIn: BN;
619
- stableSwapOut: BN;
620
- addLiquidity: BN;
621
- removeLiquidity: BN;
728
+ swapIn: {
729
+ baseRate: BN;
730
+ slope1: BN;
731
+ constant1: BN;
732
+ slope2: BN;
733
+ constant2: BN;
734
+ minFee: BN;
735
+ maxFee: BN;
736
+ };
737
+ swapOut: {
738
+ baseRate: BN;
739
+ slope1: BN;
740
+ constant1: BN;
741
+ slope2: BN;
742
+ constant2: BN;
743
+ minFee: BN;
744
+ maxFee: BN;
745
+ };
746
+ addLiquidity: {
747
+ baseRate: BN;
748
+ slope1: BN;
749
+ constant1: BN;
750
+ slope2: BN;
751
+ constant2: BN;
752
+ minFee: BN;
753
+ maxFee: BN;
754
+ };
755
+ removeLiquidity: {
756
+ baseRate: BN;
757
+ slope1: BN;
758
+ constant1: BN;
759
+ slope2: BN;
760
+ constant2: BN;
761
+ minFee: BN;
762
+ maxFee: BN;
763
+ };
622
764
  openPosition: BN;
623
765
  closePosition: BN;
766
+ removeCollateral: BN;
624
767
  liquidation: BN;
625
768
  protocolShare: BN;
626
769
  };
@@ -655,28 +798,32 @@ export declare class PerpetualsClient {
655
798
  tradeStats: {
656
799
  profitUsd: BN;
657
800
  lossUsd: BN;
658
- oiLongUsd: BN;
659
- oiShortUsd: BN;
801
+ oiLong: BN;
802
+ oiShort: BN;
660
803
  };
661
804
  longPositions: {
662
805
  openPositions: BN;
663
806
  collateralUsd: BN;
664
807
  sizeUsd: BN;
808
+ borrowSizeUsd: BN;
665
809
  lockedAmount: BN;
666
810
  weightedPrice: BN;
667
811
  totalQuantity: BN;
668
812
  cumulativeInterestUsd: BN;
669
813
  cumulativeInterestSnapshot: BN;
814
+ collateralAmount: BN;
670
815
  };
671
816
  shortPositions: {
672
817
  openPositions: BN;
673
818
  collateralUsd: BN;
674
819
  sizeUsd: BN;
820
+ borrowSizeUsd: BN;
675
821
  lockedAmount: BN;
676
822
  weightedPrice: BN;
677
823
  totalQuantity: BN;
678
824
  cumulativeInterestUsd: BN;
679
825
  cumulativeInterestSnapshot: BN;
826
+ collateralAmount: BN;
680
827
  };
681
828
  borrowRateState: {
682
829
  currentRate: BN;
@@ -692,10 +839,11 @@ export declare class PerpetualsClient {
692
839
  instructionDataLen: number;
693
840
  instructionHash: BN;
694
841
  signers: PublicKey[];
695
- signed: boolean[];
842
+ signed: number[];
696
843
  price: BN;
697
844
  expo: number;
698
845
  conf: BN;
846
+ ema: BN;
699
847
  publishTime: BN;
700
848
  pools: PublicKey[];
701
849
  transferAuthorityBump: number;
@@ -711,7 +859,9 @@ export declare class PerpetualsClient {
711
859
  aumUsd: BN;
712
860
  lpTokenBump: number;
713
861
  owner: PublicKey;
862
+ payer: PublicKey;
714
863
  custody: PublicKey;
864
+ collateralCustody: PublicKey;
715
865
  openTime: BN;
716
866
  updateTime: BN;
717
867
  side: {
@@ -720,6 +870,7 @@ export declare class PerpetualsClient {
720
870
  short?: Record<string, never>;
721
871
  };
722
872
  sizeUsd: BN;
873
+ borrowSizeUsd: BN;
723
874
  collateralUsd: BN;
724
875
  unrealizedProfitUsd: BN;
725
876
  unrealizedLossUsd: BN;
@@ -733,13 +884,17 @@ export declare class PerpetualsClient {
733
884
  tokenAccount: PublicKey;
734
885
  decimals: number;
735
886
  isStable: boolean;
887
+ isVirtual: boolean;
736
888
  oracle: {
737
889
  oracleAccount: PublicKey;
890
+ customOracleAccount: PublicKey;
738
891
  oracleType: {
739
892
  none?: Record<string, never>;
740
- test?: Record<string, never>;
893
+ custom?: Record<string, never>;
741
894
  pyth?: Record<string, never>;
895
+ backup?: Record<string, never>;
742
896
  };
897
+ maxDifferenceThreshold: BN;
743
898
  maxPriceError: BN;
744
899
  maxPriceAgeSec: number;
745
900
  };
@@ -752,19 +907,12 @@ export declare class PerpetualsClient {
752
907
  minInitialLeverage: BN;
753
908
  maxInitialLeverage: BN;
754
909
  maxLeverage: BN;
910
+ minCollateralUsd: BN;
911
+ minTimeSeconds: BN;
755
912
  maxPayoffMult: BN;
756
913
  maxUtilization: BN;
757
914
  maxPositionLockedUsd: BN;
758
915
  maxTotalLockedUsd: BN;
759
- } | {
760
- useEma: boolean;
761
- useUnrealizedPnlInAum: boolean;
762
- tradeSpreadLong: BN;
763
- tradeSpreadShort: BN;
764
- swapSpread: BN;
765
- minInitialLeverage: BN;
766
- maxLeverage: BN;
767
- maxPayoffMult: BN;
768
916
  };
769
917
  permissions: {
770
918
  allowSwap: boolean;
@@ -783,14 +931,45 @@ export declare class PerpetualsClient {
783
931
  };
784
932
  ratioMult: BN;
785
933
  utilizationMult: BN;
786
- swapIn: BN;
787
- swapOut: BN;
788
- stableSwapIn: BN;
789
- stableSwapOut: BN;
790
- addLiquidity: BN;
791
- removeLiquidity: BN;
934
+ swapIn: {
935
+ baseRate: BN;
936
+ slope1: BN;
937
+ constant1: BN;
938
+ slope2: BN;
939
+ constant2: BN;
940
+ minFee: BN;
941
+ maxFee: BN;
942
+ };
943
+ swapOut: {
944
+ baseRate: BN;
945
+ slope1: BN;
946
+ constant1: BN;
947
+ slope2: BN;
948
+ constant2: BN;
949
+ minFee: BN;
950
+ maxFee: BN;
951
+ };
952
+ addLiquidity: {
953
+ baseRate: BN;
954
+ slope1: BN;
955
+ constant1: BN;
956
+ slope2: BN;
957
+ constant2: BN;
958
+ minFee: BN;
959
+ maxFee: BN;
960
+ };
961
+ removeLiquidity: {
962
+ baseRate: BN;
963
+ slope1: BN;
964
+ constant1: BN;
965
+ slope2: BN;
966
+ constant2: BN;
967
+ minFee: BN;
968
+ maxFee: BN;
969
+ };
792
970
  openPosition: BN;
793
971
  closePosition: BN;
972
+ removeCollateral: BN;
794
973
  liquidation: BN;
795
974
  protocolShare: BN;
796
975
  };
@@ -825,28 +1004,32 @@ export declare class PerpetualsClient {
825
1004
  tradeStats: {
826
1005
  profitUsd: BN;
827
1006
  lossUsd: BN;
828
- oiLongUsd: BN;
829
- oiShortUsd: BN;
1007
+ oiLong: BN;
1008
+ oiShort: BN;
830
1009
  };
831
1010
  longPositions: {
832
1011
  openPositions: BN;
833
1012
  collateralUsd: BN;
834
1013
  sizeUsd: BN;
1014
+ borrowSizeUsd: BN;
835
1015
  lockedAmount: BN;
836
1016
  weightedPrice: BN;
837
1017
  totalQuantity: BN;
838
1018
  cumulativeInterestUsd: BN;
839
1019
  cumulativeInterestSnapshot: BN;
1020
+ collateralAmount: BN;
840
1021
  };
841
1022
  shortPositions: {
842
1023
  openPositions: BN;
843
1024
  collateralUsd: BN;
844
1025
  sizeUsd: BN;
1026
+ borrowSizeUsd: BN;
845
1027
  lockedAmount: BN;
846
1028
  weightedPrice: BN;
847
1029
  totalQuantity: BN;
848
1030
  cumulativeInterestUsd: BN;
849
1031
  cumulativeInterestSnapshot: BN;
1032
+ collateralAmount: BN;
850
1033
  };
851
1034
  borrowRateState: {
852
1035
  currentRate: BN;
@@ -862,10 +1045,11 @@ export declare class PerpetualsClient {
862
1045
  instructionDataLen: number;
863
1046
  instructionHash: BN;
864
1047
  signers: PublicKey[];
865
- signed: boolean[];
1048
+ signed: number[];
866
1049
  price: BN;
867
1050
  expo: number;
868
1051
  conf: BN;
1052
+ ema: BN;
869
1053
  publishTime: BN;
870
1054
  pools: PublicKey[];
871
1055
  transferAuthorityBump: number;
@@ -881,7 +1065,9 @@ export declare class PerpetualsClient {
881
1065
  aumUsd: BN;
882
1066
  lpTokenBump: number;
883
1067
  owner: PublicKey;
1068
+ payer: PublicKey;
884
1069
  custody: PublicKey;
1070
+ collateralCustody: PublicKey;
885
1071
  openTime: BN;
886
1072
  updateTime: BN;
887
1073
  side: {
@@ -890,6 +1076,7 @@ export declare class PerpetualsClient {
890
1076
  short?: Record<string, never>;
891
1077
  };
892
1078
  sizeUsd: BN;
1079
+ borrowSizeUsd: BN;
893
1080
  collateralUsd: BN;
894
1081
  unrealizedProfitUsd: BN;
895
1082
  unrealizedLossUsd: BN;
@@ -904,13 +1091,17 @@ export declare class PerpetualsClient {
904
1091
  tokenAccount: PublicKey;
905
1092
  decimals: number;
906
1093
  isStable: boolean;
1094
+ isVirtual: boolean;
907
1095
  oracle: {
908
1096
  oracleAccount: PublicKey;
1097
+ customOracleAccount: PublicKey;
909
1098
  oracleType: {
910
1099
  none?: Record<string, never>;
911
- test?: Record<string, never>;
1100
+ custom?: Record<string, never>;
912
1101
  pyth?: Record<string, never>;
1102
+ backup?: Record<string, never>;
913
1103
  };
1104
+ maxDifferenceThreshold: BN;
914
1105
  maxPriceError: BN;
915
1106
  maxPriceAgeSec: number;
916
1107
  };
@@ -923,19 +1114,12 @@ export declare class PerpetualsClient {
923
1114
  minInitialLeverage: BN;
924
1115
  maxInitialLeverage: BN;
925
1116
  maxLeverage: BN;
1117
+ minCollateralUsd: BN;
1118
+ minTimeSeconds: BN;
926
1119
  maxPayoffMult: BN;
927
1120
  maxUtilization: BN;
928
1121
  maxPositionLockedUsd: BN;
929
1122
  maxTotalLockedUsd: BN;
930
- } | {
931
- useEma: boolean;
932
- useUnrealizedPnlInAum: boolean;
933
- tradeSpreadLong: BN;
934
- tradeSpreadShort: BN;
935
- swapSpread: BN;
936
- minInitialLeverage: BN;
937
- maxLeverage: BN;
938
- maxPayoffMult: BN;
939
1123
  };
940
1124
  permissions: {
941
1125
  allowSwap: boolean;
@@ -954,14 +1138,45 @@ export declare class PerpetualsClient {
954
1138
  };
955
1139
  ratioMult: BN;
956
1140
  utilizationMult: BN;
957
- swapIn: BN;
958
- swapOut: BN;
959
- stableSwapIn: BN;
960
- stableSwapOut: BN;
961
- addLiquidity: BN;
962
- removeLiquidity: BN;
1141
+ swapIn: {
1142
+ baseRate: BN;
1143
+ slope1: BN;
1144
+ constant1: BN;
1145
+ slope2: BN;
1146
+ constant2: BN;
1147
+ minFee: BN;
1148
+ maxFee: BN;
1149
+ };
1150
+ swapOut: {
1151
+ baseRate: BN;
1152
+ slope1: BN;
1153
+ constant1: BN;
1154
+ slope2: BN;
1155
+ constant2: BN;
1156
+ minFee: BN;
1157
+ maxFee: BN;
1158
+ };
1159
+ addLiquidity: {
1160
+ baseRate: BN;
1161
+ slope1: BN;
1162
+ constant1: BN;
1163
+ slope2: BN;
1164
+ constant2: BN;
1165
+ minFee: BN;
1166
+ maxFee: BN;
1167
+ };
1168
+ removeLiquidity: {
1169
+ baseRate: BN;
1170
+ slope1: BN;
1171
+ constant1: BN;
1172
+ slope2: BN;
1173
+ constant2: BN;
1174
+ minFee: BN;
1175
+ maxFee: BN;
1176
+ };
963
1177
  openPosition: BN;
964
1178
  closePosition: BN;
1179
+ removeCollateral: BN;
965
1180
  liquidation: BN;
966
1181
  protocolShare: BN;
967
1182
  };
@@ -996,28 +1211,32 @@ export declare class PerpetualsClient {
996
1211
  tradeStats: {
997
1212
  profitUsd: BN;
998
1213
  lossUsd: BN;
999
- oiLongUsd: BN;
1000
- oiShortUsd: BN;
1214
+ oiLong: BN;
1215
+ oiShort: BN;
1001
1216
  };
1002
1217
  longPositions: {
1003
1218
  openPositions: BN;
1004
1219
  collateralUsd: BN;
1005
1220
  sizeUsd: BN;
1221
+ borrowSizeUsd: BN;
1006
1222
  lockedAmount: BN;
1007
1223
  weightedPrice: BN;
1008
1224
  totalQuantity: BN;
1009
1225
  cumulativeInterestUsd: BN;
1010
1226
  cumulativeInterestSnapshot: BN;
1227
+ collateralAmount: BN;
1011
1228
  };
1012
1229
  shortPositions: {
1013
1230
  openPositions: BN;
1014
1231
  collateralUsd: BN;
1015
1232
  sizeUsd: BN;
1233
+ borrowSizeUsd: BN;
1016
1234
  lockedAmount: BN;
1017
1235
  weightedPrice: BN;
1018
1236
  totalQuantity: BN;
1019
1237
  cumulativeInterestUsd: BN;
1020
1238
  cumulativeInterestSnapshot: BN;
1239
+ collateralAmount: BN;
1021
1240
  };
1022
1241
  borrowRateState: {
1023
1242
  currentRate: BN;
@@ -1033,10 +1252,11 @@ export declare class PerpetualsClient {
1033
1252
  instructionDataLen: number;
1034
1253
  instructionHash: BN;
1035
1254
  signers: PublicKey[];
1036
- signed: boolean[];
1255
+ signed: number[];
1037
1256
  price: BN;
1038
1257
  expo: number;
1039
1258
  conf: BN;
1259
+ ema: BN;
1040
1260
  publishTime: BN;
1041
1261
  pools: PublicKey[];
1042
1262
  transferAuthorityBump: number;
@@ -1052,7 +1272,9 @@ export declare class PerpetualsClient {
1052
1272
  aumUsd: BN;
1053
1273
  lpTokenBump: number;
1054
1274
  owner: PublicKey;
1275
+ payer: PublicKey;
1055
1276
  custody: PublicKey;
1277
+ collateralCustody: PublicKey;
1056
1278
  openTime: BN;
1057
1279
  updateTime: BN;
1058
1280
  side: {
@@ -1061,6 +1283,7 @@ export declare class PerpetualsClient {
1061
1283
  short?: Record<string, never>;
1062
1284
  };
1063
1285
  sizeUsd: BN;
1286
+ borrowSizeUsd: BN;
1064
1287
  collateralUsd: BN;
1065
1288
  unrealizedProfitUsd: BN;
1066
1289
  unrealizedLossUsd: BN;
@@ -1075,13 +1298,17 @@ export declare class PerpetualsClient {
1075
1298
  tokenAccount: PublicKey;
1076
1299
  decimals: number;
1077
1300
  isStable: boolean;
1301
+ isVirtual: boolean;
1078
1302
  oracle: {
1079
1303
  oracleAccount: PublicKey;
1304
+ customOracleAccount: PublicKey;
1080
1305
  oracleType: {
1081
1306
  none?: Record<string, never>;
1082
- test?: Record<string, never>;
1307
+ custom?: Record<string, never>;
1083
1308
  pyth?: Record<string, never>;
1309
+ backup?: Record<string, never>;
1084
1310
  };
1311
+ maxDifferenceThreshold: BN;
1085
1312
  maxPriceError: BN;
1086
1313
  maxPriceAgeSec: number;
1087
1314
  };
@@ -1094,19 +1321,12 @@ export declare class PerpetualsClient {
1094
1321
  minInitialLeverage: BN;
1095
1322
  maxInitialLeverage: BN;
1096
1323
  maxLeverage: BN;
1324
+ minCollateralUsd: BN;
1325
+ minTimeSeconds: BN;
1097
1326
  maxPayoffMult: BN;
1098
1327
  maxUtilization: BN;
1099
1328
  maxPositionLockedUsd: BN;
1100
1329
  maxTotalLockedUsd: BN;
1101
- } | {
1102
- useEma: boolean;
1103
- useUnrealizedPnlInAum: boolean;
1104
- tradeSpreadLong: BN;
1105
- tradeSpreadShort: BN;
1106
- swapSpread: BN;
1107
- minInitialLeverage: BN;
1108
- maxLeverage: BN;
1109
- maxPayoffMult: BN;
1110
1330
  };
1111
1331
  permissions: {
1112
1332
  allowSwap: boolean;
@@ -1125,14 +1345,45 @@ export declare class PerpetualsClient {
1125
1345
  };
1126
1346
  ratioMult: BN;
1127
1347
  utilizationMult: BN;
1128
- swapIn: BN;
1129
- swapOut: BN;
1130
- stableSwapIn: BN;
1131
- stableSwapOut: BN;
1132
- addLiquidity: BN;
1133
- removeLiquidity: BN;
1348
+ swapIn: {
1349
+ baseRate: BN;
1350
+ slope1: BN;
1351
+ constant1: BN;
1352
+ slope2: BN;
1353
+ constant2: BN;
1354
+ minFee: BN;
1355
+ maxFee: BN;
1356
+ };
1357
+ swapOut: {
1358
+ baseRate: BN;
1359
+ slope1: BN;
1360
+ constant1: BN;
1361
+ slope2: BN;
1362
+ constant2: BN;
1363
+ minFee: BN;
1364
+ maxFee: BN;
1365
+ };
1366
+ addLiquidity: {
1367
+ baseRate: BN;
1368
+ slope1: BN;
1369
+ constant1: BN;
1370
+ slope2: BN;
1371
+ constant2: BN;
1372
+ minFee: BN;
1373
+ maxFee: BN;
1374
+ };
1375
+ removeLiquidity: {
1376
+ baseRate: BN;
1377
+ slope1: BN;
1378
+ constant1: BN;
1379
+ slope2: BN;
1380
+ constant2: BN;
1381
+ minFee: BN;
1382
+ maxFee: BN;
1383
+ };
1134
1384
  openPosition: BN;
1135
1385
  closePosition: BN;
1386
+ removeCollateral: BN;
1136
1387
  liquidation: BN;
1137
1388
  protocolShare: BN;
1138
1389
  };
@@ -1167,28 +1418,32 @@ export declare class PerpetualsClient {
1167
1418
  tradeStats: {
1168
1419
  profitUsd: BN;
1169
1420
  lossUsd: BN;
1170
- oiLongUsd: BN;
1171
- oiShortUsd: BN;
1421
+ oiLong: BN;
1422
+ oiShort: BN;
1172
1423
  };
1173
1424
  longPositions: {
1174
1425
  openPositions: BN;
1175
1426
  collateralUsd: BN;
1176
1427
  sizeUsd: BN;
1428
+ borrowSizeUsd: BN;
1177
1429
  lockedAmount: BN;
1178
1430
  weightedPrice: BN;
1179
1431
  totalQuantity: BN;
1180
1432
  cumulativeInterestUsd: BN;
1181
1433
  cumulativeInterestSnapshot: BN;
1434
+ collateralAmount: BN;
1182
1435
  };
1183
1436
  shortPositions: {
1184
1437
  openPositions: BN;
1185
1438
  collateralUsd: BN;
1186
1439
  sizeUsd: BN;
1440
+ borrowSizeUsd: BN;
1187
1441
  lockedAmount: BN;
1188
1442
  weightedPrice: BN;
1189
1443
  totalQuantity: BN;
1190
1444
  cumulativeInterestUsd: BN;
1191
1445
  cumulativeInterestSnapshot: BN;
1446
+ collateralAmount: BN;
1192
1447
  };
1193
1448
  borrowRateState: {
1194
1449
  currentRate: BN;
@@ -1204,10 +1459,11 @@ export declare class PerpetualsClient {
1204
1459
  instructionDataLen: number;
1205
1460
  instructionHash: BN;
1206
1461
  signers: PublicKey[];
1207
- signed: boolean[];
1462
+ signed: number[];
1208
1463
  price: BN;
1209
1464
  expo: number;
1210
1465
  conf: BN;
1466
+ ema: BN;
1211
1467
  publishTime: BN;
1212
1468
  pools: PublicKey[];
1213
1469
  transferAuthorityBump: number;
@@ -1223,7 +1479,9 @@ export declare class PerpetualsClient {
1223
1479
  aumUsd: BN;
1224
1480
  lpTokenBump: number;
1225
1481
  owner: PublicKey;
1482
+ payer: PublicKey;
1226
1483
  custody: PublicKey;
1484
+ collateralCustody: PublicKey;
1227
1485
  openTime: BN;
1228
1486
  updateTime: BN;
1229
1487
  side: {
@@ -1232,6 +1490,7 @@ export declare class PerpetualsClient {
1232
1490
  short?: Record<string, never>;
1233
1491
  };
1234
1492
  sizeUsd: BN;
1493
+ borrowSizeUsd: BN;
1235
1494
  collateralUsd: BN;
1236
1495
  unrealizedProfitUsd: BN;
1237
1496
  unrealizedLossUsd: BN;
@@ -1245,13 +1504,17 @@ export declare class PerpetualsClient {
1245
1504
  tokenAccount: PublicKey;
1246
1505
  decimals: number;
1247
1506
  isStable: boolean;
1507
+ isVirtual: boolean;
1248
1508
  oracle: {
1249
1509
  oracleAccount: PublicKey;
1510
+ customOracleAccount: PublicKey;
1250
1511
  oracleType: {
1251
1512
  none?: Record<string, never>;
1252
- test?: Record<string, never>;
1513
+ custom?: Record<string, never>;
1253
1514
  pyth?: Record<string, never>;
1515
+ backup?: Record<string, never>;
1254
1516
  };
1517
+ maxDifferenceThreshold: BN;
1255
1518
  maxPriceError: BN;
1256
1519
  maxPriceAgeSec: number;
1257
1520
  };
@@ -1264,19 +1527,12 @@ export declare class PerpetualsClient {
1264
1527
  minInitialLeverage: BN;
1265
1528
  maxInitialLeverage: BN;
1266
1529
  maxLeverage: BN;
1530
+ minCollateralUsd: BN;
1531
+ minTimeSeconds: BN;
1267
1532
  maxPayoffMult: BN;
1268
1533
  maxUtilization: BN;
1269
1534
  maxPositionLockedUsd: BN;
1270
1535
  maxTotalLockedUsd: BN;
1271
- } | {
1272
- useEma: boolean;
1273
- useUnrealizedPnlInAum: boolean;
1274
- tradeSpreadLong: BN;
1275
- tradeSpreadShort: BN;
1276
- swapSpread: BN;
1277
- minInitialLeverage: BN;
1278
- maxLeverage: BN;
1279
- maxPayoffMult: BN;
1280
1536
  };
1281
1537
  permissions: {
1282
1538
  allowSwap: boolean;
@@ -1295,14 +1551,45 @@ export declare class PerpetualsClient {
1295
1551
  };
1296
1552
  ratioMult: BN;
1297
1553
  utilizationMult: BN;
1298
- swapIn: BN;
1299
- swapOut: BN;
1300
- stableSwapIn: BN;
1301
- stableSwapOut: BN;
1302
- addLiquidity: BN;
1303
- removeLiquidity: BN;
1554
+ swapIn: {
1555
+ baseRate: BN;
1556
+ slope1: BN;
1557
+ constant1: BN;
1558
+ slope2: BN;
1559
+ constant2: BN;
1560
+ minFee: BN;
1561
+ maxFee: BN;
1562
+ };
1563
+ swapOut: {
1564
+ baseRate: BN;
1565
+ slope1: BN;
1566
+ constant1: BN;
1567
+ slope2: BN;
1568
+ constant2: BN;
1569
+ minFee: BN;
1570
+ maxFee: BN;
1571
+ };
1572
+ addLiquidity: {
1573
+ baseRate: BN;
1574
+ slope1: BN;
1575
+ constant1: BN;
1576
+ slope2: BN;
1577
+ constant2: BN;
1578
+ minFee: BN;
1579
+ maxFee: BN;
1580
+ };
1581
+ removeLiquidity: {
1582
+ baseRate: BN;
1583
+ slope1: BN;
1584
+ constant1: BN;
1585
+ slope2: BN;
1586
+ constant2: BN;
1587
+ minFee: BN;
1588
+ maxFee: BN;
1589
+ };
1304
1590
  openPosition: BN;
1305
1591
  closePosition: BN;
1592
+ removeCollateral: BN;
1306
1593
  liquidation: BN;
1307
1594
  protocolShare: BN;
1308
1595
  };
@@ -1337,28 +1624,32 @@ export declare class PerpetualsClient {
1337
1624
  tradeStats: {
1338
1625
  profitUsd: BN;
1339
1626
  lossUsd: BN;
1340
- oiLongUsd: BN;
1341
- oiShortUsd: BN;
1627
+ oiLong: BN;
1628
+ oiShort: BN;
1342
1629
  };
1343
1630
  longPositions: {
1344
1631
  openPositions: BN;
1345
1632
  collateralUsd: BN;
1346
1633
  sizeUsd: BN;
1634
+ borrowSizeUsd: BN;
1347
1635
  lockedAmount: BN;
1348
1636
  weightedPrice: BN;
1349
1637
  totalQuantity: BN;
1350
1638
  cumulativeInterestUsd: BN;
1351
1639
  cumulativeInterestSnapshot: BN;
1640
+ collateralAmount: BN;
1352
1641
  };
1353
1642
  shortPositions: {
1354
1643
  openPositions: BN;
1355
1644
  collateralUsd: BN;
1356
1645
  sizeUsd: BN;
1646
+ borrowSizeUsd: BN;
1357
1647
  lockedAmount: BN;
1358
1648
  weightedPrice: BN;
1359
1649
  totalQuantity: BN;
1360
1650
  cumulativeInterestUsd: BN;
1361
1651
  cumulativeInterestSnapshot: BN;
1652
+ collateralAmount: BN;
1362
1653
  };
1363
1654
  borrowRateState: {
1364
1655
  currentRate: BN;
@@ -1374,10 +1665,11 @@ export declare class PerpetualsClient {
1374
1665
  instructionDataLen: number;
1375
1666
  instructionHash: BN;
1376
1667
  signers: PublicKey[];
1377
- signed: boolean[];
1668
+ signed: number[];
1378
1669
  price: BN;
1379
1670
  expo: number;
1380
1671
  conf: BN;
1672
+ ema: BN;
1381
1673
  publishTime: BN;
1382
1674
  pools: PublicKey[];
1383
1675
  transferAuthorityBump: number;
@@ -1393,7 +1685,9 @@ export declare class PerpetualsClient {
1393
1685
  aumUsd: BN;
1394
1686
  lpTokenBump: number;
1395
1687
  owner: PublicKey;
1688
+ payer: PublicKey;
1396
1689
  custody: PublicKey;
1690
+ collateralCustody: PublicKey;
1397
1691
  openTime: BN;
1398
1692
  updateTime: BN;
1399
1693
  side: {
@@ -1402,6 +1696,7 @@ export declare class PerpetualsClient {
1402
1696
  short?: Record<string, never>;
1403
1697
  };
1404
1698
  sizeUsd: BN;
1699
+ borrowSizeUsd: BN;
1405
1700
  collateralUsd: BN;
1406
1701
  unrealizedProfitUsd: BN;
1407
1702
  unrealizedLossUsd: BN;
@@ -1415,13 +1710,17 @@ export declare class PerpetualsClient {
1415
1710
  tokenAccount: PublicKey;
1416
1711
  decimals: number;
1417
1712
  isStable: boolean;
1713
+ isVirtual: boolean;
1418
1714
  oracle: {
1419
1715
  oracleAccount: PublicKey;
1716
+ customOracleAccount: PublicKey;
1420
1717
  oracleType: {
1421
1718
  none?: Record<string, never>;
1422
- test?: Record<string, never>;
1719
+ custom?: Record<string, never>;
1423
1720
  pyth?: Record<string, never>;
1721
+ backup?: Record<string, never>;
1424
1722
  };
1723
+ maxDifferenceThreshold: BN;
1425
1724
  maxPriceError: BN;
1426
1725
  maxPriceAgeSec: number;
1427
1726
  };
@@ -1434,19 +1733,12 @@ export declare class PerpetualsClient {
1434
1733
  minInitialLeverage: BN;
1435
1734
  maxInitialLeverage: BN;
1436
1735
  maxLeverage: BN;
1736
+ minCollateralUsd: BN;
1737
+ minTimeSeconds: BN;
1437
1738
  maxPayoffMult: BN;
1438
1739
  maxUtilization: BN;
1439
1740
  maxPositionLockedUsd: BN;
1440
1741
  maxTotalLockedUsd: BN;
1441
- } | {
1442
- useEma: boolean;
1443
- useUnrealizedPnlInAum: boolean;
1444
- tradeSpreadLong: BN;
1445
- tradeSpreadShort: BN;
1446
- swapSpread: BN;
1447
- minInitialLeverage: BN;
1448
- maxLeverage: BN;
1449
- maxPayoffMult: BN;
1450
1742
  };
1451
1743
  permissions: {
1452
1744
  allowSwap: boolean;
@@ -1465,14 +1757,45 @@ export declare class PerpetualsClient {
1465
1757
  };
1466
1758
  ratioMult: BN;
1467
1759
  utilizationMult: BN;
1468
- swapIn: BN;
1469
- swapOut: BN;
1470
- stableSwapIn: BN;
1471
- stableSwapOut: BN;
1472
- addLiquidity: BN;
1473
- removeLiquidity: BN;
1760
+ swapIn: {
1761
+ baseRate: BN;
1762
+ slope1: BN;
1763
+ constant1: BN;
1764
+ slope2: BN;
1765
+ constant2: BN;
1766
+ minFee: BN;
1767
+ maxFee: BN;
1768
+ };
1769
+ swapOut: {
1770
+ baseRate: BN;
1771
+ slope1: BN;
1772
+ constant1: BN;
1773
+ slope2: BN;
1774
+ constant2: BN;
1775
+ minFee: BN;
1776
+ maxFee: BN;
1777
+ };
1778
+ addLiquidity: {
1779
+ baseRate: BN;
1780
+ slope1: BN;
1781
+ constant1: BN;
1782
+ slope2: BN;
1783
+ constant2: BN;
1784
+ minFee: BN;
1785
+ maxFee: BN;
1786
+ };
1787
+ removeLiquidity: {
1788
+ baseRate: BN;
1789
+ slope1: BN;
1790
+ constant1: BN;
1791
+ slope2: BN;
1792
+ constant2: BN;
1793
+ minFee: BN;
1794
+ maxFee: BN;
1795
+ };
1474
1796
  openPosition: BN;
1475
1797
  closePosition: BN;
1798
+ removeCollateral: BN;
1476
1799
  liquidation: BN;
1477
1800
  protocolShare: BN;
1478
1801
  };
@@ -1507,28 +1830,32 @@ export declare class PerpetualsClient {
1507
1830
  tradeStats: {
1508
1831
  profitUsd: BN;
1509
1832
  lossUsd: BN;
1510
- oiLongUsd: BN;
1511
- oiShortUsd: BN;
1833
+ oiLong: BN;
1834
+ oiShort: BN;
1512
1835
  };
1513
1836
  longPositions: {
1514
1837
  openPositions: BN;
1515
1838
  collateralUsd: BN;
1516
1839
  sizeUsd: BN;
1840
+ borrowSizeUsd: BN;
1517
1841
  lockedAmount: BN;
1518
1842
  weightedPrice: BN;
1519
1843
  totalQuantity: BN;
1520
1844
  cumulativeInterestUsd: BN;
1521
1845
  cumulativeInterestSnapshot: BN;
1846
+ collateralAmount: BN;
1522
1847
  };
1523
1848
  shortPositions: {
1524
1849
  openPositions: BN;
1525
1850
  collateralUsd: BN;
1526
1851
  sizeUsd: BN;
1852
+ borrowSizeUsd: BN;
1527
1853
  lockedAmount: BN;
1528
1854
  weightedPrice: BN;
1529
1855
  totalQuantity: BN;
1530
1856
  cumulativeInterestUsd: BN;
1531
1857
  cumulativeInterestSnapshot: BN;
1858
+ collateralAmount: BN;
1532
1859
  };
1533
1860
  borrowRateState: {
1534
1861
  currentRate: BN;
@@ -1544,10 +1871,11 @@ export declare class PerpetualsClient {
1544
1871
  instructionDataLen: number;
1545
1872
  instructionHash: BN;
1546
1873
  signers: PublicKey[];
1547
- signed: boolean[];
1874
+ signed: number[];
1548
1875
  price: BN;
1549
1876
  expo: number;
1550
1877
  conf: BN;
1878
+ ema: BN;
1551
1879
  publishTime: BN;
1552
1880
  pools: PublicKey[];
1553
1881
  transferAuthorityBump: number;
@@ -1563,7 +1891,9 @@ export declare class PerpetualsClient {
1563
1891
  aumUsd: BN;
1564
1892
  lpTokenBump: number;
1565
1893
  owner: PublicKey;
1894
+ payer: PublicKey;
1566
1895
  custody: PublicKey;
1896
+ collateralCustody: PublicKey;
1567
1897
  openTime: BN;
1568
1898
  updateTime: BN;
1569
1899
  side: {
@@ -1572,6 +1902,7 @@ export declare class PerpetualsClient {
1572
1902
  short?: Record<string, never>;
1573
1903
  };
1574
1904
  sizeUsd: BN;
1905
+ borrowSizeUsd: BN;
1575
1906
  collateralUsd: BN;
1576
1907
  unrealizedProfitUsd: BN;
1577
1908
  unrealizedLossUsd: BN;
@@ -1586,13 +1917,17 @@ export declare class PerpetualsClient {
1586
1917
  tokenAccount: PublicKey;
1587
1918
  decimals: number;
1588
1919
  isStable: boolean;
1920
+ isVirtual: boolean;
1589
1921
  oracle: {
1590
1922
  oracleAccount: PublicKey;
1923
+ customOracleAccount: PublicKey;
1591
1924
  oracleType: {
1592
1925
  none?: Record<string, never>;
1593
- test?: Record<string, never>;
1926
+ custom?: Record<string, never>;
1594
1927
  pyth?: Record<string, never>;
1928
+ backup?: Record<string, never>;
1595
1929
  };
1930
+ maxDifferenceThreshold: BN;
1596
1931
  maxPriceError: BN;
1597
1932
  maxPriceAgeSec: number;
1598
1933
  };
@@ -1605,19 +1940,12 @@ export declare class PerpetualsClient {
1605
1940
  minInitialLeverage: BN;
1606
1941
  maxInitialLeverage: BN;
1607
1942
  maxLeverage: BN;
1943
+ minCollateralUsd: BN;
1944
+ minTimeSeconds: BN;
1608
1945
  maxPayoffMult: BN;
1609
1946
  maxUtilization: BN;
1610
1947
  maxPositionLockedUsd: BN;
1611
1948
  maxTotalLockedUsd: BN;
1612
- } | {
1613
- useEma: boolean;
1614
- useUnrealizedPnlInAum: boolean;
1615
- tradeSpreadLong: BN;
1616
- tradeSpreadShort: BN;
1617
- swapSpread: BN;
1618
- minInitialLeverage: BN;
1619
- maxLeverage: BN;
1620
- maxPayoffMult: BN;
1621
1949
  };
1622
1950
  permissions: {
1623
1951
  allowSwap: boolean;
@@ -1636,14 +1964,45 @@ export declare class PerpetualsClient {
1636
1964
  };
1637
1965
  ratioMult: BN;
1638
1966
  utilizationMult: BN;
1639
- swapIn: BN;
1640
- swapOut: BN;
1641
- stableSwapIn: BN;
1642
- stableSwapOut: BN;
1643
- addLiquidity: BN;
1644
- removeLiquidity: BN;
1967
+ swapIn: {
1968
+ baseRate: BN;
1969
+ slope1: BN;
1970
+ constant1: BN;
1971
+ slope2: BN;
1972
+ constant2: BN;
1973
+ minFee: BN;
1974
+ maxFee: BN;
1975
+ };
1976
+ swapOut: {
1977
+ baseRate: BN;
1978
+ slope1: BN;
1979
+ constant1: BN;
1980
+ slope2: BN;
1981
+ constant2: BN;
1982
+ minFee: BN;
1983
+ maxFee: BN;
1984
+ };
1985
+ addLiquidity: {
1986
+ baseRate: BN;
1987
+ slope1: BN;
1988
+ constant1: BN;
1989
+ slope2: BN;
1990
+ constant2: BN;
1991
+ minFee: BN;
1992
+ maxFee: BN;
1993
+ };
1994
+ removeLiquidity: {
1995
+ baseRate: BN;
1996
+ slope1: BN;
1997
+ constant1: BN;
1998
+ slope2: BN;
1999
+ constant2: BN;
2000
+ minFee: BN;
2001
+ maxFee: BN;
2002
+ };
1645
2003
  openPosition: BN;
1646
2004
  closePosition: BN;
2005
+ removeCollateral: BN;
1647
2006
  liquidation: BN;
1648
2007
  protocolShare: BN;
1649
2008
  };
@@ -1678,28 +2037,32 @@ export declare class PerpetualsClient {
1678
2037
  tradeStats: {
1679
2038
  profitUsd: BN;
1680
2039
  lossUsd: BN;
1681
- oiLongUsd: BN;
1682
- oiShortUsd: BN;
2040
+ oiLong: BN;
2041
+ oiShort: BN;
1683
2042
  };
1684
2043
  longPositions: {
1685
2044
  openPositions: BN;
1686
2045
  collateralUsd: BN;
1687
2046
  sizeUsd: BN;
2047
+ borrowSizeUsd: BN;
1688
2048
  lockedAmount: BN;
1689
2049
  weightedPrice: BN;
1690
2050
  totalQuantity: BN;
1691
2051
  cumulativeInterestUsd: BN;
1692
2052
  cumulativeInterestSnapshot: BN;
2053
+ collateralAmount: BN;
1693
2054
  };
1694
2055
  shortPositions: {
1695
2056
  openPositions: BN;
1696
2057
  collateralUsd: BN;
1697
2058
  sizeUsd: BN;
2059
+ borrowSizeUsd: BN;
1698
2060
  lockedAmount: BN;
1699
2061
  weightedPrice: BN;
1700
2062
  totalQuantity: BN;
1701
2063
  cumulativeInterestUsd: BN;
1702
2064
  cumulativeInterestSnapshot: BN;
2065
+ collateralAmount: BN;
1703
2066
  };
1704
2067
  borrowRateState: {
1705
2068
  currentRate: BN;
@@ -1715,10 +2078,11 @@ export declare class PerpetualsClient {
1715
2078
  instructionDataLen: number;
1716
2079
  instructionHash: BN;
1717
2080
  signers: PublicKey[];
1718
- signed: boolean[];
2081
+ signed: number[];
1719
2082
  price: BN;
1720
2083
  expo: number;
1721
2084
  conf: BN;
2085
+ ema: BN;
1722
2086
  publishTime: BN;
1723
2087
  pools: PublicKey[];
1724
2088
  transferAuthorityBump: number;
@@ -1734,7 +2098,9 @@ export declare class PerpetualsClient {
1734
2098
  aumUsd: BN;
1735
2099
  lpTokenBump: number;
1736
2100
  owner: PublicKey;
2101
+ payer: PublicKey;
1737
2102
  custody: PublicKey;
2103
+ collateralCustody: PublicKey;
1738
2104
  openTime: BN;
1739
2105
  updateTime: BN;
1740
2106
  side: {
@@ -1743,6 +2109,7 @@ export declare class PerpetualsClient {
1743
2109
  short?: Record<string, never>;
1744
2110
  };
1745
2111
  sizeUsd: BN;
2112
+ borrowSizeUsd: BN;
1746
2113
  collateralUsd: BN;
1747
2114
  unrealizedProfitUsd: BN;
1748
2115
  unrealizedLossUsd: BN;
@@ -1756,13 +2123,17 @@ export declare class PerpetualsClient {
1756
2123
  tokenAccount: PublicKey;
1757
2124
  decimals: number;
1758
2125
  isStable: boolean;
2126
+ isVirtual: boolean;
1759
2127
  oracle: {
1760
2128
  oracleAccount: PublicKey;
2129
+ customOracleAccount: PublicKey;
1761
2130
  oracleType: {
1762
2131
  none?: Record<string, never>;
1763
- test?: Record<string, never>;
2132
+ custom?: Record<string, never>;
1764
2133
  pyth?: Record<string, never>;
2134
+ backup?: Record<string, never>;
1765
2135
  };
2136
+ maxDifferenceThreshold: BN;
1766
2137
  maxPriceError: BN;
1767
2138
  maxPriceAgeSec: number;
1768
2139
  };
@@ -1775,19 +2146,12 @@ export declare class PerpetualsClient {
1775
2146
  minInitialLeverage: BN;
1776
2147
  maxInitialLeverage: BN;
1777
2148
  maxLeverage: BN;
2149
+ minCollateralUsd: BN;
2150
+ minTimeSeconds: BN;
1778
2151
  maxPayoffMult: BN;
1779
2152
  maxUtilization: BN;
1780
2153
  maxPositionLockedUsd: BN;
1781
2154
  maxTotalLockedUsd: BN;
1782
- } | {
1783
- useEma: boolean;
1784
- useUnrealizedPnlInAum: boolean;
1785
- tradeSpreadLong: BN;
1786
- tradeSpreadShort: BN;
1787
- swapSpread: BN;
1788
- minInitialLeverage: BN;
1789
- maxLeverage: BN;
1790
- maxPayoffMult: BN;
1791
2155
  };
1792
2156
  permissions: {
1793
2157
  allowSwap: boolean;
@@ -1806,14 +2170,45 @@ export declare class PerpetualsClient {
1806
2170
  };
1807
2171
  ratioMult: BN;
1808
2172
  utilizationMult: BN;
1809
- swapIn: BN;
1810
- swapOut: BN;
1811
- stableSwapIn: BN;
1812
- stableSwapOut: BN;
1813
- addLiquidity: BN;
1814
- removeLiquidity: BN;
2173
+ swapIn: {
2174
+ baseRate: BN;
2175
+ slope1: BN;
2176
+ constant1: BN;
2177
+ slope2: BN;
2178
+ constant2: BN;
2179
+ minFee: BN;
2180
+ maxFee: BN;
2181
+ };
2182
+ swapOut: {
2183
+ baseRate: BN;
2184
+ slope1: BN;
2185
+ constant1: BN;
2186
+ slope2: BN;
2187
+ constant2: BN;
2188
+ minFee: BN;
2189
+ maxFee: BN;
2190
+ };
2191
+ addLiquidity: {
2192
+ baseRate: BN;
2193
+ slope1: BN;
2194
+ constant1: BN;
2195
+ slope2: BN;
2196
+ constant2: BN;
2197
+ minFee: BN;
2198
+ maxFee: BN;
2199
+ };
2200
+ removeLiquidity: {
2201
+ baseRate: BN;
2202
+ slope1: BN;
2203
+ constant1: BN;
2204
+ slope2: BN;
2205
+ constant2: BN;
2206
+ minFee: BN;
2207
+ maxFee: BN;
2208
+ };
1815
2209
  openPosition: BN;
1816
2210
  closePosition: BN;
2211
+ removeCollateral: BN;
1817
2212
  liquidation: BN;
1818
2213
  protocolShare: BN;
1819
2214
  };
@@ -1848,28 +2243,32 @@ export declare class PerpetualsClient {
1848
2243
  tradeStats: {
1849
2244
  profitUsd: BN;
1850
2245
  lossUsd: BN;
1851
- oiLongUsd: BN;
1852
- oiShortUsd: BN;
2246
+ oiLong: BN;
2247
+ oiShort: BN;
1853
2248
  };
1854
2249
  longPositions: {
1855
2250
  openPositions: BN;
1856
2251
  collateralUsd: BN;
1857
2252
  sizeUsd: BN;
2253
+ borrowSizeUsd: BN;
1858
2254
  lockedAmount: BN;
1859
2255
  weightedPrice: BN;
1860
2256
  totalQuantity: BN;
1861
2257
  cumulativeInterestUsd: BN;
1862
2258
  cumulativeInterestSnapshot: BN;
2259
+ collateralAmount: BN;
1863
2260
  };
1864
2261
  shortPositions: {
1865
2262
  openPositions: BN;
1866
2263
  collateralUsd: BN;
1867
2264
  sizeUsd: BN;
2265
+ borrowSizeUsd: BN;
1868
2266
  lockedAmount: BN;
1869
2267
  weightedPrice: BN;
1870
2268
  totalQuantity: BN;
1871
2269
  cumulativeInterestUsd: BN;
1872
2270
  cumulativeInterestSnapshot: BN;
2271
+ collateralAmount: BN;
1873
2272
  };
1874
2273
  borrowRateState: {
1875
2274
  currentRate: BN;
@@ -1885,10 +2284,11 @@ export declare class PerpetualsClient {
1885
2284
  instructionDataLen: number;
1886
2285
  instructionHash: BN;
1887
2286
  signers: PublicKey[];
1888
- signed: boolean[];
2287
+ signed: number[];
1889
2288
  price: BN;
1890
2289
  expo: number;
1891
2290
  conf: BN;
2291
+ ema: BN;
1892
2292
  publishTime: BN;
1893
2293
  pools: PublicKey[];
1894
2294
  transferAuthorityBump: number;
@@ -1904,7 +2304,9 @@ export declare class PerpetualsClient {
1904
2304
  aumUsd: BN;
1905
2305
  lpTokenBump: number;
1906
2306
  owner: PublicKey;
2307
+ payer: PublicKey;
1907
2308
  custody: PublicKey;
2309
+ collateralCustody: PublicKey;
1908
2310
  openTime: BN;
1909
2311
  updateTime: BN;
1910
2312
  side: {
@@ -1913,6 +2315,7 @@ export declare class PerpetualsClient {
1913
2315
  short?: Record<string, never>;
1914
2316
  };
1915
2317
  sizeUsd: BN;
2318
+ borrowSizeUsd: BN;
1916
2319
  collateralUsd: BN;
1917
2320
  unrealizedProfitUsd: BN;
1918
2321
  unrealizedLossUsd: BN;
@@ -1931,7 +2334,7 @@ export declare class PerpetualsClient {
1931
2334
  editCustody: (poolName: string, tokenMint: PublicKey, isStable: boolean, oracle: OracleParams, pricing: PricingParams, permissions: Permissions, fees: Fees, borrowRate: BorrowRateParams, ratios: TokenRatios[]) => Promise<void>;
1932
2335
  removeCustody: (poolName: string, tokenMint: PublicKey, ratios: TokenRatios[]) => Promise<void>;
1933
2336
  upgradeCustody: (poolName: string, tokenMint: PublicKey) => Promise<void>;
1934
- liquidate: (wallet: PublicKey, poolName: string, tokenMint: PublicKey, side: PositionSide, receivingAccount: PublicKey, rewardsReceivingAccount: PublicKey) => Promise<string>;
2337
+ liquidate: (wallet: PublicKey, poolName: string, tokenMint: PublicKey, collateralMint: PublicKey, side: PositionSide, receivingAccount: PublicKey, rewardsReceivingAccount: PublicKey) => Promise<string>;
1935
2338
  getOraclePrice: (poolName: string, tokenMint: PublicKey, ema: boolean) => Promise<any>;
1936
2339
  getAddLiquidityAmountAndFee: (poolName: string, tokenMint: PublicKey, amount: BN) => Promise<any>;
1937
2340
  getRemoveLiquidityAmountAndFee: (poolName: string, tokenMint: PublicKey, lpAmount: BN) => Promise<any>;
@@ -1951,20 +2354,18 @@ export declare class PerpetualsClient {
1951
2354
  getAumView: (poolName: string) => Promise<any>;
1952
2355
  getAumTrx: (poolName: string) => Promise<string>;
1953
2356
  getAumSdk: (poolAccount: PoolAccount, token_prices: OraclePrice[], token_ema_prices: OraclePrice[], custodies: CustodyAccount[], aum_calc_mode: AumCalcMode, currentTime: BN) => BN;
1954
- openPosition: (payTokenSymbol: string, priceAfterSlippage: BN, collateralWithfee: BN, fee: BN, size: BN, side: Side, poolConfig: PoolConfig, createUserWSOLATA?: boolean, skipBalanceChecks?: boolean) => Promise<{
2357
+ openPosition: (marketSymbol: string, collateralSymbol: string, priceAfterSlippage: BN, collateralWithfee: BN, fee: BN, size: BN, side: Side, poolConfig: PoolConfig, createUserWSOLATA?: boolean, skipBalanceChecks?: boolean) => Promise<{
1955
2358
  instructions: TransactionInstruction[];
1956
2359
  additionalSigners: Signer[];
1957
2360
  }>;
1958
- closePosition: (receivingTokenSymbol: string, priceAfterSlippage: BN, side: Side, poolConfig: PoolConfig, createUserATA?: boolean, closeUsersWSOLATA?: boolean) => Promise<{
2361
+ closePosition: (marketSymbol: string, collateralSymbol: string, priceAfterSlippage: BN, side: Side, poolConfig: PoolConfig, createUserATA?: boolean, closeUsersWSOLATA?: boolean) => Promise<{
1959
2362
  instructions: TransactionInstruction[];
1960
2363
  additionalSigners: Signer[];
1961
2364
  }>;
1962
- openPositionOld: (payTokenSymbol: string, priceAfterSlippage: BN, collateral: BN, fee: BN, size: BN, side: Side, poolConfig: PoolConfig, createUserWSOLATA?: boolean) => Promise<TransactionInstruction[]>;
1963
- closePositionOld: (receivingTokenSymbol: string, priceAfterSlippage: BN, side: Side, poolConfig: PoolConfig) => Promise<TransactionInstruction[]>;
1964
2365
  swap: (poolReceivingTokenSymbol: string, poolDispensingTokenSymbol: string, amountIn: BN, minAmountOut: BN, poolConfig: PoolConfig, unWrapSol?: boolean) => Promise<TransactionInstruction[]>;
1965
- addCollateral: (collateralWithoutFee: BN, fee: BN, collateralSymbol: string, positionPubKey: PublicKey, poolConfig: PoolConfig) => Promise<TransactionInstruction[]>;
1966
- removeCollateral: (collateralWithoutFee: BN, collateralSymbol: string, positionPubKey: PublicKey, poolConfig: PoolConfig) => Promise<TransactionInstruction[]>;
2366
+ addCollateral: (collateralWithoutFee: BN, fee: BN, marketSymbol: string, collateralSymbol: string, positionPubKey: PublicKey, poolConfig: PoolConfig) => Promise<TransactionInstruction[]>;
2367
+ removeCollateral: (collateralWithoutFee: BN, marketSymbol: string, collateralSymbol: string, positionPubKey: PublicKey, poolConfig: PoolConfig) => Promise<TransactionInstruction[]>;
1967
2368
  addLiquidity: (payTokenSymbol: string, tokenAmountIn: BN, minLpAmountOut: BN, poolConfig: PoolConfig) => Promise<TransactionInstruction[]>;
1968
2369
  removeLiquidity: (recieveTokenSymbol: string, liquidityAmountIn: BN, minTokenAmountOut: BN, poolConfig: PoolConfig, closeLpATA?: boolean) => Promise<TransactionInstruction[]>;
1969
- sendTransaction(ixs: TransactionInstruction[], opts?: any): Promise<string>;
2370
+ sendTransaction(ixs: TransactionInstruction[], opts?: SendTransactionOpts): Promise<string>;
1970
2371
  }