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