flash-sdk 13.0.2-alpha.0 → 13.0.2

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,4 +1,3 @@
1
- /// <reference types="bn.js" />
2
1
  import { BN } from "@coral-xyz/anchor";
3
2
  import { ContractOraclePrice } from "./types";
4
3
  export declare class OraclePrice {
@@ -1,4 +1,3 @@
1
- /// <reference types="bn.js" />
2
1
  import { BN } from "@coral-xyz/anchor";
3
2
  import { PublicKey } from "@solana/web3.js";
4
3
  import { LimitOrder, Order, TriggerOrder } from "./types";
@@ -1,5 +1,3 @@
1
- /// <reference types="bn.js" />
2
- /// <reference types="node" />
3
1
  import { Program, AnchorProvider, BN } from "@coral-xyz/anchor";
4
2
  import { PublicKey, TransactionInstruction, Commitment, Signer, AddressLookupTableAccount, VersionedTransaction } from "@solana/web3.js";
5
3
  import { PoolAccount } from "./PoolAccount";
@@ -11,7 +9,6 @@ import type { Perpetuals } from './idl/perpetuals';
11
9
  import { SendTransactionOpts } from "./utils/rpc";
12
10
  import { MarketConfig, PoolConfig, Token } from "./PoolConfig";
13
11
  import { MarketAccount } from "./MarketAccount";
14
- import { TokenStakeAccount } from "./TokenStakeAccount";
15
12
  export type PerpClientOptions = {
16
13
  postSendTxCallback?: ({ txid }: {
17
14
  txid: string;
@@ -78,24 +75,79 @@ export declare class PerpetualsClient {
78
75
  bump: number;
79
76
  };
80
77
  adjustTokenRatios: (ratios: TokenRatios[]) => TokenRatios[];
81
- getPerpetuals: () => Promise<any>;
78
+ getPerpetuals: () => Promise<{
79
+ permissions: {
80
+ allowSwap: boolean;
81
+ allowAddLiquidity: boolean;
82
+ allowRemoveLiquidity: boolean;
83
+ allowOpenPosition: boolean;
84
+ allowClosePosition: boolean;
85
+ allowCollateralWithdrawal: boolean;
86
+ allowSizeChange: boolean;
87
+ allowLiquidation: boolean;
88
+ allowLpStaking: boolean;
89
+ allowFeeDistribution: boolean;
90
+ allowUngatedTrading: boolean;
91
+ allowFeeDiscounts: boolean;
92
+ allowReferralRebates: boolean;
93
+ };
94
+ pools: PublicKey[];
95
+ collections: PublicKey[];
96
+ voltageMultiplier: {
97
+ volume: BN;
98
+ rewards: BN;
99
+ rebates: BN;
100
+ };
101
+ tradingDiscount: BN[];
102
+ referralRebate: BN[];
103
+ defaultRebate: BN;
104
+ inceptionTime: BN;
105
+ transferAuthorityBump: number;
106
+ perpetualsBump: number;
107
+ tradeLimit: number;
108
+ triggerOrderLimit: number;
109
+ rebateLimitUsd: number;
110
+ }>;
82
111
  getPoolKey: (name: string) => PublicKey;
83
112
  getPool: (name: string) => Promise<{
84
113
  name: string;
85
- permissions: any;
114
+ permissions: {
115
+ allowSwap: boolean;
116
+ allowAddLiquidity: boolean;
117
+ allowRemoveLiquidity: boolean;
118
+ allowOpenPosition: boolean;
119
+ allowClosePosition: boolean;
120
+ allowCollateralWithdrawal: boolean;
121
+ allowSizeChange: boolean;
122
+ allowLiquidation: boolean;
123
+ allowLpStaking: boolean;
124
+ allowFeeDistribution: boolean;
125
+ allowUngatedTrading: boolean;
126
+ allowFeeDiscounts: boolean;
127
+ allowReferralRebates: boolean;
128
+ };
86
129
  inceptionTime: BN;
87
130
  lpMint: PublicKey;
88
131
  oracleAuthority: PublicKey;
89
132
  stakedLpVault: PublicKey;
90
133
  rewardCustody: PublicKey;
91
134
  custodies: PublicKey[];
92
- ratios: any[];
135
+ ratios: {
136
+ target: BN;
137
+ min: BN;
138
+ max: BN;
139
+ }[];
93
140
  markets: PublicKey[];
94
141
  maxAumUsd: BN;
95
142
  buffer: BN;
96
143
  rawAumUsd: BN;
97
144
  equityUsd: BN;
98
- totalStaked: any;
145
+ totalStaked: {
146
+ pendingActivation: BN;
147
+ activeAmount: BN;
148
+ pendingDeactivation: BN;
149
+ deactivatedAmount: BN;
150
+ };
99
151
  stakingFeeShareBps: BN;
100
152
  bump: number;
101
153
  lpMintBump: number;
@@ -106,7 +158,13 @@ export declare class PerpetualsClient {
106
158
  stakingFeeBoostBps: BN[];
107
159
  compoundingMint: PublicKey;
108
160
  compoundingLpVault: PublicKey;
109
- compoundingStats: any;
161
+ compoundingStats: {
162
+ activeAmount: BN;
163
+ totalSupply: BN;
164
+ rewardSnapshot: BN;
165
+ feeShareBps: BN;
166
+ lastCompoundTime: BN;
167
+ };
110
168
  compoundingMintBump: number;
111
169
  compoundingLpVaultBump: number;
112
170
  minLpPriceUsd: BN;
@@ -120,20 +178,43 @@ export declare class PerpetualsClient {
120
178
  }>;
121
179
  getPools: () => Promise<{
122
180
  name: string;
123
- permissions: any;
181
+ permissions: {
182
+ allowSwap: boolean;
183
+ allowAddLiquidity: boolean;
184
+ allowRemoveLiquidity: boolean;
185
+ allowOpenPosition: boolean;
186
+ allowClosePosition: boolean;
187
+ allowCollateralWithdrawal: boolean;
188
+ allowSizeChange: boolean;
189
+ allowLiquidation: boolean;
190
+ allowLpStaking: boolean;
191
+ allowFeeDistribution: boolean;
192
+ allowUngatedTrading: boolean;
193
+ allowFeeDiscounts: boolean;
194
+ allowReferralRebates: boolean;
195
+ };
124
196
  inceptionTime: BN;
125
197
  lpMint: PublicKey;
126
198
  oracleAuthority: PublicKey;
127
199
  stakedLpVault: PublicKey;
128
200
  rewardCustody: PublicKey;
129
201
  custodies: PublicKey[];
130
- ratios: any[];
202
+ ratios: {
203
+ target: BN;
204
+ min: BN;
205
+ max: BN;
206
+ }[];
131
207
  markets: PublicKey[];
132
208
  maxAumUsd: BN;
133
209
  buffer: BN;
134
210
  rawAumUsd: BN;
135
211
  equityUsd: BN;
136
- totalStaked: any;
212
+ totalStaked: {
213
+ pendingActivation: BN;
214
+ activeAmount: BN;
215
+ pendingDeactivation: BN;
216
+ deactivatedAmount: BN;
217
+ };
137
218
  stakingFeeShareBps: BN;
138
219
  bump: number;
139
220
  lpMintBump: number;
@@ -144,7 +225,13 @@ export declare class PerpetualsClient {
144
225
  stakingFeeBoostBps: BN[];
145
226
  compoundingMint: PublicKey;
146
227
  compoundingLpVault: PublicKey;
147
- compoundingStats: any;
228
+ compoundingStats: {
229
+ activeAmount: BN;
230
+ totalSupply: BN;
231
+ rewardSnapshot: BN;
232
+ feeShareBps: BN;
233
+ lastCompoundTime: BN;
234
+ };
148
235
  compoundingMintBump: number;
149
236
  compoundingLpVaultBump: number;
150
237
  minLpPriceUsd: BN;
@@ -169,7 +256,10 @@ export declare class PerpetualsClient {
169
256
  delegate: PublicKey;
170
257
  openTime: BN;
171
258
  updateTime: BN;
172
- entryPrice: any;
259
+ entryPrice: {
260
+ price: BN;
261
+ exponent: number;
262
+ };
173
263
  sizeAmount: BN;
174
264
  sizeUsd: BN;
175
265
  lockedAmount: BN;
@@ -180,7 +270,10 @@ export declare class PerpetualsClient {
180
270
  unsettledFeesUsd: BN;
181
271
  cumulativeLockFeeSnapshot: BN;
182
272
  degenSizeUsd: BN;
183
- referencePrice: any;
273
+ referencePrice: {
274
+ price: BN;
275
+ exponent: number;
276
+ };
184
277
  buffer: number[];
185
278
  priceImpactSet: number;
186
279
  sizeDecimals: number;
@@ -193,9 +286,40 @@ export declare class PerpetualsClient {
193
286
  getOrderAccount: (orderAccountKey: PublicKey) => Promise<{
194
287
  owner: PublicKey;
195
288
  market: PublicKey;
196
- limitOrders: any[];
197
- takeProfitOrders: any[];
198
- stopLossOrders: any[];
289
+ limitOrders: {
290
+ limitPrice: {
291
+ price: BN;
292
+ exponent: number;
293
+ };
294
+ reserveAmount: BN;
295
+ reserveCustodyUid: number;
296
+ receiveCustodyUid: number;
297
+ sizeAmount: BN;
298
+ stopLossPrice: {
299
+ price: BN;
300
+ exponent: number;
301
+ };
302
+ takeProfitPrice: {
303
+ price: BN;
304
+ exponent: number;
305
+ };
306
+ }[];
307
+ takeProfitOrders: {
308
+ triggerPrice: {
309
+ price: BN;
310
+ exponent: number;
311
+ };
312
+ triggerSize: BN;
313
+ receiveCustodyUid: number;
314
+ }[];
315
+ stopLossOrders: {
316
+ triggerPrice: {
317
+ price: BN;
318
+ exponent: number;
319
+ };
320
+ triggerSize: BN;
321
+ receiveCustodyUid: number;
322
+ }[];
199
323
  isInitialised: boolean;
200
324
  openOrders: number;
201
325
  openSl: number;
@@ -214,7 +338,10 @@ export declare class PerpetualsClient {
214
338
  delegate: PublicKey;
215
339
  openTime: BN;
216
340
  updateTime: BN;
217
- entryPrice: any;
341
+ entryPrice: {
342
+ price: BN;
343
+ exponent: number;
344
+ };
218
345
  sizeAmount: BN;
219
346
  sizeUsd: BN;
220
347
  lockedAmount: BN;
@@ -225,7 +352,10 @@ export declare class PerpetualsClient {
225
352
  unsettledFeesUsd: BN;
226
353
  cumulativeLockFeeSnapshot: BN;
227
354
  degenSizeUsd: BN;
228
- referencePrice: any;
355
+ referencePrice: {
356
+ price: BN;
357
+ exponent: number;
358
+ };
229
359
  buffer: number[];
230
360
  priceImpactSet: number;
231
361
  sizeDecimals: number;
@@ -240,7 +370,10 @@ export declare class PerpetualsClient {
240
370
  delegate: PublicKey;
241
371
  openTime: BN;
242
372
  updateTime: BN;
243
- entryPrice: any;
373
+ entryPrice: {
374
+ price: BN;
375
+ exponent: number;
376
+ };
244
377
  sizeAmount: BN;
245
378
  sizeUsd: BN;
246
379
  lockedAmount: BN;
@@ -251,7 +384,10 @@ export declare class PerpetualsClient {
251
384
  unsettledFeesUsd: BN;
252
385
  cumulativeLockFeeSnapshot: BN;
253
386
  degenSizeUsd: BN;
254
- referencePrice: any;
387
+ referencePrice: {
388
+ price: BN;
389
+ exponent: number;
390
+ };
255
391
  buffer: number[];
256
392
  priceImpactSet: number;
257
393
  sizeDecimals: number;
@@ -312,7 +448,10 @@ export declare class PerpetualsClient {
312
448
  delegate: PublicKey;
313
449
  openTime: BN;
314
450
  updateTime: BN;
315
- entryPrice: any;
451
+ entryPrice: {
452
+ price: BN;
453
+ exponent: number;
454
+ };
316
455
  sizeAmount: BN;
317
456
  sizeUsd: BN;
318
457
  lockedAmount: BN;
@@ -323,7 +462,10 @@ export declare class PerpetualsClient {
323
462
  unsettledFeesUsd: BN;
324
463
  cumulativeLockFeeSnapshot: BN;
325
464
  degenSizeUsd: BN;
326
- referencePrice: any;
465
+ referencePrice: {
466
+ price: BN;
467
+ exponent: number;
468
+ };
327
469
  buffer: number[];
328
470
  priceImpactSet: number;
329
471
  sizeDecimals: number;
@@ -338,7 +480,10 @@ export declare class PerpetualsClient {
338
480
  delegate: PublicKey;
339
481
  openTime: BN;
340
482
  updateTime: BN;
341
- entryPrice: any;
483
+ entryPrice: {
484
+ price: BN;
485
+ exponent: number;
486
+ };
342
487
  sizeAmount: BN;
343
488
  sizeUsd: BN;
344
489
  lockedAmount: BN;
@@ -349,7 +494,10 @@ export declare class PerpetualsClient {
349
494
  unsettledFeesUsd: BN;
350
495
  cumulativeLockFeeSnapshot: BN;
351
496
  degenSizeUsd: BN;
352
- referencePrice: any;
497
+ referencePrice: {
498
+ price: BN;
499
+ exponent: number;
500
+ };
353
501
  buffer: number[];
354
502
  priceImpactSet: number;
355
503
  sizeDecimals: number;
@@ -364,7 +512,10 @@ export declare class PerpetualsClient {
364
512
  delegate: PublicKey;
365
513
  openTime: BN;
366
514
  updateTime: BN;
367
- entryPrice: any;
515
+ entryPrice: {
516
+ price: BN;
517
+ exponent: number;
518
+ };
368
519
  sizeAmount: BN;
369
520
  sizeUsd: BN;
370
521
  lockedAmount: BN;
@@ -375,7 +526,10 @@ export declare class PerpetualsClient {
375
526
  unsettledFeesUsd: BN;
376
527
  cumulativeLockFeeSnapshot: BN;
377
528
  degenSizeUsd: BN;
378
- referencePrice: any;
529
+ referencePrice: {
530
+ price: BN;
531
+ exponent: number;
532
+ };
379
533
  buffer: number[];
380
534
  priceImpactSet: number;
381
535
  sizeDecimals: number;
@@ -390,7 +544,10 @@ export declare class PerpetualsClient {
390
544
  delegate: PublicKey;
391
545
  openTime: BN;
392
546
  updateTime: BN;
393
- entryPrice: any;
547
+ entryPrice: {
548
+ price: BN;
549
+ exponent: number;
550
+ };
394
551
  sizeAmount: BN;
395
552
  sizeUsd: BN;
396
553
  lockedAmount: BN;
@@ -401,7 +558,10 @@ export declare class PerpetualsClient {
401
558
  unsettledFeesUsd: BN;
402
559
  cumulativeLockFeeSnapshot: BN;
403
560
  degenSizeUsd: BN;
404
- referencePrice: any;
561
+ referencePrice: {
562
+ price: BN;
563
+ exponent: number;
564
+ };
405
565
  buffer: number[];
406
566
  priceImpactSet: number;
407
567
  sizeDecimals: number;
@@ -413,9 +573,40 @@ export declare class PerpetualsClient {
413
573
  getAllOrderAccounts: () => Promise<import("@coral-xyz/anchor").ProgramAccount<{
414
574
  owner: PublicKey;
415
575
  market: PublicKey;
416
- limitOrders: any[];
417
- takeProfitOrders: any[];
418
- stopLossOrders: any[];
576
+ limitOrders: {
577
+ limitPrice: {
578
+ price: BN;
579
+ exponent: number;
580
+ };
581
+ reserveAmount: BN;
582
+ reserveCustodyUid: number;
583
+ receiveCustodyUid: number;
584
+ sizeAmount: BN;
585
+ stopLossPrice: {
586
+ price: BN;
587
+ exponent: number;
588
+ };
589
+ takeProfitPrice: {
590
+ price: BN;
591
+ exponent: number;
592
+ };
593
+ }[];
594
+ takeProfitOrders: {
595
+ triggerPrice: {
596
+ price: BN;
597
+ exponent: number;
598
+ };
599
+ triggerSize: BN;
600
+ receiveCustodyUid: number;
601
+ }[];
602
+ stopLossOrders: {
603
+ triggerPrice: {
604
+ price: BN;
605
+ exponent: number;
606
+ };
607
+ triggerSize: BN;
608
+ receiveCustodyUid: number;
609
+ }[];
419
610
  isInitialised: boolean;
420
611
  openOrders: number;
421
612
  openSl: number;
@@ -535,20 +726,6 @@ export declare class PerpetualsClient {
535
726
  };
536
727
  getIndexPriceAtParticularTime: (poolConfig: PoolConfig, targetPricesAtT1Ui: Number[], targetPricesAtT2Ui: Number[], tokenRatiosAtT2BN: BN[]) => string;
537
728
  getUserClaimableRevenueAmount: (POOL_CONFIG: PoolConfig, userPublicKey: PublicKey, enableDebuglogs?: boolean) => Promise<BN>;
538
- getTokenStakeAccount: (poolConfig: PoolConfig, userPublicKey: PublicKey) => Promise<TokenStakeAccount | null>;
539
- getUserUnstakingStatus: (poolConfig: PoolConfig, userPublicKey: PublicKey) => Promise<{
540
- activeStakeAmount: BN;
541
- totalLocked: BN;
542
- totalWithdrawable: BN;
543
- revenueEligibleAmount: BN;
544
- requests: {
545
- requestId: number;
546
- lockedAmount: BN;
547
- withdrawableAmount: BN;
548
- timeRemaining: BN;
549
- totalAmount: BN;
550
- }[];
551
- } | null>;
552
729
  getLpTokenPriceView: (poolConfig: PoolConfig, includeRemainingAccounts?: boolean) => Promise<any>;
553
730
  getStakedLpTokenPrice: (poolKey: PublicKey, POOL_CONFIG: PoolConfig, includeRemainingAccounts?: boolean) => Promise<string>;
554
731
  getCompoundingLPTokenPrice: (poolKey: PublicKey, POOL_CONFIG: PoolConfig, includeRemainingAccounts?: boolean) => Promise<string>;
@@ -665,6 +842,10 @@ export declare class PerpetualsClient {
665
842
  instructions: TransactionInstruction[];
666
843
  additionalSigners: Signer[];
667
844
  }>;
845
+ migrateTokenStake: (tokenStakeAccounts: PublicKey[]) => Promise<{
846
+ instructions: TransactionInstruction[];
847
+ additionalSigners: Signer[];
848
+ }>;
668
849
  migrateFlp: (amount: BN, rewardTokenMint: PublicKey, poolConfig: PoolConfig) => Promise<{
669
850
  instructions: TransactionInstruction[];
670
851
  additionalSigners: Signer[];
@@ -681,23 +862,23 @@ export declare class PerpetualsClient {
681
862
  instructions: TransactionInstruction[];
682
863
  additionalSigners: Signer[];
683
864
  }>;
684
- withdrawToken: (owner: PublicKey, withdrawRequestId: number, poolConfig: PoolConfig) => Promise<{
865
+ unstakeTokenInstant: (owner: PublicKey, unstakeAmount: BN, poolConfig: PoolConfig) => Promise<{
685
866
  instructions: TransactionInstruction[];
686
867
  additionalSigners: Signer[];
687
868
  }>;
688
- cancelUnstakeTokenRequest: (owner: PublicKey, withdrawRequestId: number, poolConfig: PoolConfig) => Promise<{
869
+ withdrawToken: (owner: PublicKey, withdrawRequestId: number, poolConfig: PoolConfig) => Promise<{
689
870
  instructions: TransactionInstruction[];
690
871
  additionalSigners: Signer[];
691
872
  }>;
692
- collectTokenReward: (owner: PublicKey, poolConfig: PoolConfig, createUserATA?: boolean) => Promise<{
873
+ cancelUnstakeRequest: (owner: PublicKey, withdrawRequestId: number, poolConfig: PoolConfig) => Promise<{
693
874
  instructions: TransactionInstruction[];
694
875
  additionalSigners: Signer[];
695
876
  }>;
696
- collectRevenue: (owner: PublicKey, rewardSymbol: string, poolConfig: PoolConfig, createUserATA?: boolean) => Promise<{
877
+ collectTokenReward: (owner: PublicKey, poolConfig: PoolConfig, createUserATA?: boolean) => Promise<{
697
878
  instructions: TransactionInstruction[];
698
879
  additionalSigners: Signer[];
699
880
  }>;
700
- refreshTokenStake: (tokenStakeAccounts: PublicKey[], poolConfig: PoolConfig) => Promise<{
881
+ collectRevenue: (owner: PublicKey, rewardSymbol: string, poolConfig: PoolConfig, createUserATA?: boolean) => Promise<{
701
882
  instructions: TransactionInstruction[];
702
883
  additionalSigners: Signer[];
703
884
  }>;
@@ -822,7 +1003,7 @@ export declare class PerpetualsClient {
822
1003
  instructions: TransactionInstruction[];
823
1004
  additionalSigners: Signer[];
824
1005
  }>;
825
- setTokenVaultConfig: (token_permissions: TokenPermissions, withdrawTimeLimit: BN, withdrawInstantFee: BN, stakeLevel: BN[], unlockPeriod: BN, poolConfig: PoolConfig) => Promise<{
1006
+ setTokenVaultConfig: (token_permissions: TokenPermissions, withdrawTimeLimit: BN, withdrawInstantFee: BN, stakeLevel: BN[], poolConfig: PoolConfig) => Promise<{
826
1007
  instructions: TransactionInstruction[];
827
1008
  additionalSigners: Signer[];
828
1009
  }>;