flash-sdk 2.5.0 → 2.5.1

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.
@@ -3,7 +3,7 @@ import { Program, AnchorProvider, BN } from "@coral-xyz/anchor";
3
3
  import { PublicKey, TransactionInstruction, Commitment, Signer, AddressLookupTableAccount } from "@solana/web3.js";
4
4
  import { PoolAccount } from "./PoolAccount";
5
5
  import { PositionAccount } from "./PositionAccount";
6
- import { AddLiquidityAmountAndFee, BorrowRateParams, EntryPriceAndFee, ExitPriceAndFee, Fees, OracleParams, Permissions, PricingParams, RemoveCollateralData, RemoveLiquidityAmountAndFee, Side, TokenRatios, MinAndMaxPrice, FeesAction, ContractOraclePrice, Privilege } from "./types";
6
+ import { AddLiquidityAmountAndFee, BorrowRateParams, EntryPriceAndFee, ExitPriceAndFee, Fees, OracleParams, Permissions, PricingParams, RemoveCollateralData, RemoveLiquidityAmountAndFee, Side, TokenRatios, MinAndMaxPrice, FeesAction, ContractOraclePrice, Privilege, PerpetualsAccount, Trading } from "./types";
7
7
  import { OraclePrice } from "./OraclePrice";
8
8
  import { CustodyAccount } from "./CustodyAccount";
9
9
  import { Perpetuals } from "./idl/perpetuals";
@@ -249,6 +249,8 @@ export declare class PerpetualsClient {
249
249
  inceptionTime: BN;
250
250
  transferAuthorityBump: number;
251
251
  perpetualsBump: number;
252
+ tradeLimit: number;
253
+ rebateLimitUsd: number;
252
254
  name: string;
253
255
  flpMint: PublicKey;
254
256
  oracleAuthority: PublicKey;
@@ -273,8 +275,6 @@ export declare class PerpetualsClient {
273
275
  flpMintBump: number;
274
276
  flpTokenAccountBump: number;
275
277
  vpVolumeFactor: number;
276
- padding: number[] | BN[] | BN[];
277
- stakingFeeBoostBps: BN[];
278
278
  market: PublicKey;
279
279
  delegate: PublicKey;
280
280
  openTime: BN;
@@ -304,7 +304,7 @@ export declare class PerpetualsClient {
304
304
  lockedDecimals: number;
305
305
  collateralDecimals: number;
306
306
  refererTradingAccount: PublicKey;
307
- refererBoosterAccount: PublicKey;
307
+ padding: BN[] | BN[];
308
308
  nftMint: PublicKey;
309
309
  level: number;
310
310
  voltagePoints: BN;
@@ -318,6 +318,8 @@ export declare class PerpetualsClient {
318
318
  lpRewardsUsd: BN;
319
319
  referralRebateUsd: BN;
320
320
  };
321
+ timestamp: BN;
322
+ counter: BN;
321
323
  }>;
322
324
  getPoolKey: (name: string) => PublicKey;
323
325
  getPool: (name: string) => Promise<{
@@ -508,6 +510,8 @@ export declare class PerpetualsClient {
508
510
  inceptionTime: BN;
509
511
  transferAuthorityBump: number;
510
512
  perpetualsBump: number;
513
+ tradeLimit: number;
514
+ rebateLimitUsd: number;
511
515
  name: string;
512
516
  flpMint: PublicKey;
513
517
  oracleAuthority: PublicKey;
@@ -532,8 +536,6 @@ export declare class PerpetualsClient {
532
536
  flpMintBump: number;
533
537
  flpTokenAccountBump: number;
534
538
  vpVolumeFactor: number;
535
- padding: number[] | BN[] | BN[];
536
- stakingFeeBoostBps: BN[];
537
539
  market: PublicKey;
538
540
  delegate: PublicKey;
539
541
  openTime: BN;
@@ -563,7 +565,7 @@ export declare class PerpetualsClient {
563
565
  lockedDecimals: number;
564
566
  collateralDecimals: number;
565
567
  refererTradingAccount: PublicKey;
566
- refererBoosterAccount: PublicKey;
568
+ padding: BN[] | BN[];
567
569
  nftMint: PublicKey;
568
570
  level: number;
569
571
  voltagePoints: BN;
@@ -577,6 +579,8 @@ export declare class PerpetualsClient {
577
579
  lpRewardsUsd: BN;
578
580
  referralRebateUsd: BN;
579
581
  };
582
+ timestamp: BN;
583
+ counter: BN;
580
584
  }>;
581
585
  getPools: () => Promise<{
582
586
  pool: PublicKey;
@@ -766,6 +770,8 @@ export declare class PerpetualsClient {
766
770
  inceptionTime: BN;
767
771
  transferAuthorityBump: number;
768
772
  perpetualsBump: number;
773
+ tradeLimit: number;
774
+ rebateLimitUsd: number;
769
775
  name: string;
770
776
  flpMint: PublicKey;
771
777
  oracleAuthority: PublicKey;
@@ -790,8 +796,6 @@ export declare class PerpetualsClient {
790
796
  flpMintBump: number;
791
797
  flpTokenAccountBump: number;
792
798
  vpVolumeFactor: number;
793
- padding: number[] | BN[] | BN[];
794
- stakingFeeBoostBps: BN[];
795
799
  market: PublicKey;
796
800
  delegate: PublicKey;
797
801
  openTime: BN;
@@ -821,7 +825,7 @@ export declare class PerpetualsClient {
821
825
  lockedDecimals: number;
822
826
  collateralDecimals: number;
823
827
  refererTradingAccount: PublicKey;
824
- refererBoosterAccount: PublicKey;
828
+ padding: BN[] | BN[];
825
829
  nftMint: PublicKey;
826
830
  level: number;
827
831
  voltagePoints: BN;
@@ -835,6 +839,8 @@ export declare class PerpetualsClient {
835
839
  lpRewardsUsd: BN;
836
840
  referralRebateUsd: BN;
837
841
  };
842
+ timestamp: BN;
843
+ counter: BN;
838
844
  }[]>;
839
845
  getPoolLpTokenKey: (name: string) => PublicKey;
840
846
  getCustodyKey: (poolName: string, tokenMint: PublicKey) => PublicKey;
@@ -1027,6 +1033,8 @@ export declare class PerpetualsClient {
1027
1033
  inceptionTime: BN;
1028
1034
  transferAuthorityBump: number;
1029
1035
  perpetualsBump: number;
1036
+ tradeLimit: number;
1037
+ rebateLimitUsd: number;
1030
1038
  name: string;
1031
1039
  flpMint: PublicKey;
1032
1040
  oracleAuthority: PublicKey;
@@ -1051,8 +1059,6 @@ export declare class PerpetualsClient {
1051
1059
  flpMintBump: number;
1052
1060
  flpTokenAccountBump: number;
1053
1061
  vpVolumeFactor: number;
1054
- padding: number[] | BN[] | BN[];
1055
- stakingFeeBoostBps: BN[];
1056
1062
  market: PublicKey;
1057
1063
  delegate: PublicKey;
1058
1064
  openTime: BN;
@@ -1082,7 +1088,7 @@ export declare class PerpetualsClient {
1082
1088
  lockedDecimals: number;
1083
1089
  collateralDecimals: number;
1084
1090
  refererTradingAccount: PublicKey;
1085
- refererBoosterAccount: PublicKey;
1091
+ padding: BN[] | BN[];
1086
1092
  nftMint: PublicKey;
1087
1093
  level: number;
1088
1094
  voltagePoints: BN;
@@ -1096,6 +1102,8 @@ export declare class PerpetualsClient {
1096
1102
  lpRewardsUsd: BN;
1097
1103
  referralRebateUsd: BN;
1098
1104
  };
1105
+ timestamp: BN;
1106
+ counter: BN;
1099
1107
  }>;
1100
1108
  getMarketPk(targetCustody: PublicKey, collateralCustody: PublicKey, side: Side): PublicKey;
1101
1109
  getPositionKey(owner: PublicKey, targetCustody: PublicKey, collateralCustody: PublicKey, side: Side): PublicKey;
@@ -1287,6 +1295,8 @@ export declare class PerpetualsClient {
1287
1295
  inceptionTime: BN;
1288
1296
  transferAuthorityBump: number;
1289
1297
  perpetualsBump: number;
1298
+ tradeLimit: number;
1299
+ rebateLimitUsd: number;
1290
1300
  name: string;
1291
1301
  flpMint: PublicKey;
1292
1302
  oracleAuthority: PublicKey;
@@ -1311,8 +1321,6 @@ export declare class PerpetualsClient {
1311
1321
  flpMintBump: number;
1312
1322
  flpTokenAccountBump: number;
1313
1323
  vpVolumeFactor: number;
1314
- padding: number[] | BN[] | BN[];
1315
- stakingFeeBoostBps: BN[];
1316
1324
  market: PublicKey;
1317
1325
  delegate: PublicKey;
1318
1326
  openTime: BN;
@@ -1342,7 +1350,7 @@ export declare class PerpetualsClient {
1342
1350
  lockedDecimals: number;
1343
1351
  collateralDecimals: number;
1344
1352
  refererTradingAccount: PublicKey;
1345
- refererBoosterAccount: PublicKey;
1353
+ padding: BN[] | BN[];
1346
1354
  nftMint: PublicKey;
1347
1355
  level: number;
1348
1356
  voltagePoints: BN;
@@ -1356,6 +1364,8 @@ export declare class PerpetualsClient {
1356
1364
  lpRewardsUsd: BN;
1357
1365
  referralRebateUsd: BN;
1358
1366
  };
1367
+ timestamp: BN;
1368
+ counter: BN;
1359
1369
  }>;
1360
1370
  getUserPosition: (owner: PublicKey, targetCustody: PublicKey, collateralCustody: PublicKey, side: Side) => Promise<{
1361
1371
  pool: PublicKey;
@@ -1545,6 +1555,8 @@ export declare class PerpetualsClient {
1545
1555
  inceptionTime: BN;
1546
1556
  transferAuthorityBump: number;
1547
1557
  perpetualsBump: number;
1558
+ tradeLimit: number;
1559
+ rebateLimitUsd: number;
1548
1560
  name: string;
1549
1561
  flpMint: PublicKey;
1550
1562
  oracleAuthority: PublicKey;
@@ -1569,8 +1581,6 @@ export declare class PerpetualsClient {
1569
1581
  flpMintBump: number;
1570
1582
  flpTokenAccountBump: number;
1571
1583
  vpVolumeFactor: number;
1572
- padding: number[] | BN[] | BN[];
1573
- stakingFeeBoostBps: BN[];
1574
1584
  market: PublicKey;
1575
1585
  delegate: PublicKey;
1576
1586
  openTime: BN;
@@ -1600,7 +1610,7 @@ export declare class PerpetualsClient {
1600
1610
  lockedDecimals: number;
1601
1611
  collateralDecimals: number;
1602
1612
  refererTradingAccount: PublicKey;
1603
- refererBoosterAccount: PublicKey;
1613
+ padding: BN[] | BN[];
1604
1614
  nftMint: PublicKey;
1605
1615
  level: number;
1606
1616
  voltagePoints: BN;
@@ -1614,6 +1624,8 @@ export declare class PerpetualsClient {
1614
1624
  lpRewardsUsd: BN;
1615
1625
  referralRebateUsd: BN;
1616
1626
  };
1627
+ timestamp: BN;
1628
+ counter: BN;
1617
1629
  }>;
1618
1630
  getUserPositions: (wallet: PublicKey, poolConfig: PoolConfig) => Promise<{
1619
1631
  owner: PublicKey;
@@ -1836,6 +1848,8 @@ export declare class PerpetualsClient {
1836
1848
  inceptionTime: BN;
1837
1849
  transferAuthorityBump: number;
1838
1850
  perpetualsBump: number;
1851
+ tradeLimit: number;
1852
+ rebateLimitUsd: number;
1839
1853
  name: string;
1840
1854
  flpMint: PublicKey;
1841
1855
  oracleAuthority: PublicKey;
@@ -1860,8 +1874,6 @@ export declare class PerpetualsClient {
1860
1874
  flpMintBump: number;
1861
1875
  flpTokenAccountBump: number;
1862
1876
  vpVolumeFactor: number;
1863
- padding: number[] | BN[] | BN[];
1864
- stakingFeeBoostBps: BN[];
1865
1877
  market: PublicKey;
1866
1878
  delegate: PublicKey;
1867
1879
  openTime: BN;
@@ -1891,7 +1903,7 @@ export declare class PerpetualsClient {
1891
1903
  lockedDecimals: number;
1892
1904
  collateralDecimals: number;
1893
1905
  refererTradingAccount: PublicKey;
1894
- refererBoosterAccount: PublicKey;
1906
+ padding: BN[] | BN[];
1895
1907
  nftMint: PublicKey;
1896
1908
  level: number;
1897
1909
  voltagePoints: BN;
@@ -1905,6 +1917,8 @@ export declare class PerpetualsClient {
1905
1917
  lpRewardsUsd: BN;
1906
1918
  referralRebateUsd: BN;
1907
1919
  };
1920
+ timestamp: BN;
1921
+ counter: BN;
1908
1922
  }>[]>;
1909
1923
  getAllPositions: () => Promise<import("@coral-xyz/anchor").ProgramAccount<{
1910
1924
  pool: PublicKey;
@@ -2094,6 +2108,8 @@ export declare class PerpetualsClient {
2094
2108
  inceptionTime: BN;
2095
2109
  transferAuthorityBump: number;
2096
2110
  perpetualsBump: number;
2111
+ tradeLimit: number;
2112
+ rebateLimitUsd: number;
2097
2113
  name: string;
2098
2114
  flpMint: PublicKey;
2099
2115
  oracleAuthority: PublicKey;
@@ -2118,8 +2134,6 @@ export declare class PerpetualsClient {
2118
2134
  flpMintBump: number;
2119
2135
  flpTokenAccountBump: number;
2120
2136
  vpVolumeFactor: number;
2121
- padding: number[] | BN[] | BN[];
2122
- stakingFeeBoostBps: BN[];
2123
2137
  market: PublicKey;
2124
2138
  delegate: PublicKey;
2125
2139
  openTime: BN;
@@ -2149,7 +2163,7 @@ export declare class PerpetualsClient {
2149
2163
  lockedDecimals: number;
2150
2164
  collateralDecimals: number;
2151
2165
  refererTradingAccount: PublicKey;
2152
- refererBoosterAccount: PublicKey;
2166
+ padding: BN[] | BN[];
2153
2167
  nftMint: PublicKey;
2154
2168
  level: number;
2155
2169
  voltagePoints: BN;
@@ -2163,6 +2177,8 @@ export declare class PerpetualsClient {
2163
2177
  lpRewardsUsd: BN;
2164
2178
  referralRebateUsd: BN;
2165
2179
  };
2180
+ timestamp: BN;
2181
+ counter: BN;
2166
2182
  }>[]>;
2167
2183
  getAccountDiscriminator: (name: string) => Buffer;
2168
2184
  log: (...message: string[]) => void;
@@ -2175,7 +2191,6 @@ export declare class PerpetualsClient {
2175
2191
  editCustody: (poolName: string, tokenMint: PublicKey, isStable: boolean, oracle: OracleParams, pricing: PricingParams, permissions: Permissions, fees: Fees, borrowRate: BorrowRateParams, ratios: TokenRatios[]) => Promise<void>;
2176
2192
  removeCustody: (poolName: string, tokenMint: PublicKey, ratios: TokenRatios[]) => Promise<void>;
2177
2193
  getLiquidationState: (positionAccount: PublicKey, poolName: string, tokenMint: PublicKey, collateralMint: PublicKey, poolConfig: PoolConfig) => Promise<any>;
2178
- getLpTokenPrice: (poolConfig: PoolConfig) => Promise<any>;
2179
2194
  liquidate: (positionAccount: PublicKey, poolConfig: PoolConfig, tokenMint: PublicKey, collateralMint: PublicKey, marketPk: PublicKey) => Promise<TransactionInstruction>;
2180
2195
  getApyPercentageUi: (rewardCustodyAccount: CustodyAccount, previousSnapShotRewardPerLpStaked: BN, lpTokenUsdPrice: BN) => string;
2181
2196
  getAddLiquidityAmountAndFeeSync: (amountIn: BN, poolAccount: PoolAccount, inputTokenPrice: OraclePrice, inputTokenEmaPrice: OraclePrice, inputTokenCustodyAccount: CustodyAccount, lpTokenSupplyAmount: BN, poolAumUsdMax: BN, poolConfig: PoolConfig) => AddLiquidityAmountAndFee;
@@ -2233,6 +2248,9 @@ export declare class PerpetualsClient {
2233
2248
  poolAmountUsd: BN;
2234
2249
  poolEquityUsd: BN;
2235
2250
  };
2251
+ getNftFinalDiscount: (perpetualsAccount: PerpetualsAccount, nftTradingAccount: Trading, currentTime: BN) => {
2252
+ discountBn: BN;
2253
+ };
2236
2254
  openPosition: (targetSymbol: string, collateralSymbol: string, priceWithSlippage: ContractOraclePrice, collateralWithfee: BN, size: BN, side: Side, poolConfig: PoolConfig, nftTradingAccount: PublicKey, nftReferralAccount: PublicKey, nftRebateTokenAccount: PublicKey, privilege: Privilege, skipBalanceChecks?: boolean) => Promise<{
2237
2255
  instructions: TransactionInstruction[];
2238
2256
  additionalSigners: Signer[];
@@ -2293,7 +2311,7 @@ export declare class PerpetualsClient {
2293
2311
  instructions: TransactionInstruction[];
2294
2312
  additionalSigners: Signer[];
2295
2313
  }>;
2296
- updateNftAccount: (nftMint: PublicKey, updateReferer: boolean, updateBooster: boolean, flpStakeAccounts: PublicKey[]) => Promise<{
2314
+ updateNftAccount: (nftMint: PublicKey) => Promise<{
2297
2315
  instructions: TransactionInstruction[];
2298
2316
  additionalSigners: Signer[];
2299
2317
  }>;
@@ -2324,7 +2342,7 @@ export declare class PerpetualsClient {
2324
2342
  instructions: TransactionInstruction[];
2325
2343
  additionalSigners: Signer[];
2326
2344
  }>;
2327
- collectStakeFees: (rewardSymbol: string, poolConfig: PoolConfig, nftTradingAccount?: PublicKey, nftBoostingAccount?: PublicKey, createUserATA?: boolean) => Promise<{
2345
+ collectStakeFees: (rewardSymbol: string, poolConfig: PoolConfig, nftTradingAccount?: PublicKey, createUserATA?: boolean) => Promise<{
2328
2346
  instructions: TransactionInstruction[];
2329
2347
  additionalSigners: Signer[];
2330
2348
  }>;
@@ -2361,5 +2379,9 @@ export declare class PerpetualsClient {
2361
2379
  instructions: TransactionInstruction[];
2362
2380
  additionalSigners: Signer[];
2363
2381
  }>;
2382
+ reimburse: (poolName: string, tokenMint: PublicKey, amountIn: BN, poolConfig: PoolConfig) => Promise<{
2383
+ instructions: TransactionInstruction[];
2384
+ additionalSigners: Signer[];
2385
+ }>;
2364
2386
  sendTransaction(ixs: TransactionInstruction[], opts?: SendTransactionOpts): Promise<string>;
2365
2387
  }
@@ -543,53 +543,6 @@ 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.useCustomOracle ? custody.customOracleAddress : custody.oracleAddress,
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
- }); };
593
546
  this.liquidate = function (positionAccount, poolConfig, tokenMint, collateralMint, marketPk) { return __awaiter(_this, void 0, void 0, function () {
594
547
  var targetCustodyConfig, collateralCustodyConfig;
595
548
  return __generator(this, function (_a) {
@@ -1653,6 +1606,14 @@ var PerpetualsClient = (function () {
1653
1606
  return { poolAmountUsd: poolAmountUsd, poolEquityUsd: constants_1.BN_ZERO };
1654
1607
  }
1655
1608
  };
1609
+ this.getNftFinalDiscount = function (perpetualsAccount, nftTradingAccount, currentTime) {
1610
+ if (currentTime.sub(nftTradingAccount.timestamp).lt(constants_1.DAY_SECONDS) && nftTradingAccount.counter.gt(new anchor_1.BN(perpetualsAccount.tradeLimit))) {
1611
+ return { discountBn: constants_1.BN_ZERO };
1612
+ }
1613
+ else {
1614
+ return { discountBn: perpetualsAccount.tradingDiscount[nftTradingAccount.level - 1] };
1615
+ }
1616
+ };
1656
1617
  this.openPosition = function (targetSymbol, collateralSymbol, priceWithSlippage, collateralWithfee, size, side, poolConfig, nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege, skipBalanceChecks) {
1657
1618
  if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
1658
1619
  return __awaiter(_this, void 0, void 0, function () {
@@ -3245,8 +3206,8 @@ var PerpetualsClient = (function () {
3245
3206
  }
3246
3207
  });
3247
3208
  }); };
3248
- this.updateNftAccount = function (nftMint, updateReferer, updateBooster, flpStakeAccounts) { return __awaiter(_this, void 0, void 0, function () {
3249
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, nftTradingAccount, nftReferralAccount, nftTokenAccount, flpStakeAccountMetas, _i, flpStakeAccounts_1, flpStakeAccountPk, updateNftTradingAccountInstruction, err_7;
3209
+ this.updateNftAccount = function (nftMint) { return __awaiter(_this, void 0, void 0, function () {
3210
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, nftTradingAccount, nftReferralAccount, nftTokenAccount, updateNftTradingAccountInstruction, err_7;
3250
3211
  return __generator(this, function (_a) {
3251
3212
  switch (_a.label) {
3252
3213
  case 0:
@@ -3269,20 +3230,8 @@ var PerpetualsClient = (function () {
3269
3230
  return [4, (0, spl_token_1.getAssociatedTokenAddress)(nftMint, publicKey)];
3270
3231
  case 2:
3271
3232
  nftTokenAccount = _a.sent();
3272
- flpStakeAccountMetas = [];
3273
- for (_i = 0, flpStakeAccounts_1 = flpStakeAccounts; _i < flpStakeAccounts_1.length; _i++) {
3274
- flpStakeAccountPk = flpStakeAccounts_1[_i];
3275
- flpStakeAccountMetas.push({
3276
- pubkey: flpStakeAccountPk,
3277
- isSigner: false,
3278
- isWritable: true,
3279
- });
3280
- }
3281
3233
  return [4, this.program.methods
3282
- .updateTradingAccount({
3283
- updateReferer: updateReferer,
3284
- updateBooster: updateBooster
3285
- })
3234
+ .updateTradingAccount({})
3286
3235
  .accounts({
3287
3236
  owner: publicKey,
3288
3237
  feePayer: publicKey,
@@ -3290,7 +3239,6 @@ var PerpetualsClient = (function () {
3290
3239
  referralAccount: nftReferralAccount,
3291
3240
  tradingAccount: nftTradingAccount
3292
3241
  })
3293
- .remainingAccounts(__spreadArray([], flpStakeAccountMetas, true))
3294
3242
  .instruction()];
3295
3243
  case 3:
3296
3244
  updateNftTradingAccountInstruction = _a.sent();
@@ -3458,7 +3406,7 @@ var PerpetualsClient = (function () {
3458
3406
  });
3459
3407
  }); };
3460
3408
  this.refreshStakeWithAllFlpStakeAccounts = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
3461
- var flpStakeAccounts, maxFlpStakeAccountLength, pendingActivationAccounts, _i, flpStakeAccounts_2, flpStakeAccount, account, refreshStakeInstructions, i, batch, instruction;
3409
+ var flpStakeAccounts, maxFlpStakeAccountLength, pendingActivationAccounts, _i, flpStakeAccounts_1, flpStakeAccount, account, refreshStakeInstructions, i, batch, instruction;
3462
3410
  return __generator(this, function (_a) {
3463
3411
  switch (_a.label) {
3464
3412
  case 0: return [4, this.program.account.flpStake.all()];
@@ -3467,8 +3415,8 @@ var PerpetualsClient = (function () {
3467
3415
  console.log("total no of flpStakeAccounts: ", flpStakeAccounts.length);
3468
3416
  maxFlpStakeAccountLength = 32 - (4 + poolConfig.custodies.length);
3469
3417
  pendingActivationAccounts = [];
3470
- for (_i = 0, flpStakeAccounts_2 = flpStakeAccounts; _i < flpStakeAccounts_2.length; _i++) {
3471
- flpStakeAccount = flpStakeAccounts_2[_i];
3418
+ for (_i = 0, flpStakeAccounts_1 = flpStakeAccounts; _i < flpStakeAccounts_1.length; _i++) {
3419
+ flpStakeAccount = flpStakeAccounts_1[_i];
3472
3420
  account = flpStakeAccount.account;
3473
3421
  pendingActivationAccounts.push(flpStakeAccount.publicKey);
3474
3422
  }
@@ -3755,10 +3703,10 @@ var PerpetualsClient = (function () {
3755
3703
  });
3756
3704
  });
3757
3705
  };
3758
- this.collectStakeFees = function (rewardSymbol, poolConfig, nftTradingAccount, nftBoostingAccount, createUserATA) {
3706
+ this.collectStakeFees = function (rewardSymbol, poolConfig, nftTradingAccount, createUserATA) {
3759
3707
  if (createUserATA === void 0) { createUserATA = true; }
3760
3708
  return __awaiter(_this, void 0, void 0, function () {
3761
- var publicKey, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tradingAccount, boostingAccount, withdrawStakeInstruction, err_16;
3709
+ var publicKey, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tradingAccount, withdrawStakeInstruction, err_16;
3762
3710
  return __generator(this, function (_b) {
3763
3711
  switch (_b.label) {
3764
3712
  case 0:
@@ -3793,14 +3741,6 @@ var PerpetualsClient = (function () {
3793
3741
  isWritable: true,
3794
3742
  });
3795
3743
  }
3796
- boostingAccount = [];
3797
- if (nftBoostingAccount) {
3798
- boostingAccount.push({
3799
- pubkey: nftBoostingAccount,
3800
- isSigner: false,
3801
- isWritable: true,
3802
- });
3803
- }
3804
3744
  return [4, this.program.methods
3805
3745
  .collectStakeFees({})
3806
3746
  .accounts({
@@ -3818,7 +3758,7 @@ var PerpetualsClient = (function () {
3818
3758
  eventAuthority: this.eventAuthority.publicKey,
3819
3759
  ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
3820
3760
  })
3821
- .remainingAccounts(__spreadArray(__spreadArray([], tradingAccount, true), boostingAccount, true))
3761
+ .remainingAccounts(tradingAccount)
3822
3762
  .instruction()];
3823
3763
  case 4:
3824
3764
  withdrawStakeInstruction = _b.sent();
@@ -4340,6 +4280,78 @@ var PerpetualsClient = (function () {
4340
4280
  }
4341
4281
  });
4342
4282
  }); };
4283
+ this.reimburse = function (poolName, tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
4284
+ var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_26;
4285
+ var _f;
4286
+ return __generator(this, function (_g) {
4287
+ switch (_g.label) {
4288
+ case 0:
4289
+ custodyAccountMetas = [];
4290
+ custodyOracleAccountMetas = [];
4291
+ markets = [];
4292
+ for (_i = 0, _a = poolConfig.custodies; _i < _a.length; _i++) {
4293
+ custody = _a[_i];
4294
+ custodyAccountMetas.push({
4295
+ pubkey: custody.custodyAccount,
4296
+ isSigner: false,
4297
+ isWritable: false,
4298
+ });
4299
+ custodyOracleAccountMetas.push({
4300
+ pubkey: custody.customOracleAddress,
4301
+ isSigner: false,
4302
+ isWritable: false,
4303
+ });
4304
+ }
4305
+ for (_b = 0, _c = poolConfig.markets; _b < _c.length; _b++) {
4306
+ market = _c[_b];
4307
+ markets.push({
4308
+ pubkey: market.marketAccount,
4309
+ isSigner: false,
4310
+ isWritable: false,
4311
+ });
4312
+ }
4313
+ instructions = [];
4314
+ additionalSigners = [];
4315
+ custodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(tokenMint); });
4316
+ console.log("custodyConfig: ", custodyConfig);
4317
+ _g.label = 1;
4318
+ case 1:
4319
+ _g.trys.push([1, 4, , 5]);
4320
+ _e = (_d = this.program.methods
4321
+ .reimburse({ amountIn: amountIn }))
4322
+ .accounts;
4323
+ _f = {
4324
+ admin: this.provider.wallet.publicKey,
4325
+ multisig: poolConfig.multisig
4326
+ };
4327
+ return [4, (0, spl_token_1.getAssociatedTokenAddress)(tokenMint, this.provider.wallet.publicKey)];
4328
+ case 2: return [4, _e.apply(_d, [(_f.fundingAccount = _g.sent(),
4329
+ _f.perpetuals = poolConfig.perpetuals,
4330
+ _f.pool = this.getPoolKey(poolName),
4331
+ _f.custody = this.getCustodyKey(poolName, tokenMint),
4332
+ _f.custodyOracleAccount = this.useCustomOracle ? custodyConfig.customOracleAddress : custodyConfig.oracleAddress,
4333
+ _f.custodyTokenAccount = custodyConfig.tokenAccount,
4334
+ _f.tokenProgram = spl_token_1.TOKEN_PROGRAM_ID,
4335
+ _f.program = poolConfig.programId,
4336
+ _f.ixSysvar = web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
4337
+ _f)])
4338
+ .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true), markets, true))
4339
+ .instruction()];
4340
+ case 3:
4341
+ reimburse = _g.sent();
4342
+ instructions.push(reimburse);
4343
+ return [3, 5];
4344
+ case 4:
4345
+ err_26 = _g.sent();
4346
+ console.log("perpClient setPool error:: ", err_26);
4347
+ throw err_26;
4348
+ case 5: return [2, {
4349
+ instructions: __spreadArray([], instructions, true),
4350
+ additionalSigners: additionalSigners
4351
+ }];
4352
+ }
4353
+ });
4354
+ }); };
4343
4355
  this.provider = provider;
4344
4356
  (0, anchor_1.setProvider)(provider);
4345
4357
  this.program = new anchor_1.Program(perpetuals_1.IDL, programId);
@@ -22,8 +22,6 @@ export declare class PoolAccount implements Pool {
22
22
  flpMintBump: number;
23
23
  flpTokenAccountBump: number;
24
24
  vpVolumeFactor: number;
25
- padding: number[];
26
- stakingFeeBoostBps: BN[];
27
25
  constructor(publicKey: PublicKey, parseData: Pool);
28
26
  static from(publicKey: PublicKey, parseData: Pool): PoolAccount;
29
27
  updatePoolData(parseData: Pool): void;