flash-sdk 3.1.10 → 3.2.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MarketAccount.d.ts +1 -1
- package/dist/OraclePrice.d.ts +0 -1
- package/dist/OrderAccount.d.ts +0 -1
- package/dist/PerpetualsClient.d.ts +184 -204
- package/dist/PerpetualsClient.js +142 -309
- package/dist/PoolAccount.d.ts +0 -1
- package/dist/PoolConfig.d.ts +1 -0
- package/dist/PoolConfig.json +78 -0
- package/dist/PoolDataClient.d.ts +0 -1
- package/dist/PositionAccount.d.ts +3 -3
- package/dist/PositionAccount.js +4 -0
- package/dist/TokenStakeAccount.d.ts +0 -1
- package/dist/TokenVaultAccount.d.ts +0 -1
- package/dist/TradingAccount.d.ts +0 -1
- package/dist/ViewHelper.js +2 -2
- package/dist/backupOracle.js +4 -4
- package/dist/constants/index.d.ts +0 -1
- package/dist/idl/perpetuals.d.ts +38 -537
- package/dist/idl/perpetuals.js +38 -537
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/index.js +5 -5
- package/dist/utils/IdlCoder.js +17 -7
- package/dist/utils/alt.js +5 -6
- package/dist/utils/anchorCpiEvents.d.ts +0 -1
- 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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
26
26
|
function step(op) {
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
@@ -1132,7 +1132,9 @@ var PerpetualsClient = (function () {
|
|
1132
1132
|
if (errorBandwidthPercentageUi > 100 || errorBandwidthPercentageUi < 0) {
|
1133
1133
|
throw new Error("errorBandwidthPercentageUi cannot be >100 or <0");
|
1134
1134
|
}
|
1135
|
-
var MAX_INIT_LEVERAGE =
|
1135
|
+
var MAX_INIT_LEVERAGE = positionAccount.isDegenMode() ?
|
1136
|
+
(new anchor_1.BN(targetCustodyAccount.pricing.maxInitDegenLeverage)).mul(new anchor_1.BN(100 - errorBandwidthPercentageUi)).div(new anchor_1.BN(100))
|
1137
|
+
: (new anchor_1.BN(targetCustodyAccount.pricing.maxInitLeverage)).mul(new anchor_1.BN(100 - errorBandwidthPercentageUi)).div(new anchor_1.BN(100));
|
1136
1138
|
var profitLoss = _this.getPnlSync(positionAccount, targetPrice, targetEmaPrice, targetCustodyAccount, collateralPrice, collateralEmaPrice, collateralCustodyAccount, currentTimestamp, targetCustodyAccount.pricing.delaySeconds, poolConfig);
|
1137
1139
|
var _a = _this.getMinAndMaxOraclePriceSync(collateralPrice, collateralEmaPrice, collateralCustodyAccount), collateralMinPrice = _a.min, collateralMaxPrice = _a.max;
|
1138
1140
|
var currentCollateralUsd = collateralMinPrice.getAssetAmountUsd(positionAccount.collateralAmount.add(closeAmount), collateralCustodyAccount.decimals);
|
@@ -1150,8 +1152,8 @@ var PerpetualsClient = (function () {
|
|
1150
1152
|
}
|
1151
1153
|
var maxWithdrawableAmount;
|
1152
1154
|
var remainingCollateralUsd = availableInitMarginUsd.sub(maxRemovableCollateralUsd);
|
1153
|
-
if (remainingCollateralUsd
|
1154
|
-
var diff = targetCustodyAccount.pricing.minCollateralUsd.sub(remainingCollateralUsd);
|
1155
|
+
if (remainingCollateralUsd.lt(new anchor_1.BN(targetCustodyAccount.pricing.minCollateralUsd))) {
|
1156
|
+
var diff = (new anchor_1.BN(targetCustodyAccount.pricing.minCollateralUsd)).sub(remainingCollateralUsd);
|
1155
1157
|
var updatedMaxRemovableCollateralUsd = maxRemovableCollateralUsd.sub(diff);
|
1156
1158
|
if (updatedMaxRemovableCollateralUsd.isNeg()) {
|
1157
1159
|
return constants_1.BN_ZERO;
|
@@ -1190,8 +1192,10 @@ var PerpetualsClient = (function () {
|
|
1190
1192
|
if (errorBandwidthPercentageUi > 100 || errorBandwidthPercentageUi < 0) {
|
1191
1193
|
throw new Error("errorBandwidthPercentageUi cannot be >100 or <0");
|
1192
1194
|
}
|
1193
|
-
var MAX_INIT_LEVERAGE =
|
1194
|
-
|
1195
|
+
var MAX_INIT_LEVERAGE = positionAccount.isDegenMode() ?
|
1196
|
+
(new anchor_1.BN(targetCustodyAccount.pricing.maxInitDegenLeverage)).mul(new anchor_1.BN(100 - errorBandwidthPercentageUi)).div(new anchor_1.BN(100))
|
1197
|
+
: (new anchor_1.BN(targetCustodyAccount.pricing.maxInitLeverage)).mul(new anchor_1.BN(100 - errorBandwidthPercentageUi)).div(new anchor_1.BN(100));
|
1198
|
+
var maxRemoveableCollateralUsdAfterMinRequired = positionAccount.collateralUsd.sub((new anchor_1.BN(targetCustodyAccount.pricing.minCollateralUsd)).mul(new anchor_1.BN(100 + errorBandwidthPercentageUi)).div(new anchor_1.BN(100)));
|
1195
1199
|
if (maxRemoveableCollateralUsdAfterMinRequired.isNeg()) {
|
1196
1200
|
console.log("THIS cannot happen but still");
|
1197
1201
|
return constants_1.BN_ZERO;
|
@@ -1241,11 +1245,11 @@ var PerpetualsClient = (function () {
|
|
1241
1245
|
borrowRate = (currentUtilization.mul(custodyAccount.borrowRate.slope1))
|
1242
1246
|
.div(custodyAccount.borrowRate.optimalUtilization);
|
1243
1247
|
}
|
1244
|
-
else if (currentUtilization.lt(custodyAccount.pricing.maxUtilization)) {
|
1248
|
+
else if (currentUtilization.lt((new anchor_1.BN(custodyAccount.pricing.maxUtilization)))) {
|
1245
1249
|
borrowRate = custodyAccount.borrowRate.slope1
|
1246
1250
|
.add(currentUtilization.sub(custodyAccount.borrowRate.optimalUtilization)
|
1247
1251
|
.mul(custodyAccount.borrowRate.slope2)
|
1248
|
-
.div(custodyAccount.pricing.maxUtilization.sub(custodyAccount.borrowRate.optimalUtilization)));
|
1252
|
+
.div((new anchor_1.BN(custodyAccount.pricing.maxUtilization)).sub(custodyAccount.borrowRate.optimalUtilization)));
|
1249
1253
|
}
|
1250
1254
|
else {
|
1251
1255
|
borrowRate = custodyAccount.borrowRate.slope1.add(custodyAccount.borrowRate.slope2);
|
@@ -1287,7 +1291,7 @@ var PerpetualsClient = (function () {
|
|
1287
1291
|
}
|
1288
1292
|
var exitFeeUsd = positionAccount.sizeUsd.mul(targetCustodyAccount.fees.closePosition).div(new anchor_1.BN(constants_1.RATE_POWER));
|
1289
1293
|
var unsettledLossUsd = exitFeeUsd.add(lockAndUnsettledFeeUsd);
|
1290
|
-
var liablitiesUsd = positionAccount.sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(targetCustodyAccount.pricing.maxLeverage).add(unsettledLossUsd);
|
1294
|
+
var liablitiesUsd = positionAccount.sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(new anchor_1.BN(targetCustodyAccount.pricing.maxLeverage)).add(unsettledLossUsd);
|
1291
1295
|
var targetMinMaxPriceOracle = _this.getMinAndMaxOraclePriceSync(targetPrice, targetEmaPrice, targetCustodyAccount);
|
1292
1296
|
var collateralMinMaxPriceOracle = _this.getMinAndMaxOraclePriceSync(collateralPrice, collateralEmaPrice, collateralCustodyAccount);
|
1293
1297
|
var liquidationPrice;
|
@@ -1377,7 +1381,7 @@ var PerpetualsClient = (function () {
|
|
1377
1381
|
}
|
1378
1382
|
var exitFeeUsd = sizeUsd.mul(targetCustodyAccount.fees.closePosition).div(new anchor_1.BN(constants_1.RATE_POWER));
|
1379
1383
|
var unsettledLossUsd = exitFeeUsd;
|
1380
|
-
var liablitiesUsd = sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(targetCustodyAccount.pricing.maxLeverage).add(unsettledLossUsd);
|
1384
|
+
var liablitiesUsd = sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(new anchor_1.BN(targetCustodyAccount.pricing.maxLeverage)).add(unsettledLossUsd);
|
1381
1385
|
var targetMinMaxPriceOracle = _this.getMinAndMaxOraclePriceSync(targetPrice, targetEmaPrice, targetCustodyAccount);
|
1382
1386
|
var collateralMinMaxPriceOracle = _this.getMinAndMaxOraclePriceSync(collateralPrice, collateralEmaPrice, collateralCustodyAccount);
|
1383
1387
|
var liquidationPrice;
|
@@ -5958,143 +5962,13 @@ var PerpetualsClient = (function () {
|
|
5958
5962
|
});
|
5959
5963
|
});
|
5960
5964
|
};
|
5961
|
-
this.setTriggerPrice = function (targetSymbol, collateralSymbol, side, triggerPrice, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5962
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, positionAccount, instructions, additionalSigners, setTriggerPrice, err_36;
|
5963
|
-
return __generator(this, function (_a) {
|
5964
|
-
switch (_a.label) {
|
5965
|
-
case 0:
|
5966
|
-
publicKey = this.provider.wallet.publicKey;
|
5967
|
-
targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(targetSymbol).mintKey); });
|
5968
|
-
collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey); });
|
5969
|
-
marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
|
5970
|
-
positionAccount = poolConfig.getPositionFromMarketPk(publicKey, marketAccount);
|
5971
|
-
instructions = [];
|
5972
|
-
additionalSigners = [];
|
5973
|
-
_a.label = 1;
|
5974
|
-
case 1:
|
5975
|
-
_a.trys.push([1, 3, , 4]);
|
5976
|
-
return [4, this.program.methods
|
5977
|
-
.setTriggerPrice({
|
5978
|
-
triggerPrice: triggerPrice,
|
5979
|
-
isStopLoss: isStopLoss
|
5980
|
-
})
|
5981
|
-
.accounts({
|
5982
|
-
owner: publicKey,
|
5983
|
-
perpetuals: this.perpetuals.publicKey,
|
5984
|
-
pool: poolConfig.poolAddress,
|
5985
|
-
position: positionAccount,
|
5986
|
-
market: marketAccount,
|
5987
|
-
targetCustody: targetCustodyConfig.custodyAccount,
|
5988
|
-
targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
|
5989
|
-
collateralCustody: collateralCustodyConfig.custodyAccount,
|
5990
|
-
collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
|
5991
|
-
eventAuthority: this.eventAuthority.publicKey,
|
5992
|
-
program: this.programId,
|
5993
|
-
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
5994
|
-
})
|
5995
|
-
.instruction()];
|
5996
|
-
case 2:
|
5997
|
-
setTriggerPrice = _a.sent();
|
5998
|
-
instructions.push(setTriggerPrice);
|
5999
|
-
return [3, 4];
|
6000
|
-
case 3:
|
6001
|
-
err_36 = _a.sent();
|
6002
|
-
console.log("perpClient setTriggerPrice error:: ", err_36);
|
6003
|
-
throw err_36;
|
6004
|
-
case 4: return [2, {
|
6005
|
-
instructions: __spreadArray([], instructions, true),
|
6006
|
-
additionalSigners: additionalSigners
|
6007
|
-
}];
|
6008
|
-
}
|
6009
|
-
});
|
6010
|
-
}); };
|
6011
|
-
this.forceClosePosition = function (positionAccount_2, targetSymbol_1, collateralSymbol_1, side_1, isStopLoss_1, poolConfig_1) {
|
6012
|
-
var args_1 = [];
|
6013
|
-
for (var _i = 6; _i < arguments.length; _i++) {
|
6014
|
-
args_1[_i - 6] = arguments[_i];
|
6015
|
-
}
|
6016
|
-
return __awaiter(_this, __spreadArray([positionAccount_2, targetSymbol_1, collateralSymbol_1, side_1, isStopLoss_1, poolConfig_1], args_1, true), void 0, function (positionAccount, targetSymbol, collateralSymbol, side, isStopLoss, poolConfig, createUserATA, closeUsersWSOLATA, ephemeralSignerPubkey) {
|
6017
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, forceClosePosition, closeWsolATAIns, err_37;
|
6018
|
-
if (createUserATA === void 0) { createUserATA = true; }
|
6019
|
-
if (closeUsersWSOLATA === void 0) { closeUsersWSOLATA = false; }
|
6020
|
-
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6021
|
-
return __generator(this, function (_b) {
|
6022
|
-
switch (_b.label) {
|
6023
|
-
case 0:
|
6024
|
-
payerPubkey = this.provider.wallet.publicKey;
|
6025
|
-
targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(targetSymbol).mintKey); });
|
6026
|
-
collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey); });
|
6027
|
-
marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
|
6028
|
-
preInstructions = [];
|
6029
|
-
instructions = [];
|
6030
|
-
postInstructions = [];
|
6031
|
-
additionalSigners = [];
|
6032
|
-
_b.label = 1;
|
6033
|
-
case 1:
|
6034
|
-
_b.trys.push([1, 5, , 6]);
|
6035
|
-
userReceivingTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey, positionAccount.owner, false, poolConfig.getTokenFromSymbol(collateralSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID);
|
6036
|
-
_a = createUserATA;
|
6037
|
-
if (!_a) return [3, 3];
|
6038
|
-
return [4, (0, utils_1.checkIfAccountExists)(userReceivingTokenAccount, this.provider.connection)];
|
6039
|
-
case 2:
|
6040
|
-
_a = !(_b.sent());
|
6041
|
-
_b.label = 3;
|
6042
|
-
case 3:
|
6043
|
-
if (_a) {
|
6044
|
-
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(payerPubkey, userReceivingTokenAccount, positionAccount.owner, poolConfig.getTokenFromSymbol(collateralSymbol).mintKey, poolConfig.getTokenFromSymbol(collateralSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID));
|
6045
|
-
}
|
6046
|
-
return [4, this.program.methods
|
6047
|
-
.forceClosePosition({
|
6048
|
-
privilege: types_1.Privilege.None,
|
6049
|
-
isStopLoss: isStopLoss
|
6050
|
-
})
|
6051
|
-
.accounts({
|
6052
|
-
owner: positionAccount.owner,
|
6053
|
-
receivingAccount: userReceivingTokenAccount,
|
6054
|
-
transferAuthority: poolConfig.transferAuthority,
|
6055
|
-
perpetuals: this.perpetuals.publicKey,
|
6056
|
-
pool: poolConfig.poolAddress,
|
6057
|
-
position: positionAccount.publicKey,
|
6058
|
-
market: marketAccount,
|
6059
|
-
targetCustody: targetCustodyConfig.custodyAccount,
|
6060
|
-
targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
|
6061
|
-
collateralCustody: collateralCustodyConfig.custodyAccount,
|
6062
|
-
collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
|
6063
|
-
collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
|
6064
|
-
tokenProgram: poolConfig.getTokenFromSymbol(collateralSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID,
|
6065
|
-
eventAuthority: this.eventAuthority.publicKey,
|
6066
|
-
program: this.programId,
|
6067
|
-
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
6068
|
-
receivingMint: collateralCustodyConfig.mintKey
|
6069
|
-
})
|
6070
|
-
.instruction()];
|
6071
|
-
case 4:
|
6072
|
-
forceClosePosition = _b.sent();
|
6073
|
-
instructions.push(forceClosePosition);
|
6074
|
-
if (collateralSymbol == 'WSOL' && closeUsersWSOLATA) {
|
6075
|
-
closeWsolATAIns = (0, spl_token_1.createCloseAccountInstruction)(userReceivingTokenAccount, positionAccount.owner, positionAccount.owner);
|
6076
|
-
postInstructions.push(closeWsolATAIns);
|
6077
|
-
}
|
6078
|
-
return [3, 6];
|
6079
|
-
case 5:
|
6080
|
-
err_37 = _b.sent();
|
6081
|
-
console.log("perpClient forceClosePosition error:: ", err_37);
|
6082
|
-
throw err_37;
|
6083
|
-
case 6: return [2, {
|
6084
|
-
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6085
|
-
additionalSigners: additionalSigners
|
6086
|
-
}];
|
6087
|
-
}
|
6088
|
-
});
|
6089
|
-
});
|
6090
|
-
};
|
6091
5965
|
this.placeLimitOrder = function (targetSymbol_1, collateralSymbol_1, reserveSymbol_1, receiveSymbol_1, side_1, limitPrice_1, reserveAmount_1, sizeAmount_1, stopLossPrice_1, takeProfitPrice_1, poolConfig_1) {
|
6092
5966
|
var args_1 = [];
|
6093
5967
|
for (var _i = 11; _i < arguments.length; _i++) {
|
6094
5968
|
args_1[_i - 11] = arguments[_i];
|
6095
5969
|
}
|
6096
5970
|
return __awaiter(_this, __spreadArray([targetSymbol_1, collateralSymbol_1, reserveSymbol_1, receiveSymbol_1, side_1, limitPrice_1, reserveAmount_1, sizeAmount_1, stopLossPrice_1, takeProfitPrice_1, poolConfig_1], args_1, true), void 0, function (targetSymbol, collateralSymbol, reserveSymbol, receiveSymbol, side, limitPrice, reserveAmount, sizeAmount, stopLossPrice, takeProfitPrice, poolConfig, skipBalanceChecks, ephemeralSignerPubkey) {
|
6097
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder,
|
5971
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder, err_36;
|
6098
5972
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
6099
5973
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6100
5974
|
return __generator(this, function (_c) {
|
@@ -6200,9 +6074,9 @@ var PerpetualsClient = (function () {
|
|
6200
6074
|
instructions.push(placeLimitOrder);
|
6201
6075
|
return [3, 10];
|
6202
6076
|
case 9:
|
6203
|
-
|
6204
|
-
console.log("perpClient placeLimitOrder error:: ",
|
6205
|
-
throw
|
6077
|
+
err_36 = _c.sent();
|
6078
|
+
console.log("perpClient placeLimitOrder error:: ", err_36);
|
6079
|
+
throw err_36;
|
6206
6080
|
case 10: return [2, {
|
6207
6081
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6208
6082
|
additionalSigners: additionalSigners
|
@@ -6217,7 +6091,7 @@ var PerpetualsClient = (function () {
|
|
6217
6091
|
args_1[_i - 11] = arguments[_i];
|
6218
6092
|
}
|
6219
6093
|
return __awaiter(_this, __spreadArray([targetSymbol_1, collateralSymbol_1, reserveSymbol_1, receiveSymbol_1, side_1, orderId_1, limitPrice_1, sizeAmount_1, stopLossPrice_1, takeProfitPrice_1, poolConfig_1], args_1, true), void 0, function (targetSymbol, collateralSymbol, reserveSymbol, receiveSymbol, side, orderId, limitPrice, sizeAmount, stopLossPrice, takeProfitPrice, poolConfig, createUserATA, ephemeralSignerPubkey) {
|
6220
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder,
|
6094
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder, err_37;
|
6221
6095
|
if (createUserATA === void 0) { createUserATA = true; }
|
6222
6096
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6223
6097
|
return __generator(this, function (_b) {
|
@@ -6308,9 +6182,9 @@ var PerpetualsClient = (function () {
|
|
6308
6182
|
instructions.push(editLimitOrder);
|
6309
6183
|
return [3, 8];
|
6310
6184
|
case 7:
|
6311
|
-
|
6312
|
-
console.log("perpClient editLimitOrder error:: ",
|
6313
|
-
throw
|
6185
|
+
err_37 = _b.sent();
|
6186
|
+
console.log("perpClient editLimitOrder error:: ", err_37);
|
6187
|
+
throw err_37;
|
6314
6188
|
case 8: return [2, {
|
6315
6189
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6316
6190
|
additionalSigners: additionalSigners
|
@@ -6325,7 +6199,7 @@ var PerpetualsClient = (function () {
|
|
6325
6199
|
args_1[_i - 7] = arguments[_i];
|
6326
6200
|
}
|
6327
6201
|
return __awaiter(_this, __spreadArray([userPubkey_1, targetSymbol_1, collateralSymbol_1, side_1, orderId_1, poolConfig_1, privilege_1], args_1, true), void 0, function (userPubkey, targetSymbol, collateralSymbol, side, orderId, poolConfig, privilege, tokenStakeAccount, userReferralAccount, rebateTokenAccount) {
|
6328
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder,
|
6202
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder, err_38;
|
6329
6203
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
6330
6204
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
6331
6205
|
if (rebateTokenAccount === void 0) { rebateTokenAccount = web3_js_1.PublicKey.default; }
|
@@ -6378,9 +6252,9 @@ var PerpetualsClient = (function () {
|
|
6378
6252
|
instructions.push(executeLimitOrder);
|
6379
6253
|
return [3, 4];
|
6380
6254
|
case 3:
|
6381
|
-
|
6382
|
-
console.log("perpClient executeLimitOrder error:: ",
|
6383
|
-
throw
|
6255
|
+
err_38 = _a.sent();
|
6256
|
+
console.log("perpClient executeLimitOrder error:: ", err_38);
|
6257
|
+
throw err_38;
|
6384
6258
|
case 4: return [2, {
|
6385
6259
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6386
6260
|
additionalSigners: additionalSigners
|
@@ -6395,7 +6269,7 @@ var PerpetualsClient = (function () {
|
|
6395
6269
|
args_1[_i - 8] = arguments[_i];
|
6396
6270
|
}
|
6397
6271
|
return __awaiter(_this, __spreadArray([userPubkey_1, targetSymbol_1, collateralSymbol_1, reserveSymbol_1, side_1, orderId_1, poolConfig_1, privilege_1], args_1, true), void 0, function (userPubkey, targetSymbol, collateralSymbol, reserveSymbol, side, orderId, poolConfig, privilege, tokenStakeAccount, userReferralAccount, rebateTokenAccount) {
|
6398
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap,
|
6272
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap, err_39;
|
6399
6273
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
6400
6274
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
6401
6275
|
if (rebateTokenAccount === void 0) { rebateTokenAccount = web3_js_1.PublicKey.default; }
|
@@ -6451,9 +6325,9 @@ var PerpetualsClient = (function () {
|
|
6451
6325
|
instructions.push(executeLimitWithSwap);
|
6452
6326
|
return [3, 4];
|
6453
6327
|
case 3:
|
6454
|
-
|
6455
|
-
console.log("perpClient executeLimitWithSwap error:: ",
|
6456
|
-
throw
|
6328
|
+
err_39 = _a.sent();
|
6329
|
+
console.log("perpClient executeLimitWithSwap error:: ", err_39);
|
6330
|
+
throw err_39;
|
6457
6331
|
case 4: return [2, {
|
6458
6332
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6459
6333
|
additionalSigners: additionalSigners
|
@@ -6463,7 +6337,7 @@ var PerpetualsClient = (function () {
|
|
6463
6337
|
});
|
6464
6338
|
};
|
6465
6339
|
this.placeTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6466
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder,
|
6340
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder, err_40;
|
6467
6341
|
return __generator(this, function (_a) {
|
6468
6342
|
switch (_a.label) {
|
6469
6343
|
case 0:
|
@@ -6511,9 +6385,9 @@ var PerpetualsClient = (function () {
|
|
6511
6385
|
instructions.push(placeTriggerOrder);
|
6512
6386
|
return [3, 4];
|
6513
6387
|
case 3:
|
6514
|
-
|
6515
|
-
console.log("perpClient placeTriggerOrder error:: ",
|
6516
|
-
throw
|
6388
|
+
err_40 = _a.sent();
|
6389
|
+
console.log("perpClient placeTriggerOrder error:: ", err_40);
|
6390
|
+
throw err_40;
|
6517
6391
|
case 4: return [2, {
|
6518
6392
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6519
6393
|
additionalSigners: additionalSigners
|
@@ -6522,7 +6396,7 @@ var PerpetualsClient = (function () {
|
|
6522
6396
|
});
|
6523
6397
|
}); };
|
6524
6398
|
this.editTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, orderId, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6525
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder,
|
6399
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder, err_41;
|
6526
6400
|
return __generator(this, function (_a) {
|
6527
6401
|
switch (_a.label) {
|
6528
6402
|
case 0:
|
@@ -6569,9 +6443,9 @@ var PerpetualsClient = (function () {
|
|
6569
6443
|
instructions.push(editTriggerOrder);
|
6570
6444
|
return [3, 4];
|
6571
6445
|
case 3:
|
6572
|
-
|
6573
|
-
console.log("perpClient editTriggerOrder error:: ",
|
6574
|
-
throw
|
6446
|
+
err_41 = _a.sent();
|
6447
|
+
console.log("perpClient editTriggerOrder error:: ", err_41);
|
6448
|
+
throw err_41;
|
6575
6449
|
case 4: return [2, {
|
6576
6450
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6577
6451
|
additionalSigners: additionalSigners
|
@@ -6580,7 +6454,7 @@ var PerpetualsClient = (function () {
|
|
6580
6454
|
});
|
6581
6455
|
}); };
|
6582
6456
|
this.cancelTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6583
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder,
|
6457
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder, err_42;
|
6584
6458
|
return __generator(this, function (_a) {
|
6585
6459
|
switch (_a.label) {
|
6586
6460
|
case 0:
|
@@ -6613,9 +6487,9 @@ var PerpetualsClient = (function () {
|
|
6613
6487
|
instructions.push(cancelTriggerOrder);
|
6614
6488
|
return [3, 4];
|
6615
6489
|
case 3:
|
6616
|
-
|
6617
|
-
console.log("perpClient cancelTriggerOrder error:: ",
|
6618
|
-
throw
|
6490
|
+
err_42 = _a.sent();
|
6491
|
+
console.log("perpClient cancelTriggerOrder error:: ", err_42);
|
6492
|
+
throw err_42;
|
6619
6493
|
case 4: return [2, {
|
6620
6494
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6621
6495
|
additionalSigners: additionalSigners
|
@@ -6624,7 +6498,7 @@ var PerpetualsClient = (function () {
|
|
6624
6498
|
});
|
6625
6499
|
}); };
|
6626
6500
|
this.cancelAllTriggerOrders = function (targetSymbol, collateralSymbol, side, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6627
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders,
|
6501
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders, err_43;
|
6628
6502
|
return __generator(this, function (_a) {
|
6629
6503
|
switch (_a.label) {
|
6630
6504
|
case 0:
|
@@ -6655,9 +6529,9 @@ var PerpetualsClient = (function () {
|
|
6655
6529
|
instructions.push(cancelAllTriggerOrders);
|
6656
6530
|
return [3, 4];
|
6657
6531
|
case 3:
|
6658
|
-
|
6659
|
-
console.log("perpClient cancelAllTriggerOrders error:: ",
|
6660
|
-
throw
|
6532
|
+
err_43 = _a.sent();
|
6533
|
+
console.log("perpClient cancelAllTriggerOrders error:: ", err_43);
|
6534
|
+
throw err_43;
|
6661
6535
|
case 4: return [2, {
|
6662
6536
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6663
6537
|
additionalSigners: additionalSigners
|
@@ -6671,7 +6545,7 @@ var PerpetualsClient = (function () {
|
|
6671
6545
|
args_1[_i - 9] = arguments[_i];
|
6672
6546
|
}
|
6673
6547
|
return __awaiter(_this, __spreadArray([owner_1, targetSymbol_1, collateralSymbol_1, receivingSymbol_1, side_1, orderId_1, isStopLoss_1, privilege_1, poolConfig_1], args_1, true), void 0, function (owner, targetSymbol, collateralSymbol, receivingSymbol, side, orderId, isStopLoss, privilege, poolConfig, createUserATA, ephemeralSignerPubkey, tokenStakeAccount, userReferralAccount, rebateTokenAccount) {
|
6674
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, userReceivingTokenAccount, userReceivingTokenAccountCollateral, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, collateralToken, receivingToken, _a, _b, positionAccount, orderAccount, custodyAccountMetas, custodyOracleAccountMetas, _c, _d, custody, executeTriggerWithSwap,
|
6548
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, userReceivingTokenAccount, userReceivingTokenAccountCollateral, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, collateralToken, receivingToken, _a, _b, positionAccount, orderAccount, custodyAccountMetas, custodyOracleAccountMetas, _c, _d, custody, executeTriggerWithSwap, err_44;
|
6675
6549
|
if (createUserATA === void 0) { createUserATA = true; }
|
6676
6550
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6677
6551
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
@@ -6778,9 +6652,9 @@ var PerpetualsClient = (function () {
|
|
6778
6652
|
instructions.push(executeTriggerWithSwap);
|
6779
6653
|
return [3, 10];
|
6780
6654
|
case 9:
|
6781
|
-
|
6782
|
-
console.log("perpClient executeTriggerWithSwap error:: ",
|
6783
|
-
throw
|
6655
|
+
err_44 = _e.sent();
|
6656
|
+
console.log("perpClient executeTriggerWithSwap error:: ", err_44);
|
6657
|
+
throw err_44;
|
6784
6658
|
case 10: return [2, {
|
6785
6659
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6786
6660
|
additionalSigners: additionalSigners
|
@@ -6795,7 +6669,7 @@ var PerpetualsClient = (function () {
|
|
6795
6669
|
args_1[_i - 8] = arguments[_i];
|
6796
6670
|
}
|
6797
6671
|
return __awaiter(_this, __spreadArray([owner_1, targetSymbol_1, collateralSymbol_1, side_1, orderId_1, isStopLoss_1, privilege_1, poolConfig_1], args_1, true), void 0, function (owner, targetSymbol, collateralSymbol, side, orderId, isStopLoss, privilege, poolConfig, createUserATA, ephemeralSignerPubkey, tokenStakeAccount, userReferralAccount, rebateTokenAccount) {
|
6798
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder,
|
6672
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder, err_45;
|
6799
6673
|
if (createUserATA === void 0) { createUserATA = true; }
|
6800
6674
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6801
6675
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
@@ -6867,9 +6741,9 @@ var PerpetualsClient = (function () {
|
|
6867
6741
|
instructions.push(executeTriggerOrder);
|
6868
6742
|
return [3, 8];
|
6869
6743
|
case 7:
|
6870
|
-
|
6871
|
-
console.log("perpClient executeTriggerOrder error:: ",
|
6872
|
-
throw
|
6744
|
+
err_45 = _b.sent();
|
6745
|
+
console.log("perpClient executeTriggerOrder error:: ", err_45);
|
6746
|
+
throw err_45;
|
6873
6747
|
case 8: return [2, {
|
6874
6748
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6875
6749
|
additionalSigners: additionalSigners
|
@@ -6878,54 +6752,13 @@ var PerpetualsClient = (function () {
|
|
6878
6752
|
});
|
6879
6753
|
});
|
6880
6754
|
};
|
6881
|
-
this.migrateTriggerOrder = function (owner, marketAccount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6882
|
-
var payerPubkey, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, migrateTriggerOrder, err_48;
|
6883
|
-
return __generator(this, function (_a) {
|
6884
|
-
switch (_a.label) {
|
6885
|
-
case 0:
|
6886
|
-
payerPubkey = this.provider.wallet.publicKey;
|
6887
|
-
preInstructions = [];
|
6888
|
-
instructions = [];
|
6889
|
-
postInstructions = [];
|
6890
|
-
additionalSigners = [];
|
6891
|
-
_a.label = 1;
|
6892
|
-
case 1:
|
6893
|
-
_a.trys.push([1, 3, , 4]);
|
6894
|
-
positionAccount = poolConfig.getPositionFromMarketPk(owner, marketAccount);
|
6895
|
-
orderAccount = poolConfig.getOrderFromMarketPk(owner, marketAccount);
|
6896
|
-
return [4, this.program.methods
|
6897
|
-
.migrateTriggerOrder()
|
6898
|
-
.accounts({
|
6899
|
-
owner: owner,
|
6900
|
-
feePayer: payerPubkey,
|
6901
|
-
position: positionAccount,
|
6902
|
-
order: orderAccount,
|
6903
|
-
market: marketAccount,
|
6904
|
-
systemProgram: web3_js_1.SystemProgram.programId,
|
6905
|
-
})
|
6906
|
-
.instruction()];
|
6907
|
-
case 2:
|
6908
|
-
migrateTriggerOrder = _a.sent();
|
6909
|
-
instructions.push(migrateTriggerOrder);
|
6910
|
-
return [3, 4];
|
6911
|
-
case 3:
|
6912
|
-
err_48 = _a.sent();
|
6913
|
-
console.log("perpClient migrateTriggerOrder error:: ", err_48);
|
6914
|
-
throw err_48;
|
6915
|
-
case 4: return [2, {
|
6916
|
-
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6917
|
-
additionalSigners: additionalSigners
|
6918
|
-
}];
|
6919
|
-
}
|
6920
|
-
});
|
6921
|
-
}); };
|
6922
6755
|
this.swap = function (userInputTokenSymbol_1, userOutputTokenSymbol_1, amountIn_1, minAmountOut_1, poolConfig_1) {
|
6923
6756
|
var args_1 = [];
|
6924
6757
|
for (var _i = 5; _i < arguments.length; _i++) {
|
6925
6758
|
args_1[_i - 5] = arguments[_i];
|
6926
6759
|
}
|
6927
6760
|
return __awaiter(_this, __spreadArray([userInputTokenSymbol_1, userOutputTokenSymbol_1, amountIn_1, minAmountOut_1, poolConfig_1], args_1, true), void 0, function (userInputTokenSymbol, userOutputTokenSymbol, amountIn, minAmountOut, poolConfig, useFeesPool, createUserATA, unWrapSol, skipBalanceChecks, ephemeralSignerPubkey) {
|
6928
|
-
var userInputCustodyConfig, userOutputCustodyConfig, publicKey, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userOutputTokenAccount, userInputTokenAccount, wsolAssociatedTokenAccount, wsolATAExist, unWrappedSolBalance, _a, wsolAssociatedTokenAccount, closeWsolATAIns, accCreationLamports, lamports, unWrappedSolBalance, _b, tokenAccountBalance, _c, lamports, _d, custodyAccountMetas, custodyOracleAccountMetas, _e, _f, custody, params, inx, closeWsolATAIns,
|
6761
|
+
var userInputCustodyConfig, userOutputCustodyConfig, publicKey, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userOutputTokenAccount, userInputTokenAccount, wsolAssociatedTokenAccount, wsolATAExist, unWrappedSolBalance, _a, wsolAssociatedTokenAccount, closeWsolATAIns, accCreationLamports, lamports, unWrappedSolBalance, _b, tokenAccountBalance, _c, lamports, _d, custodyAccountMetas, custodyOracleAccountMetas, _e, _f, custody, params, inx, closeWsolATAIns, err_46;
|
6929
6762
|
if (useFeesPool === void 0) { useFeesPool = false; }
|
6930
6763
|
if (createUserATA === void 0) { createUserATA = true; }
|
6931
6764
|
if (unWrapSol === void 0) { unWrapSol = false; }
|
@@ -7130,9 +6963,9 @@ var PerpetualsClient = (function () {
|
|
7130
6963
|
}
|
7131
6964
|
return [3, 20];
|
7132
6965
|
case 19:
|
7133
|
-
|
7134
|
-
console.error("perpClient Swap error:: ",
|
7135
|
-
throw
|
6966
|
+
err_46 = _g.sent();
|
6967
|
+
console.error("perpClient Swap error:: ", err_46);
|
6968
|
+
throw err_46;
|
7136
6969
|
case 20: return [2, {
|
7137
6970
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
7138
6971
|
additionalSigners: additionalSigners
|
@@ -7142,7 +6975,7 @@ var PerpetualsClient = (function () {
|
|
7142
6975
|
});
|
7143
6976
|
};
|
7144
6977
|
this.swapFeeInternal = function (rewardTokenSymbol, swapTokenSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7145
|
-
var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx,
|
6978
|
+
var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx, err_47;
|
7146
6979
|
return __generator(this, function (_b) {
|
7147
6980
|
switch (_b.label) {
|
7148
6981
|
case 0:
|
@@ -7202,9 +7035,9 @@ var PerpetualsClient = (function () {
|
|
7202
7035
|
instructions.push(inx);
|
7203
7036
|
return [3, 4];
|
7204
7037
|
case 3:
|
7205
|
-
|
7206
|
-
console.error("perpClient Swap error:: ",
|
7207
|
-
throw
|
7038
|
+
err_47 = _b.sent();
|
7039
|
+
console.error("perpClient Swap error:: ", err_47);
|
7040
|
+
throw err_47;
|
7208
7041
|
case 4: return [2, {
|
7209
7042
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
7210
7043
|
additionalSigners: additionalSigners
|
@@ -7213,7 +7046,7 @@ var PerpetualsClient = (function () {
|
|
7213
7046
|
});
|
7214
7047
|
}); };
|
7215
7048
|
this.setLpTokenPrice = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7216
|
-
var instructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, setLpTokenPriceInstruction,
|
7049
|
+
var instructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, setLpTokenPriceInstruction, err_48;
|
7217
7050
|
return __generator(this, function (_d) {
|
7218
7051
|
switch (_d.label) {
|
7219
7052
|
case 0:
|
@@ -7261,9 +7094,9 @@ var PerpetualsClient = (function () {
|
|
7261
7094
|
instructions.push(setLpTokenPriceInstruction);
|
7262
7095
|
return [3, 4];
|
7263
7096
|
case 3:
|
7264
|
-
|
7265
|
-
console.log("perpClient setLpTokenPriceInstruction error:: ",
|
7266
|
-
throw
|
7097
|
+
err_48 = _d.sent();
|
7098
|
+
console.log("perpClient setLpTokenPriceInstruction error:: ", err_48);
|
7099
|
+
throw err_48;
|
7267
7100
|
case 4: return [2, {
|
7268
7101
|
instructions: __spreadArray([], instructions, true),
|
7269
7102
|
additionalSigners: additionalSigners
|
@@ -7311,7 +7144,7 @@ var PerpetualsClient = (function () {
|
|
7311
7144
|
});
|
7312
7145
|
}); };
|
7313
7146
|
this.setAdminSigners = function (admins, minSignatures) { return __awaiter(_this, void 0, void 0, function () {
|
7314
|
-
var adminMetas, _i, admins_2, admin,
|
7147
|
+
var adminMetas, _i, admins_2, admin, err_49;
|
7315
7148
|
return __generator(this, function (_a) {
|
7316
7149
|
switch (_a.label) {
|
7317
7150
|
case 0:
|
@@ -7341,11 +7174,11 @@ var PerpetualsClient = (function () {
|
|
7341
7174
|
_a.sent();
|
7342
7175
|
return [3, 4];
|
7343
7176
|
case 3:
|
7344
|
-
|
7177
|
+
err_49 = _a.sent();
|
7345
7178
|
if (this.printErrors) {
|
7346
|
-
console.error("setAdminSigners err:",
|
7179
|
+
console.error("setAdminSigners err:", err_49);
|
7347
7180
|
}
|
7348
|
-
throw
|
7181
|
+
throw err_49;
|
7349
7182
|
case 4: return [2];
|
7350
7183
|
}
|
7351
7184
|
});
|
@@ -7534,7 +7367,7 @@ var PerpetualsClient = (function () {
|
|
7534
7367
|
});
|
7535
7368
|
}); };
|
7536
7369
|
this.protocolWithdrawFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7537
|
-
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx,
|
7370
|
+
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_50;
|
7538
7371
|
return __generator(this, function (_a) {
|
7539
7372
|
switch (_a.label) {
|
7540
7373
|
case 0:
|
@@ -7567,9 +7400,9 @@ var PerpetualsClient = (function () {
|
|
7567
7400
|
instructions.push(withdrawFeesIx);
|
7568
7401
|
return [3, 5];
|
7569
7402
|
case 4:
|
7570
|
-
|
7571
|
-
console.log("perpClient setPool error:: ",
|
7572
|
-
throw
|
7403
|
+
err_50 = _a.sent();
|
7404
|
+
console.log("perpClient setPool error:: ", err_50);
|
7405
|
+
throw err_50;
|
7573
7406
|
case 5: return [2, {
|
7574
7407
|
instructions: __spreadArray([], instructions, true),
|
7575
7408
|
additionalSigners: additionalSigners
|
@@ -7578,7 +7411,7 @@ var PerpetualsClient = (function () {
|
|
7578
7411
|
});
|
7579
7412
|
}); };
|
7580
7413
|
this.moveProtocolFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7581
|
-
var publicKey, custodyConfig, instructions, additionalSigners, moveProtocolFeesIx,
|
7414
|
+
var publicKey, custodyConfig, instructions, additionalSigners, moveProtocolFeesIx, err_51;
|
7582
7415
|
return __generator(this, function (_a) {
|
7583
7416
|
switch (_a.label) {
|
7584
7417
|
case 0:
|
@@ -7612,9 +7445,9 @@ var PerpetualsClient = (function () {
|
|
7612
7445
|
instructions.push(moveProtocolFeesIx);
|
7613
7446
|
return [3, 4];
|
7614
7447
|
case 3:
|
7615
|
-
|
7616
|
-
console.log("perpClient setPool error:: ",
|
7617
|
-
throw
|
7448
|
+
err_51 = _a.sent();
|
7449
|
+
console.log("perpClient setPool error:: ", err_51);
|
7450
|
+
throw err_51;
|
7618
7451
|
case 4: return [2, {
|
7619
7452
|
instructions: __spreadArray([], instructions, true),
|
7620
7453
|
additionalSigners: additionalSigners
|
@@ -7623,7 +7456,7 @@ var PerpetualsClient = (function () {
|
|
7623
7456
|
});
|
7624
7457
|
}); };
|
7625
7458
|
this.setProtocolFeeShareBps = function (feeShareBps, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7626
|
-
var publicKey, setProtocolFeeShareBpsIx,
|
7459
|
+
var publicKey, setProtocolFeeShareBpsIx, err_52;
|
7627
7460
|
return __generator(this, function (_a) {
|
7628
7461
|
switch (_a.label) {
|
7629
7462
|
case 0:
|
@@ -7643,15 +7476,15 @@ var PerpetualsClient = (function () {
|
|
7643
7476
|
setProtocolFeeShareBpsIx = _a.sent();
|
7644
7477
|
return [2, setProtocolFeeShareBpsIx];
|
7645
7478
|
case 2:
|
7646
|
-
|
7647
|
-
console.log("perpClient setProtocolFeeShareBpsIx error:: ",
|
7648
|
-
throw
|
7479
|
+
err_52 = _a.sent();
|
7480
|
+
console.log("perpClient setProtocolFeeShareBpsIx error:: ", err_52);
|
7481
|
+
throw err_52;
|
7649
7482
|
case 3: return [2];
|
7650
7483
|
}
|
7651
7484
|
});
|
7652
7485
|
}); };
|
7653
7486
|
this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
|
7654
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction,
|
7487
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_53;
|
7655
7488
|
return __generator(this, function (_a) {
|
7656
7489
|
switch (_a.label) {
|
7657
7490
|
case 0:
|
@@ -7678,9 +7511,9 @@ var PerpetualsClient = (function () {
|
|
7678
7511
|
instructions.push(setPermissionsInstruction);
|
7679
7512
|
return [3, 4];
|
7680
7513
|
case 3:
|
7681
|
-
|
7682
|
-
console.log("perpClient setPool error:: ",
|
7683
|
-
throw
|
7514
|
+
err_53 = _a.sent();
|
7515
|
+
console.log("perpClient setPool error:: ", err_53);
|
7516
|
+
throw err_53;
|
7684
7517
|
case 4: return [2, {
|
7685
7518
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
7686
7519
|
additionalSigners: additionalSigners
|
@@ -7689,7 +7522,7 @@ var PerpetualsClient = (function () {
|
|
7689
7522
|
});
|
7690
7523
|
}); };
|
7691
7524
|
this.reimburse = function (tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7692
|
-
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e,
|
7525
|
+
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_54;
|
7693
7526
|
var _f;
|
7694
7527
|
return __generator(this, function (_g) {
|
7695
7528
|
switch (_g.label) {
|
@@ -7750,9 +7583,9 @@ var PerpetualsClient = (function () {
|
|
7750
7583
|
instructions.push(reimburse);
|
7751
7584
|
return [3, 5];
|
7752
7585
|
case 4:
|
7753
|
-
|
7754
|
-
console.log("perpClient setPool error:: ",
|
7755
|
-
throw
|
7586
|
+
err_54 = _g.sent();
|
7587
|
+
console.log("perpClient setPool error:: ", err_54);
|
7588
|
+
throw err_54;
|
7756
7589
|
case 5: return [2, {
|
7757
7590
|
instructions: __spreadArray([], instructions, true),
|
7758
7591
|
additionalSigners: additionalSigners
|
@@ -7761,7 +7594,7 @@ var PerpetualsClient = (function () {
|
|
7761
7594
|
});
|
7762
7595
|
}); };
|
7763
7596
|
this.setInternalOraclePrice = function (tokenMint, price, expo, conf, ema, publishTime, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7764
|
-
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice,
|
7597
|
+
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_55;
|
7765
7598
|
return __generator(this, function (_a) {
|
7766
7599
|
switch (_a.label) {
|
7767
7600
|
case 0:
|
@@ -7794,9 +7627,9 @@ var PerpetualsClient = (function () {
|
|
7794
7627
|
instructions.push(setInternalOraclePrice);
|
7795
7628
|
return [3, 4];
|
7796
7629
|
case 3:
|
7797
|
-
|
7798
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
7799
|
-
throw
|
7630
|
+
err_55 = _a.sent();
|
7631
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_55);
|
7632
|
+
throw err_55;
|
7800
7633
|
case 4: return [2, {
|
7801
7634
|
instructions: __spreadArray([], instructions, true),
|
7802
7635
|
additionalSigners: additionalSigners
|
@@ -7805,7 +7638,7 @@ var PerpetualsClient = (function () {
|
|
7805
7638
|
});
|
7806
7639
|
}); };
|
7807
7640
|
this.setInternalOraclePriceBatch = function (tokenMintList, tokenInternalPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
7808
|
-
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice,
|
7641
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_56;
|
7809
7642
|
return __generator(this, function (_a) {
|
7810
7643
|
switch (_a.label) {
|
7811
7644
|
case 0:
|
@@ -7855,9 +7688,9 @@ var PerpetualsClient = (function () {
|
|
7855
7688
|
instructions.push(setInternalOraclePrice);
|
7856
7689
|
return [3, 4];
|
7857
7690
|
case 3:
|
7858
|
-
|
7859
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
7860
|
-
throw
|
7691
|
+
err_56 = _a.sent();
|
7692
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_56);
|
7693
|
+
throw err_56;
|
7861
7694
|
case 4: return [2, {
|
7862
7695
|
instructions: __spreadArray([], instructions, true),
|
7863
7696
|
additionalSigners: additionalSigners
|
@@ -7866,7 +7699,7 @@ var PerpetualsClient = (function () {
|
|
7866
7699
|
});
|
7867
7700
|
}); };
|
7868
7701
|
this.setInternalOracleEmaPriceBatch = function (tokenMintList, tokenInternalEmaPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
7869
|
-
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalOraclePrice,
|
7702
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_57;
|
7870
7703
|
return __generator(this, function (_a) {
|
7871
7704
|
switch (_a.label) {
|
7872
7705
|
case 0:
|
@@ -7916,9 +7749,9 @@ var PerpetualsClient = (function () {
|
|
7916
7749
|
instructions.push(setInternalOraclePrice);
|
7917
7750
|
return [3, 4];
|
7918
7751
|
case 3:
|
7919
|
-
|
7920
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
7921
|
-
throw
|
7752
|
+
err_57 = _a.sent();
|
7753
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_57);
|
7754
|
+
throw err_57;
|
7922
7755
|
case 4: return [2, {
|
7923
7756
|
instructions: __spreadArray([], instructions, true),
|
7924
7757
|
additionalSigners: additionalSigners
|
@@ -7927,7 +7760,7 @@ var PerpetualsClient = (function () {
|
|
7927
7760
|
});
|
7928
7761
|
}); };
|
7929
7762
|
this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7930
|
-
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp,
|
7763
|
+
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_58;
|
7931
7764
|
return __generator(this, function (_a) {
|
7932
7765
|
switch (_a.label) {
|
7933
7766
|
case 0:
|
@@ -7965,8 +7798,8 @@ var PerpetualsClient = (function () {
|
|
7965
7798
|
instructions.push(renameFlp);
|
7966
7799
|
return [3, 4];
|
7967
7800
|
case 3:
|
7968
|
-
|
7969
|
-
console.log("perpClient renameFlp error:: ",
|
7801
|
+
err_58 = _a.sent();
|
7802
|
+
console.log("perpClient renameFlp error:: ", err_58);
|
7970
7803
|
return [3, 4];
|
7971
7804
|
case 4: return [2, {
|
7972
7805
|
instructions: __spreadArray([], instructions, true),
|
@@ -7976,7 +7809,7 @@ var PerpetualsClient = (function () {
|
|
7976
7809
|
});
|
7977
7810
|
}); };
|
7978
7811
|
this.initStake = function (stakingFeeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7979
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction,
|
7812
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_59;
|
7980
7813
|
return __generator(this, function (_a) {
|
7981
7814
|
switch (_a.label) {
|
7982
7815
|
case 0:
|
@@ -8014,9 +7847,9 @@ var PerpetualsClient = (function () {
|
|
8014
7847
|
instructions.push(initStakeInstruction);
|
8015
7848
|
return [3, 4];
|
8016
7849
|
case 3:
|
8017
|
-
|
8018
|
-
console.log("perpClient InitStaking error:: ",
|
8019
|
-
throw
|
7850
|
+
err_59 = _a.sent();
|
7851
|
+
console.log("perpClient InitStaking error:: ", err_59);
|
7852
|
+
throw err_59;
|
8020
7853
|
case 4: return [2, {
|
8021
7854
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
8022
7855
|
additionalSigners: additionalSigners
|
@@ -8025,7 +7858,7 @@ var PerpetualsClient = (function () {
|
|
8025
7858
|
});
|
8026
7859
|
}); };
|
8027
7860
|
this.initCompounding = function (feeShareBps, metadataTitle, metadataSymbol, metadataUri, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
8028
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction,
|
7861
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_60;
|
8029
7862
|
return __generator(this, function (_a) {
|
8030
7863
|
switch (_a.label) {
|
8031
7864
|
case 0:
|
@@ -8070,9 +7903,9 @@ var PerpetualsClient = (function () {
|
|
8070
7903
|
instructions.push(initCompoundingInstruction);
|
8071
7904
|
return [3, 4];
|
8072
7905
|
case 3:
|
8073
|
-
|
8074
|
-
console.log("perpClient initCompounding error:: ",
|
8075
|
-
throw
|
7906
|
+
err_60 = _a.sent();
|
7907
|
+
console.log("perpClient initCompounding error:: ", err_60);
|
7908
|
+
throw err_60;
|
8076
7909
|
case 4: return [2, {
|
8077
7910
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
8078
7911
|
additionalSigners: additionalSigners
|
@@ -8081,7 +7914,7 @@ var PerpetualsClient = (function () {
|
|
8081
7914
|
});
|
8082
7915
|
}); };
|
8083
7916
|
this.initTokenVault = function (token_permissions, tokens_to_distribute, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
8084
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction,
|
7917
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_61;
|
8085
7918
|
return __generator(this, function (_a) {
|
8086
7919
|
switch (_a.label) {
|
8087
7920
|
case 0:
|
@@ -8122,9 +7955,9 @@ var PerpetualsClient = (function () {
|
|
8122
7955
|
instructions.push(initTokenVaultInstruction);
|
8123
7956
|
return [3, 4];
|
8124
7957
|
case 3:
|
8125
|
-
|
8126
|
-
console.log("perpClient InitTokenVaultInstruction error:: ",
|
8127
|
-
throw
|
7958
|
+
err_61 = _a.sent();
|
7959
|
+
console.log("perpClient InitTokenVaultInstruction error:: ", err_61);
|
7960
|
+
throw err_61;
|
8128
7961
|
case 4: return [2, {
|
8129
7962
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
8130
7963
|
additionalSigners: additionalSigners
|
@@ -8133,7 +7966,7 @@ var PerpetualsClient = (function () {
|
|
8133
7966
|
});
|
8134
7967
|
}); };
|
8135
7968
|
this.setTokenVaultConfig = function (token_permissions, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
8136
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction,
|
7969
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_62;
|
8137
7970
|
return __generator(this, function (_a) {
|
8138
7971
|
switch (_a.label) {
|
8139
7972
|
case 0:
|
@@ -8164,9 +7997,9 @@ var PerpetualsClient = (function () {
|
|
8164
7997
|
instructions.push(setTokenVaultConfigInstruction);
|
8165
7998
|
return [3, 4];
|
8166
7999
|
case 3:
|
8167
|
-
|
8168
|
-
console.log("perpClient setTokenVaultConfigInstruction error:: ",
|
8169
|
-
throw
|
8000
|
+
err_62 = _a.sent();
|
8001
|
+
console.log("perpClient setTokenVaultConfigInstruction error:: ", err_62);
|
8002
|
+
throw err_62;
|
8170
8003
|
case 4: return [2, {
|
8171
8004
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
8172
8005
|
additionalSigners: additionalSigners
|
@@ -8175,7 +8008,7 @@ var PerpetualsClient = (function () {
|
|
8175
8008
|
});
|
8176
8009
|
}); };
|
8177
8010
|
this.withdrawInstantFee = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
8178
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction,
|
8011
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_63;
|
8179
8012
|
return __generator(this, function (_a) {
|
8180
8013
|
switch (_a.label) {
|
8181
8014
|
case 0:
|
@@ -8214,9 +8047,9 @@ var PerpetualsClient = (function () {
|
|
8214
8047
|
instructions.push(withdrawInstantFeeInstruction);
|
8215
8048
|
return [3, 6];
|
8216
8049
|
case 5:
|
8217
|
-
|
8218
|
-
console.log("perpClient withdrawInstantFeeInstruction error:: ",
|
8219
|
-
throw
|
8050
|
+
err_63 = _a.sent();
|
8051
|
+
console.log("perpClient withdrawInstantFeeInstruction error:: ", err_63);
|
8052
|
+
throw err_63;
|
8220
8053
|
case 6: return [2, {
|
8221
8054
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
8222
8055
|
additionalSigners: additionalSigners
|
@@ -8225,7 +8058,7 @@ var PerpetualsClient = (function () {
|
|
8225
8058
|
});
|
8226
8059
|
}); };
|
8227
8060
|
this.initRevenueTokenAccount = function (feeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
8228
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction,
|
8061
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_64;
|
8229
8062
|
return __generator(this, function (_a) {
|
8230
8063
|
switch (_a.label) {
|
8231
8064
|
case 0:
|
@@ -8262,9 +8095,9 @@ var PerpetualsClient = (function () {
|
|
8262
8095
|
instructions.push(initRevenueTokenAccountInstruction);
|
8263
8096
|
return [3, 4];
|
8264
8097
|
case 3:
|
8265
|
-
|
8266
|
-
console.log("perpClient initRevenueTokenAccountInstruction error:: ",
|
8267
|
-
throw
|
8098
|
+
err_64 = _a.sent();
|
8099
|
+
console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_64);
|
8100
|
+
throw err_64;
|
8268
8101
|
case 4: return [2, {
|
8269
8102
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
8270
8103
|
additionalSigners: additionalSigners
|
@@ -8273,7 +8106,7 @@ var PerpetualsClient = (function () {
|
|
8273
8106
|
});
|
8274
8107
|
}); };
|
8275
8108
|
this.distributeTokenReward = function (amount, epochCount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
8276
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction,
|
8109
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_65;
|
8277
8110
|
return __generator(this, function (_a) {
|
8278
8111
|
switch (_a.label) {
|
8279
8112
|
case 0:
|
@@ -8312,9 +8145,9 @@ var PerpetualsClient = (function () {
|
|
8312
8145
|
instructions.push(distributeTokenRewardInstruction);
|
8313
8146
|
return [3, 4];
|
8314
8147
|
case 3:
|
8315
|
-
|
8316
|
-
console.log("perpClient distributeTokenRewardInstruction error:: ",
|
8317
|
-
throw
|
8148
|
+
err_65 = _a.sent();
|
8149
|
+
console.log("perpClient distributeTokenRewardInstruction error:: ", err_65);
|
8150
|
+
throw err_65;
|
8318
8151
|
case 4: return [2, {
|
8319
8152
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
8320
8153
|
additionalSigners: additionalSigners
|
@@ -8323,7 +8156,7 @@ var PerpetualsClient = (function () {
|
|
8323
8156
|
});
|
8324
8157
|
}); };
|
8325
8158
|
this.setTokenStakeLevel = function (owner, stakeLevel) { return __awaiter(_this, void 0, void 0, function () {
|
8326
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction,
|
8159
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_66;
|
8327
8160
|
return __generator(this, function (_a) {
|
8328
8161
|
switch (_a.label) {
|
8329
8162
|
case 0:
|
@@ -8351,9 +8184,9 @@ var PerpetualsClient = (function () {
|
|
8351
8184
|
instructions.push(setTokenStakeLevelInstruction);
|
8352
8185
|
return [3, 4];
|
8353
8186
|
case 3:
|
8354
|
-
|
8355
|
-
console.log("perpClient setTokenStakeLevelInstruction error:: ",
|
8356
|
-
throw
|
8187
|
+
err_66 = _a.sent();
|
8188
|
+
console.log("perpClient setTokenStakeLevelInstruction error:: ", err_66);
|
8189
|
+
throw err_66;
|
8357
8190
|
case 4: return [2, {
|
8358
8191
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
8359
8192
|
additionalSigners: additionalSigners
|
@@ -8362,7 +8195,7 @@ var PerpetualsClient = (function () {
|
|
8362
8195
|
});
|
8363
8196
|
}); };
|
8364
8197
|
this.setTokenReward = function (owner, amount, epochCount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
8365
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction,
|
8198
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_67;
|
8366
8199
|
return __generator(this, function (_a) {
|
8367
8200
|
switch (_a.label) {
|
8368
8201
|
case 0:
|
@@ -8394,9 +8227,9 @@ var PerpetualsClient = (function () {
|
|
8394
8227
|
instructions.push(setTokenRewardInstruction);
|
8395
8228
|
return [3, 4];
|
8396
8229
|
case 3:
|
8397
|
-
|
8398
|
-
console.log("perpClient setTokenRewardInstruction error:: ",
|
8399
|
-
throw
|
8230
|
+
err_67 = _a.sent();
|
8231
|
+
console.log("perpClient setTokenRewardInstruction error:: ", err_67);
|
8232
|
+
throw err_67;
|
8400
8233
|
case 4: return [2, {
|
8401
8234
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
8402
8235
|
additionalSigners: additionalSigners
|