flash-sdk 2.17.4 → 2.17.6
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/PerpetualsClient.d.ts +3 -7
- package/dist/PerpetualsClient.js +110 -210
- package/dist/idl/perp_composability.d.ts +5 -0
- package/dist/idl/perp_composability.js +5 -0
- package/dist/idl/perpetuals.d.ts +27 -269
- package/dist/idl/perpetuals.js +28 -270
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/PerpetualsClient.js
CHANGED
@@ -567,7 +567,7 @@ var PerpetualsClient = (function () {
|
|
567
567
|
}
|
568
568
|
});
|
569
569
|
}); };
|
570
|
-
this.liquidate = function (positionAccount, poolConfig, tokenMint, collateralMint, marketPk) { return __awaiter(_this, void 0, void 0, function () {
|
570
|
+
this.liquidate = function (positionAccount, orderAccount, poolConfig, tokenMint, collateralMint, marketPk) { return __awaiter(_this, void 0, void 0, function () {
|
571
571
|
var targetCustodyConfig, collateralCustodyConfig;
|
572
572
|
return __generator(this, function (_a) {
|
573
573
|
switch (_a.label) {
|
@@ -581,6 +581,7 @@ var PerpetualsClient = (function () {
|
|
581
581
|
perpetuals: this.perpetuals.publicKey,
|
582
582
|
pool: poolConfig.poolAddress,
|
583
583
|
position: positionAccount,
|
584
|
+
order: orderAccount,
|
584
585
|
market: marketPk,
|
585
586
|
targetCustody: targetCustodyConfig.custodyAccount,
|
586
587
|
targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
|
@@ -2505,7 +2506,7 @@ var PerpetualsClient = (function () {
|
|
2505
2506
|
if (closeUsersWSOLATA === void 0) { closeUsersWSOLATA = false; }
|
2506
2507
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
2507
2508
|
return __awaiter(_this, void 0, void 0, function () {
|
2508
|
-
var publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, lamports, _a, collateralCustodyConfig, targetCustodyConfig, marketAccount, positionAccount, instruction, closeWsolATAIns, error_2;
|
2509
|
+
var publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, lamports, _a, collateralCustodyConfig, targetCustodyConfig, marketAccount, positionAccount, orderAccount, instruction, closeWsolATAIns, error_2;
|
2509
2510
|
return __generator(this, function (_b) {
|
2510
2511
|
switch (_b.label) {
|
2511
2512
|
case 0:
|
@@ -2556,6 +2557,7 @@ var PerpetualsClient = (function () {
|
|
2556
2557
|
targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(marketSymbol).mintKey); });
|
2557
2558
|
marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
|
2558
2559
|
positionAccount = poolConfig.getPositionFromMarketPk(publicKey, marketAccount);
|
2560
|
+
orderAccount = poolConfig.getOrderFromMarketPk(publicKey, marketAccount);
|
2559
2561
|
return [4, this.program.methods
|
2560
2562
|
.closePosition({
|
2561
2563
|
priceWithSlippage: priceWithSlippage,
|
@@ -2569,6 +2571,7 @@ var PerpetualsClient = (function () {
|
|
2569
2571
|
perpetuals: poolConfig.perpetuals,
|
2570
2572
|
pool: poolConfig.poolAddress,
|
2571
2573
|
position: positionAccount,
|
2574
|
+
order: orderAccount,
|
2572
2575
|
market: marketAccount,
|
2573
2576
|
targetCustody: targetCustodyConfig.custodyAccount,
|
2574
2577
|
targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
|
@@ -2608,7 +2611,7 @@ var PerpetualsClient = (function () {
|
|
2608
2611
|
if (nftRebateTokenAccount === void 0) { nftRebateTokenAccount = web3_js_1.PublicKey.default; }
|
2609
2612
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
2610
2613
|
return __awaiter(_this, void 0, void 0, function () {
|
2611
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, swapInCustodyConfig, swapOutCustodyConfig, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userReceivingTokenAccount, lamports, userCollateralTokenAccount, marketAccount, positionAccount, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody, instruction;
|
2614
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, swapInCustodyConfig, swapOutCustodyConfig, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userReceivingTokenAccount, lamports, userCollateralTokenAccount, marketAccount, positionAccount, orderAccount, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody, instruction;
|
2612
2615
|
return __generator(this, function (_b) {
|
2613
2616
|
switch (_b.label) {
|
2614
2617
|
case 0:
|
@@ -2664,6 +2667,7 @@ var PerpetualsClient = (function () {
|
|
2664
2667
|
}
|
2665
2668
|
marketAccount = positionPoolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
|
2666
2669
|
positionAccount = positionPoolConfig.getPositionFromMarketPk(publicKey, marketAccount);
|
2670
|
+
orderAccount = positionPoolConfig.getOrderFromMarketPk(publicKey, marketAccount);
|
2667
2671
|
custodyAccountMetas = [];
|
2668
2672
|
custodyOracleAccountMetas = [];
|
2669
2673
|
for (_i = 0, _a = swapPoolConfig.custodies; _i < _a.length; _i++) {
|
@@ -2701,6 +2705,7 @@ var PerpetualsClient = (function () {
|
|
2701
2705
|
dispensingCustodyTokenAccount: swapOutCustodyConfig.tokenAccount,
|
2702
2706
|
positionPool: positionPoolConfig.poolAddress,
|
2703
2707
|
position: positionAccount,
|
2708
|
+
order: orderAccount,
|
2704
2709
|
market: marketAccount,
|
2705
2710
|
targetCustody: targetCustodyConfig.custodyAccount,
|
2706
2711
|
targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
|
@@ -5070,87 +5075,11 @@ var PerpetualsClient = (function () {
|
|
5070
5075
|
});
|
5071
5076
|
});
|
5072
5077
|
};
|
5073
|
-
this.
|
5074
|
-
if (createUserATA === void 0) { createUserATA = true; }
|
5075
|
-
if (closeUsersWSOLATA === void 0) { closeUsersWSOLATA = false; }
|
5076
|
-
return __awaiter(_this, void 0, void 0, function () {
|
5077
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, forceClosePartial, closeWsolATAIns, err_25;
|
5078
|
-
return __generator(this, function (_b) {
|
5079
|
-
switch (_b.label) {
|
5080
|
-
case 0:
|
5081
|
-
payerPubkey = this.provider.wallet.publicKey;
|
5082
|
-
targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(targetSymbol).mintKey); });
|
5083
|
-
collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey); });
|
5084
|
-
marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
|
5085
|
-
preInstructions = [];
|
5086
|
-
instructions = [];
|
5087
|
-
postInstructions = [];
|
5088
|
-
additionalSigners = [];
|
5089
|
-
_b.label = 1;
|
5090
|
-
case 1:
|
5091
|
-
_b.trys.push([1, 6, , 7]);
|
5092
|
-
return [4, (0, spl_token_1.getAssociatedTokenAddress)(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey, positionAccount.owner)];
|
5093
|
-
case 2:
|
5094
|
-
userReceivingTokenAccount = _b.sent();
|
5095
|
-
_a = createUserATA;
|
5096
|
-
if (!_a) return [3, 4];
|
5097
|
-
return [4, (0, utils_1.checkIfAccountExists)(userReceivingTokenAccount, this.provider.connection)];
|
5098
|
-
case 3:
|
5099
|
-
_a = !(_b.sent());
|
5100
|
-
_b.label = 4;
|
5101
|
-
case 4:
|
5102
|
-
if (_a) {
|
5103
|
-
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(payerPubkey, userReceivingTokenAccount, positionAccount.owner, poolConfig.getTokenFromSymbol(collateralSymbol).mintKey));
|
5104
|
-
}
|
5105
|
-
return [4, this.program.methods
|
5106
|
-
.forceClosePartial({
|
5107
|
-
priceWithSlippage: priceWithSlippage,
|
5108
|
-
sizeDelta: sizeDelta,
|
5109
|
-
isStopLoss: isStopLoss
|
5110
|
-
})
|
5111
|
-
.accounts({
|
5112
|
-
owner: positionAccount.owner,
|
5113
|
-
receivingAccount: userReceivingTokenAccount,
|
5114
|
-
transferAuthority: poolConfig.transferAuthority,
|
5115
|
-
perpetuals: this.perpetuals.publicKey,
|
5116
|
-
pool: poolConfig.poolAddress,
|
5117
|
-
position: positionAccount.publicKey,
|
5118
|
-
market: marketAccount,
|
5119
|
-
targetCustody: targetCustodyConfig.custodyAccount,
|
5120
|
-
targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
|
5121
|
-
collateralCustody: collateralCustodyConfig.custodyAccount,
|
5122
|
-
collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
|
5123
|
-
collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
|
5124
|
-
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
5125
|
-
eventAuthority: this.eventAuthority.publicKey,
|
5126
|
-
program: this.programId,
|
5127
|
-
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
5128
|
-
})
|
5129
|
-
.instruction()];
|
5130
|
-
case 5:
|
5131
|
-
forceClosePartial = _b.sent();
|
5132
|
-
instructions.push(forceClosePartial);
|
5133
|
-
if (collateralSymbol == 'WSOL' && closeUsersWSOLATA) {
|
5134
|
-
closeWsolATAIns = (0, spl_token_1.createCloseAccountInstruction)(userReceivingTokenAccount, positionAccount.owner, positionAccount.owner);
|
5135
|
-
postInstructions.push(closeWsolATAIns);
|
5136
|
-
}
|
5137
|
-
return [3, 7];
|
5138
|
-
case 6:
|
5139
|
-
err_25 = _b.sent();
|
5140
|
-
console.log("perpClient forceClosePartial error:: ", err_25);
|
5141
|
-
throw err_25;
|
5142
|
-
case 7: return [2, {
|
5143
|
-
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5144
|
-
additionalSigners: additionalSigners
|
5145
|
-
}];
|
5146
|
-
}
|
5147
|
-
});
|
5148
|
-
});
|
5149
|
-
};
|
5150
|
-
this.placeLimitOrder = function (targetSymbol, collateralSymbol, reserveSymbol, side, limitPrice, reserveAmount, sizeAmount, stopLossPrice, takeProfitPrice, receiveCustodyId, poolConfig, skipBalanceChecks) {
|
5078
|
+
this.placeLimitOrder = function (targetSymbol, collateralSymbol, reserveSymbol, side, limitPrice, reserveAmount, sizeAmount, stopLossPrice, takeProfitPrice, receiveCustodyId, poolConfig, skipBalanceChecks, ephemeralSignerPubkey) {
|
5151
5079
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
5080
|
+
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5152
5081
|
return __awaiter(_this, void 0, void 0, function () {
|
5153
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder,
|
5082
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder, err_25;
|
5154
5083
|
return __generator(this, function (_c) {
|
5155
5084
|
switch (_c.label) {
|
5156
5085
|
case 0:
|
@@ -5171,31 +5100,34 @@ var PerpetualsClient = (function () {
|
|
5171
5100
|
_c.trys.push([2, 10, , 11]);
|
5172
5101
|
if (!(reserveSymbol == 'SOL')) return [3, 5];
|
5173
5102
|
console.log("reserveSymbol === SOL", reserveSymbol);
|
5174
|
-
|
5175
|
-
return [4, (0, spl_token_1.getMinimumBalanceForRentExemptAccount)(this.provider.connection)];
|
5176
|
-
case 3:
|
5177
|
-
accCreationLamports = (_c.sent());
|
5178
|
-
console.log("accCreationLamports:", accCreationLamports);
|
5103
|
+
accCreationLamports = this.minimumBalanceForRentExemptAccountLamports;
|
5179
5104
|
lamports = reserveAmount.add(new anchor_1.BN(accCreationLamports));
|
5105
|
+
if (!!skipBalanceChecks) return [3, 4];
|
5180
5106
|
_a = anchor_1.BN.bind;
|
5181
5107
|
return [4, this.provider.connection.getBalance(publicKey)];
|
5182
|
-
case
|
5108
|
+
case 3:
|
5183
5109
|
unWrappedSolBalance = new (_a.apply(anchor_1.BN, [void 0, _c.sent()]))();
|
5184
5110
|
if (unWrappedSolBalance.lt(lamports)) {
|
5185
5111
|
throw "Insufficient SOL Funds";
|
5186
5112
|
}
|
5113
|
+
_c.label = 4;
|
5114
|
+
case 4:
|
5115
|
+
if (!ephemeralSignerPubkey) {
|
5116
|
+
wrappedSolAccount = new web3_js_1.Keypair();
|
5117
|
+
additionalSigners.push(wrappedSolAccount);
|
5118
|
+
}
|
5187
5119
|
preInstructions = [
|
5188
5120
|
web3_js_1.SystemProgram.createAccount({
|
5189
5121
|
fromPubkey: publicKey,
|
5190
|
-
newAccountPubkey: wrappedSolAccount.publicKey,
|
5122
|
+
newAccountPubkey: (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey),
|
5191
5123
|
lamports: lamports.toNumber(),
|
5192
5124
|
space: 165,
|
5193
5125
|
programId: spl_token_1.TOKEN_PROGRAM_ID,
|
5194
5126
|
}),
|
5195
|
-
(0, spl_token_1.createInitializeAccount3Instruction)(wrappedSolAccount.publicKey, spl_token_1.NATIVE_MINT, publicKey),
|
5127
|
+
(0, spl_token_1.createInitializeAccount3Instruction)((ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey), spl_token_1.NATIVE_MINT, publicKey),
|
5196
5128
|
];
|
5197
5129
|
postInstructions = [
|
5198
|
-
(0, spl_token_1.createCloseAccountInstruction)(wrappedSolAccount.publicKey, publicKey, publicKey),
|
5130
|
+
(0, spl_token_1.createCloseAccountInstruction)((ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey), publicKey, publicKey),
|
5199
5131
|
];
|
5200
5132
|
additionalSigners.push(wrappedSolAccount);
|
5201
5133
|
return [3, 8];
|
@@ -5251,9 +5183,9 @@ var PerpetualsClient = (function () {
|
|
5251
5183
|
instructions.push(placeLimitOrder);
|
5252
5184
|
return [3, 11];
|
5253
5185
|
case 10:
|
5254
|
-
|
5255
|
-
console.log("perpClient placeLimitOrder error:: ",
|
5256
|
-
throw
|
5186
|
+
err_25 = _c.sent();
|
5187
|
+
console.log("perpClient placeLimitOrder error:: ", err_25);
|
5188
|
+
throw err_25;
|
5257
5189
|
case 11: return [2, {
|
5258
5190
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5259
5191
|
additionalSigners: additionalSigners
|
@@ -5262,11 +5194,10 @@ var PerpetualsClient = (function () {
|
|
5262
5194
|
});
|
5263
5195
|
});
|
5264
5196
|
};
|
5265
|
-
this.editLimitOrder = function (targetSymbol, collateralSymbol, reserveSymbol, side, orderId, limitPrice, sizeAmount, stopLossPrice, takeProfitPrice, poolConfig, createUserATA
|
5197
|
+
this.editLimitOrder = function (targetSymbol, collateralSymbol, reserveSymbol, side, orderId, limitPrice, sizeAmount, stopLossPrice, takeProfitPrice, poolConfig, createUserATA) {
|
5266
5198
|
if (createUserATA === void 0) { createUserATA = true; }
|
5267
|
-
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5268
5199
|
return __awaiter(_this, void 0, void 0, function () {
|
5269
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, marketAccount,
|
5200
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, userReceivingTokenAccount, _a, positionAccount, orderAccount, editLimitOrder, err_26;
|
5270
5201
|
return __generator(this, function (_b) {
|
5271
5202
|
switch (_b.label) {
|
5272
5203
|
case 0:
|
@@ -5281,48 +5212,18 @@ var PerpetualsClient = (function () {
|
|
5281
5212
|
additionalSigners = [];
|
5282
5213
|
_b.label = 1;
|
5283
5214
|
case 1:
|
5284
|
-
_b.trys.push([1,
|
5285
|
-
if (!(collateralSymbol == 'SOL')) return [3, 3];
|
5286
|
-
console.log("collateralSymbol === SOL", collateralSymbol);
|
5287
|
-
wrappedSolAccount = new web3_js_1.Keypair();
|
5288
|
-
return [4, (0, spl_token_1.getMinimumBalanceForRentExemptAccount)(this.provider.connection)];
|
5289
|
-
case 2:
|
5290
|
-
accCreationLamports = (_b.sent());
|
5291
|
-
console.log("accCreationLamports:", accCreationLamports);
|
5292
|
-
lamports = accCreationLamports;
|
5293
|
-
if (!ephemeralSignerPubkey) {
|
5294
|
-
wrappedSolAccount = new web3_js_1.Keypair();
|
5295
|
-
additionalSigners.push(wrappedSolAccount);
|
5296
|
-
}
|
5297
|
-
preInstructions = [
|
5298
|
-
web3_js_1.SystemProgram.createAccount({
|
5299
|
-
fromPubkey: publicKey,
|
5300
|
-
newAccountPubkey: (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey),
|
5301
|
-
lamports: lamports,
|
5302
|
-
space: 165,
|
5303
|
-
programId: spl_token_1.TOKEN_PROGRAM_ID,
|
5304
|
-
}),
|
5305
|
-
(0, spl_token_1.createInitializeAccount3Instruction)((ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey), spl_token_1.NATIVE_MINT, publicKey),
|
5306
|
-
];
|
5307
|
-
postInstructions = [
|
5308
|
-
(0, spl_token_1.createCloseAccountInstruction)((ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey), publicKey, publicKey),
|
5309
|
-
];
|
5310
|
-
additionalSigners.push(wrappedSolAccount);
|
5311
|
-
return [3, 6];
|
5312
|
-
case 3:
|
5215
|
+
_b.trys.push([1, 5, , 6]);
|
5313
5216
|
userReceivingTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey, publicKey, true);
|
5314
5217
|
_a = createUserATA;
|
5315
|
-
if (!_a) return [3,
|
5218
|
+
if (!_a) return [3, 3];
|
5316
5219
|
return [4, (0, utils_1.checkIfAccountExists)(userReceivingTokenAccount, this.provider.connection)];
|
5317
|
-
case
|
5220
|
+
case 2:
|
5318
5221
|
_a = !(_b.sent());
|
5319
|
-
_b.label =
|
5320
|
-
case
|
5222
|
+
_b.label = 3;
|
5223
|
+
case 3:
|
5321
5224
|
if (_a) {
|
5322
5225
|
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, userReceivingTokenAccount, publicKey, poolConfig.getTokenFromSymbol(collateralSymbol).mintKey));
|
5323
5226
|
}
|
5324
|
-
_b.label = 6;
|
5325
|
-
case 6:
|
5326
5227
|
positionAccount = poolConfig.getPositionFromMarketPk(publicKey, marketAccount);
|
5327
5228
|
orderAccount = poolConfig.getOrderFromMarketPk(publicKey, marketAccount);
|
5328
5229
|
return [4, this.program.methods
|
@@ -5336,7 +5237,6 @@ var PerpetualsClient = (function () {
|
|
5336
5237
|
.accounts({
|
5337
5238
|
owner: publicKey,
|
5338
5239
|
feePayer: publicKey,
|
5339
|
-
receivingAccount: reserveSymbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : userReceivingTokenAccount,
|
5340
5240
|
transferAuthority: poolConfig.transferAuthority,
|
5341
5241
|
perpetuals: poolConfig.perpetuals,
|
5342
5242
|
pool: poolConfig.poolAddress,
|
@@ -5350,18 +5250,18 @@ var PerpetualsClient = (function () {
|
|
5350
5250
|
reserveCustodyTokenAccount: reserveCustodyConfig.tokenAccount,
|
5351
5251
|
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
5352
5252
|
eventAuthority: this.eventAuthority.publicKey,
|
5353
|
-
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
5253
|
+
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
5354
5254
|
})
|
5355
5255
|
.instruction()];
|
5356
|
-
case
|
5256
|
+
case 4:
|
5357
5257
|
editLimitOrder = _b.sent();
|
5358
5258
|
instructions.push(editLimitOrder);
|
5359
|
-
return [3,
|
5360
|
-
case
|
5361
|
-
|
5362
|
-
console.log("perpClient editLimitOrder error:: ",
|
5363
|
-
throw
|
5364
|
-
case
|
5259
|
+
return [3, 6];
|
5260
|
+
case 5:
|
5261
|
+
err_26 = _b.sent();
|
5262
|
+
console.log("perpClient editLimitOrder error:: ", err_26);
|
5263
|
+
throw err_26;
|
5264
|
+
case 6: return [2, {
|
5365
5265
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5366
5266
|
additionalSigners: additionalSigners
|
5367
5267
|
}];
|
@@ -5374,7 +5274,7 @@ var PerpetualsClient = (function () {
|
|
5374
5274
|
if (nftReferralAccount === void 0) { nftReferralAccount = web3_js_1.PublicKey.default; }
|
5375
5275
|
if (nftRebateTokenAccount === void 0) { nftRebateTokenAccount = web3_js_1.PublicKey.default; }
|
5376
5276
|
return __awaiter(_this, void 0, void 0, function () {
|
5377
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder,
|
5277
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder, err_27;
|
5378
5278
|
return __generator(this, function (_a) {
|
5379
5279
|
switch (_a.label) {
|
5380
5280
|
case 0:
|
@@ -5420,9 +5320,9 @@ var PerpetualsClient = (function () {
|
|
5420
5320
|
instructions.push(executeLimitOrder);
|
5421
5321
|
return [3, 4];
|
5422
5322
|
case 3:
|
5423
|
-
|
5424
|
-
console.log("perpClient executeLimitOrder error:: ",
|
5425
|
-
throw
|
5323
|
+
err_27 = _a.sent();
|
5324
|
+
console.log("perpClient executeLimitOrder error:: ", err_27);
|
5325
|
+
throw err_27;
|
5426
5326
|
case 4: return [2, {
|
5427
5327
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5428
5328
|
additionalSigners: additionalSigners
|
@@ -5432,7 +5332,7 @@ var PerpetualsClient = (function () {
|
|
5432
5332
|
});
|
5433
5333
|
};
|
5434
5334
|
this.placeTriggerOrder = function (targetSymbol, collateralSymbol, side, triggerPrice, deltaSizeAmount, isStopLoss, receiveCustodyId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5435
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder,
|
5335
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder, err_28;
|
5436
5336
|
return __generator(this, function (_a) {
|
5437
5337
|
switch (_a.label) {
|
5438
5338
|
case 0:
|
@@ -5479,9 +5379,9 @@ var PerpetualsClient = (function () {
|
|
5479
5379
|
instructions.push(placeTriggerOrder);
|
5480
5380
|
return [3, 4];
|
5481
5381
|
case 3:
|
5482
|
-
|
5483
|
-
console.log("perpClient placeTriggerOrder error:: ",
|
5484
|
-
throw
|
5382
|
+
err_28 = _a.sent();
|
5383
|
+
console.log("perpClient placeTriggerOrder error:: ", err_28);
|
5384
|
+
throw err_28;
|
5485
5385
|
case 4: return [2, {
|
5486
5386
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5487
5387
|
additionalSigners: additionalSigners
|
@@ -5490,7 +5390,7 @@ var PerpetualsClient = (function () {
|
|
5490
5390
|
});
|
5491
5391
|
}); };
|
5492
5392
|
this.editTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5493
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder,
|
5393
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder, err_29;
|
5494
5394
|
return __generator(this, function (_a) {
|
5495
5395
|
switch (_a.label) {
|
5496
5396
|
case 0:
|
@@ -5535,9 +5435,9 @@ var PerpetualsClient = (function () {
|
|
5535
5435
|
instructions.push(editTriggerOrder);
|
5536
5436
|
return [3, 4];
|
5537
5437
|
case 3:
|
5538
|
-
|
5539
|
-
console.log("perpClient editTriggerOrder error:: ",
|
5540
|
-
throw
|
5438
|
+
err_29 = _a.sent();
|
5439
|
+
console.log("perpClient editTriggerOrder error:: ", err_29);
|
5440
|
+
throw err_29;
|
5541
5441
|
case 4: return [2, {
|
5542
5442
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5543
5443
|
additionalSigners: additionalSigners
|
@@ -5549,7 +5449,7 @@ var PerpetualsClient = (function () {
|
|
5549
5449
|
if (createUserATA === void 0) { createUserATA = true; }
|
5550
5450
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5551
5451
|
return __awaiter(_this, void 0, void 0, function () {
|
5552
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, _a, positionAccount, orderAccount, executeTriggerOrder,
|
5452
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, _a, positionAccount, orderAccount, executeTriggerOrder, err_30;
|
5553
5453
|
return __generator(this, function (_b) {
|
5554
5454
|
switch (_b.label) {
|
5555
5455
|
case 0:
|
@@ -5635,9 +5535,9 @@ var PerpetualsClient = (function () {
|
|
5635
5535
|
instructions.push(executeTriggerOrder);
|
5636
5536
|
return [3, 9];
|
5637
5537
|
case 8:
|
5638
|
-
|
5639
|
-
console.log("perpClient executeTriggerOrder error:: ",
|
5640
|
-
throw
|
5538
|
+
err_30 = _b.sent();
|
5539
|
+
console.log("perpClient executeTriggerOrder error:: ", err_30);
|
5540
|
+
throw err_30;
|
5641
5541
|
case 9: return [2, {
|
5642
5542
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5643
5543
|
additionalSigners: additionalSigners
|
@@ -5647,7 +5547,7 @@ var PerpetualsClient = (function () {
|
|
5647
5547
|
});
|
5648
5548
|
};
|
5649
5549
|
this.getPositionData = function (position, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5650
|
-
var marketConfig, targetCustodyConfig, collateralCustodyConfig, getPositionData,
|
5550
|
+
var marketConfig, targetCustodyConfig, collateralCustodyConfig, getPositionData, err_31;
|
5651
5551
|
return __generator(this, function (_a) {
|
5652
5552
|
switch (_a.label) {
|
5653
5553
|
case 0:
|
@@ -5676,15 +5576,15 @@ var PerpetualsClient = (function () {
|
|
5676
5576
|
console.log(getPositionData);
|
5677
5577
|
return [2, getPositionData];
|
5678
5578
|
case 3:
|
5679
|
-
|
5680
|
-
console.log("perpClient setPool error:: ",
|
5681
|
-
throw
|
5579
|
+
err_31 = _a.sent();
|
5580
|
+
console.log("perpClient setPool error:: ", err_31);
|
5581
|
+
throw err_31;
|
5682
5582
|
case 4: return [2];
|
5683
5583
|
}
|
5684
5584
|
});
|
5685
5585
|
}); };
|
5686
5586
|
this.protocolWithdrawFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5687
|
-
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx,
|
5587
|
+
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_32;
|
5688
5588
|
return __generator(this, function (_a) {
|
5689
5589
|
switch (_a.label) {
|
5690
5590
|
case 0:
|
@@ -5717,9 +5617,9 @@ var PerpetualsClient = (function () {
|
|
5717
5617
|
instructions.push(withdrawFeesIx);
|
5718
5618
|
return [3, 5];
|
5719
5619
|
case 4:
|
5720
|
-
|
5721
|
-
console.log("perpClient setPool error:: ",
|
5722
|
-
throw
|
5620
|
+
err_32 = _a.sent();
|
5621
|
+
console.log("perpClient setPool error:: ", err_32);
|
5622
|
+
throw err_32;
|
5723
5623
|
case 5: return [2, {
|
5724
5624
|
instructions: __spreadArray([], instructions, true),
|
5725
5625
|
additionalSigners: additionalSigners
|
@@ -5728,7 +5628,7 @@ var PerpetualsClient = (function () {
|
|
5728
5628
|
});
|
5729
5629
|
}); };
|
5730
5630
|
this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
|
5731
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction,
|
5631
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_33;
|
5732
5632
|
return __generator(this, function (_a) {
|
5733
5633
|
switch (_a.label) {
|
5734
5634
|
case 0:
|
@@ -5755,9 +5655,9 @@ var PerpetualsClient = (function () {
|
|
5755
5655
|
instructions.push(setPermissionsInstruction);
|
5756
5656
|
return [3, 4];
|
5757
5657
|
case 3:
|
5758
|
-
|
5759
|
-
console.log("perpClient setPool error:: ",
|
5760
|
-
throw
|
5658
|
+
err_33 = _a.sent();
|
5659
|
+
console.log("perpClient setPool error:: ", err_33);
|
5660
|
+
throw err_33;
|
5761
5661
|
case 4: return [2, {
|
5762
5662
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5763
5663
|
additionalSigners: additionalSigners
|
@@ -5766,7 +5666,7 @@ var PerpetualsClient = (function () {
|
|
5766
5666
|
});
|
5767
5667
|
}); };
|
5768
5668
|
this.reimburse = function (tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5769
|
-
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e,
|
5669
|
+
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_34;
|
5770
5670
|
var _f;
|
5771
5671
|
return __generator(this, function (_g) {
|
5772
5672
|
switch (_g.label) {
|
@@ -5826,9 +5726,9 @@ var PerpetualsClient = (function () {
|
|
5826
5726
|
instructions.push(reimburse);
|
5827
5727
|
return [3, 5];
|
5828
5728
|
case 4:
|
5829
|
-
|
5830
|
-
console.log("perpClient setPool error:: ",
|
5831
|
-
throw
|
5729
|
+
err_34 = _g.sent();
|
5730
|
+
console.log("perpClient setPool error:: ", err_34);
|
5731
|
+
throw err_34;
|
5832
5732
|
case 5: return [2, {
|
5833
5733
|
instructions: __spreadArray([], instructions, true),
|
5834
5734
|
additionalSigners: additionalSigners
|
@@ -5837,7 +5737,7 @@ var PerpetualsClient = (function () {
|
|
5837
5737
|
});
|
5838
5738
|
}); };
|
5839
5739
|
this.setInternalOraclePrice = function (tokenMint, price, expo, conf, ema, publishTime, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5840
|
-
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice,
|
5740
|
+
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_35;
|
5841
5741
|
return __generator(this, function (_a) {
|
5842
5742
|
switch (_a.label) {
|
5843
5743
|
case 0:
|
@@ -5870,9 +5770,9 @@ var PerpetualsClient = (function () {
|
|
5870
5770
|
instructions.push(setInternalOraclePrice);
|
5871
5771
|
return [3, 4];
|
5872
5772
|
case 3:
|
5873
|
-
|
5874
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
5875
|
-
throw
|
5773
|
+
err_35 = _a.sent();
|
5774
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_35);
|
5775
|
+
throw err_35;
|
5876
5776
|
case 4: return [2, {
|
5877
5777
|
instructions: __spreadArray([], instructions, true),
|
5878
5778
|
additionalSigners: additionalSigners
|
@@ -5884,7 +5784,7 @@ var PerpetualsClient = (function () {
|
|
5884
5784
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
5885
5785
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5886
5786
|
return __awaiter(_this, void 0, void 0, function () {
|
5887
|
-
var publicKey, preInstructions, instructions, additionalSigners, postInstructions, rewardCustody, inCustodyConfig, lpTokenMint, compoundingTokenMint, wrappedSolAccount, lpTokenAccount, compoundingTokenAccount, fundingAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, lamports, unWrappedSolBalance, _d, addCompoundingLiquidity,
|
5787
|
+
var publicKey, preInstructions, instructions, additionalSigners, postInstructions, rewardCustody, inCustodyConfig, lpTokenMint, compoundingTokenMint, wrappedSolAccount, lpTokenAccount, compoundingTokenAccount, fundingAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, lamports, unWrappedSolBalance, _d, addCompoundingLiquidity, err_36;
|
5888
5788
|
return __generator(this, function (_e) {
|
5889
5789
|
switch (_e.label) {
|
5890
5790
|
case 0:
|
@@ -6007,8 +5907,8 @@ var PerpetualsClient = (function () {
|
|
6007
5907
|
instructions.push(addCompoundingLiquidity);
|
6008
5908
|
return [3, 10];
|
6009
5909
|
case 9:
|
6010
|
-
|
6011
|
-
console.log("perpClient addCompoundingLiquidity error:: ",
|
5910
|
+
err_36 = _e.sent();
|
5911
|
+
console.log("perpClient addCompoundingLiquidity error:: ", err_36);
|
6012
5912
|
return [3, 10];
|
6013
5913
|
case 10: return [2, {
|
6014
5914
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6022,7 +5922,7 @@ var PerpetualsClient = (function () {
|
|
6022
5922
|
if (createUserATA === void 0) { createUserATA = true; }
|
6023
5923
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6024
5924
|
return __awaiter(_this, void 0, void 0, function () {
|
6025
|
-
var publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, outCustodyConfig, lpTokenMint, compoundingTokenMint, lamports, _a, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _b, custody, _c, _d, market, compoundingTokenAccount, removeCompoundingLiquidity,
|
5925
|
+
var publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, outCustodyConfig, lpTokenMint, compoundingTokenMint, lamports, _a, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _b, custody, _c, _d, market, compoundingTokenAccount, removeCompoundingLiquidity, err_37;
|
6026
5926
|
return __generator(this, function (_e) {
|
6027
5927
|
switch (_e.label) {
|
6028
5928
|
case 0:
|
@@ -6129,8 +6029,8 @@ var PerpetualsClient = (function () {
|
|
6129
6029
|
instructions.push(removeCompoundingLiquidity);
|
6130
6030
|
return [3, 8];
|
6131
6031
|
case 7:
|
6132
|
-
|
6133
|
-
console.log("perpClient removeCompoundingLiquidity error:: ",
|
6032
|
+
err_37 = _e.sent();
|
6033
|
+
console.log("perpClient removeCompoundingLiquidity error:: ", err_37);
|
6134
6034
|
return [3, 8];
|
6135
6035
|
case 8: return [2, {
|
6136
6036
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6143,7 +6043,7 @@ var PerpetualsClient = (function () {
|
|
6143
6043
|
this.migrateStake = function (amount, rewardTokenMint, poolConfig, createUserATA) {
|
6144
6044
|
if (createUserATA === void 0) { createUserATA = true; }
|
6145
6045
|
return __awaiter(_this, void 0, void 0, function () {
|
6146
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, _a, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _b, custody, _c, _d, market, migrateStake,
|
6046
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, _a, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _b, custody, _c, _d, market, migrateStake, err_38;
|
6147
6047
|
return __generator(this, function (_e) {
|
6148
6048
|
switch (_e.label) {
|
6149
6049
|
case 0:
|
@@ -6224,8 +6124,8 @@ var PerpetualsClient = (function () {
|
|
6224
6124
|
instructions.push(migrateStake);
|
6225
6125
|
return [3, 6];
|
6226
6126
|
case 5:
|
6227
|
-
|
6228
|
-
console.log("perpClient migrateStake error:: ",
|
6127
|
+
err_38 = _e.sent();
|
6128
|
+
console.log("perpClient migrateStake error:: ", err_38);
|
6229
6129
|
return [3, 6];
|
6230
6130
|
case 6: return [2, {
|
6231
6131
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6236,7 +6136,7 @@ var PerpetualsClient = (function () {
|
|
6236
6136
|
});
|
6237
6137
|
};
|
6238
6138
|
this.migrateFlp = function (amount, rewardTokenMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6239
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp,
|
6139
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp, err_39;
|
6240
6140
|
return __generator(this, function (_d) {
|
6241
6141
|
switch (_d.label) {
|
6242
6142
|
case 0:
|
@@ -6308,8 +6208,8 @@ var PerpetualsClient = (function () {
|
|
6308
6208
|
instructions.push(migrateFlp);
|
6309
6209
|
return [3, 4];
|
6310
6210
|
case 3:
|
6311
|
-
|
6312
|
-
console.log("perpClient migrateFlp error:: ",
|
6211
|
+
err_39 = _d.sent();
|
6212
|
+
console.log("perpClient migrateFlp error:: ", err_39);
|
6313
6213
|
return [3, 4];
|
6314
6214
|
case 4: return [2, {
|
6315
6215
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6321,7 +6221,7 @@ var PerpetualsClient = (function () {
|
|
6321
6221
|
this.compoundingFee = function (poolConfig, rewardTokenSymbol) {
|
6322
6222
|
if (rewardTokenSymbol === void 0) { rewardTokenSymbol = 'USDC'; }
|
6323
6223
|
return __awaiter(_this, void 0, void 0, function () {
|
6324
|
-
var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, compoundingFee,
|
6224
|
+
var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, compoundingFee, err_40;
|
6325
6225
|
return __generator(this, function (_d) {
|
6326
6226
|
switch (_d.label) {
|
6327
6227
|
case 0:
|
@@ -6378,8 +6278,8 @@ var PerpetualsClient = (function () {
|
|
6378
6278
|
instructions.push(compoundingFee);
|
6379
6279
|
return [3, 4];
|
6380
6280
|
case 3:
|
6381
|
-
|
6382
|
-
console.log("perpClient compoundingFee error:: ",
|
6281
|
+
err_40 = _d.sent();
|
6282
|
+
console.log("perpClient compoundingFee error:: ", err_40);
|
6383
6283
|
return [3, 4];
|
6384
6284
|
case 4: return [2, {
|
6385
6285
|
instructions: __spreadArray([], instructions, true),
|
@@ -6390,7 +6290,7 @@ var PerpetualsClient = (function () {
|
|
6390
6290
|
});
|
6391
6291
|
};
|
6392
6292
|
this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6393
|
-
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp,
|
6293
|
+
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_41;
|
6394
6294
|
return __generator(this, function (_a) {
|
6395
6295
|
switch (_a.label) {
|
6396
6296
|
case 0:
|
@@ -6428,8 +6328,8 @@ var PerpetualsClient = (function () {
|
|
6428
6328
|
instructions.push(renameFlp);
|
6429
6329
|
return [3, 4];
|
6430
6330
|
case 3:
|
6431
|
-
|
6432
|
-
console.log("perpClient renameFlp error:: ",
|
6331
|
+
err_41 = _a.sent();
|
6332
|
+
console.log("perpClient renameFlp error:: ", err_41);
|
6433
6333
|
return [3, 4];
|
6434
6334
|
case 4: return [2, {
|
6435
6335
|
instructions: __spreadArray([], instructions, true),
|
@@ -6439,7 +6339,7 @@ var PerpetualsClient = (function () {
|
|
6439
6339
|
});
|
6440
6340
|
}); };
|
6441
6341
|
this.initRewardDistribution = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6442
|
-
var publicKey, rewardMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, transferAuthority, initRewardVault,
|
6342
|
+
var publicKey, rewardMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, transferAuthority, initRewardVault, err_42;
|
6443
6343
|
return __generator(this, function (_a) {
|
6444
6344
|
switch (_a.label) {
|
6445
6345
|
case 0:
|
@@ -6473,9 +6373,9 @@ var PerpetualsClient = (function () {
|
|
6473
6373
|
instructions.push(initRewardVault);
|
6474
6374
|
return [3, 4];
|
6475
6375
|
case 3:
|
6476
|
-
|
6477
|
-
console.log("rewardDistribution InitRewardVault error:: ",
|
6478
|
-
throw
|
6376
|
+
err_42 = _a.sent();
|
6377
|
+
console.log("rewardDistribution InitRewardVault error:: ", err_42);
|
6378
|
+
throw err_42;
|
6479
6379
|
case 4: return [2, {
|
6480
6380
|
instructions: __spreadArray([], instructions, true),
|
6481
6381
|
additionalSigners: additionalSigners
|
@@ -6484,7 +6384,7 @@ var PerpetualsClient = (function () {
|
|
6484
6384
|
});
|
6485
6385
|
}); };
|
6486
6386
|
this.updateCounterReward = function () { return __awaiter(_this, void 0, void 0, function () {
|
6487
|
-
var publicKey, instructions, additionalSigners, rewardVault, updateCounter,
|
6387
|
+
var publicKey, instructions, additionalSigners, rewardVault, updateCounter, err_43;
|
6488
6388
|
return __generator(this, function (_a) {
|
6489
6389
|
switch (_a.label) {
|
6490
6390
|
case 0:
|
@@ -6507,9 +6407,9 @@ var PerpetualsClient = (function () {
|
|
6507
6407
|
instructions.push(updateCounter);
|
6508
6408
|
return [3, 4];
|
6509
6409
|
case 3:
|
6510
|
-
|
6511
|
-
console.log("rewardDistribution updateCounter error:: ",
|
6512
|
-
throw
|
6410
|
+
err_43 = _a.sent();
|
6411
|
+
console.log("rewardDistribution updateCounter error:: ", err_43);
|
6412
|
+
throw err_43;
|
6513
6413
|
case 4: return [2, {
|
6514
6414
|
instructions: __spreadArray([], instructions, true),
|
6515
6415
|
additionalSigners: additionalSigners
|
@@ -6518,7 +6418,7 @@ var PerpetualsClient = (function () {
|
|
6518
6418
|
});
|
6519
6419
|
}); };
|
6520
6420
|
this.rewardDistribution = function (counter, owner, rewardAmount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6521
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, rewardRecord, distributeReward,
|
6421
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, rewardRecord, distributeReward, err_44;
|
6522
6422
|
return __generator(this, function (_a) {
|
6523
6423
|
switch (_a.label) {
|
6524
6424
|
case 0:
|
@@ -6557,9 +6457,9 @@ var PerpetualsClient = (function () {
|
|
6557
6457
|
instructions.push(distributeReward);
|
6558
6458
|
return [3, 4];
|
6559
6459
|
case 3:
|
6560
|
-
|
6561
|
-
console.log("rewardDistribution distributeReward error:: ",
|
6562
|
-
throw
|
6460
|
+
err_44 = _a.sent();
|
6461
|
+
console.log("rewardDistribution distributeReward error:: ", err_44);
|
6462
|
+
throw err_44;
|
6563
6463
|
case 4: return [2, {
|
6564
6464
|
instructions: __spreadArray([], instructions, true),
|
6565
6465
|
additionalSigners: additionalSigners
|
@@ -6570,7 +6470,7 @@ var PerpetualsClient = (function () {
|
|
6570
6470
|
this.collectReward = function (counter, owner, rewardSymbol, poolConfig, createUserATA) {
|
6571
6471
|
if (createUserATA === void 0) { createUserATA = true; }
|
6572
6472
|
return __awaiter(_this, void 0, void 0, function () {
|
6573
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, receivingTokenAccount, _a, rewardVault, rewardTokenAccount, rewardRecord, transferAuthority, collectNftReward,
|
6473
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, receivingTokenAccount, _a, rewardVault, rewardTokenAccount, rewardRecord, transferAuthority, collectNftReward, err_45;
|
6574
6474
|
return __generator(this, function (_b) {
|
6575
6475
|
switch (_b.label) {
|
6576
6476
|
case 0:
|
@@ -6616,8 +6516,8 @@ var PerpetualsClient = (function () {
|
|
6616
6516
|
instructions.push(collectNftReward);
|
6617
6517
|
return [3, 6];
|
6618
6518
|
case 5:
|
6619
|
-
|
6620
|
-
throw
|
6519
|
+
err_45 = _b.sent();
|
6520
|
+
throw err_45;
|
6621
6521
|
case 6: return [2, {
|
6622
6522
|
instructions: __spreadArray([], instructions, true),
|
6623
6523
|
additionalSigners: additionalSigners
|