flash-sdk 11.8.2-alpha.0 → 11.8.3

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.
@@ -701,7 +701,7 @@ var PerpetualsClient = (function () {
701
701
  currentMarginUsd = positionAccount.collateralUsd.sub(lossUsd);
702
702
  }
703
703
  else {
704
- currentMarginUsd = positionAccount.collateralUsd.add(pnl.finalProfitUsd).sub(lossUsd);
704
+ currentMarginUsd = positionAccount.collateralUsd.add(pnl.profitUsd).sub(lossUsd);
705
705
  }
706
706
  if (currentMarginUsd.gt(constants_1.BN_ZERO)) {
707
707
  return positionAccount.sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(currentMarginUsd);
@@ -1056,7 +1056,7 @@ var PerpetualsClient = (function () {
1056
1056
  var totalFeesUsd = (exitFeeUsd.add(lockAndUnsettledFeeUsd));
1057
1057
  var currentCollateralUsd = positionDelta.collateralUsd;
1058
1058
  var liabilityUsd = newPnl.lossUsd.add(totalFeesUsd);
1059
- var assetsUsd = anchor_1.BN.min(newPnl.finalProfitUsd.add(currentCollateralUsd), collateralMinMaxPrice.max.getAssetAmountUsd(positionDelta.lockedAmount, collateralCustodyAccount.decimals));
1059
+ var assetsUsd = anchor_1.BN.min(newPnl.profitUsd.add(currentCollateralUsd), collateralMinMaxPrice.max.getAssetAmountUsd(positionDelta.lockedAmount, collateralCustodyAccount.decimals));
1060
1060
  if (debugLogs) {
1061
1061
  console.log("assetsUsd.sub(liabilityUsd):", collateralCustodyAccount.decimals, assetsUsd.toString(), liabilityUsd.toString(), assetsUsd.sub(liabilityUsd).toString());
1062
1062
  }
@@ -1193,7 +1193,7 @@ var PerpetualsClient = (function () {
1193
1193
  var exitPriceAndFee = _this.getExitPriceAndFeeSync(positionAccount, marketCorrelation, positionAccount.collateralAmount, positionAccount.sizeAmount, side, targetPrice, targetEmaPrice, targetCustodyAccount, collateralPrice, collateralEmaPrice, collateralCustodyAccount, currentTimestamp);
1194
1194
  var totalFeesUsd = (exitPriceAndFee.exitFeeUsd.add(exitPriceAndFee.borrowFeeUsd));
1195
1195
  var liabilityUsd = newPnl.lossUsd.add(totalFeesUsd);
1196
- var assetsUsd = anchor_1.BN.min(newPnl.finalProfitUsd.add(positionAccount.collateralUsd), collateralMinMaxPrice.max.getAssetAmountUsd(positionAccount.lockedAmount, collateralCustodyAccount.decimals));
1196
+ var assetsUsd = anchor_1.BN.min(newPnl.profitUsd.add(positionAccount.collateralUsd), collateralMinMaxPrice.max.getAssetAmountUsd(positionAccount.lockedAmount, collateralCustodyAccount.decimals));
1197
1197
  var closeAmountUsd, feesAmountUsd;
1198
1198
  if (assetsUsd.gt(liabilityUsd)) {
1199
1199
  closeAmountUsd = assetsUsd.sub(liabilityUsd);
@@ -1609,8 +1609,6 @@ var PerpetualsClient = (function () {
1609
1609
  return {
1610
1610
  profitUsd: constants_1.BN_ZERO,
1611
1611
  lossUsd: constants_1.BN_ZERO,
1612
- penaltyUsd: constants_1.BN_ZERO,
1613
- finalProfitUsd: constants_1.BN_ZERO,
1614
1612
  };
1615
1613
  }
1616
1614
  var side = poolConfig.getMarketConfigByPk(positionAccount.market).side;
@@ -1674,34 +1672,16 @@ var PerpetualsClient = (function () {
1674
1672
  if (!priceDiffProfit.exponent.eq(priceDiffLoss.exponent)) {
1675
1673
  throw new Error("exponent mistach");
1676
1674
  }
1677
- var totalPenaltyBps = positionAccount.oraclePenalty + positionAccount.previousPenalty;
1678
1675
  if (priceDiffProfit.price.gt(constants_1.BN_ZERO)) {
1679
- var grossProfitUsd = priceDiffProfit.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals);
1680
- var penaltyUsd = constants_1.BN_ZERO;
1681
- var finalProfitUsd = grossProfitUsd;
1682
- if (totalPenaltyBps > 0 && grossProfitUsd.gt(constants_1.BN_ZERO)) {
1683
- penaltyUsd = grossProfitUsd.muln(totalPenaltyBps).divn(constants_1.BPS_POWER);
1684
- if (penaltyUsd.gte(grossProfitUsd)) {
1685
- penaltyUsd = grossProfitUsd;
1686
- finalProfitUsd = constants_1.BN_ZERO;
1687
- }
1688
- else {
1689
- finalProfitUsd = grossProfitUsd.sub(penaltyUsd);
1690
- }
1691
- }
1692
1676
  return {
1693
- profitUsd: grossProfitUsd,
1677
+ profitUsd: priceDiffProfit.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals),
1694
1678
  lossUsd: constants_1.BN_ZERO,
1695
- penaltyUsd: penaltyUsd,
1696
- finalProfitUsd: finalProfitUsd,
1697
1679
  };
1698
1680
  }
1699
1681
  else {
1700
1682
  return {
1701
1683
  profitUsd: constants_1.BN_ZERO,
1702
1684
  lossUsd: priceDiffLoss.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals),
1703
- penaltyUsd: constants_1.BN_ZERO,
1704
- finalProfitUsd: constants_1.BN_ZERO,
1705
1685
  };
1706
1686
  }
1707
1687
  };
@@ -1780,40 +1760,22 @@ var PerpetualsClient = (function () {
1780
1760
  priceDiffLoss = new OraclePrice_1.OraclePrice({ price: exitOraclePrice.price.sub(entryOraclePrice.price), exponent: exitOraclePrice.exponent, confidence: constants_1.BN_ZERO, timestamp: constants_1.BN_ZERO });
1781
1761
  }
1782
1762
  }
1783
- var totalPenaltyBps = positionAccount.oraclePenalty + positionAccount.previousPenalty;
1784
1763
  if (priceDiffProfit.price.gt(constants_1.BN_ZERO)) {
1785
- var grossProfitUsd = priceDiffProfit.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals);
1786
- var penaltyUsd = constants_1.BN_ZERO;
1787
- var finalProfitUsd = grossProfitUsd;
1788
- if (totalPenaltyBps > 0 && grossProfitUsd.gt(constants_1.BN_ZERO)) {
1789
- penaltyUsd = grossProfitUsd.muln(totalPenaltyBps).divn(constants_1.BPS_POWER);
1790
- if (penaltyUsd.gte(grossProfitUsd)) {
1791
- penaltyUsd = grossProfitUsd;
1792
- finalProfitUsd = constants_1.BN_ZERO;
1793
- }
1794
- else {
1795
- finalProfitUsd = grossProfitUsd.sub(penaltyUsd);
1796
- }
1797
- }
1798
1764
  pnl = {
1799
- profitUsd: grossProfitUsd,
1765
+ profitUsd: priceDiffProfit.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals),
1800
1766
  lossUsd: constants_1.BN_ZERO,
1801
- penaltyUsd: penaltyUsd,
1802
- finalProfitUsd: finalProfitUsd,
1803
1767
  };
1804
1768
  }
1805
1769
  else {
1806
1770
  pnl = {
1807
1771
  profitUsd: constants_1.BN_ZERO,
1808
1772
  lossUsd: priceDiffLoss.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals),
1809
- penaltyUsd: constants_1.BN_ZERO,
1810
- finalProfitUsd: constants_1.BN_ZERO,
1811
1773
  };
1812
1774
  }
1813
1775
  var liquidationPrice = _this.getLiquidationPriceContractHelper(entryOraclePrice, lockAndUnsettledFeeUsd, side, targetCustodyAccount, positionAccount);
1814
1776
  var unsettledFeesUsd = exitFeeUsd.add(lockAndUnsettledFeeUsd);
1815
1777
  var lossUsd = pnl.lossUsd.add(unsettledFeesUsd);
1816
- var currentMarginUsd = positionAccount.collateralUsd.add(pnl.finalProfitUsd).sub(lossUsd);
1778
+ var currentMarginUsd = positionAccount.collateralUsd.add(pnl.profitUsd).sub(lossUsd);
1817
1779
  var leverage;
1818
1780
  if (currentMarginUsd.gt(constants_1.BN_ZERO)) {
1819
1781
  leverage = positionAccount.sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(currentMarginUsd);
@@ -7631,42 +7593,8 @@ var PerpetualsClient = (function () {
7631
7593
  }
7632
7594
  });
7633
7595
  }); };
7634
- this.setPositionPenalty = function (positionPubkey, oraclePenalty, oracleAuthority) { return __awaiter(_this, void 0, void 0, function () {
7635
- var instructions, additionalSigners, setPositionPenaltyIx, err_52;
7636
- return __generator(this, function (_a) {
7637
- switch (_a.label) {
7638
- case 0:
7639
- instructions = [];
7640
- additionalSigners = [];
7641
- _a.label = 1;
7642
- case 1:
7643
- _a.trys.push([1, 3, , 4]);
7644
- return [4, this.program.methods
7645
- .setPositionPenalty({
7646
- oraclePenalty: oraclePenalty,
7647
- })
7648
- .accounts({
7649
- authority: oracleAuthority,
7650
- position: positionPubkey,
7651
- })
7652
- .instruction()];
7653
- case 2:
7654
- setPositionPenaltyIx = _a.sent();
7655
- instructions.push(setPositionPenaltyIx);
7656
- return [3, 4];
7657
- case 3:
7658
- err_52 = _a.sent();
7659
- console.log("perpClient setPositionPenalty error:: ", err_52);
7660
- throw err_52;
7661
- case 4: return [2, {
7662
- instructions: __spreadArray([], instructions, true),
7663
- additionalSigners: additionalSigners
7664
- }];
7665
- }
7666
- });
7667
- }); };
7668
7596
  this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7669
- var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_53;
7597
+ var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_52;
7670
7598
  return __generator(this, function (_a) {
7671
7599
  switch (_a.label) {
7672
7600
  case 0:
@@ -7704,8 +7632,8 @@ var PerpetualsClient = (function () {
7704
7632
  instructions.push(renameFlp);
7705
7633
  return [3, 4];
7706
7634
  case 3:
7707
- err_53 = _a.sent();
7708
- console.log("perpClient renameFlp error:: ", err_53);
7635
+ err_52 = _a.sent();
7636
+ console.log("perpClient renameFlp error:: ", err_52);
7709
7637
  return [3, 4];
7710
7638
  case 4: return [2, {
7711
7639
  instructions: __spreadArray([], instructions, true),
@@ -7715,7 +7643,7 @@ var PerpetualsClient = (function () {
7715
7643
  });
7716
7644
  }); };
7717
7645
  this.initStake = function (stakingFeeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7718
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_54;
7646
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_53;
7719
7647
  return __generator(this, function (_a) {
7720
7648
  switch (_a.label) {
7721
7649
  case 0:
@@ -7753,9 +7681,9 @@ var PerpetualsClient = (function () {
7753
7681
  instructions.push(initStakeInstruction);
7754
7682
  return [3, 4];
7755
7683
  case 3:
7756
- err_54 = _a.sent();
7757
- console.log("perpClient InitStaking error:: ", err_54);
7758
- throw err_54;
7684
+ err_53 = _a.sent();
7685
+ console.log("perpClient InitStaking error:: ", err_53);
7686
+ throw err_53;
7759
7687
  case 4: return [2, {
7760
7688
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7761
7689
  additionalSigners: additionalSigners
@@ -7764,7 +7692,7 @@ var PerpetualsClient = (function () {
7764
7692
  });
7765
7693
  }); };
7766
7694
  this.initCompounding = function (feeShareBps, metadataTitle, metadataSymbol, metadataUri, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7767
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_55;
7695
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_54;
7768
7696
  return __generator(this, function (_a) {
7769
7697
  switch (_a.label) {
7770
7698
  case 0:
@@ -7808,9 +7736,9 @@ var PerpetualsClient = (function () {
7808
7736
  instructions.push(initCompoundingInstruction);
7809
7737
  return [3, 4];
7810
7738
  case 3:
7811
- err_55 = _a.sent();
7812
- console.log("perpClient initCompounding error:: ", err_55);
7813
- throw err_55;
7739
+ err_54 = _a.sent();
7740
+ console.log("perpClient initCompounding error:: ", err_54);
7741
+ throw err_54;
7814
7742
  case 4: return [2, {
7815
7743
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7816
7744
  additionalSigners: additionalSigners
@@ -7819,7 +7747,7 @@ var PerpetualsClient = (function () {
7819
7747
  });
7820
7748
  }); };
7821
7749
  this.initTokenVault = function (token_permissions, tokens_to_distribute, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7822
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_56;
7750
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_55;
7823
7751
  return __generator(this, function (_a) {
7824
7752
  switch (_a.label) {
7825
7753
  case 0:
@@ -7860,9 +7788,9 @@ var PerpetualsClient = (function () {
7860
7788
  instructions.push(initTokenVaultInstruction);
7861
7789
  return [3, 4];
7862
7790
  case 3:
7863
- err_56 = _a.sent();
7864
- console.log("perpClient InitTokenVaultInstruction error:: ", err_56);
7865
- throw err_56;
7791
+ err_55 = _a.sent();
7792
+ console.log("perpClient InitTokenVaultInstruction error:: ", err_55);
7793
+ throw err_55;
7866
7794
  case 4: return [2, {
7867
7795
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7868
7796
  additionalSigners: additionalSigners
@@ -7871,7 +7799,7 @@ var PerpetualsClient = (function () {
7871
7799
  });
7872
7800
  }); };
7873
7801
  this.setTokenVaultConfig = function (token_permissions, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7874
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_57;
7802
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_56;
7875
7803
  return __generator(this, function (_a) {
7876
7804
  switch (_a.label) {
7877
7805
  case 0:
@@ -7902,9 +7830,9 @@ var PerpetualsClient = (function () {
7902
7830
  instructions.push(setTokenVaultConfigInstruction);
7903
7831
  return [3, 4];
7904
7832
  case 3:
7905
- err_57 = _a.sent();
7906
- console.log("perpClient setTokenVaultConfigInstruction error:: ", err_57);
7907
- throw err_57;
7833
+ err_56 = _a.sent();
7834
+ console.log("perpClient setTokenVaultConfigInstruction error:: ", err_56);
7835
+ throw err_56;
7908
7836
  case 4: return [2, {
7909
7837
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7910
7838
  additionalSigners: additionalSigners
@@ -7913,7 +7841,7 @@ var PerpetualsClient = (function () {
7913
7841
  });
7914
7842
  }); };
7915
7843
  this.withdrawInstantFee = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7916
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_58;
7844
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_57;
7917
7845
  return __generator(this, function (_a) {
7918
7846
  switch (_a.label) {
7919
7847
  case 0:
@@ -7952,9 +7880,9 @@ var PerpetualsClient = (function () {
7952
7880
  instructions.push(withdrawInstantFeeInstruction);
7953
7881
  return [3, 6];
7954
7882
  case 5:
7955
- err_58 = _a.sent();
7956
- console.log("perpClient withdrawInstantFeeInstruction error:: ", err_58);
7957
- throw err_58;
7883
+ err_57 = _a.sent();
7884
+ console.log("perpClient withdrawInstantFeeInstruction error:: ", err_57);
7885
+ throw err_57;
7958
7886
  case 6: return [2, {
7959
7887
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7960
7888
  additionalSigners: additionalSigners
@@ -7963,7 +7891,7 @@ var PerpetualsClient = (function () {
7963
7891
  });
7964
7892
  }); };
7965
7893
  this.withdrawUnclaimedTokens = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7966
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction, err_59;
7894
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction, err_58;
7967
7895
  return __generator(this, function (_a) {
7968
7896
  switch (_a.label) {
7969
7897
  case 0:
@@ -8002,9 +7930,9 @@ var PerpetualsClient = (function () {
8002
7930
  instructions.push(withdrawUnclaimedTokensInstruction);
8003
7931
  return [3, 6];
8004
7932
  case 5:
8005
- err_59 = _a.sent();
8006
- console.log("perpClient withdrawUnclaimedTokensInstruction error:: ", err_59);
8007
- throw err_59;
7933
+ err_58 = _a.sent();
7934
+ console.log("perpClient withdrawUnclaimedTokensInstruction error:: ", err_58);
7935
+ throw err_58;
8008
7936
  case 6: return [2, {
8009
7937
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8010
7938
  additionalSigners: additionalSigners
@@ -8013,7 +7941,7 @@ var PerpetualsClient = (function () {
8013
7941
  });
8014
7942
  }); };
8015
7943
  this.initRevenueTokenAccount = function (feeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
8016
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_60;
7944
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_59;
8017
7945
  return __generator(this, function (_a) {
8018
7946
  switch (_a.label) {
8019
7947
  case 0:
@@ -8050,9 +7978,9 @@ var PerpetualsClient = (function () {
8050
7978
  instructions.push(initRevenueTokenAccountInstruction);
8051
7979
  return [3, 4];
8052
7980
  case 3:
8053
- err_60 = _a.sent();
8054
- console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_60);
8055
- throw err_60;
7981
+ err_59 = _a.sent();
7982
+ console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_59);
7983
+ throw err_59;
8056
7984
  case 4: return [2, {
8057
7985
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8058
7986
  additionalSigners: additionalSigners
@@ -8061,7 +7989,7 @@ var PerpetualsClient = (function () {
8061
7989
  });
8062
7990
  }); };
8063
7991
  this.initRebateVault = function (allowRebatePayout, rebateSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
8064
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateCustodyMint, initRebateVaultInstruction, err_61;
7992
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateCustodyMint, initRebateVaultInstruction, err_60;
8065
7993
  return __generator(this, function (_a) {
8066
7994
  switch (_a.label) {
8067
7995
  case 0:
@@ -8096,9 +8024,9 @@ var PerpetualsClient = (function () {
8096
8024
  instructions.push(initRebateVaultInstruction);
8097
8025
  return [3, 4];
8098
8026
  case 3:
8099
- err_61 = _a.sent();
8100
- console.log("perpClient initRebateVaultInstruction error:: ", err_61);
8101
- throw err_61;
8027
+ err_60 = _a.sent();
8028
+ console.log("perpClient initRebateVaultInstruction error:: ", err_60);
8029
+ throw err_60;
8102
8030
  case 4: return [2, {
8103
8031
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8104
8032
  additionalSigners: additionalSigners
@@ -8107,7 +8035,7 @@ var PerpetualsClient = (function () {
8107
8035
  });
8108
8036
  }); };
8109
8037
  this.distributeTokenReward = function (amount, epochCount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
8110
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_62;
8038
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_61;
8111
8039
  return __generator(this, function (_a) {
8112
8040
  switch (_a.label) {
8113
8041
  case 0:
@@ -8146,9 +8074,9 @@ var PerpetualsClient = (function () {
8146
8074
  instructions.push(distributeTokenRewardInstruction);
8147
8075
  return [3, 4];
8148
8076
  case 3:
8149
- err_62 = _a.sent();
8150
- console.log("perpClient distributeTokenRewardInstruction error:: ", err_62);
8151
- throw err_62;
8077
+ err_61 = _a.sent();
8078
+ console.log("perpClient distributeTokenRewardInstruction error:: ", err_61);
8079
+ throw err_61;
8152
8080
  case 4: return [2, {
8153
8081
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8154
8082
  additionalSigners: additionalSigners
@@ -8157,7 +8085,7 @@ var PerpetualsClient = (function () {
8157
8085
  });
8158
8086
  }); };
8159
8087
  this.setTokenStakeLevel = function (owner, stakeLevel) { return __awaiter(_this, void 0, void 0, function () {
8160
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_63;
8088
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_62;
8161
8089
  return __generator(this, function (_a) {
8162
8090
  switch (_a.label) {
8163
8091
  case 0:
@@ -8185,9 +8113,9 @@ var PerpetualsClient = (function () {
8185
8113
  instructions.push(setTokenStakeLevelInstruction);
8186
8114
  return [3, 4];
8187
8115
  case 3:
8188
- err_63 = _a.sent();
8189
- console.log("perpClient setTokenStakeLevelInstruction error:: ", err_63);
8190
- throw err_63;
8116
+ err_62 = _a.sent();
8117
+ console.log("perpClient setTokenStakeLevelInstruction error:: ", err_62);
8118
+ throw err_62;
8191
8119
  case 4: return [2, {
8192
8120
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8193
8121
  additionalSigners: additionalSigners
@@ -8196,7 +8124,7 @@ var PerpetualsClient = (function () {
8196
8124
  });
8197
8125
  }); };
8198
8126
  this.setTokenReward = function (owner, amount, epochCount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
8199
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_64;
8127
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_63;
8200
8128
  return __generator(this, function (_a) {
8201
8129
  switch (_a.label) {
8202
8130
  case 0:
@@ -8228,9 +8156,9 @@ var PerpetualsClient = (function () {
8228
8156
  instructions.push(setTokenRewardInstruction);
8229
8157
  return [3, 4];
8230
8158
  case 3:
8231
- err_64 = _a.sent();
8232
- console.log("perpClient setTokenRewardInstruction error:: ", err_64);
8233
- throw err_64;
8159
+ err_63 = _a.sent();
8160
+ console.log("perpClient setTokenRewardInstruction error:: ", err_63);
8161
+ throw err_63;
8234
8162
  case 4: return [2, {
8235
8163
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8236
8164
  additionalSigners: additionalSigners
@@ -8239,7 +8167,7 @@ var PerpetualsClient = (function () {
8239
8167
  });
8240
8168
  }); };
8241
8169
  this.resizeInternalOracle = function (extOracle, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
8242
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction, err_65;
8170
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction, err_64;
8243
8171
  return __generator(this, function (_a) {
8244
8172
  switch (_a.label) {
8245
8173
  case 0:
@@ -8268,9 +8196,9 @@ var PerpetualsClient = (function () {
8268
8196
  instructions.push(resizeInternalOracleInstruction);
8269
8197
  return [3, 4];
8270
8198
  case 3:
8271
- err_65 = _a.sent();
8272
- console.log("perpClient resizeInternalOracleInstruction error:: ", err_65);
8273
- throw err_65;
8199
+ err_64 = _a.sent();
8200
+ console.log("perpClient resizeInternalOracleInstruction error:: ", err_64);
8201
+ throw err_64;
8274
8202
  case 4: return [2, {
8275
8203
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8276
8204
  additionalSigners: additionalSigners
@@ -8279,7 +8207,7 @@ var PerpetualsClient = (function () {
8279
8207
  });
8280
8208
  }); };
8281
8209
  this.createWhitelist = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
8282
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction, err_66;
8210
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction, err_65;
8283
8211
  return __generator(this, function (_a) {
8284
8212
  switch (_a.label) {
8285
8213
  case 0:
@@ -8312,9 +8240,9 @@ var PerpetualsClient = (function () {
8312
8240
  instructions.push(createWhitelistInstruction);
8313
8241
  return [3, 4];
8314
8242
  case 3:
8315
- err_66 = _a.sent();
8316
- console.log("perpClient createWhitelistInstruction error:: ", err_66);
8317
- throw err_66;
8243
+ err_65 = _a.sent();
8244
+ console.log("perpClient createWhitelistInstruction error:: ", err_65);
8245
+ throw err_65;
8318
8246
  case 4: return [2, {
8319
8247
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8320
8248
  additionalSigners: additionalSigners
@@ -8323,7 +8251,7 @@ var PerpetualsClient = (function () {
8323
8251
  });
8324
8252
  }); };
8325
8253
  this.setWhitelistConfig = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
8326
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction, err_67;
8254
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction, err_66;
8327
8255
  return __generator(this, function (_a) {
8328
8256
  switch (_a.label) {
8329
8257
  case 0:
@@ -8356,9 +8284,9 @@ var PerpetualsClient = (function () {
8356
8284
  instructions.push(setWhitelistConfigInstruction);
8357
8285
  return [3, 4];
8358
8286
  case 3:
8359
- err_67 = _a.sent();
8360
- console.log("perpClient setWhitelistConfigInstruction error:: ", err_67);
8361
- throw err_67;
8287
+ err_66 = _a.sent();
8288
+ console.log("perpClient setWhitelistConfigInstruction error:: ", err_66);
8289
+ throw err_66;
8362
8290
  case 4: return [2, {
8363
8291
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8364
8292
  additionalSigners: additionalSigners
@@ -564,9 +564,9 @@
564
564
  "tokenPrecision": 4,
565
565
  "isStable": false,
566
566
  "isVirtual": true,
567
- "lazerId": 2691,
568
- "pythTicker": "Commodities.WTIG6/USD",
569
- "pythPriceId": "0x7e91242dfd2cea64715b26edaa3e51bafc712a56ac4228a77bd53b51fd66db52",
567
+ "lazerId": 2692,
568
+ "pythTicker": "Commodities.WTIH6/USD",
569
+ "pythPriceId": "0x0058c6f03fd28b18083d00fcdc3baaed2f11edef8b981f6b74130b85be474b17",
570
570
  "isToken2022": false
571
571
  },
572
572
  {
@@ -681,10 +681,10 @@
681
681
  "isStable": false,
682
682
  "isVirtual": true,
683
683
  "intOracleAddress": "5qLQ3BT7JCf4fUxoAH1xZwHCca9fZuuTWTgTsNxLNcoZ",
684
- "extOracleAddress": "8nMThr5gWoXaoWHR3gMXrz8ZULukjsBgoW83kuYCDzqG",
685
- "lazerId": 2691,
686
- "pythTicker": "Commodities.WTIG6/USD",
687
- "pythPriceId": "0x7e91242dfd2cea64715b26edaa3e51bafc712a56ac4228a77bd53b51fd66db52"
684
+ "extOracleAddress": "Gf9Cg2NS2xfsxLXixjsfAsQkeH1UxN2WVA7dRzKoacYk",
685
+ "lazerId": 2692,
686
+ "pythTicker": "Commodities.WTIH6/USD",
687
+ "pythPriceId": "0x0058c6f03fd28b18083d00fcdc3baaed2f11edef8b981f6b74130b85be474b17"
688
688
  },
689
689
  {
690
690
  "custodyId": 7,
@@ -3031,9 +3031,9 @@
3031
3031
  "tokenPrecision": 4,
3032
3032
  "isStable": false,
3033
3033
  "isVirtual": true,
3034
- "lazerId": 2691,
3035
- "pythTicker": "Commodities.WTIG6/USD",
3036
- "pythPriceId": "0x7e91242dfd2cea64715b26edaa3e51bafc712a56ac4228a77bd53b51fd66db52",
3034
+ "lazerId": 2692,
3035
+ "pythTicker": "Commodities.WTIH6/USD",
3036
+ "pythPriceId": "0x0058c6f03fd28b18083d00fcdc3baaed2f11edef8b981f6b74130b85be474b17",
3037
3037
  "isToken2022": false
3038
3038
  },
3039
3039
  {
@@ -3148,10 +3148,10 @@
3148
3148
  "isStable": false,
3149
3149
  "isVirtual": true,
3150
3150
  "intOracleAddress": "BeqYMCytDcEJrpikXhz8ZLaBb9ACGDVvmp9ekwbgBgma",
3151
- "extOracleAddress": "8nMThr5gWoXaoWHR3gMXrz8ZULukjsBgoW83kuYCDzqG",
3152
- "lazerId": 2691,
3153
- "pythTicker": "Commodities.WTIG6/USD",
3154
- "pythPriceId": "0x7e91242dfd2cea64715b26edaa3e51bafc712a56ac4228a77bd53b51fd66db52"
3151
+ "extOracleAddress": "Gf9Cg2NS2xfsxLXixjsfAsQkeH1UxN2WVA7dRzKoacYk",
3152
+ "lazerId": 2692,
3153
+ "pythTicker": "Commodities.WTIH6/USD",
3154
+ "pythPriceId": "0x0058c6f03fd28b18083d00fcdc3baaed2f11edef8b981f6b74130b85be474b17"
3155
3155
  },
3156
3156
  {
3157
3157
  "custodyId": 7,
@@ -21,8 +21,7 @@ export declare class PositionAccount implements Position {
21
21
  cumulativeLockFeeSnapshot: BN;
22
22
  degenSizeUsd: BN;
23
23
  referencePrice: ContractOraclePrice;
24
- oraclePenalty: number;
25
- previousPenalty: number;
24
+ buffer: number;
26
25
  sizeDecimals: number;
27
26
  lockedDecimals: number;
28
27
  collateralDecimals: number;