flash-sdk 2.6.9 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -275,6 +275,8 @@ export declare class PerpetualsClient {
275
275
  flpMintBump: number;
276
276
  flpTokenAccountBump: number;
277
277
  vpVolumeFactor: number;
278
+ padding: number[] | BN[] | BN[];
279
+ stakingFeeBoostBps: BN[];
278
280
  market: PublicKey;
279
281
  delegate: PublicKey;
280
282
  openTime: BN;
@@ -304,7 +306,7 @@ export declare class PerpetualsClient {
304
306
  lockedDecimals: number;
305
307
  collateralDecimals: number;
306
308
  refererTradingAccount: PublicKey;
307
- padding: BN[] | BN[];
309
+ refererBoosterAccount: PublicKey;
308
310
  nftMint: PublicKey;
309
311
  level: number;
310
312
  voltagePoints: BN;
@@ -536,6 +538,8 @@ export declare class PerpetualsClient {
536
538
  flpMintBump: number;
537
539
  flpTokenAccountBump: number;
538
540
  vpVolumeFactor: number;
541
+ padding: number[] | BN[] | BN[];
542
+ stakingFeeBoostBps: BN[];
539
543
  market: PublicKey;
540
544
  delegate: PublicKey;
541
545
  openTime: BN;
@@ -565,7 +569,7 @@ export declare class PerpetualsClient {
565
569
  lockedDecimals: number;
566
570
  collateralDecimals: number;
567
571
  refererTradingAccount: PublicKey;
568
- padding: BN[] | BN[];
572
+ refererBoosterAccount: PublicKey;
569
573
  nftMint: PublicKey;
570
574
  level: number;
571
575
  voltagePoints: BN;
@@ -796,6 +800,8 @@ export declare class PerpetualsClient {
796
800
  flpMintBump: number;
797
801
  flpTokenAccountBump: number;
798
802
  vpVolumeFactor: number;
803
+ padding: number[] | BN[] | BN[];
804
+ stakingFeeBoostBps: BN[];
799
805
  market: PublicKey;
800
806
  delegate: PublicKey;
801
807
  openTime: BN;
@@ -825,7 +831,7 @@ export declare class PerpetualsClient {
825
831
  lockedDecimals: number;
826
832
  collateralDecimals: number;
827
833
  refererTradingAccount: PublicKey;
828
- padding: BN[] | BN[];
834
+ refererBoosterAccount: PublicKey;
829
835
  nftMint: PublicKey;
830
836
  level: number;
831
837
  voltagePoints: BN;
@@ -1059,6 +1065,8 @@ export declare class PerpetualsClient {
1059
1065
  flpMintBump: number;
1060
1066
  flpTokenAccountBump: number;
1061
1067
  vpVolumeFactor: number;
1068
+ padding: number[] | BN[] | BN[];
1069
+ stakingFeeBoostBps: BN[];
1062
1070
  market: PublicKey;
1063
1071
  delegate: PublicKey;
1064
1072
  openTime: BN;
@@ -1088,7 +1096,7 @@ export declare class PerpetualsClient {
1088
1096
  lockedDecimals: number;
1089
1097
  collateralDecimals: number;
1090
1098
  refererTradingAccount: PublicKey;
1091
- padding: BN[] | BN[];
1099
+ refererBoosterAccount: PublicKey;
1092
1100
  nftMint: PublicKey;
1093
1101
  level: number;
1094
1102
  voltagePoints: BN;
@@ -1321,6 +1329,8 @@ export declare class PerpetualsClient {
1321
1329
  flpMintBump: number;
1322
1330
  flpTokenAccountBump: number;
1323
1331
  vpVolumeFactor: number;
1332
+ padding: number[] | BN[] | BN[];
1333
+ stakingFeeBoostBps: BN[];
1324
1334
  market: PublicKey;
1325
1335
  delegate: PublicKey;
1326
1336
  openTime: BN;
@@ -1350,7 +1360,7 @@ export declare class PerpetualsClient {
1350
1360
  lockedDecimals: number;
1351
1361
  collateralDecimals: number;
1352
1362
  refererTradingAccount: PublicKey;
1353
- padding: BN[] | BN[];
1363
+ refererBoosterAccount: PublicKey;
1354
1364
  nftMint: PublicKey;
1355
1365
  level: number;
1356
1366
  voltagePoints: BN;
@@ -1581,6 +1591,8 @@ export declare class PerpetualsClient {
1581
1591
  flpMintBump: number;
1582
1592
  flpTokenAccountBump: number;
1583
1593
  vpVolumeFactor: number;
1594
+ padding: number[] | BN[] | BN[];
1595
+ stakingFeeBoostBps: BN[];
1584
1596
  market: PublicKey;
1585
1597
  delegate: PublicKey;
1586
1598
  openTime: BN;
@@ -1610,7 +1622,7 @@ export declare class PerpetualsClient {
1610
1622
  lockedDecimals: number;
1611
1623
  collateralDecimals: number;
1612
1624
  refererTradingAccount: PublicKey;
1613
- padding: BN[] | BN[];
1625
+ refererBoosterAccount: PublicKey;
1614
1626
  nftMint: PublicKey;
1615
1627
  level: number;
1616
1628
  voltagePoints: BN;
@@ -1874,6 +1886,8 @@ export declare class PerpetualsClient {
1874
1886
  flpMintBump: number;
1875
1887
  flpTokenAccountBump: number;
1876
1888
  vpVolumeFactor: number;
1889
+ padding: number[] | BN[] | BN[];
1890
+ stakingFeeBoostBps: BN[];
1877
1891
  market: PublicKey;
1878
1892
  delegate: PublicKey;
1879
1893
  openTime: BN;
@@ -1903,7 +1917,7 @@ export declare class PerpetualsClient {
1903
1917
  lockedDecimals: number;
1904
1918
  collateralDecimals: number;
1905
1919
  refererTradingAccount: PublicKey;
1906
- padding: BN[] | BN[];
1920
+ refererBoosterAccount: PublicKey;
1907
1921
  nftMint: PublicKey;
1908
1922
  level: number;
1909
1923
  voltagePoints: BN;
@@ -2134,6 +2148,8 @@ export declare class PerpetualsClient {
2134
2148
  flpMintBump: number;
2135
2149
  flpTokenAccountBump: number;
2136
2150
  vpVolumeFactor: number;
2151
+ padding: number[] | BN[] | BN[];
2152
+ stakingFeeBoostBps: BN[];
2137
2153
  market: PublicKey;
2138
2154
  delegate: PublicKey;
2139
2155
  openTime: BN;
@@ -2163,7 +2179,7 @@ export declare class PerpetualsClient {
2163
2179
  lockedDecimals: number;
2164
2180
  collateralDecimals: number;
2165
2181
  refererTradingAccount: PublicKey;
2166
- padding: BN[] | BN[];
2182
+ refererBoosterAccount: PublicKey;
2167
2183
  nftMint: PublicKey;
2168
2184
  level: number;
2169
2185
  voltagePoints: BN;
@@ -2191,6 +2207,7 @@ export declare class PerpetualsClient {
2191
2207
  editCustody: (poolName: string, tokenMint: PublicKey, isStable: boolean, oracle: OracleParams, pricing: PricingParams, permissions: Permissions, fees: Fees, borrowRate: BorrowRateParams, ratios: TokenRatios[]) => Promise<void>;
2192
2208
  removeCustody: (poolName: string, tokenMint: PublicKey, ratios: TokenRatios[]) => Promise<void>;
2193
2209
  getLiquidationState: (positionAccount: PublicKey, poolName: string, tokenMint: PublicKey, collateralMint: PublicKey, poolConfig: PoolConfig) => Promise<any>;
2210
+ getLpTokenPrice: (poolConfig: PoolConfig) => Promise<any>;
2194
2211
  liquidate: (positionAccount: PublicKey, poolConfig: PoolConfig, tokenMint: PublicKey, collateralMint: PublicKey, marketPk: PublicKey) => Promise<TransactionInstruction>;
2195
2212
  getApyPercentageUi: (rewardCustodyAccount: CustodyAccount, previousSnapShotRewardPerLpStaked: BN, lpTokenUsdPrice: BN) => string;
2196
2213
  getAddLiquidityAmountAndFeeSync: (amountIn: BN, poolAccount: PoolAccount, inputTokenPrice: OraclePrice, inputTokenEmaPrice: OraclePrice, inputTokenCustodyAccount: CustodyAccount, lpTokenSupplyAmount: BN, poolAumUsdMax: BN, poolConfig: PoolConfig) => AddLiquidityAmountAndFee;
@@ -2312,7 +2329,7 @@ export declare class PerpetualsClient {
2312
2329
  instructions: TransactionInstruction[];
2313
2330
  additionalSigners: Signer[];
2314
2331
  }>;
2315
- updateNftAccount: (nftMint: PublicKey) => Promise<{
2332
+ updateNftAccount: (nftMint: PublicKey, updateReferer: boolean, updateBooster: boolean, flpStakeAccounts: PublicKey[]) => Promise<{
2316
2333
  instructions: TransactionInstruction[];
2317
2334
  additionalSigners: Signer[];
2318
2335
  }>;
@@ -2343,7 +2360,7 @@ export declare class PerpetualsClient {
2343
2360
  instructions: TransactionInstruction[];
2344
2361
  additionalSigners: Signer[];
2345
2362
  }>;
2346
- collectStakeFees: (rewardSymbol: string, poolConfig: PoolConfig, nftTradingAccount?: PublicKey, createUserATA?: boolean) => Promise<{
2363
+ collectStakeFees: (rewardSymbol: string, poolConfig: PoolConfig, nftTradingAccount?: PublicKey, nftBoostingAccount?: PublicKey, createUserATA?: boolean) => Promise<{
2347
2364
  instructions: TransactionInstruction[];
2348
2365
  additionalSigners: Signer[];
2349
2366
  }>;
@@ -543,6 +543,53 @@ var PerpetualsClient = (function () {
543
543
  }
544
544
  });
545
545
  }); };
546
+ this.getLpTokenPrice = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
547
+ var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market;
548
+ return __generator(this, function (_d) {
549
+ switch (_d.label) {
550
+ case 0:
551
+ custodyAccountMetas = [];
552
+ custodyOracleAccountMetas = [];
553
+ markets = [];
554
+ for (_i = 0, _a = poolConfig.custodies; _i < _a.length; _i++) {
555
+ custody = _a[_i];
556
+ custodyAccountMetas.push({
557
+ pubkey: custody.custodyAccount,
558
+ isSigner: false,
559
+ isWritable: false,
560
+ });
561
+ custodyOracleAccountMetas.push({
562
+ pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
563
+ isSigner: false,
564
+ isWritable: false,
565
+ });
566
+ }
567
+ for (_b = 0, _c = poolConfig.markets; _b < _c.length; _b++) {
568
+ market = _c[_b];
569
+ markets.push({
570
+ pubkey: market.marketAccount,
571
+ isSigner: false,
572
+ isWritable: false,
573
+ });
574
+ }
575
+ return [4, this.program.methods
576
+ .getLpTokenPrice({})
577
+ .accounts({
578
+ perpetuals: this.perpetuals.publicKey,
579
+ pool: poolConfig.poolAddress,
580
+ lpTokenMint: poolConfig.lpTokenMint,
581
+ ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
582
+ })
583
+ .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true), markets, true))
584
+ .view()
585
+ .catch(function (err) {
586
+ console.error(err);
587
+ throw err;
588
+ })];
589
+ case 1: return [2, _d.sent()];
590
+ }
591
+ });
592
+ }); };
546
593
  this.liquidate = function (positionAccount, poolConfig, tokenMint, collateralMint, marketPk) { return __awaiter(_this, void 0, void 0, function () {
547
594
  var targetCustodyConfig, collateralCustodyConfig;
548
595
  return __generator(this, function (_a) {
@@ -3217,8 +3264,8 @@ var PerpetualsClient = (function () {
3217
3264
  }
3218
3265
  });
3219
3266
  }); };
3220
- this.updateNftAccount = function (nftMint) { return __awaiter(_this, void 0, void 0, function () {
3221
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, nftTradingAccount, nftReferralAccount, nftTokenAccount, updateNftTradingAccountInstruction, err_7;
3267
+ this.updateNftAccount = function (nftMint, updateReferer, updateBooster, flpStakeAccounts) { return __awaiter(_this, void 0, void 0, function () {
3268
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, nftTradingAccount, nftReferralAccount, nftTokenAccount, flpStakeAccountMetas, _i, flpStakeAccounts_1, flpStakeAccountPk, updateNftTradingAccountInstruction, err_7;
3222
3269
  return __generator(this, function (_a) {
3223
3270
  switch (_a.label) {
3224
3271
  case 0:
@@ -3241,8 +3288,20 @@ var PerpetualsClient = (function () {
3241
3288
  return [4, (0, spl_token_1.getAssociatedTokenAddress)(nftMint, publicKey)];
3242
3289
  case 2:
3243
3290
  nftTokenAccount = _a.sent();
3291
+ flpStakeAccountMetas = [];
3292
+ for (_i = 0, flpStakeAccounts_1 = flpStakeAccounts; _i < flpStakeAccounts_1.length; _i++) {
3293
+ flpStakeAccountPk = flpStakeAccounts_1[_i];
3294
+ flpStakeAccountMetas.push({
3295
+ pubkey: flpStakeAccountPk,
3296
+ isSigner: false,
3297
+ isWritable: true,
3298
+ });
3299
+ }
3244
3300
  return [4, this.program.methods
3245
- .updateTradingAccount({})
3301
+ .updateTradingAccount({
3302
+ updateReferer: updateReferer,
3303
+ updateBooster: updateBooster
3304
+ })
3246
3305
  .accounts({
3247
3306
  owner: publicKey,
3248
3307
  feePayer: publicKey,
@@ -3417,7 +3476,7 @@ var PerpetualsClient = (function () {
3417
3476
  });
3418
3477
  }); };
3419
3478
  this.refreshStakeWithAllFlpStakeAccounts = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
3420
- var flpStakeAccounts, maxFlpStakeAccountLength, pendingActivationAccounts, _i, flpStakeAccounts_1, flpStakeAccount, account, refreshStakeInstructions, i, batch, instruction;
3479
+ var flpStakeAccounts, maxFlpStakeAccountLength, pendingActivationAccounts, _i, flpStakeAccounts_2, flpStakeAccount, account, refreshStakeInstructions, i, batch, instruction;
3421
3480
  return __generator(this, function (_a) {
3422
3481
  switch (_a.label) {
3423
3482
  case 0: return [4, this.program.account.flpStake.all()];
@@ -3426,8 +3485,8 @@ var PerpetualsClient = (function () {
3426
3485
  console.log("total no of flpStakeAccounts: ", flpStakeAccounts.length);
3427
3486
  maxFlpStakeAccountLength = 32 - (4 + poolConfig.custodies.length);
3428
3487
  pendingActivationAccounts = [];
3429
- for (_i = 0, flpStakeAccounts_1 = flpStakeAccounts; _i < flpStakeAccounts_1.length; _i++) {
3430
- flpStakeAccount = flpStakeAccounts_1[_i];
3488
+ for (_i = 0, flpStakeAccounts_2 = flpStakeAccounts; _i < flpStakeAccounts_2.length; _i++) {
3489
+ flpStakeAccount = flpStakeAccounts_2[_i];
3431
3490
  account = flpStakeAccount.account;
3432
3491
  pendingActivationAccounts.push(flpStakeAccount.publicKey);
3433
3492
  }
@@ -3714,10 +3773,10 @@ var PerpetualsClient = (function () {
3714
3773
  });
3715
3774
  });
3716
3775
  };
3717
- this.collectStakeFees = function (rewardSymbol, poolConfig, nftTradingAccount, createUserATA) {
3776
+ this.collectStakeFees = function (rewardSymbol, poolConfig, nftTradingAccount, nftBoostingAccount, createUserATA) {
3718
3777
  if (createUserATA === void 0) { createUserATA = true; }
3719
3778
  return __awaiter(_this, void 0, void 0, function () {
3720
- var publicKey, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tradingAccount, withdrawStakeInstruction, err_16;
3779
+ var publicKey, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tradingAccount, boostingAccount, withdrawStakeInstruction, err_16;
3721
3780
  return __generator(this, function (_b) {
3722
3781
  switch (_b.label) {
3723
3782
  case 0:
@@ -3752,6 +3811,14 @@ var PerpetualsClient = (function () {
3752
3811
  isWritable: true,
3753
3812
  });
3754
3813
  }
3814
+ boostingAccount = [];
3815
+ if (nftBoostingAccount) {
3816
+ boostingAccount.push({
3817
+ pubkey: nftBoostingAccount,
3818
+ isSigner: false,
3819
+ isWritable: true,
3820
+ });
3821
+ }
3755
3822
  return [4, this.program.methods
3756
3823
  .collectStakeFees({})
3757
3824
  .accounts({
@@ -3769,7 +3836,7 @@ var PerpetualsClient = (function () {
3769
3836
  eventAuthority: this.eventAuthority.publicKey,
3770
3837
  ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
3771
3838
  })
3772
- .remainingAccounts(tradingAccount)
3839
+ .remainingAccounts(__spreadArray(__spreadArray([], tradingAccount, true), boostingAccount, true))
3773
3840
  .instruction()];
3774
3841
  case 4:
3775
3842
  withdrawStakeInstruction = _b.sent();
@@ -22,6 +22,8 @@ export declare class PoolAccount implements Pool {
22
22
  flpMintBump: number;
23
23
  flpTokenAccountBump: number;
24
24
  vpVolumeFactor: number;
25
+ padding: number[];
26
+ stakingFeeBoostBps: BN[];
25
27
  constructor(publicKey: PublicKey, parseData: Pool);
26
28
  static from(publicKey: PublicKey, parseData: Pool): PoolAccount;
27
29
  updatePoolData(parseData: Pool): void;
@@ -10,11 +10,11 @@ export declare class TradingAccount implements Trading {
10
10
  isInitialized: boolean;
11
11
  level: number;
12
12
  bump: number;
13
- counter: BN;
14
13
  voltagePoints: BN;
15
14
  stats: VoltageStats;
16
15
  snapshot: VoltageStats;
17
16
  timestamp: BN;
17
+ counter: BN;
18
18
  padding: BN[];
19
19
  constructor(publicKey: PublicKey, parseData: Trading);
20
20
  static from(publicKey: PublicKey, parseData: Trading): TradingAccount;
@@ -13,5 +13,5 @@ exports.RATE_POWER = Math.pow(10, (exports.RATE_DECIMALS));
13
13
  exports.ORACLE_EXPONENT = 9;
14
14
  exports.BN_ZERO = new bn_js_1.BN(0);
15
15
  exports.BN_ONE = new bn_js_1.BN(1);
16
- exports.DAY_SECONDS = new bn_js_1.BN(86400);
16
+ exports.DAY_SECONDS = new bn_js_1.BN(3600);
17
17
  exports.METAPLEX_PROGRAM_ID = new web3_js_1.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");