flash-sdk 3.2.2-alpha.1 → 4.0.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.
- package/dist/MarketAccount.d.ts +1 -1
- package/dist/PerpetualsClient.d.ts +202 -184
- package/dist/PerpetualsClient.js +307 -141
- package/dist/PoolConfig.d.ts +0 -1
- package/dist/PoolConfig.json +0 -78
- package/dist/PositionAccount.d.ts +2 -3
- package/dist/PositionAccount.js +0 -4
- package/dist/idl/perpetuals.d.ts +536 -37
- package/dist/idl/perpetuals.js +536 -37
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +2 -2
- package/package.json +1 -1
package/dist/PerpetualsClient.js
CHANGED
@@ -1132,9 +1132,7 @@ 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 =
|
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));
|
1135
|
+
var MAX_INIT_LEVERAGE = targetCustodyAccount.pricing.maxInitialLeverage.mul(new anchor_1.BN(100 - errorBandwidthPercentageUi)).div(new anchor_1.BN(100));
|
1138
1136
|
var profitLoss = _this.getPnlSync(positionAccount, targetPrice, targetEmaPrice, targetCustodyAccount, collateralPrice, collateralEmaPrice, collateralCustodyAccount, currentTimestamp, targetCustodyAccount.pricing.delaySeconds, poolConfig);
|
1139
1137
|
var _a = _this.getMinAndMaxOraclePriceSync(collateralPrice, collateralEmaPrice, collateralCustodyAccount), collateralMinPrice = _a.min, collateralMaxPrice = _a.max;
|
1140
1138
|
var currentCollateralUsd = collateralMinPrice.getAssetAmountUsd(positionAccount.collateralAmount.add(closeAmount), collateralCustodyAccount.decimals);
|
@@ -1152,9 +1150,8 @@ var PerpetualsClient = (function () {
|
|
1152
1150
|
}
|
1153
1151
|
var maxWithdrawableAmount;
|
1154
1152
|
var remainingCollateralUsd = availableInitMarginUsd.sub(maxRemovableCollateralUsd);
|
1155
|
-
|
1156
|
-
|
1157
|
-
var diff = (new anchor_1.BN(isDegenMode ? targetCustodyAccount.pricing.minDegenCollateralUsd : targetCustodyAccount.pricing.minCollateralUsd)).sub(remainingCollateralUsd);
|
1153
|
+
if (remainingCollateralUsd < targetCustodyAccount.pricing.minCollateralUsd) {
|
1154
|
+
var diff = targetCustodyAccount.pricing.minCollateralUsd.sub(remainingCollateralUsd);
|
1158
1155
|
var updatedMaxRemovableCollateralUsd = maxRemovableCollateralUsd.sub(diff);
|
1159
1156
|
if (updatedMaxRemovableCollateralUsd.isNeg()) {
|
1160
1157
|
return constants_1.BN_ZERO;
|
@@ -1193,10 +1190,8 @@ var PerpetualsClient = (function () {
|
|
1193
1190
|
if (errorBandwidthPercentageUi > 100 || errorBandwidthPercentageUi < 0) {
|
1194
1191
|
throw new Error("errorBandwidthPercentageUi cannot be >100 or <0");
|
1195
1192
|
}
|
1196
|
-
var MAX_INIT_LEVERAGE =
|
1197
|
-
|
1198
|
-
: (new anchor_1.BN(targetCustodyAccount.pricing.maxInitLeverage)).mul(new anchor_1.BN(100 - errorBandwidthPercentageUi)).div(new anchor_1.BN(100));
|
1199
|
-
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)));
|
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)));
|
1200
1195
|
if (maxRemoveableCollateralUsdAfterMinRequired.isNeg()) {
|
1201
1196
|
console.log("THIS cannot happen but still");
|
1202
1197
|
return constants_1.BN_ZERO;
|
@@ -1246,11 +1241,11 @@ var PerpetualsClient = (function () {
|
|
1246
1241
|
borrowRate = (currentUtilization.mul(custodyAccount.borrowRate.slope1))
|
1247
1242
|
.div(custodyAccount.borrowRate.optimalUtilization);
|
1248
1243
|
}
|
1249
|
-
else if (currentUtilization.lt(
|
1244
|
+
else if (currentUtilization.lt(custodyAccount.pricing.maxUtilization)) {
|
1250
1245
|
borrowRate = custodyAccount.borrowRate.slope1
|
1251
1246
|
.add(currentUtilization.sub(custodyAccount.borrowRate.optimalUtilization)
|
1252
1247
|
.mul(custodyAccount.borrowRate.slope2)
|
1253
|
-
.div(
|
1248
|
+
.div(custodyAccount.pricing.maxUtilization.sub(custodyAccount.borrowRate.optimalUtilization)));
|
1254
1249
|
}
|
1255
1250
|
else {
|
1256
1251
|
borrowRate = custodyAccount.borrowRate.slope1.add(custodyAccount.borrowRate.slope2);
|
@@ -1292,7 +1287,7 @@ var PerpetualsClient = (function () {
|
|
1292
1287
|
}
|
1293
1288
|
var exitFeeUsd = positionAccount.sizeUsd.mul(targetCustodyAccount.fees.closePosition).div(new anchor_1.BN(constants_1.RATE_POWER));
|
1294
1289
|
var unsettledLossUsd = exitFeeUsd.add(lockAndUnsettledFeeUsd);
|
1295
|
-
var liablitiesUsd = positionAccount.sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(
|
1290
|
+
var liablitiesUsd = positionAccount.sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(targetCustodyAccount.pricing.maxLeverage).add(unsettledLossUsd);
|
1296
1291
|
var targetMinMaxPriceOracle = _this.getMinAndMaxOraclePriceSync(targetPrice, targetEmaPrice, targetCustodyAccount);
|
1297
1292
|
var collateralMinMaxPriceOracle = _this.getMinAndMaxOraclePriceSync(collateralPrice, collateralEmaPrice, collateralCustodyAccount);
|
1298
1293
|
var liquidationPrice;
|
@@ -1382,7 +1377,7 @@ var PerpetualsClient = (function () {
|
|
1382
1377
|
}
|
1383
1378
|
var exitFeeUsd = sizeUsd.mul(targetCustodyAccount.fees.closePosition).div(new anchor_1.BN(constants_1.RATE_POWER));
|
1384
1379
|
var unsettledLossUsd = exitFeeUsd;
|
1385
|
-
var liablitiesUsd = sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(
|
1380
|
+
var liablitiesUsd = sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(targetCustodyAccount.pricing.maxLeverage).add(unsettledLossUsd);
|
1386
1381
|
var targetMinMaxPriceOracle = _this.getMinAndMaxOraclePriceSync(targetPrice, targetEmaPrice, targetCustodyAccount);
|
1387
1382
|
var collateralMinMaxPriceOracle = _this.getMinAndMaxOraclePriceSync(collateralPrice, collateralEmaPrice, collateralCustodyAccount);
|
1388
1383
|
var liquidationPrice;
|
@@ -5963,13 +5958,143 @@ var PerpetualsClient = (function () {
|
|
5963
5958
|
});
|
5964
5959
|
});
|
5965
5960
|
};
|
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
|
+
};
|
5966
6091
|
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) {
|
5967
6092
|
var args_1 = [];
|
5968
6093
|
for (var _i = 11; _i < arguments.length; _i++) {
|
5969
6094
|
args_1[_i - 11] = arguments[_i];
|
5970
6095
|
}
|
5971
6096
|
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) {
|
5972
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder,
|
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;
|
5973
6098
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
5974
6099
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5975
6100
|
return __generator(this, function (_c) {
|
@@ -6075,9 +6200,9 @@ var PerpetualsClient = (function () {
|
|
6075
6200
|
instructions.push(placeLimitOrder);
|
6076
6201
|
return [3, 10];
|
6077
6202
|
case 9:
|
6078
|
-
|
6079
|
-
console.log("perpClient placeLimitOrder error:: ",
|
6080
|
-
throw
|
6203
|
+
err_38 = _c.sent();
|
6204
|
+
console.log("perpClient placeLimitOrder error:: ", err_38);
|
6205
|
+
throw err_38;
|
6081
6206
|
case 10: return [2, {
|
6082
6207
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6083
6208
|
additionalSigners: additionalSigners
|
@@ -6092,7 +6217,7 @@ var PerpetualsClient = (function () {
|
|
6092
6217
|
args_1[_i - 11] = arguments[_i];
|
6093
6218
|
}
|
6094
6219
|
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) {
|
6095
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder,
|
6220
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder, err_39;
|
6096
6221
|
if (createUserATA === void 0) { createUserATA = true; }
|
6097
6222
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6098
6223
|
return __generator(this, function (_b) {
|
@@ -6183,9 +6308,9 @@ var PerpetualsClient = (function () {
|
|
6183
6308
|
instructions.push(editLimitOrder);
|
6184
6309
|
return [3, 8];
|
6185
6310
|
case 7:
|
6186
|
-
|
6187
|
-
console.log("perpClient editLimitOrder error:: ",
|
6188
|
-
throw
|
6311
|
+
err_39 = _b.sent();
|
6312
|
+
console.log("perpClient editLimitOrder error:: ", err_39);
|
6313
|
+
throw err_39;
|
6189
6314
|
case 8: return [2, {
|
6190
6315
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6191
6316
|
additionalSigners: additionalSigners
|
@@ -6200,7 +6325,7 @@ var PerpetualsClient = (function () {
|
|
6200
6325
|
args_1[_i - 7] = arguments[_i];
|
6201
6326
|
}
|
6202
6327
|
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) {
|
6203
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder,
|
6328
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder, err_40;
|
6204
6329
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
6205
6330
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
6206
6331
|
if (rebateTokenAccount === void 0) { rebateTokenAccount = web3_js_1.PublicKey.default; }
|
@@ -6253,9 +6378,9 @@ var PerpetualsClient = (function () {
|
|
6253
6378
|
instructions.push(executeLimitOrder);
|
6254
6379
|
return [3, 4];
|
6255
6380
|
case 3:
|
6256
|
-
|
6257
|
-
console.log("perpClient executeLimitOrder error:: ",
|
6258
|
-
throw
|
6381
|
+
err_40 = _a.sent();
|
6382
|
+
console.log("perpClient executeLimitOrder error:: ", err_40);
|
6383
|
+
throw err_40;
|
6259
6384
|
case 4: return [2, {
|
6260
6385
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6261
6386
|
additionalSigners: additionalSigners
|
@@ -6270,7 +6395,7 @@ var PerpetualsClient = (function () {
|
|
6270
6395
|
args_1[_i - 8] = arguments[_i];
|
6271
6396
|
}
|
6272
6397
|
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) {
|
6273
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap,
|
6398
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap, err_41;
|
6274
6399
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
6275
6400
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
6276
6401
|
if (rebateTokenAccount === void 0) { rebateTokenAccount = web3_js_1.PublicKey.default; }
|
@@ -6326,9 +6451,9 @@ var PerpetualsClient = (function () {
|
|
6326
6451
|
instructions.push(executeLimitWithSwap);
|
6327
6452
|
return [3, 4];
|
6328
6453
|
case 3:
|
6329
|
-
|
6330
|
-
console.log("perpClient executeLimitWithSwap error:: ",
|
6331
|
-
throw
|
6454
|
+
err_41 = _a.sent();
|
6455
|
+
console.log("perpClient executeLimitWithSwap error:: ", err_41);
|
6456
|
+
throw err_41;
|
6332
6457
|
case 4: return [2, {
|
6333
6458
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6334
6459
|
additionalSigners: additionalSigners
|
@@ -6338,7 +6463,7 @@ var PerpetualsClient = (function () {
|
|
6338
6463
|
});
|
6339
6464
|
};
|
6340
6465
|
this.placeTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6341
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder,
|
6466
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder, err_42;
|
6342
6467
|
return __generator(this, function (_a) {
|
6343
6468
|
switch (_a.label) {
|
6344
6469
|
case 0:
|
@@ -6386,9 +6511,9 @@ var PerpetualsClient = (function () {
|
|
6386
6511
|
instructions.push(placeTriggerOrder);
|
6387
6512
|
return [3, 4];
|
6388
6513
|
case 3:
|
6389
|
-
|
6390
|
-
console.log("perpClient placeTriggerOrder error:: ",
|
6391
|
-
throw
|
6514
|
+
err_42 = _a.sent();
|
6515
|
+
console.log("perpClient placeTriggerOrder error:: ", err_42);
|
6516
|
+
throw err_42;
|
6392
6517
|
case 4: return [2, {
|
6393
6518
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6394
6519
|
additionalSigners: additionalSigners
|
@@ -6397,7 +6522,7 @@ var PerpetualsClient = (function () {
|
|
6397
6522
|
});
|
6398
6523
|
}); };
|
6399
6524
|
this.editTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, orderId, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6400
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder,
|
6525
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder, err_43;
|
6401
6526
|
return __generator(this, function (_a) {
|
6402
6527
|
switch (_a.label) {
|
6403
6528
|
case 0:
|
@@ -6444,9 +6569,9 @@ var PerpetualsClient = (function () {
|
|
6444
6569
|
instructions.push(editTriggerOrder);
|
6445
6570
|
return [3, 4];
|
6446
6571
|
case 3:
|
6447
|
-
|
6448
|
-
console.log("perpClient editTriggerOrder error:: ",
|
6449
|
-
throw
|
6572
|
+
err_43 = _a.sent();
|
6573
|
+
console.log("perpClient editTriggerOrder error:: ", err_43);
|
6574
|
+
throw err_43;
|
6450
6575
|
case 4: return [2, {
|
6451
6576
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6452
6577
|
additionalSigners: additionalSigners
|
@@ -6455,7 +6580,7 @@ var PerpetualsClient = (function () {
|
|
6455
6580
|
});
|
6456
6581
|
}); };
|
6457
6582
|
this.cancelTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6458
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder,
|
6583
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder, err_44;
|
6459
6584
|
return __generator(this, function (_a) {
|
6460
6585
|
switch (_a.label) {
|
6461
6586
|
case 0:
|
@@ -6488,9 +6613,9 @@ var PerpetualsClient = (function () {
|
|
6488
6613
|
instructions.push(cancelTriggerOrder);
|
6489
6614
|
return [3, 4];
|
6490
6615
|
case 3:
|
6491
|
-
|
6492
|
-
console.log("perpClient cancelTriggerOrder error:: ",
|
6493
|
-
throw
|
6616
|
+
err_44 = _a.sent();
|
6617
|
+
console.log("perpClient cancelTriggerOrder error:: ", err_44);
|
6618
|
+
throw err_44;
|
6494
6619
|
case 4: return [2, {
|
6495
6620
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6496
6621
|
additionalSigners: additionalSigners
|
@@ -6499,7 +6624,7 @@ var PerpetualsClient = (function () {
|
|
6499
6624
|
});
|
6500
6625
|
}); };
|
6501
6626
|
this.cancelAllTriggerOrders = function (targetSymbol, collateralSymbol, side, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6502
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders,
|
6627
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders, err_45;
|
6503
6628
|
return __generator(this, function (_a) {
|
6504
6629
|
switch (_a.label) {
|
6505
6630
|
case 0:
|
@@ -6530,9 +6655,9 @@ var PerpetualsClient = (function () {
|
|
6530
6655
|
instructions.push(cancelAllTriggerOrders);
|
6531
6656
|
return [3, 4];
|
6532
6657
|
case 3:
|
6533
|
-
|
6534
|
-
console.log("perpClient cancelAllTriggerOrders error:: ",
|
6535
|
-
throw
|
6658
|
+
err_45 = _a.sent();
|
6659
|
+
console.log("perpClient cancelAllTriggerOrders error:: ", err_45);
|
6660
|
+
throw err_45;
|
6536
6661
|
case 4: return [2, {
|
6537
6662
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6538
6663
|
additionalSigners: additionalSigners
|
@@ -6546,7 +6671,7 @@ var PerpetualsClient = (function () {
|
|
6546
6671
|
args_1[_i - 9] = arguments[_i];
|
6547
6672
|
}
|
6548
6673
|
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) {
|
6549
|
-
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,
|
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;
|
6550
6675
|
if (createUserATA === void 0) { createUserATA = true; }
|
6551
6676
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6552
6677
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
@@ -6653,9 +6778,9 @@ var PerpetualsClient = (function () {
|
|
6653
6778
|
instructions.push(executeTriggerWithSwap);
|
6654
6779
|
return [3, 10];
|
6655
6780
|
case 9:
|
6656
|
-
|
6657
|
-
console.log("perpClient executeTriggerWithSwap error:: ",
|
6658
|
-
throw
|
6781
|
+
err_46 = _e.sent();
|
6782
|
+
console.log("perpClient executeTriggerWithSwap error:: ", err_46);
|
6783
|
+
throw err_46;
|
6659
6784
|
case 10: return [2, {
|
6660
6785
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6661
6786
|
additionalSigners: additionalSigners
|
@@ -6670,7 +6795,7 @@ var PerpetualsClient = (function () {
|
|
6670
6795
|
args_1[_i - 8] = arguments[_i];
|
6671
6796
|
}
|
6672
6797
|
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) {
|
6673
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder,
|
6798
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder, err_47;
|
6674
6799
|
if (createUserATA === void 0) { createUserATA = true; }
|
6675
6800
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6676
6801
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
@@ -6742,9 +6867,9 @@ var PerpetualsClient = (function () {
|
|
6742
6867
|
instructions.push(executeTriggerOrder);
|
6743
6868
|
return [3, 8];
|
6744
6869
|
case 7:
|
6745
|
-
|
6746
|
-
console.log("perpClient executeTriggerOrder error:: ",
|
6747
|
-
throw
|
6870
|
+
err_47 = _b.sent();
|
6871
|
+
console.log("perpClient executeTriggerOrder error:: ", err_47);
|
6872
|
+
throw err_47;
|
6748
6873
|
case 8: return [2, {
|
6749
6874
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6750
6875
|
additionalSigners: additionalSigners
|
@@ -6753,13 +6878,54 @@ var PerpetualsClient = (function () {
|
|
6753
6878
|
});
|
6754
6879
|
});
|
6755
6880
|
};
|
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
|
+
}); };
|
6756
6922
|
this.swap = function (userInputTokenSymbol_1, userOutputTokenSymbol_1, amountIn_1, minAmountOut_1, poolConfig_1) {
|
6757
6923
|
var args_1 = [];
|
6758
6924
|
for (var _i = 5; _i < arguments.length; _i++) {
|
6759
6925
|
args_1[_i - 5] = arguments[_i];
|
6760
6926
|
}
|
6761
6927
|
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) {
|
6762
|
-
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,
|
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;
|
6763
6929
|
if (useFeesPool === void 0) { useFeesPool = false; }
|
6764
6930
|
if (createUserATA === void 0) { createUserATA = true; }
|
6765
6931
|
if (unWrapSol === void 0) { unWrapSol = false; }
|
@@ -6964,9 +7130,9 @@ var PerpetualsClient = (function () {
|
|
6964
7130
|
}
|
6965
7131
|
return [3, 20];
|
6966
7132
|
case 19:
|
6967
|
-
|
6968
|
-
console.error("perpClient Swap error:: ",
|
6969
|
-
throw
|
7133
|
+
err_49 = _g.sent();
|
7134
|
+
console.error("perpClient Swap error:: ", err_49);
|
7135
|
+
throw err_49;
|
6970
7136
|
case 20: return [2, {
|
6971
7137
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6972
7138
|
additionalSigners: additionalSigners
|
@@ -6976,7 +7142,7 @@ var PerpetualsClient = (function () {
|
|
6976
7142
|
});
|
6977
7143
|
};
|
6978
7144
|
this.swapFeeInternal = function (rewardTokenSymbol, swapTokenSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6979
|
-
var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx,
|
7145
|
+
var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx, err_50;
|
6980
7146
|
return __generator(this, function (_b) {
|
6981
7147
|
switch (_b.label) {
|
6982
7148
|
case 0:
|
@@ -7036,9 +7202,9 @@ var PerpetualsClient = (function () {
|
|
7036
7202
|
instructions.push(inx);
|
7037
7203
|
return [3, 4];
|
7038
7204
|
case 3:
|
7039
|
-
|
7040
|
-
console.error("perpClient Swap error:: ",
|
7041
|
-
throw
|
7205
|
+
err_50 = _b.sent();
|
7206
|
+
console.error("perpClient Swap error:: ", err_50);
|
7207
|
+
throw err_50;
|
7042
7208
|
case 4: return [2, {
|
7043
7209
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
7044
7210
|
additionalSigners: additionalSigners
|
@@ -7047,7 +7213,7 @@ var PerpetualsClient = (function () {
|
|
7047
7213
|
});
|
7048
7214
|
}); };
|
7049
7215
|
this.setLpTokenPrice = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7050
|
-
var instructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, setLpTokenPriceInstruction,
|
7216
|
+
var instructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, setLpTokenPriceInstruction, err_51;
|
7051
7217
|
return __generator(this, function (_d) {
|
7052
7218
|
switch (_d.label) {
|
7053
7219
|
case 0:
|
@@ -7095,9 +7261,9 @@ var PerpetualsClient = (function () {
|
|
7095
7261
|
instructions.push(setLpTokenPriceInstruction);
|
7096
7262
|
return [3, 4];
|
7097
7263
|
case 3:
|
7098
|
-
|
7099
|
-
console.log("perpClient setLpTokenPriceInstruction error:: ",
|
7100
|
-
throw
|
7264
|
+
err_51 = _d.sent();
|
7265
|
+
console.log("perpClient setLpTokenPriceInstruction error:: ", err_51);
|
7266
|
+
throw err_51;
|
7101
7267
|
case 4: return [2, {
|
7102
7268
|
instructions: __spreadArray([], instructions, true),
|
7103
7269
|
additionalSigners: additionalSigners
|
@@ -7145,7 +7311,7 @@ var PerpetualsClient = (function () {
|
|
7145
7311
|
});
|
7146
7312
|
}); };
|
7147
7313
|
this.setAdminSigners = function (admins, minSignatures) { return __awaiter(_this, void 0, void 0, function () {
|
7148
|
-
var adminMetas, _i, admins_2, admin,
|
7314
|
+
var adminMetas, _i, admins_2, admin, err_52;
|
7149
7315
|
return __generator(this, function (_a) {
|
7150
7316
|
switch (_a.label) {
|
7151
7317
|
case 0:
|
@@ -7175,11 +7341,11 @@ var PerpetualsClient = (function () {
|
|
7175
7341
|
_a.sent();
|
7176
7342
|
return [3, 4];
|
7177
7343
|
case 3:
|
7178
|
-
|
7344
|
+
err_52 = _a.sent();
|
7179
7345
|
if (this.printErrors) {
|
7180
|
-
console.error("setAdminSigners err:",
|
7346
|
+
console.error("setAdminSigners err:", err_52);
|
7181
7347
|
}
|
7182
|
-
throw
|
7348
|
+
throw err_52;
|
7183
7349
|
case 4: return [2];
|
7184
7350
|
}
|
7185
7351
|
});
|
@@ -7368,7 +7534,7 @@ var PerpetualsClient = (function () {
|
|
7368
7534
|
});
|
7369
7535
|
}); };
|
7370
7536
|
this.protocolWithdrawFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7371
|
-
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx,
|
7537
|
+
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_53;
|
7372
7538
|
return __generator(this, function (_a) {
|
7373
7539
|
switch (_a.label) {
|
7374
7540
|
case 0:
|
@@ -7401,9 +7567,9 @@ var PerpetualsClient = (function () {
|
|
7401
7567
|
instructions.push(withdrawFeesIx);
|
7402
7568
|
return [3, 5];
|
7403
7569
|
case 4:
|
7404
|
-
|
7405
|
-
console.log("perpClient setPool error:: ",
|
7406
|
-
throw
|
7570
|
+
err_53 = _a.sent();
|
7571
|
+
console.log("perpClient setPool error:: ", err_53);
|
7572
|
+
throw err_53;
|
7407
7573
|
case 5: return [2, {
|
7408
7574
|
instructions: __spreadArray([], instructions, true),
|
7409
7575
|
additionalSigners: additionalSigners
|
@@ -7412,7 +7578,7 @@ var PerpetualsClient = (function () {
|
|
7412
7578
|
});
|
7413
7579
|
}); };
|
7414
7580
|
this.moveProtocolFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7415
|
-
var publicKey, custodyConfig, instructions, additionalSigners, moveProtocolFeesIx,
|
7581
|
+
var publicKey, custodyConfig, instructions, additionalSigners, moveProtocolFeesIx, err_54;
|
7416
7582
|
return __generator(this, function (_a) {
|
7417
7583
|
switch (_a.label) {
|
7418
7584
|
case 0:
|
@@ -7446,9 +7612,9 @@ var PerpetualsClient = (function () {
|
|
7446
7612
|
instructions.push(moveProtocolFeesIx);
|
7447
7613
|
return [3, 4];
|
7448
7614
|
case 3:
|
7449
|
-
|
7450
|
-
console.log("perpClient setPool error:: ",
|
7451
|
-
throw
|
7615
|
+
err_54 = _a.sent();
|
7616
|
+
console.log("perpClient setPool error:: ", err_54);
|
7617
|
+
throw err_54;
|
7452
7618
|
case 4: return [2, {
|
7453
7619
|
instructions: __spreadArray([], instructions, true),
|
7454
7620
|
additionalSigners: additionalSigners
|
@@ -7457,7 +7623,7 @@ var PerpetualsClient = (function () {
|
|
7457
7623
|
});
|
7458
7624
|
}); };
|
7459
7625
|
this.setProtocolFeeShareBps = function (feeShareBps, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7460
|
-
var publicKey, setProtocolFeeShareBpsIx,
|
7626
|
+
var publicKey, setProtocolFeeShareBpsIx, err_55;
|
7461
7627
|
return __generator(this, function (_a) {
|
7462
7628
|
switch (_a.label) {
|
7463
7629
|
case 0:
|
@@ -7477,15 +7643,15 @@ var PerpetualsClient = (function () {
|
|
7477
7643
|
setProtocolFeeShareBpsIx = _a.sent();
|
7478
7644
|
return [2, setProtocolFeeShareBpsIx];
|
7479
7645
|
case 2:
|
7480
|
-
|
7481
|
-
console.log("perpClient setProtocolFeeShareBpsIx error:: ",
|
7482
|
-
throw
|
7646
|
+
err_55 = _a.sent();
|
7647
|
+
console.log("perpClient setProtocolFeeShareBpsIx error:: ", err_55);
|
7648
|
+
throw err_55;
|
7483
7649
|
case 3: return [2];
|
7484
7650
|
}
|
7485
7651
|
});
|
7486
7652
|
}); };
|
7487
7653
|
this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
|
7488
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction,
|
7654
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_56;
|
7489
7655
|
return __generator(this, function (_a) {
|
7490
7656
|
switch (_a.label) {
|
7491
7657
|
case 0:
|
@@ -7512,9 +7678,9 @@ var PerpetualsClient = (function () {
|
|
7512
7678
|
instructions.push(setPermissionsInstruction);
|
7513
7679
|
return [3, 4];
|
7514
7680
|
case 3:
|
7515
|
-
|
7516
|
-
console.log("perpClient setPool error:: ",
|
7517
|
-
throw
|
7681
|
+
err_56 = _a.sent();
|
7682
|
+
console.log("perpClient setPool error:: ", err_56);
|
7683
|
+
throw err_56;
|
7518
7684
|
case 4: return [2, {
|
7519
7685
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
7520
7686
|
additionalSigners: additionalSigners
|
@@ -7523,7 +7689,7 @@ var PerpetualsClient = (function () {
|
|
7523
7689
|
});
|
7524
7690
|
}); };
|
7525
7691
|
this.reimburse = function (tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7526
|
-
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e,
|
7692
|
+
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_57;
|
7527
7693
|
var _f;
|
7528
7694
|
return __generator(this, function (_g) {
|
7529
7695
|
switch (_g.label) {
|
@@ -7584,9 +7750,9 @@ var PerpetualsClient = (function () {
|
|
7584
7750
|
instructions.push(reimburse);
|
7585
7751
|
return [3, 5];
|
7586
7752
|
case 4:
|
7587
|
-
|
7588
|
-
console.log("perpClient setPool error:: ",
|
7589
|
-
throw
|
7753
|
+
err_57 = _g.sent();
|
7754
|
+
console.log("perpClient setPool error:: ", err_57);
|
7755
|
+
throw err_57;
|
7590
7756
|
case 5: return [2, {
|
7591
7757
|
instructions: __spreadArray([], instructions, true),
|
7592
7758
|
additionalSigners: additionalSigners
|
@@ -7595,7 +7761,7 @@ var PerpetualsClient = (function () {
|
|
7595
7761
|
});
|
7596
7762
|
}); };
|
7597
7763
|
this.setInternalOraclePrice = function (tokenMint, price, expo, conf, ema, publishTime, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7598
|
-
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice,
|
7764
|
+
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_58;
|
7599
7765
|
return __generator(this, function (_a) {
|
7600
7766
|
switch (_a.label) {
|
7601
7767
|
case 0:
|
@@ -7628,9 +7794,9 @@ var PerpetualsClient = (function () {
|
|
7628
7794
|
instructions.push(setInternalOraclePrice);
|
7629
7795
|
return [3, 4];
|
7630
7796
|
case 3:
|
7631
|
-
|
7632
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
7633
|
-
throw
|
7797
|
+
err_58 = _a.sent();
|
7798
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_58);
|
7799
|
+
throw err_58;
|
7634
7800
|
case 4: return [2, {
|
7635
7801
|
instructions: __spreadArray([], instructions, true),
|
7636
7802
|
additionalSigners: additionalSigners
|
@@ -7639,7 +7805,7 @@ var PerpetualsClient = (function () {
|
|
7639
7805
|
});
|
7640
7806
|
}); };
|
7641
7807
|
this.setInternalOraclePriceBatch = function (tokenMintList, tokenInternalPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
7642
|
-
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice,
|
7808
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_59;
|
7643
7809
|
return __generator(this, function (_a) {
|
7644
7810
|
switch (_a.label) {
|
7645
7811
|
case 0:
|
@@ -7689,9 +7855,9 @@ var PerpetualsClient = (function () {
|
|
7689
7855
|
instructions.push(setInternalOraclePrice);
|
7690
7856
|
return [3, 4];
|
7691
7857
|
case 3:
|
7692
|
-
|
7693
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
7694
|
-
throw
|
7858
|
+
err_59 = _a.sent();
|
7859
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_59);
|
7860
|
+
throw err_59;
|
7695
7861
|
case 4: return [2, {
|
7696
7862
|
instructions: __spreadArray([], instructions, true),
|
7697
7863
|
additionalSigners: additionalSigners
|
@@ -7700,7 +7866,7 @@ var PerpetualsClient = (function () {
|
|
7700
7866
|
});
|
7701
7867
|
}); };
|
7702
7868
|
this.setInternalOracleEmaPriceBatch = function (tokenMintList, tokenInternalEmaPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
7703
|
-
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalOraclePrice,
|
7869
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_60;
|
7704
7870
|
return __generator(this, function (_a) {
|
7705
7871
|
switch (_a.label) {
|
7706
7872
|
case 0:
|
@@ -7750,9 +7916,9 @@ var PerpetualsClient = (function () {
|
|
7750
7916
|
instructions.push(setInternalOraclePrice);
|
7751
7917
|
return [3, 4];
|
7752
7918
|
case 3:
|
7753
|
-
|
7754
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
7755
|
-
throw
|
7919
|
+
err_60 = _a.sent();
|
7920
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_60);
|
7921
|
+
throw err_60;
|
7756
7922
|
case 4: return [2, {
|
7757
7923
|
instructions: __spreadArray([], instructions, true),
|
7758
7924
|
additionalSigners: additionalSigners
|
@@ -7761,7 +7927,7 @@ var PerpetualsClient = (function () {
|
|
7761
7927
|
});
|
7762
7928
|
}); };
|
7763
7929
|
this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7764
|
-
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp,
|
7930
|
+
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_61;
|
7765
7931
|
return __generator(this, function (_a) {
|
7766
7932
|
switch (_a.label) {
|
7767
7933
|
case 0:
|
@@ -7799,8 +7965,8 @@ var PerpetualsClient = (function () {
|
|
7799
7965
|
instructions.push(renameFlp);
|
7800
7966
|
return [3, 4];
|
7801
7967
|
case 3:
|
7802
|
-
|
7803
|
-
console.log("perpClient renameFlp error:: ",
|
7968
|
+
err_61 = _a.sent();
|
7969
|
+
console.log("perpClient renameFlp error:: ", err_61);
|
7804
7970
|
return [3, 4];
|
7805
7971
|
case 4: return [2, {
|
7806
7972
|
instructions: __spreadArray([], instructions, true),
|
@@ -7810,7 +7976,7 @@ var PerpetualsClient = (function () {
|
|
7810
7976
|
});
|
7811
7977
|
}); };
|
7812
7978
|
this.initStake = function (stakingFeeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7813
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction,
|
7979
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_62;
|
7814
7980
|
return __generator(this, function (_a) {
|
7815
7981
|
switch (_a.label) {
|
7816
7982
|
case 0:
|
@@ -7848,9 +8014,9 @@ var PerpetualsClient = (function () {
|
|
7848
8014
|
instructions.push(initStakeInstruction);
|
7849
8015
|
return [3, 4];
|
7850
8016
|
case 3:
|
7851
|
-
|
7852
|
-
console.log("perpClient InitStaking error:: ",
|
7853
|
-
throw
|
8017
|
+
err_62 = _a.sent();
|
8018
|
+
console.log("perpClient InitStaking error:: ", err_62);
|
8019
|
+
throw err_62;
|
7854
8020
|
case 4: return [2, {
|
7855
8021
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
7856
8022
|
additionalSigners: additionalSigners
|
@@ -7859,7 +8025,7 @@ var PerpetualsClient = (function () {
|
|
7859
8025
|
});
|
7860
8026
|
}); };
|
7861
8027
|
this.initCompounding = function (feeShareBps, metadataTitle, metadataSymbol, metadataUri, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7862
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction,
|
8028
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_63;
|
7863
8029
|
return __generator(this, function (_a) {
|
7864
8030
|
switch (_a.label) {
|
7865
8031
|
case 0:
|
@@ -7904,9 +8070,9 @@ var PerpetualsClient = (function () {
|
|
7904
8070
|
instructions.push(initCompoundingInstruction);
|
7905
8071
|
return [3, 4];
|
7906
8072
|
case 3:
|
7907
|
-
|
7908
|
-
console.log("perpClient initCompounding error:: ",
|
7909
|
-
throw
|
8073
|
+
err_63 = _a.sent();
|
8074
|
+
console.log("perpClient initCompounding error:: ", err_63);
|
8075
|
+
throw err_63;
|
7910
8076
|
case 4: return [2, {
|
7911
8077
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
7912
8078
|
additionalSigners: additionalSigners
|
@@ -7915,7 +8081,7 @@ var PerpetualsClient = (function () {
|
|
7915
8081
|
});
|
7916
8082
|
}); };
|
7917
8083
|
this.initTokenVault = function (token_permissions, tokens_to_distribute, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7918
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction,
|
8084
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_64;
|
7919
8085
|
return __generator(this, function (_a) {
|
7920
8086
|
switch (_a.label) {
|
7921
8087
|
case 0:
|
@@ -7956,9 +8122,9 @@ var PerpetualsClient = (function () {
|
|
7956
8122
|
instructions.push(initTokenVaultInstruction);
|
7957
8123
|
return [3, 4];
|
7958
8124
|
case 3:
|
7959
|
-
|
7960
|
-
console.log("perpClient InitTokenVaultInstruction error:: ",
|
7961
|
-
throw
|
8125
|
+
err_64 = _a.sent();
|
8126
|
+
console.log("perpClient InitTokenVaultInstruction error:: ", err_64);
|
8127
|
+
throw err_64;
|
7962
8128
|
case 4: return [2, {
|
7963
8129
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
7964
8130
|
additionalSigners: additionalSigners
|
@@ -7967,7 +8133,7 @@ var PerpetualsClient = (function () {
|
|
7967
8133
|
});
|
7968
8134
|
}); };
|
7969
8135
|
this.setTokenVaultConfig = function (token_permissions, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7970
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction,
|
8136
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_65;
|
7971
8137
|
return __generator(this, function (_a) {
|
7972
8138
|
switch (_a.label) {
|
7973
8139
|
case 0:
|
@@ -7998,9 +8164,9 @@ var PerpetualsClient = (function () {
|
|
7998
8164
|
instructions.push(setTokenVaultConfigInstruction);
|
7999
8165
|
return [3, 4];
|
8000
8166
|
case 3:
|
8001
|
-
|
8002
|
-
console.log("perpClient setTokenVaultConfigInstruction error:: ",
|
8003
|
-
throw
|
8167
|
+
err_65 = _a.sent();
|
8168
|
+
console.log("perpClient setTokenVaultConfigInstruction error:: ", err_65);
|
8169
|
+
throw err_65;
|
8004
8170
|
case 4: return [2, {
|
8005
8171
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
8006
8172
|
additionalSigners: additionalSigners
|
@@ -8009,7 +8175,7 @@ var PerpetualsClient = (function () {
|
|
8009
8175
|
});
|
8010
8176
|
}); };
|
8011
8177
|
this.withdrawInstantFee = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
8012
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction,
|
8178
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_66;
|
8013
8179
|
return __generator(this, function (_a) {
|
8014
8180
|
switch (_a.label) {
|
8015
8181
|
case 0:
|
@@ -8048,9 +8214,9 @@ var PerpetualsClient = (function () {
|
|
8048
8214
|
instructions.push(withdrawInstantFeeInstruction);
|
8049
8215
|
return [3, 6];
|
8050
8216
|
case 5:
|
8051
|
-
|
8052
|
-
console.log("perpClient withdrawInstantFeeInstruction error:: ",
|
8053
|
-
throw
|
8217
|
+
err_66 = _a.sent();
|
8218
|
+
console.log("perpClient withdrawInstantFeeInstruction error:: ", err_66);
|
8219
|
+
throw err_66;
|
8054
8220
|
case 6: return [2, {
|
8055
8221
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
8056
8222
|
additionalSigners: additionalSigners
|
@@ -8059,7 +8225,7 @@ var PerpetualsClient = (function () {
|
|
8059
8225
|
});
|
8060
8226
|
}); };
|
8061
8227
|
this.initRevenueTokenAccount = function (feeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
8062
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction,
|
8228
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_67;
|
8063
8229
|
return __generator(this, function (_a) {
|
8064
8230
|
switch (_a.label) {
|
8065
8231
|
case 0:
|
@@ -8096,9 +8262,9 @@ var PerpetualsClient = (function () {
|
|
8096
8262
|
instructions.push(initRevenueTokenAccountInstruction);
|
8097
8263
|
return [3, 4];
|
8098
8264
|
case 3:
|
8099
|
-
|
8100
|
-
console.log("perpClient initRevenueTokenAccountInstruction error:: ",
|
8101
|
-
throw
|
8265
|
+
err_67 = _a.sent();
|
8266
|
+
console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_67);
|
8267
|
+
throw err_67;
|
8102
8268
|
case 4: return [2, {
|
8103
8269
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
8104
8270
|
additionalSigners: additionalSigners
|
@@ -8107,7 +8273,7 @@ var PerpetualsClient = (function () {
|
|
8107
8273
|
});
|
8108
8274
|
}); };
|
8109
8275
|
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,
|
8276
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_68;
|
8111
8277
|
return __generator(this, function (_a) {
|
8112
8278
|
switch (_a.label) {
|
8113
8279
|
case 0:
|
@@ -8146,9 +8312,9 @@ var PerpetualsClient = (function () {
|
|
8146
8312
|
instructions.push(distributeTokenRewardInstruction);
|
8147
8313
|
return [3, 4];
|
8148
8314
|
case 3:
|
8149
|
-
|
8150
|
-
console.log("perpClient distributeTokenRewardInstruction error:: ",
|
8151
|
-
throw
|
8315
|
+
err_68 = _a.sent();
|
8316
|
+
console.log("perpClient distributeTokenRewardInstruction error:: ", err_68);
|
8317
|
+
throw err_68;
|
8152
8318
|
case 4: return [2, {
|
8153
8319
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
8154
8320
|
additionalSigners: additionalSigners
|
@@ -8157,7 +8323,7 @@ var PerpetualsClient = (function () {
|
|
8157
8323
|
});
|
8158
8324
|
}); };
|
8159
8325
|
this.setTokenStakeLevel = function (owner, stakeLevel) { return __awaiter(_this, void 0, void 0, function () {
|
8160
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction,
|
8326
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_69;
|
8161
8327
|
return __generator(this, function (_a) {
|
8162
8328
|
switch (_a.label) {
|
8163
8329
|
case 0:
|
@@ -8185,9 +8351,9 @@ var PerpetualsClient = (function () {
|
|
8185
8351
|
instructions.push(setTokenStakeLevelInstruction);
|
8186
8352
|
return [3, 4];
|
8187
8353
|
case 3:
|
8188
|
-
|
8189
|
-
console.log("perpClient setTokenStakeLevelInstruction error:: ",
|
8190
|
-
throw
|
8354
|
+
err_69 = _a.sent();
|
8355
|
+
console.log("perpClient setTokenStakeLevelInstruction error:: ", err_69);
|
8356
|
+
throw err_69;
|
8191
8357
|
case 4: return [2, {
|
8192
8358
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
8193
8359
|
additionalSigners: additionalSigners
|
@@ -8196,7 +8362,7 @@ var PerpetualsClient = (function () {
|
|
8196
8362
|
});
|
8197
8363
|
}); };
|
8198
8364
|
this.setTokenReward = function (owner, amount, epochCount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
8199
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction,
|
8365
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_70;
|
8200
8366
|
return __generator(this, function (_a) {
|
8201
8367
|
switch (_a.label) {
|
8202
8368
|
case 0:
|
@@ -8228,9 +8394,9 @@ var PerpetualsClient = (function () {
|
|
8228
8394
|
instructions.push(setTokenRewardInstruction);
|
8229
8395
|
return [3, 4];
|
8230
8396
|
case 3:
|
8231
|
-
|
8232
|
-
console.log("perpClient setTokenRewardInstruction error:: ",
|
8233
|
-
throw
|
8397
|
+
err_70 = _a.sent();
|
8398
|
+
console.log("perpClient setTokenRewardInstruction error:: ", err_70);
|
8399
|
+
throw err_70;
|
8234
8400
|
case 4: return [2, {
|
8235
8401
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
8236
8402
|
additionalSigners: additionalSigners
|