flash-sdk 3.1.9 → 3.2.0-alpha.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.
@@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
20
20
  });
21
21
  };
22
22
  var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
24
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
25
  function verb(n) { return function (v) { return step([n, v]); }; }
26
26
  function step(op) {
27
27
  if (f) throw new TypeError("Generator is already executing.");
@@ -1132,7 +1132,9 @@ var PerpetualsClient = (function () {
1132
1132
  if (errorBandwidthPercentageUi > 100 || errorBandwidthPercentageUi < 0) {
1133
1133
  throw new Error("errorBandwidthPercentageUi cannot be >100 or <0");
1134
1134
  }
1135
- var MAX_INIT_LEVERAGE = targetCustodyAccount.pricing.maxInitialLeverage.mul(new anchor_1.BN(100 - errorBandwidthPercentageUi)).div(new anchor_1.BN(100));
1135
+ var MAX_INIT_LEVERAGE = positionAccount.isDegenMode() ?
1136
+ (new anchor_1.BN(targetCustodyAccount.pricing.maxInitDegenLeverage)).mul(new anchor_1.BN(100 - errorBandwidthPercentageUi)).div(new anchor_1.BN(100))
1137
+ : (new anchor_1.BN(targetCustodyAccount.pricing.maxInitLeverage)).mul(new anchor_1.BN(100 - errorBandwidthPercentageUi)).div(new anchor_1.BN(100));
1136
1138
  var profitLoss = _this.getPnlSync(positionAccount, targetPrice, targetEmaPrice, targetCustodyAccount, collateralPrice, collateralEmaPrice, collateralCustodyAccount, currentTimestamp, targetCustodyAccount.pricing.delaySeconds, poolConfig);
1137
1139
  var _a = _this.getMinAndMaxOraclePriceSync(collateralPrice, collateralEmaPrice, collateralCustodyAccount), collateralMinPrice = _a.min, collateralMaxPrice = _a.max;
1138
1140
  var currentCollateralUsd = collateralMinPrice.getAssetAmountUsd(positionAccount.collateralAmount.add(closeAmount), collateralCustodyAccount.decimals);
@@ -1150,8 +1152,8 @@ var PerpetualsClient = (function () {
1150
1152
  }
1151
1153
  var maxWithdrawableAmount;
1152
1154
  var remainingCollateralUsd = availableInitMarginUsd.sub(maxRemovableCollateralUsd);
1153
- if (remainingCollateralUsd < targetCustodyAccount.pricing.minCollateralUsd) {
1154
- var diff = targetCustodyAccount.pricing.minCollateralUsd.sub(remainingCollateralUsd);
1155
+ if (remainingCollateralUsd.lt(new anchor_1.BN(targetCustodyAccount.pricing.minCollateralUsd))) {
1156
+ var diff = (new anchor_1.BN(targetCustodyAccount.pricing.minCollateralUsd)).sub(remainingCollateralUsd);
1155
1157
  var updatedMaxRemovableCollateralUsd = maxRemovableCollateralUsd.sub(diff);
1156
1158
  if (updatedMaxRemovableCollateralUsd.isNeg()) {
1157
1159
  return constants_1.BN_ZERO;
@@ -1190,8 +1192,10 @@ var PerpetualsClient = (function () {
1190
1192
  if (errorBandwidthPercentageUi > 100 || errorBandwidthPercentageUi < 0) {
1191
1193
  throw new Error("errorBandwidthPercentageUi cannot be >100 or <0");
1192
1194
  }
1193
- var MAX_INIT_LEVERAGE = targetCustodyAccount.pricing.maxInitialLeverage.mul(new anchor_1.BN(100 - errorBandwidthPercentageUi)).div(new anchor_1.BN(100));
1194
- var maxRemoveableCollateralUsdAfterMinRequired = positionAccount.collateralUsd.sub(targetCustodyAccount.pricing.minCollateralUsd.mul(new anchor_1.BN(100 + errorBandwidthPercentageUi)).div(new anchor_1.BN(100)));
1195
+ var MAX_INIT_LEVERAGE = positionAccount.isDegenMode() ?
1196
+ (new anchor_1.BN(targetCustodyAccount.pricing.maxInitDegenLeverage)).mul(new anchor_1.BN(100 - errorBandwidthPercentageUi)).div(new anchor_1.BN(100))
1197
+ : (new anchor_1.BN(targetCustodyAccount.pricing.maxInitLeverage)).mul(new anchor_1.BN(100 - errorBandwidthPercentageUi)).div(new anchor_1.BN(100));
1198
+ var maxRemoveableCollateralUsdAfterMinRequired = positionAccount.collateralUsd.sub((new anchor_1.BN(targetCustodyAccount.pricing.minCollateralUsd)).mul(new anchor_1.BN(100 + errorBandwidthPercentageUi)).div(new anchor_1.BN(100)));
1195
1199
  if (maxRemoveableCollateralUsdAfterMinRequired.isNeg()) {
1196
1200
  console.log("THIS cannot happen but still");
1197
1201
  return constants_1.BN_ZERO;
@@ -1241,11 +1245,11 @@ var PerpetualsClient = (function () {
1241
1245
  borrowRate = (currentUtilization.mul(custodyAccount.borrowRate.slope1))
1242
1246
  .div(custodyAccount.borrowRate.optimalUtilization);
1243
1247
  }
1244
- else if (currentUtilization.lt(custodyAccount.pricing.maxUtilization)) {
1248
+ else if (currentUtilization.lt((new anchor_1.BN(custodyAccount.pricing.maxUtilization)))) {
1245
1249
  borrowRate = custodyAccount.borrowRate.slope1
1246
1250
  .add(currentUtilization.sub(custodyAccount.borrowRate.optimalUtilization)
1247
1251
  .mul(custodyAccount.borrowRate.slope2)
1248
- .div(custodyAccount.pricing.maxUtilization.sub(custodyAccount.borrowRate.optimalUtilization)));
1252
+ .div((new anchor_1.BN(custodyAccount.pricing.maxUtilization)).sub(custodyAccount.borrowRate.optimalUtilization)));
1249
1253
  }
1250
1254
  else {
1251
1255
  borrowRate = custodyAccount.borrowRate.slope1.add(custodyAccount.borrowRate.slope2);
@@ -1287,7 +1291,7 @@ var PerpetualsClient = (function () {
1287
1291
  }
1288
1292
  var exitFeeUsd = positionAccount.sizeUsd.mul(targetCustodyAccount.fees.closePosition).div(new anchor_1.BN(constants_1.RATE_POWER));
1289
1293
  var unsettledLossUsd = exitFeeUsd.add(lockAndUnsettledFeeUsd);
1290
- var liablitiesUsd = positionAccount.sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(targetCustodyAccount.pricing.maxLeverage).add(unsettledLossUsd);
1294
+ var liablitiesUsd = positionAccount.sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(new anchor_1.BN(targetCustodyAccount.pricing.maxLeverage)).add(unsettledLossUsd);
1291
1295
  var targetMinMaxPriceOracle = _this.getMinAndMaxOraclePriceSync(targetPrice, targetEmaPrice, targetCustodyAccount);
1292
1296
  var collateralMinMaxPriceOracle = _this.getMinAndMaxOraclePriceSync(collateralPrice, collateralEmaPrice, collateralCustodyAccount);
1293
1297
  var liquidationPrice;
@@ -1377,7 +1381,7 @@ var PerpetualsClient = (function () {
1377
1381
  }
1378
1382
  var exitFeeUsd = sizeUsd.mul(targetCustodyAccount.fees.closePosition).div(new anchor_1.BN(constants_1.RATE_POWER));
1379
1383
  var unsettledLossUsd = exitFeeUsd;
1380
- var liablitiesUsd = sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(targetCustodyAccount.pricing.maxLeverage).add(unsettledLossUsd);
1384
+ var liablitiesUsd = sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(new anchor_1.BN(targetCustodyAccount.pricing.maxLeverage)).add(unsettledLossUsd);
1381
1385
  var targetMinMaxPriceOracle = _this.getMinAndMaxOraclePriceSync(targetPrice, targetEmaPrice, targetCustodyAccount);
1382
1386
  var collateralMinMaxPriceOracle = _this.getMinAndMaxOraclePriceSync(collateralPrice, collateralEmaPrice, collateralCustodyAccount);
1383
1387
  var liquidationPrice;
@@ -5958,143 +5962,13 @@ var PerpetualsClient = (function () {
5958
5962
  });
5959
5963
  });
5960
5964
  };
5961
- this.setTriggerPrice = function (targetSymbol, collateralSymbol, side, triggerPrice, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
5962
- var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, positionAccount, instructions, additionalSigners, setTriggerPrice, err_36;
5963
- return __generator(this, function (_a) {
5964
- switch (_a.label) {
5965
- case 0:
5966
- publicKey = this.provider.wallet.publicKey;
5967
- targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(targetSymbol).mintKey); });
5968
- collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey); });
5969
- marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
5970
- positionAccount = poolConfig.getPositionFromMarketPk(publicKey, marketAccount);
5971
- instructions = [];
5972
- additionalSigners = [];
5973
- _a.label = 1;
5974
- case 1:
5975
- _a.trys.push([1, 3, , 4]);
5976
- return [4, this.program.methods
5977
- .setTriggerPrice({
5978
- triggerPrice: triggerPrice,
5979
- isStopLoss: isStopLoss
5980
- })
5981
- .accounts({
5982
- owner: publicKey,
5983
- perpetuals: this.perpetuals.publicKey,
5984
- pool: poolConfig.poolAddress,
5985
- position: positionAccount,
5986
- market: marketAccount,
5987
- targetCustody: targetCustodyConfig.custodyAccount,
5988
- targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
5989
- collateralCustody: collateralCustodyConfig.custodyAccount,
5990
- collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
5991
- eventAuthority: this.eventAuthority.publicKey,
5992
- program: this.programId,
5993
- ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
5994
- })
5995
- .instruction()];
5996
- case 2:
5997
- setTriggerPrice = _a.sent();
5998
- instructions.push(setTriggerPrice);
5999
- return [3, 4];
6000
- case 3:
6001
- err_36 = _a.sent();
6002
- console.log("perpClient setTriggerPrice error:: ", err_36);
6003
- throw err_36;
6004
- case 4: return [2, {
6005
- instructions: __spreadArray([], instructions, true),
6006
- additionalSigners: additionalSigners
6007
- }];
6008
- }
6009
- });
6010
- }); };
6011
- this.forceClosePosition = function (positionAccount_2, targetSymbol_1, collateralSymbol_1, side_1, isStopLoss_1, poolConfig_1) {
6012
- var args_1 = [];
6013
- for (var _i = 6; _i < arguments.length; _i++) {
6014
- args_1[_i - 6] = arguments[_i];
6015
- }
6016
- return __awaiter(_this, __spreadArray([positionAccount_2, targetSymbol_1, collateralSymbol_1, side_1, isStopLoss_1, poolConfig_1], args_1, true), void 0, function (positionAccount, targetSymbol, collateralSymbol, side, isStopLoss, poolConfig, createUserATA, closeUsersWSOLATA, ephemeralSignerPubkey) {
6017
- var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, forceClosePosition, closeWsolATAIns, err_37;
6018
- if (createUserATA === void 0) { createUserATA = true; }
6019
- if (closeUsersWSOLATA === void 0) { closeUsersWSOLATA = false; }
6020
- if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
6021
- return __generator(this, function (_b) {
6022
- switch (_b.label) {
6023
- case 0:
6024
- payerPubkey = this.provider.wallet.publicKey;
6025
- targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(targetSymbol).mintKey); });
6026
- collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey); });
6027
- marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
6028
- preInstructions = [];
6029
- instructions = [];
6030
- postInstructions = [];
6031
- additionalSigners = [];
6032
- _b.label = 1;
6033
- case 1:
6034
- _b.trys.push([1, 5, , 6]);
6035
- userReceivingTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey, positionAccount.owner, false, poolConfig.getTokenFromSymbol(collateralSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID);
6036
- _a = createUserATA;
6037
- if (!_a) return [3, 3];
6038
- return [4, (0, utils_1.checkIfAccountExists)(userReceivingTokenAccount, this.provider.connection)];
6039
- case 2:
6040
- _a = !(_b.sent());
6041
- _b.label = 3;
6042
- case 3:
6043
- if (_a) {
6044
- preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(payerPubkey, userReceivingTokenAccount, positionAccount.owner, poolConfig.getTokenFromSymbol(collateralSymbol).mintKey, poolConfig.getTokenFromSymbol(collateralSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID));
6045
- }
6046
- return [4, this.program.methods
6047
- .forceClosePosition({
6048
- privilege: types_1.Privilege.None,
6049
- isStopLoss: isStopLoss
6050
- })
6051
- .accounts({
6052
- owner: positionAccount.owner,
6053
- receivingAccount: userReceivingTokenAccount,
6054
- transferAuthority: poolConfig.transferAuthority,
6055
- perpetuals: this.perpetuals.publicKey,
6056
- pool: poolConfig.poolAddress,
6057
- position: positionAccount.publicKey,
6058
- market: marketAccount,
6059
- targetCustody: targetCustodyConfig.custodyAccount,
6060
- targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
6061
- collateralCustody: collateralCustodyConfig.custodyAccount,
6062
- collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
6063
- collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
6064
- tokenProgram: poolConfig.getTokenFromSymbol(collateralSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID,
6065
- eventAuthority: this.eventAuthority.publicKey,
6066
- program: this.programId,
6067
- ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
6068
- receivingMint: collateralCustodyConfig.mintKey
6069
- })
6070
- .instruction()];
6071
- case 4:
6072
- forceClosePosition = _b.sent();
6073
- instructions.push(forceClosePosition);
6074
- if (collateralSymbol == 'WSOL' && closeUsersWSOLATA) {
6075
- closeWsolATAIns = (0, spl_token_1.createCloseAccountInstruction)(userReceivingTokenAccount, positionAccount.owner, positionAccount.owner);
6076
- postInstructions.push(closeWsolATAIns);
6077
- }
6078
- return [3, 6];
6079
- case 5:
6080
- err_37 = _b.sent();
6081
- console.log("perpClient forceClosePosition error:: ", err_37);
6082
- throw err_37;
6083
- case 6: return [2, {
6084
- instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
6085
- additionalSigners: additionalSigners
6086
- }];
6087
- }
6088
- });
6089
- });
6090
- };
6091
5965
  this.placeLimitOrder = function (targetSymbol_1, collateralSymbol_1, reserveSymbol_1, receiveSymbol_1, side_1, limitPrice_1, reserveAmount_1, sizeAmount_1, stopLossPrice_1, takeProfitPrice_1, poolConfig_1) {
6092
5966
  var args_1 = [];
6093
5967
  for (var _i = 11; _i < arguments.length; _i++) {
6094
5968
  args_1[_i - 11] = arguments[_i];
6095
5969
  }
6096
5970
  return __awaiter(_this, __spreadArray([targetSymbol_1, collateralSymbol_1, reserveSymbol_1, receiveSymbol_1, side_1, limitPrice_1, reserveAmount_1, sizeAmount_1, stopLossPrice_1, takeProfitPrice_1, poolConfig_1], args_1, true), void 0, function (targetSymbol, collateralSymbol, reserveSymbol, receiveSymbol, side, limitPrice, reserveAmount, sizeAmount, stopLossPrice, takeProfitPrice, poolConfig, skipBalanceChecks, ephemeralSignerPubkey) {
6097
- var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder, err_38;
5971
+ var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder, err_36;
6098
5972
  if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
6099
5973
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
6100
5974
  return __generator(this, function (_c) {
@@ -6200,9 +6074,9 @@ var PerpetualsClient = (function () {
6200
6074
  instructions.push(placeLimitOrder);
6201
6075
  return [3, 10];
6202
6076
  case 9:
6203
- err_38 = _c.sent();
6204
- console.log("perpClient placeLimitOrder error:: ", err_38);
6205
- throw err_38;
6077
+ err_36 = _c.sent();
6078
+ console.log("perpClient placeLimitOrder error:: ", err_36);
6079
+ throw err_36;
6206
6080
  case 10: return [2, {
6207
6081
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
6208
6082
  additionalSigners: additionalSigners
@@ -6217,7 +6091,7 @@ var PerpetualsClient = (function () {
6217
6091
  args_1[_i - 11] = arguments[_i];
6218
6092
  }
6219
6093
  return __awaiter(_this, __spreadArray([targetSymbol_1, collateralSymbol_1, reserveSymbol_1, receiveSymbol_1, side_1, orderId_1, limitPrice_1, sizeAmount_1, stopLossPrice_1, takeProfitPrice_1, poolConfig_1], args_1, true), void 0, function (targetSymbol, collateralSymbol, reserveSymbol, receiveSymbol, side, orderId, limitPrice, sizeAmount, stopLossPrice, takeProfitPrice, poolConfig, createUserATA, ephemeralSignerPubkey) {
6220
- var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder, err_39;
6094
+ var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder, err_37;
6221
6095
  if (createUserATA === void 0) { createUserATA = true; }
6222
6096
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
6223
6097
  return __generator(this, function (_b) {
@@ -6308,9 +6182,9 @@ var PerpetualsClient = (function () {
6308
6182
  instructions.push(editLimitOrder);
6309
6183
  return [3, 8];
6310
6184
  case 7:
6311
- err_39 = _b.sent();
6312
- console.log("perpClient editLimitOrder error:: ", err_39);
6313
- throw err_39;
6185
+ err_37 = _b.sent();
6186
+ console.log("perpClient editLimitOrder error:: ", err_37);
6187
+ throw err_37;
6314
6188
  case 8: return [2, {
6315
6189
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
6316
6190
  additionalSigners: additionalSigners
@@ -6325,7 +6199,7 @@ var PerpetualsClient = (function () {
6325
6199
  args_1[_i - 7] = arguments[_i];
6326
6200
  }
6327
6201
  return __awaiter(_this, __spreadArray([userPubkey_1, targetSymbol_1, collateralSymbol_1, side_1, orderId_1, poolConfig_1, privilege_1], args_1, true), void 0, function (userPubkey, targetSymbol, collateralSymbol, side, orderId, poolConfig, privilege, tokenStakeAccount, userReferralAccount, rebateTokenAccount) {
6328
- var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder, err_40;
6202
+ var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder, err_38;
6329
6203
  if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
6330
6204
  if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
6331
6205
  if (rebateTokenAccount === void 0) { rebateTokenAccount = web3_js_1.PublicKey.default; }
@@ -6378,9 +6252,9 @@ var PerpetualsClient = (function () {
6378
6252
  instructions.push(executeLimitOrder);
6379
6253
  return [3, 4];
6380
6254
  case 3:
6381
- err_40 = _a.sent();
6382
- console.log("perpClient executeLimitOrder error:: ", err_40);
6383
- throw err_40;
6255
+ err_38 = _a.sent();
6256
+ console.log("perpClient executeLimitOrder error:: ", err_38);
6257
+ throw err_38;
6384
6258
  case 4: return [2, {
6385
6259
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
6386
6260
  additionalSigners: additionalSigners
@@ -6395,7 +6269,7 @@ var PerpetualsClient = (function () {
6395
6269
  args_1[_i - 8] = arguments[_i];
6396
6270
  }
6397
6271
  return __awaiter(_this, __spreadArray([userPubkey_1, targetSymbol_1, collateralSymbol_1, reserveSymbol_1, side_1, orderId_1, poolConfig_1, privilege_1], args_1, true), void 0, function (userPubkey, targetSymbol, collateralSymbol, reserveSymbol, side, orderId, poolConfig, privilege, tokenStakeAccount, userReferralAccount, rebateTokenAccount) {
6398
- var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap, err_41;
6272
+ var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap, err_39;
6399
6273
  if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
6400
6274
  if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
6401
6275
  if (rebateTokenAccount === void 0) { rebateTokenAccount = web3_js_1.PublicKey.default; }
@@ -6451,9 +6325,9 @@ var PerpetualsClient = (function () {
6451
6325
  instructions.push(executeLimitWithSwap);
6452
6326
  return [3, 4];
6453
6327
  case 3:
6454
- err_41 = _a.sent();
6455
- console.log("perpClient executeLimitWithSwap error:: ", err_41);
6456
- throw err_41;
6328
+ err_39 = _a.sent();
6329
+ console.log("perpClient executeLimitWithSwap error:: ", err_39);
6330
+ throw err_39;
6457
6331
  case 4: return [2, {
6458
6332
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
6459
6333
  additionalSigners: additionalSigners
@@ -6463,7 +6337,7 @@ var PerpetualsClient = (function () {
6463
6337
  });
6464
6338
  };
6465
6339
  this.placeTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6466
- var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder, err_42;
6340
+ var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder, err_40;
6467
6341
  return __generator(this, function (_a) {
6468
6342
  switch (_a.label) {
6469
6343
  case 0:
@@ -6511,9 +6385,9 @@ var PerpetualsClient = (function () {
6511
6385
  instructions.push(placeTriggerOrder);
6512
6386
  return [3, 4];
6513
6387
  case 3:
6514
- err_42 = _a.sent();
6515
- console.log("perpClient placeTriggerOrder error:: ", err_42);
6516
- throw err_42;
6388
+ err_40 = _a.sent();
6389
+ console.log("perpClient placeTriggerOrder error:: ", err_40);
6390
+ throw err_40;
6517
6391
  case 4: return [2, {
6518
6392
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
6519
6393
  additionalSigners: additionalSigners
@@ -6522,7 +6396,7 @@ var PerpetualsClient = (function () {
6522
6396
  });
6523
6397
  }); };
6524
6398
  this.editTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, orderId, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6525
- var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder, err_43;
6399
+ var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder, err_41;
6526
6400
  return __generator(this, function (_a) {
6527
6401
  switch (_a.label) {
6528
6402
  case 0:
@@ -6569,9 +6443,9 @@ var PerpetualsClient = (function () {
6569
6443
  instructions.push(editTriggerOrder);
6570
6444
  return [3, 4];
6571
6445
  case 3:
6572
- err_43 = _a.sent();
6573
- console.log("perpClient editTriggerOrder error:: ", err_43);
6574
- throw err_43;
6446
+ err_41 = _a.sent();
6447
+ console.log("perpClient editTriggerOrder error:: ", err_41);
6448
+ throw err_41;
6575
6449
  case 4: return [2, {
6576
6450
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
6577
6451
  additionalSigners: additionalSigners
@@ -6580,7 +6454,7 @@ var PerpetualsClient = (function () {
6580
6454
  });
6581
6455
  }); };
6582
6456
  this.cancelTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6583
- var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder, err_44;
6457
+ var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder, err_42;
6584
6458
  return __generator(this, function (_a) {
6585
6459
  switch (_a.label) {
6586
6460
  case 0:
@@ -6613,9 +6487,9 @@ var PerpetualsClient = (function () {
6613
6487
  instructions.push(cancelTriggerOrder);
6614
6488
  return [3, 4];
6615
6489
  case 3:
6616
- err_44 = _a.sent();
6617
- console.log("perpClient cancelTriggerOrder error:: ", err_44);
6618
- throw err_44;
6490
+ err_42 = _a.sent();
6491
+ console.log("perpClient cancelTriggerOrder error:: ", err_42);
6492
+ throw err_42;
6619
6493
  case 4: return [2, {
6620
6494
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
6621
6495
  additionalSigners: additionalSigners
@@ -6624,7 +6498,7 @@ var PerpetualsClient = (function () {
6624
6498
  });
6625
6499
  }); };
6626
6500
  this.cancelAllTriggerOrders = function (targetSymbol, collateralSymbol, side, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6627
- var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders, err_45;
6501
+ var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders, err_43;
6628
6502
  return __generator(this, function (_a) {
6629
6503
  switch (_a.label) {
6630
6504
  case 0:
@@ -6655,9 +6529,9 @@ var PerpetualsClient = (function () {
6655
6529
  instructions.push(cancelAllTriggerOrders);
6656
6530
  return [3, 4];
6657
6531
  case 3:
6658
- err_45 = _a.sent();
6659
- console.log("perpClient cancelAllTriggerOrders error:: ", err_45);
6660
- throw err_45;
6532
+ err_43 = _a.sent();
6533
+ console.log("perpClient cancelAllTriggerOrders error:: ", err_43);
6534
+ throw err_43;
6661
6535
  case 4: return [2, {
6662
6536
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
6663
6537
  additionalSigners: additionalSigners
@@ -6671,7 +6545,7 @@ var PerpetualsClient = (function () {
6671
6545
  args_1[_i - 9] = arguments[_i];
6672
6546
  }
6673
6547
  return __awaiter(_this, __spreadArray([owner_1, targetSymbol_1, collateralSymbol_1, receivingSymbol_1, side_1, orderId_1, isStopLoss_1, privilege_1, poolConfig_1], args_1, true), void 0, function (owner, targetSymbol, collateralSymbol, receivingSymbol, side, orderId, isStopLoss, privilege, poolConfig, createUserATA, ephemeralSignerPubkey, tokenStakeAccount, userReferralAccount, rebateTokenAccount) {
6674
- var payerPubkey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, userReceivingTokenAccount, userReceivingTokenAccountCollateral, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, collateralToken, receivingToken, _a, _b, positionAccount, orderAccount, custodyAccountMetas, custodyOracleAccountMetas, _c, _d, custody, executeTriggerWithSwap, err_46;
6548
+ var payerPubkey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, userReceivingTokenAccount, userReceivingTokenAccountCollateral, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, collateralToken, receivingToken, _a, _b, positionAccount, orderAccount, custodyAccountMetas, custodyOracleAccountMetas, _c, _d, custody, executeTriggerWithSwap, err_44;
6675
6549
  if (createUserATA === void 0) { createUserATA = true; }
6676
6550
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
6677
6551
  if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
@@ -6778,9 +6652,9 @@ var PerpetualsClient = (function () {
6778
6652
  instructions.push(executeTriggerWithSwap);
6779
6653
  return [3, 10];
6780
6654
  case 9:
6781
- err_46 = _e.sent();
6782
- console.log("perpClient executeTriggerWithSwap error:: ", err_46);
6783
- throw err_46;
6655
+ err_44 = _e.sent();
6656
+ console.log("perpClient executeTriggerWithSwap error:: ", err_44);
6657
+ throw err_44;
6784
6658
  case 10: return [2, {
6785
6659
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
6786
6660
  additionalSigners: additionalSigners
@@ -6795,7 +6669,7 @@ var PerpetualsClient = (function () {
6795
6669
  args_1[_i - 8] = arguments[_i];
6796
6670
  }
6797
6671
  return __awaiter(_this, __spreadArray([owner_1, targetSymbol_1, collateralSymbol_1, side_1, orderId_1, isStopLoss_1, privilege_1, poolConfig_1], args_1, true), void 0, function (owner, targetSymbol, collateralSymbol, side, orderId, isStopLoss, privilege, poolConfig, createUserATA, ephemeralSignerPubkey, tokenStakeAccount, userReferralAccount, rebateTokenAccount) {
6798
- var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder, err_47;
6672
+ var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder, err_45;
6799
6673
  if (createUserATA === void 0) { createUserATA = true; }
6800
6674
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
6801
6675
  if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
@@ -6867,9 +6741,9 @@ var PerpetualsClient = (function () {
6867
6741
  instructions.push(executeTriggerOrder);
6868
6742
  return [3, 8];
6869
6743
  case 7:
6870
- err_47 = _b.sent();
6871
- console.log("perpClient executeTriggerOrder error:: ", err_47);
6872
- throw err_47;
6744
+ err_45 = _b.sent();
6745
+ console.log("perpClient executeTriggerOrder error:: ", err_45);
6746
+ throw err_45;
6873
6747
  case 8: return [2, {
6874
6748
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
6875
6749
  additionalSigners: additionalSigners
@@ -6878,54 +6752,13 @@ var PerpetualsClient = (function () {
6878
6752
  });
6879
6753
  });
6880
6754
  };
6881
- this.migrateTriggerOrder = function (owner, marketAccount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6882
- var payerPubkey, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, migrateTriggerOrder, err_48;
6883
- return __generator(this, function (_a) {
6884
- switch (_a.label) {
6885
- case 0:
6886
- payerPubkey = this.provider.wallet.publicKey;
6887
- preInstructions = [];
6888
- instructions = [];
6889
- postInstructions = [];
6890
- additionalSigners = [];
6891
- _a.label = 1;
6892
- case 1:
6893
- _a.trys.push([1, 3, , 4]);
6894
- positionAccount = poolConfig.getPositionFromMarketPk(owner, marketAccount);
6895
- orderAccount = poolConfig.getOrderFromMarketPk(owner, marketAccount);
6896
- return [4, this.program.methods
6897
- .migrateTriggerOrder()
6898
- .accounts({
6899
- owner: owner,
6900
- feePayer: payerPubkey,
6901
- position: positionAccount,
6902
- order: orderAccount,
6903
- market: marketAccount,
6904
- systemProgram: web3_js_1.SystemProgram.programId,
6905
- })
6906
- .instruction()];
6907
- case 2:
6908
- migrateTriggerOrder = _a.sent();
6909
- instructions.push(migrateTriggerOrder);
6910
- return [3, 4];
6911
- case 3:
6912
- err_48 = _a.sent();
6913
- console.log("perpClient migrateTriggerOrder error:: ", err_48);
6914
- throw err_48;
6915
- case 4: return [2, {
6916
- instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
6917
- additionalSigners: additionalSigners
6918
- }];
6919
- }
6920
- });
6921
- }); };
6922
6755
  this.swap = function (userInputTokenSymbol_1, userOutputTokenSymbol_1, amountIn_1, minAmountOut_1, poolConfig_1) {
6923
6756
  var args_1 = [];
6924
6757
  for (var _i = 5; _i < arguments.length; _i++) {
6925
6758
  args_1[_i - 5] = arguments[_i];
6926
6759
  }
6927
6760
  return __awaiter(_this, __spreadArray([userInputTokenSymbol_1, userOutputTokenSymbol_1, amountIn_1, minAmountOut_1, poolConfig_1], args_1, true), void 0, function (userInputTokenSymbol, userOutputTokenSymbol, amountIn, minAmountOut, poolConfig, useFeesPool, createUserATA, unWrapSol, skipBalanceChecks, ephemeralSignerPubkey) {
6928
- var userInputCustodyConfig, userOutputCustodyConfig, publicKey, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userOutputTokenAccount, userInputTokenAccount, wsolAssociatedTokenAccount, wsolATAExist, unWrappedSolBalance, _a, wsolAssociatedTokenAccount, closeWsolATAIns, accCreationLamports, lamports, unWrappedSolBalance, _b, tokenAccountBalance, _c, lamports, _d, custodyAccountMetas, custodyOracleAccountMetas, _e, _f, custody, params, inx, closeWsolATAIns, err_49;
6761
+ var userInputCustodyConfig, userOutputCustodyConfig, publicKey, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userOutputTokenAccount, userInputTokenAccount, wsolAssociatedTokenAccount, wsolATAExist, unWrappedSolBalance, _a, wsolAssociatedTokenAccount, closeWsolATAIns, accCreationLamports, lamports, unWrappedSolBalance, _b, tokenAccountBalance, _c, lamports, _d, custodyAccountMetas, custodyOracleAccountMetas, _e, _f, custody, params, inx, closeWsolATAIns, err_46;
6929
6762
  if (useFeesPool === void 0) { useFeesPool = false; }
6930
6763
  if (createUserATA === void 0) { createUserATA = true; }
6931
6764
  if (unWrapSol === void 0) { unWrapSol = false; }
@@ -7130,9 +6963,9 @@ var PerpetualsClient = (function () {
7130
6963
  }
7131
6964
  return [3, 20];
7132
6965
  case 19:
7133
- err_49 = _g.sent();
7134
- console.error("perpClient Swap error:: ", err_49);
7135
- throw err_49;
6966
+ err_46 = _g.sent();
6967
+ console.error("perpClient Swap error:: ", err_46);
6968
+ throw err_46;
7136
6969
  case 20: return [2, {
7137
6970
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7138
6971
  additionalSigners: additionalSigners
@@ -7142,7 +6975,7 @@ var PerpetualsClient = (function () {
7142
6975
  });
7143
6976
  };
7144
6977
  this.swapFeeInternal = function (rewardTokenSymbol, swapTokenSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7145
- var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx, err_50;
6978
+ var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx, err_47;
7146
6979
  return __generator(this, function (_b) {
7147
6980
  switch (_b.label) {
7148
6981
  case 0:
@@ -7202,9 +7035,9 @@ var PerpetualsClient = (function () {
7202
7035
  instructions.push(inx);
7203
7036
  return [3, 4];
7204
7037
  case 3:
7205
- err_50 = _b.sent();
7206
- console.error("perpClient Swap error:: ", err_50);
7207
- throw err_50;
7038
+ err_47 = _b.sent();
7039
+ console.error("perpClient Swap error:: ", err_47);
7040
+ throw err_47;
7208
7041
  case 4: return [2, {
7209
7042
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7210
7043
  additionalSigners: additionalSigners
@@ -7212,6 +7045,65 @@ var PerpetualsClient = (function () {
7212
7045
  }
7213
7046
  });
7214
7047
  }); };
7048
+ this.setLpTokenPrice = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7049
+ var instructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, setLpTokenPriceInstruction, err_48;
7050
+ return __generator(this, function (_d) {
7051
+ switch (_d.label) {
7052
+ case 0:
7053
+ instructions = [];
7054
+ additionalSigners = [];
7055
+ _d.label = 1;
7056
+ case 1:
7057
+ _d.trys.push([1, 3, , 4]);
7058
+ custodyAccountMetas = [];
7059
+ custodyOracleAccountMetas = [];
7060
+ markets = [];
7061
+ for (_i = 0, _a = poolConfig.custodies; _i < _a.length; _i++) {
7062
+ custody = _a[_i];
7063
+ custodyAccountMetas.push({
7064
+ pubkey: custody.custodyAccount,
7065
+ isSigner: false,
7066
+ isWritable: false,
7067
+ });
7068
+ custodyOracleAccountMetas.push({
7069
+ pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
7070
+ isSigner: false,
7071
+ isWritable: false,
7072
+ });
7073
+ }
7074
+ for (_b = 0, _c = poolConfig.markets; _b < _c.length; _b++) {
7075
+ market = _c[_b];
7076
+ markets.push({
7077
+ pubkey: market.marketAccount,
7078
+ isSigner: false,
7079
+ isWritable: false,
7080
+ });
7081
+ }
7082
+ return [4, this.program.methods
7083
+ .setLpTokenPrice({})
7084
+ .accounts({
7085
+ perpetuals: poolConfig.perpetuals,
7086
+ pool: poolConfig.poolAddress,
7087
+ lpTokenMint: poolConfig.stakedLpTokenMint,
7088
+ ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
7089
+ })
7090
+ .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true), markets, true))
7091
+ .instruction()];
7092
+ case 2:
7093
+ setLpTokenPriceInstruction = _d.sent();
7094
+ instructions.push(setLpTokenPriceInstruction);
7095
+ return [3, 4];
7096
+ case 3:
7097
+ err_48 = _d.sent();
7098
+ console.log("perpClient setLpTokenPriceInstruction error:: ", err_48);
7099
+ throw err_48;
7100
+ case 4: return [2, {
7101
+ instructions: __spreadArray([], instructions, true),
7102
+ additionalSigners: additionalSigners
7103
+ }];
7104
+ }
7105
+ });
7106
+ }); };
7215
7107
  this.init = function (admins, config) { return __awaiter(_this, void 0, void 0, function () {
7216
7108
  var perpetualsProgramData, adminMetas, _i, admins_1, admin;
7217
7109
  return __generator(this, function (_a) {
@@ -7252,7 +7144,7 @@ var PerpetualsClient = (function () {
7252
7144
  });
7253
7145
  }); };
7254
7146
  this.setAdminSigners = function (admins, minSignatures) { return __awaiter(_this, void 0, void 0, function () {
7255
- var adminMetas, _i, admins_2, admin, err_51;
7147
+ var adminMetas, _i, admins_2, admin, err_49;
7256
7148
  return __generator(this, function (_a) {
7257
7149
  switch (_a.label) {
7258
7150
  case 0:
@@ -7282,11 +7174,11 @@ var PerpetualsClient = (function () {
7282
7174
  _a.sent();
7283
7175
  return [3, 4];
7284
7176
  case 3:
7285
- err_51 = _a.sent();
7177
+ err_49 = _a.sent();
7286
7178
  if (this.printErrors) {
7287
- console.error("setAdminSigners err:", err_51);
7179
+ console.error("setAdminSigners err:", err_49);
7288
7180
  }
7289
- throw err_51;
7181
+ throw err_49;
7290
7182
  case 4: return [2];
7291
7183
  }
7292
7184
  });
@@ -7475,7 +7367,7 @@ var PerpetualsClient = (function () {
7475
7367
  });
7476
7368
  }); };
7477
7369
  this.protocolWithdrawFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7478
- var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_52;
7370
+ var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_50;
7479
7371
  return __generator(this, function (_a) {
7480
7372
  switch (_a.label) {
7481
7373
  case 0:
@@ -7508,9 +7400,9 @@ var PerpetualsClient = (function () {
7508
7400
  instructions.push(withdrawFeesIx);
7509
7401
  return [3, 5];
7510
7402
  case 4:
7511
- err_52 = _a.sent();
7512
- console.log("perpClient setPool error:: ", err_52);
7513
- throw err_52;
7403
+ err_50 = _a.sent();
7404
+ console.log("perpClient setPool error:: ", err_50);
7405
+ throw err_50;
7514
7406
  case 5: return [2, {
7515
7407
  instructions: __spreadArray([], instructions, true),
7516
7408
  additionalSigners: additionalSigners
@@ -7519,7 +7411,7 @@ var PerpetualsClient = (function () {
7519
7411
  });
7520
7412
  }); };
7521
7413
  this.moveProtocolFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7522
- var publicKey, custodyConfig, instructions, additionalSigners, moveProtocolFeesIx, err_53;
7414
+ var publicKey, custodyConfig, instructions, additionalSigners, moveProtocolFeesIx, err_51;
7523
7415
  return __generator(this, function (_a) {
7524
7416
  switch (_a.label) {
7525
7417
  case 0:
@@ -7553,9 +7445,9 @@ var PerpetualsClient = (function () {
7553
7445
  instructions.push(moveProtocolFeesIx);
7554
7446
  return [3, 4];
7555
7447
  case 3:
7556
- err_53 = _a.sent();
7557
- console.log("perpClient setPool error:: ", err_53);
7558
- throw err_53;
7448
+ err_51 = _a.sent();
7449
+ console.log("perpClient setPool error:: ", err_51);
7450
+ throw err_51;
7559
7451
  case 4: return [2, {
7560
7452
  instructions: __spreadArray([], instructions, true),
7561
7453
  additionalSigners: additionalSigners
@@ -7564,7 +7456,7 @@ var PerpetualsClient = (function () {
7564
7456
  });
7565
7457
  }); };
7566
7458
  this.setProtocolFeeShareBps = function (feeShareBps, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7567
- var publicKey, setProtocolFeeShareBpsIx, err_54;
7459
+ var publicKey, setProtocolFeeShareBpsIx, err_52;
7568
7460
  return __generator(this, function (_a) {
7569
7461
  switch (_a.label) {
7570
7462
  case 0:
@@ -7584,15 +7476,15 @@ var PerpetualsClient = (function () {
7584
7476
  setProtocolFeeShareBpsIx = _a.sent();
7585
7477
  return [2, setProtocolFeeShareBpsIx];
7586
7478
  case 2:
7587
- err_54 = _a.sent();
7588
- console.log("perpClient setProtocolFeeShareBpsIx error:: ", err_54);
7589
- throw err_54;
7479
+ err_52 = _a.sent();
7480
+ console.log("perpClient setProtocolFeeShareBpsIx error:: ", err_52);
7481
+ throw err_52;
7590
7482
  case 3: return [2];
7591
7483
  }
7592
7484
  });
7593
7485
  }); };
7594
7486
  this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
7595
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_55;
7487
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_53;
7596
7488
  return __generator(this, function (_a) {
7597
7489
  switch (_a.label) {
7598
7490
  case 0:
@@ -7619,9 +7511,9 @@ var PerpetualsClient = (function () {
7619
7511
  instructions.push(setPermissionsInstruction);
7620
7512
  return [3, 4];
7621
7513
  case 3:
7622
- err_55 = _a.sent();
7623
- console.log("perpClient setPool error:: ", err_55);
7624
- throw err_55;
7514
+ err_53 = _a.sent();
7515
+ console.log("perpClient setPool error:: ", err_53);
7516
+ throw err_53;
7625
7517
  case 4: return [2, {
7626
7518
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7627
7519
  additionalSigners: additionalSigners
@@ -7630,7 +7522,7 @@ var PerpetualsClient = (function () {
7630
7522
  });
7631
7523
  }); };
7632
7524
  this.reimburse = function (tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7633
- var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_56;
7525
+ var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_54;
7634
7526
  var _f;
7635
7527
  return __generator(this, function (_g) {
7636
7528
  switch (_g.label) {
@@ -7691,9 +7583,9 @@ var PerpetualsClient = (function () {
7691
7583
  instructions.push(reimburse);
7692
7584
  return [3, 5];
7693
7585
  case 4:
7694
- err_56 = _g.sent();
7695
- console.log("perpClient setPool error:: ", err_56);
7696
- throw err_56;
7586
+ err_54 = _g.sent();
7587
+ console.log("perpClient setPool error:: ", err_54);
7588
+ throw err_54;
7697
7589
  case 5: return [2, {
7698
7590
  instructions: __spreadArray([], instructions, true),
7699
7591
  additionalSigners: additionalSigners
@@ -7702,7 +7594,7 @@ var PerpetualsClient = (function () {
7702
7594
  });
7703
7595
  }); };
7704
7596
  this.setInternalOraclePrice = function (tokenMint, price, expo, conf, ema, publishTime, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7705
- var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_57;
7597
+ var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_55;
7706
7598
  return __generator(this, function (_a) {
7707
7599
  switch (_a.label) {
7708
7600
  case 0:
@@ -7735,9 +7627,9 @@ var PerpetualsClient = (function () {
7735
7627
  instructions.push(setInternalOraclePrice);
7736
7628
  return [3, 4];
7737
7629
  case 3:
7738
- err_57 = _a.sent();
7739
- console.log("perpClient setInternalOracleAccount error:: ", err_57);
7740
- throw err_57;
7630
+ err_55 = _a.sent();
7631
+ console.log("perpClient setInternalOracleAccount error:: ", err_55);
7632
+ throw err_55;
7741
7633
  case 4: return [2, {
7742
7634
  instructions: __spreadArray([], instructions, true),
7743
7635
  additionalSigners: additionalSigners
@@ -7746,7 +7638,7 @@ var PerpetualsClient = (function () {
7746
7638
  });
7747
7639
  }); };
7748
7640
  this.setInternalOraclePriceBatch = function (tokenMintList, tokenInternalPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
7749
- var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_58;
7641
+ var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_56;
7750
7642
  return __generator(this, function (_a) {
7751
7643
  switch (_a.label) {
7752
7644
  case 0:
@@ -7796,9 +7688,9 @@ var PerpetualsClient = (function () {
7796
7688
  instructions.push(setInternalOraclePrice);
7797
7689
  return [3, 4];
7798
7690
  case 3:
7799
- err_58 = _a.sent();
7800
- console.log("perpClient setInternalOracleAccount error:: ", err_58);
7801
- throw err_58;
7691
+ err_56 = _a.sent();
7692
+ console.log("perpClient setInternalOracleAccount error:: ", err_56);
7693
+ throw err_56;
7802
7694
  case 4: return [2, {
7803
7695
  instructions: __spreadArray([], instructions, true),
7804
7696
  additionalSigners: additionalSigners
@@ -7807,7 +7699,7 @@ var PerpetualsClient = (function () {
7807
7699
  });
7808
7700
  }); };
7809
7701
  this.setInternalOracleEmaPriceBatch = function (tokenMintList, tokenInternalEmaPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
7810
- var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_59;
7702
+ var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_57;
7811
7703
  return __generator(this, function (_a) {
7812
7704
  switch (_a.label) {
7813
7705
  case 0:
@@ -7857,9 +7749,9 @@ var PerpetualsClient = (function () {
7857
7749
  instructions.push(setInternalOraclePrice);
7858
7750
  return [3, 4];
7859
7751
  case 3:
7860
- err_59 = _a.sent();
7861
- console.log("perpClient setInternalOracleAccount error:: ", err_59);
7862
- throw err_59;
7752
+ err_57 = _a.sent();
7753
+ console.log("perpClient setInternalOracleAccount error:: ", err_57);
7754
+ throw err_57;
7863
7755
  case 4: return [2, {
7864
7756
  instructions: __spreadArray([], instructions, true),
7865
7757
  additionalSigners: additionalSigners
@@ -7868,7 +7760,7 @@ var PerpetualsClient = (function () {
7868
7760
  });
7869
7761
  }); };
7870
7762
  this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7871
- var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_60;
7763
+ var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_58;
7872
7764
  return __generator(this, function (_a) {
7873
7765
  switch (_a.label) {
7874
7766
  case 0:
@@ -7906,8 +7798,8 @@ var PerpetualsClient = (function () {
7906
7798
  instructions.push(renameFlp);
7907
7799
  return [3, 4];
7908
7800
  case 3:
7909
- err_60 = _a.sent();
7910
- console.log("perpClient renameFlp error:: ", err_60);
7801
+ err_58 = _a.sent();
7802
+ console.log("perpClient renameFlp error:: ", err_58);
7911
7803
  return [3, 4];
7912
7804
  case 4: return [2, {
7913
7805
  instructions: __spreadArray([], instructions, true),
@@ -7917,7 +7809,7 @@ var PerpetualsClient = (function () {
7917
7809
  });
7918
7810
  }); };
7919
7811
  this.initStake = function (stakingFeeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7920
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_61;
7812
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_59;
7921
7813
  return __generator(this, function (_a) {
7922
7814
  switch (_a.label) {
7923
7815
  case 0:
@@ -7955,9 +7847,9 @@ var PerpetualsClient = (function () {
7955
7847
  instructions.push(initStakeInstruction);
7956
7848
  return [3, 4];
7957
7849
  case 3:
7958
- err_61 = _a.sent();
7959
- console.log("perpClient InitStaking error:: ", err_61);
7960
- throw err_61;
7850
+ err_59 = _a.sent();
7851
+ console.log("perpClient InitStaking error:: ", err_59);
7852
+ throw err_59;
7961
7853
  case 4: return [2, {
7962
7854
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7963
7855
  additionalSigners: additionalSigners
@@ -7966,7 +7858,7 @@ var PerpetualsClient = (function () {
7966
7858
  });
7967
7859
  }); };
7968
7860
  this.initCompounding = function (feeShareBps, metadataTitle, metadataSymbol, metadataUri, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7969
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_62;
7861
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_60;
7970
7862
  return __generator(this, function (_a) {
7971
7863
  switch (_a.label) {
7972
7864
  case 0:
@@ -8011,9 +7903,9 @@ var PerpetualsClient = (function () {
8011
7903
  instructions.push(initCompoundingInstruction);
8012
7904
  return [3, 4];
8013
7905
  case 3:
8014
- err_62 = _a.sent();
8015
- console.log("perpClient initCompounding error:: ", err_62);
8016
- throw err_62;
7906
+ err_60 = _a.sent();
7907
+ console.log("perpClient initCompounding error:: ", err_60);
7908
+ throw err_60;
8017
7909
  case 4: return [2, {
8018
7910
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8019
7911
  additionalSigners: additionalSigners
@@ -8022,7 +7914,7 @@ var PerpetualsClient = (function () {
8022
7914
  });
8023
7915
  }); };
8024
7916
  this.initTokenVault = function (token_permissions, tokens_to_distribute, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
8025
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_63;
7917
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_61;
8026
7918
  return __generator(this, function (_a) {
8027
7919
  switch (_a.label) {
8028
7920
  case 0:
@@ -8063,9 +7955,9 @@ var PerpetualsClient = (function () {
8063
7955
  instructions.push(initTokenVaultInstruction);
8064
7956
  return [3, 4];
8065
7957
  case 3:
8066
- err_63 = _a.sent();
8067
- console.log("perpClient InitTokenVaultInstruction error:: ", err_63);
8068
- throw err_63;
7958
+ err_61 = _a.sent();
7959
+ console.log("perpClient InitTokenVaultInstruction error:: ", err_61);
7960
+ throw err_61;
8069
7961
  case 4: return [2, {
8070
7962
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8071
7963
  additionalSigners: additionalSigners
@@ -8074,7 +7966,7 @@ var PerpetualsClient = (function () {
8074
7966
  });
8075
7967
  }); };
8076
7968
  this.setTokenVaultConfig = function (token_permissions, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
8077
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_64;
7969
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_62;
8078
7970
  return __generator(this, function (_a) {
8079
7971
  switch (_a.label) {
8080
7972
  case 0:
@@ -8105,9 +7997,9 @@ var PerpetualsClient = (function () {
8105
7997
  instructions.push(setTokenVaultConfigInstruction);
8106
7998
  return [3, 4];
8107
7999
  case 3:
8108
- err_64 = _a.sent();
8109
- console.log("perpClient setTokenVaultConfigInstruction error:: ", err_64);
8110
- throw err_64;
8000
+ err_62 = _a.sent();
8001
+ console.log("perpClient setTokenVaultConfigInstruction error:: ", err_62);
8002
+ throw err_62;
8111
8003
  case 4: return [2, {
8112
8004
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8113
8005
  additionalSigners: additionalSigners
@@ -8116,7 +8008,7 @@ var PerpetualsClient = (function () {
8116
8008
  });
8117
8009
  }); };
8118
8010
  this.withdrawInstantFee = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
8119
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_65;
8011
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_63;
8120
8012
  return __generator(this, function (_a) {
8121
8013
  switch (_a.label) {
8122
8014
  case 0:
@@ -8155,9 +8047,9 @@ var PerpetualsClient = (function () {
8155
8047
  instructions.push(withdrawInstantFeeInstruction);
8156
8048
  return [3, 6];
8157
8049
  case 5:
8158
- err_65 = _a.sent();
8159
- console.log("perpClient withdrawInstantFeeInstruction error:: ", err_65);
8160
- throw err_65;
8050
+ err_63 = _a.sent();
8051
+ console.log("perpClient withdrawInstantFeeInstruction error:: ", err_63);
8052
+ throw err_63;
8161
8053
  case 6: return [2, {
8162
8054
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8163
8055
  additionalSigners: additionalSigners
@@ -8166,7 +8058,7 @@ var PerpetualsClient = (function () {
8166
8058
  });
8167
8059
  }); };
8168
8060
  this.initRevenueTokenAccount = function (feeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
8169
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_66;
8061
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_64;
8170
8062
  return __generator(this, function (_a) {
8171
8063
  switch (_a.label) {
8172
8064
  case 0:
@@ -8203,9 +8095,9 @@ var PerpetualsClient = (function () {
8203
8095
  instructions.push(initRevenueTokenAccountInstruction);
8204
8096
  return [3, 4];
8205
8097
  case 3:
8206
- err_66 = _a.sent();
8207
- console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_66);
8208
- throw err_66;
8098
+ err_64 = _a.sent();
8099
+ console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_64);
8100
+ throw err_64;
8209
8101
  case 4: return [2, {
8210
8102
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8211
8103
  additionalSigners: additionalSigners
@@ -8214,7 +8106,7 @@ var PerpetualsClient = (function () {
8214
8106
  });
8215
8107
  }); };
8216
8108
  this.distributeTokenReward = function (amount, epochCount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
8217
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_67;
8109
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_65;
8218
8110
  return __generator(this, function (_a) {
8219
8111
  switch (_a.label) {
8220
8112
  case 0:
@@ -8253,9 +8145,9 @@ var PerpetualsClient = (function () {
8253
8145
  instructions.push(distributeTokenRewardInstruction);
8254
8146
  return [3, 4];
8255
8147
  case 3:
8256
- err_67 = _a.sent();
8257
- console.log("perpClient distributeTokenRewardInstruction error:: ", err_67);
8258
- throw err_67;
8148
+ err_65 = _a.sent();
8149
+ console.log("perpClient distributeTokenRewardInstruction error:: ", err_65);
8150
+ throw err_65;
8259
8151
  case 4: return [2, {
8260
8152
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8261
8153
  additionalSigners: additionalSigners
@@ -8264,7 +8156,7 @@ var PerpetualsClient = (function () {
8264
8156
  });
8265
8157
  }); };
8266
8158
  this.setTokenStakeLevel = function (owner, stakeLevel) { return __awaiter(_this, void 0, void 0, function () {
8267
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_68;
8159
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_66;
8268
8160
  return __generator(this, function (_a) {
8269
8161
  switch (_a.label) {
8270
8162
  case 0:
@@ -8292,9 +8184,9 @@ var PerpetualsClient = (function () {
8292
8184
  instructions.push(setTokenStakeLevelInstruction);
8293
8185
  return [3, 4];
8294
8186
  case 3:
8295
- err_68 = _a.sent();
8296
- console.log("perpClient setTokenStakeLevelInstruction error:: ", err_68);
8297
- throw err_68;
8187
+ err_66 = _a.sent();
8188
+ console.log("perpClient setTokenStakeLevelInstruction error:: ", err_66);
8189
+ throw err_66;
8298
8190
  case 4: return [2, {
8299
8191
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8300
8192
  additionalSigners: additionalSigners
@@ -8303,7 +8195,7 @@ var PerpetualsClient = (function () {
8303
8195
  });
8304
8196
  }); };
8305
8197
  this.setTokenReward = function (owner, amount, epochCount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
8306
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_69;
8198
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_67;
8307
8199
  return __generator(this, function (_a) {
8308
8200
  switch (_a.label) {
8309
8201
  case 0:
@@ -8335,9 +8227,9 @@ var PerpetualsClient = (function () {
8335
8227
  instructions.push(setTokenRewardInstruction);
8336
8228
  return [3, 4];
8337
8229
  case 3:
8338
- err_69 = _a.sent();
8339
- console.log("perpClient setTokenRewardInstruction error:: ", err_69);
8340
- throw err_69;
8230
+ err_67 = _a.sent();
8231
+ console.log("perpClient setTokenRewardInstruction error:: ", err_67);
8232
+ throw err_67;
8341
8233
  case 4: return [2, {
8342
8234
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8343
8235
  additionalSigners: additionalSigners