flash-sdk 2.17.5 → 2.17.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/PerpetualsClient.d.ts +2 -6
- package/dist/PerpetualsClient.js +96 -200
- package/dist/idl/perp_composability.d.ts +5 -0
- package/dist/idl/perp_composability.js +5 -0
- package/dist/idl/perpetuals.d.ts +30 -272
- package/dist/idl/perpetuals.js +31 -273
- 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,88 +5075,11 @@ var PerpetualsClient = (function () {
|
|
5070
5075
|
});
|
5071
5076
|
});
|
5072
5077
|
};
|
5073
|
-
this.forceClosePartial = function (positionAccount, targetSymbol, collateralSymbol, side, priceWithSlippage, sizeDelta, isStopLoss, poolConfig, createUserATA, closeUsersWSOLATA) {
|
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
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; }
|
5152
5080
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5153
5081
|
return __awaiter(_this, void 0, void 0, function () {
|
5154
|
-
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;
|
5155
5083
|
return __generator(this, function (_c) {
|
5156
5084
|
switch (_c.label) {
|
5157
5085
|
case 0:
|
@@ -5255,9 +5183,9 @@ var PerpetualsClient = (function () {
|
|
5255
5183
|
instructions.push(placeLimitOrder);
|
5256
5184
|
return [3, 11];
|
5257
5185
|
case 10:
|
5258
|
-
|
5259
|
-
console.log("perpClient placeLimitOrder error:: ",
|
5260
|
-
throw
|
5186
|
+
err_25 = _c.sent();
|
5187
|
+
console.log("perpClient placeLimitOrder error:: ", err_25);
|
5188
|
+
throw err_25;
|
5261
5189
|
case 11: return [2, {
|
5262
5190
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5263
5191
|
additionalSigners: additionalSigners
|
@@ -5266,11 +5194,10 @@ var PerpetualsClient = (function () {
|
|
5266
5194
|
});
|
5267
5195
|
});
|
5268
5196
|
};
|
5269
|
-
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) {
|
5270
5198
|
if (createUserATA === void 0) { createUserATA = true; }
|
5271
|
-
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5272
5199
|
return __awaiter(_this, void 0, void 0, function () {
|
5273
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, marketAccount,
|
5200
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, userReceivingTokenAccount, _a, positionAccount, orderAccount, editLimitOrder, err_26;
|
5274
5201
|
return __generator(this, function (_b) {
|
5275
5202
|
switch (_b.label) {
|
5276
5203
|
case 0:
|
@@ -5285,48 +5212,18 @@ var PerpetualsClient = (function () {
|
|
5285
5212
|
additionalSigners = [];
|
5286
5213
|
_b.label = 1;
|
5287
5214
|
case 1:
|
5288
|
-
_b.trys.push([1,
|
5289
|
-
if (!(collateralSymbol == 'SOL')) return [3, 3];
|
5290
|
-
console.log("collateralSymbol === SOL", collateralSymbol);
|
5291
|
-
wrappedSolAccount = new web3_js_1.Keypair();
|
5292
|
-
return [4, (0, spl_token_1.getMinimumBalanceForRentExemptAccount)(this.provider.connection)];
|
5293
|
-
case 2:
|
5294
|
-
accCreationLamports = (_b.sent());
|
5295
|
-
console.log("accCreationLamports:", accCreationLamports);
|
5296
|
-
lamports = accCreationLamports;
|
5297
|
-
if (!ephemeralSignerPubkey) {
|
5298
|
-
wrappedSolAccount = new web3_js_1.Keypair();
|
5299
|
-
additionalSigners.push(wrappedSolAccount);
|
5300
|
-
}
|
5301
|
-
preInstructions = [
|
5302
|
-
web3_js_1.SystemProgram.createAccount({
|
5303
|
-
fromPubkey: publicKey,
|
5304
|
-
newAccountPubkey: (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey),
|
5305
|
-
lamports: lamports,
|
5306
|
-
space: 165,
|
5307
|
-
programId: spl_token_1.TOKEN_PROGRAM_ID,
|
5308
|
-
}),
|
5309
|
-
(0, spl_token_1.createInitializeAccount3Instruction)((ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey), spl_token_1.NATIVE_MINT, publicKey),
|
5310
|
-
];
|
5311
|
-
postInstructions = [
|
5312
|
-
(0, spl_token_1.createCloseAccountInstruction)((ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey), publicKey, publicKey),
|
5313
|
-
];
|
5314
|
-
additionalSigners.push(wrappedSolAccount);
|
5315
|
-
return [3, 6];
|
5316
|
-
case 3:
|
5215
|
+
_b.trys.push([1, 5, , 6]);
|
5317
5216
|
userReceivingTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey, publicKey, true);
|
5318
5217
|
_a = createUserATA;
|
5319
|
-
if (!_a) return [3,
|
5218
|
+
if (!_a) return [3, 3];
|
5320
5219
|
return [4, (0, utils_1.checkIfAccountExists)(userReceivingTokenAccount, this.provider.connection)];
|
5321
|
-
case
|
5220
|
+
case 2:
|
5322
5221
|
_a = !(_b.sent());
|
5323
|
-
_b.label =
|
5324
|
-
case
|
5222
|
+
_b.label = 3;
|
5223
|
+
case 3:
|
5325
5224
|
if (_a) {
|
5326
5225
|
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, userReceivingTokenAccount, publicKey, poolConfig.getTokenFromSymbol(collateralSymbol).mintKey));
|
5327
5226
|
}
|
5328
|
-
_b.label = 6;
|
5329
|
-
case 6:
|
5330
5227
|
positionAccount = poolConfig.getPositionFromMarketPk(publicKey, marketAccount);
|
5331
5228
|
orderAccount = poolConfig.getOrderFromMarketPk(publicKey, marketAccount);
|
5332
5229
|
return [4, this.program.methods
|
@@ -5340,7 +5237,6 @@ var PerpetualsClient = (function () {
|
|
5340
5237
|
.accounts({
|
5341
5238
|
owner: publicKey,
|
5342
5239
|
feePayer: publicKey,
|
5343
|
-
receivingAccount: reserveSymbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : userReceivingTokenAccount,
|
5344
5240
|
transferAuthority: poolConfig.transferAuthority,
|
5345
5241
|
perpetuals: poolConfig.perpetuals,
|
5346
5242
|
pool: poolConfig.poolAddress,
|
@@ -5354,18 +5250,18 @@ var PerpetualsClient = (function () {
|
|
5354
5250
|
reserveCustodyTokenAccount: reserveCustodyConfig.tokenAccount,
|
5355
5251
|
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
5356
5252
|
eventAuthority: this.eventAuthority.publicKey,
|
5357
|
-
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
5253
|
+
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
5358
5254
|
})
|
5359
5255
|
.instruction()];
|
5360
|
-
case
|
5256
|
+
case 4:
|
5361
5257
|
editLimitOrder = _b.sent();
|
5362
5258
|
instructions.push(editLimitOrder);
|
5363
|
-
return [3,
|
5364
|
-
case
|
5365
|
-
|
5366
|
-
console.log("perpClient editLimitOrder error:: ",
|
5367
|
-
throw
|
5368
|
-
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, {
|
5369
5265
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5370
5266
|
additionalSigners: additionalSigners
|
5371
5267
|
}];
|
@@ -5378,7 +5274,7 @@ var PerpetualsClient = (function () {
|
|
5378
5274
|
if (nftReferralAccount === void 0) { nftReferralAccount = web3_js_1.PublicKey.default; }
|
5379
5275
|
if (nftRebateTokenAccount === void 0) { nftRebateTokenAccount = web3_js_1.PublicKey.default; }
|
5380
5276
|
return __awaiter(_this, void 0, void 0, function () {
|
5381
|
-
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;
|
5382
5278
|
return __generator(this, function (_a) {
|
5383
5279
|
switch (_a.label) {
|
5384
5280
|
case 0:
|
@@ -5424,9 +5320,9 @@ var PerpetualsClient = (function () {
|
|
5424
5320
|
instructions.push(executeLimitOrder);
|
5425
5321
|
return [3, 4];
|
5426
5322
|
case 3:
|
5427
|
-
|
5428
|
-
console.log("perpClient executeLimitOrder error:: ",
|
5429
|
-
throw
|
5323
|
+
err_27 = _a.sent();
|
5324
|
+
console.log("perpClient executeLimitOrder error:: ", err_27);
|
5325
|
+
throw err_27;
|
5430
5326
|
case 4: return [2, {
|
5431
5327
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5432
5328
|
additionalSigners: additionalSigners
|
@@ -5436,7 +5332,7 @@ var PerpetualsClient = (function () {
|
|
5436
5332
|
});
|
5437
5333
|
};
|
5438
5334
|
this.placeTriggerOrder = function (targetSymbol, collateralSymbol, side, triggerPrice, deltaSizeAmount, isStopLoss, receiveCustodyId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5439
|
-
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;
|
5440
5336
|
return __generator(this, function (_a) {
|
5441
5337
|
switch (_a.label) {
|
5442
5338
|
case 0:
|
@@ -5483,9 +5379,9 @@ var PerpetualsClient = (function () {
|
|
5483
5379
|
instructions.push(placeTriggerOrder);
|
5484
5380
|
return [3, 4];
|
5485
5381
|
case 3:
|
5486
|
-
|
5487
|
-
console.log("perpClient placeTriggerOrder error:: ",
|
5488
|
-
throw
|
5382
|
+
err_28 = _a.sent();
|
5383
|
+
console.log("perpClient placeTriggerOrder error:: ", err_28);
|
5384
|
+
throw err_28;
|
5489
5385
|
case 4: return [2, {
|
5490
5386
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5491
5387
|
additionalSigners: additionalSigners
|
@@ -5494,7 +5390,7 @@ var PerpetualsClient = (function () {
|
|
5494
5390
|
});
|
5495
5391
|
}); };
|
5496
5392
|
this.editTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5497
|
-
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;
|
5498
5394
|
return __generator(this, function (_a) {
|
5499
5395
|
switch (_a.label) {
|
5500
5396
|
case 0:
|
@@ -5539,9 +5435,9 @@ var PerpetualsClient = (function () {
|
|
5539
5435
|
instructions.push(editTriggerOrder);
|
5540
5436
|
return [3, 4];
|
5541
5437
|
case 3:
|
5542
|
-
|
5543
|
-
console.log("perpClient editTriggerOrder error:: ",
|
5544
|
-
throw
|
5438
|
+
err_29 = _a.sent();
|
5439
|
+
console.log("perpClient editTriggerOrder error:: ", err_29);
|
5440
|
+
throw err_29;
|
5545
5441
|
case 4: return [2, {
|
5546
5442
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5547
5443
|
additionalSigners: additionalSigners
|
@@ -5553,7 +5449,7 @@ var PerpetualsClient = (function () {
|
|
5553
5449
|
if (createUserATA === void 0) { createUserATA = true; }
|
5554
5450
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5555
5451
|
return __awaiter(_this, void 0, void 0, function () {
|
5556
|
-
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;
|
5557
5453
|
return __generator(this, function (_b) {
|
5558
5454
|
switch (_b.label) {
|
5559
5455
|
case 0:
|
@@ -5639,9 +5535,9 @@ var PerpetualsClient = (function () {
|
|
5639
5535
|
instructions.push(executeTriggerOrder);
|
5640
5536
|
return [3, 9];
|
5641
5537
|
case 8:
|
5642
|
-
|
5643
|
-
console.log("perpClient executeTriggerOrder error:: ",
|
5644
|
-
throw
|
5538
|
+
err_30 = _b.sent();
|
5539
|
+
console.log("perpClient executeTriggerOrder error:: ", err_30);
|
5540
|
+
throw err_30;
|
5645
5541
|
case 9: return [2, {
|
5646
5542
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5647
5543
|
additionalSigners: additionalSigners
|
@@ -5651,7 +5547,7 @@ var PerpetualsClient = (function () {
|
|
5651
5547
|
});
|
5652
5548
|
};
|
5653
5549
|
this.getPositionData = function (position, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5654
|
-
var marketConfig, targetCustodyConfig, collateralCustodyConfig, getPositionData,
|
5550
|
+
var marketConfig, targetCustodyConfig, collateralCustodyConfig, getPositionData, err_31;
|
5655
5551
|
return __generator(this, function (_a) {
|
5656
5552
|
switch (_a.label) {
|
5657
5553
|
case 0:
|
@@ -5680,15 +5576,15 @@ var PerpetualsClient = (function () {
|
|
5680
5576
|
console.log(getPositionData);
|
5681
5577
|
return [2, getPositionData];
|
5682
5578
|
case 3:
|
5683
|
-
|
5684
|
-
console.log("perpClient setPool error:: ",
|
5685
|
-
throw
|
5579
|
+
err_31 = _a.sent();
|
5580
|
+
console.log("perpClient setPool error:: ", err_31);
|
5581
|
+
throw err_31;
|
5686
5582
|
case 4: return [2];
|
5687
5583
|
}
|
5688
5584
|
});
|
5689
5585
|
}); };
|
5690
5586
|
this.protocolWithdrawFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5691
|
-
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx,
|
5587
|
+
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_32;
|
5692
5588
|
return __generator(this, function (_a) {
|
5693
5589
|
switch (_a.label) {
|
5694
5590
|
case 0:
|
@@ -5721,9 +5617,9 @@ var PerpetualsClient = (function () {
|
|
5721
5617
|
instructions.push(withdrawFeesIx);
|
5722
5618
|
return [3, 5];
|
5723
5619
|
case 4:
|
5724
|
-
|
5725
|
-
console.log("perpClient setPool error:: ",
|
5726
|
-
throw
|
5620
|
+
err_32 = _a.sent();
|
5621
|
+
console.log("perpClient setPool error:: ", err_32);
|
5622
|
+
throw err_32;
|
5727
5623
|
case 5: return [2, {
|
5728
5624
|
instructions: __spreadArray([], instructions, true),
|
5729
5625
|
additionalSigners: additionalSigners
|
@@ -5732,7 +5628,7 @@ var PerpetualsClient = (function () {
|
|
5732
5628
|
});
|
5733
5629
|
}); };
|
5734
5630
|
this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
|
5735
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction,
|
5631
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_33;
|
5736
5632
|
return __generator(this, function (_a) {
|
5737
5633
|
switch (_a.label) {
|
5738
5634
|
case 0:
|
@@ -5759,9 +5655,9 @@ var PerpetualsClient = (function () {
|
|
5759
5655
|
instructions.push(setPermissionsInstruction);
|
5760
5656
|
return [3, 4];
|
5761
5657
|
case 3:
|
5762
|
-
|
5763
|
-
console.log("perpClient setPool error:: ",
|
5764
|
-
throw
|
5658
|
+
err_33 = _a.sent();
|
5659
|
+
console.log("perpClient setPool error:: ", err_33);
|
5660
|
+
throw err_33;
|
5765
5661
|
case 4: return [2, {
|
5766
5662
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5767
5663
|
additionalSigners: additionalSigners
|
@@ -5770,7 +5666,7 @@ var PerpetualsClient = (function () {
|
|
5770
5666
|
});
|
5771
5667
|
}); };
|
5772
5668
|
this.reimburse = function (tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5773
|
-
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;
|
5774
5670
|
var _f;
|
5775
5671
|
return __generator(this, function (_g) {
|
5776
5672
|
switch (_g.label) {
|
@@ -5830,9 +5726,9 @@ var PerpetualsClient = (function () {
|
|
5830
5726
|
instructions.push(reimburse);
|
5831
5727
|
return [3, 5];
|
5832
5728
|
case 4:
|
5833
|
-
|
5834
|
-
console.log("perpClient setPool error:: ",
|
5835
|
-
throw
|
5729
|
+
err_34 = _g.sent();
|
5730
|
+
console.log("perpClient setPool error:: ", err_34);
|
5731
|
+
throw err_34;
|
5836
5732
|
case 5: return [2, {
|
5837
5733
|
instructions: __spreadArray([], instructions, true),
|
5838
5734
|
additionalSigners: additionalSigners
|
@@ -5841,7 +5737,7 @@ var PerpetualsClient = (function () {
|
|
5841
5737
|
});
|
5842
5738
|
}); };
|
5843
5739
|
this.setInternalOraclePrice = function (tokenMint, price, expo, conf, ema, publishTime, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5844
|
-
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice,
|
5740
|
+
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_35;
|
5845
5741
|
return __generator(this, function (_a) {
|
5846
5742
|
switch (_a.label) {
|
5847
5743
|
case 0:
|
@@ -5874,9 +5770,9 @@ var PerpetualsClient = (function () {
|
|
5874
5770
|
instructions.push(setInternalOraclePrice);
|
5875
5771
|
return [3, 4];
|
5876
5772
|
case 3:
|
5877
|
-
|
5878
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
5879
|
-
throw
|
5773
|
+
err_35 = _a.sent();
|
5774
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_35);
|
5775
|
+
throw err_35;
|
5880
5776
|
case 4: return [2, {
|
5881
5777
|
instructions: __spreadArray([], instructions, true),
|
5882
5778
|
additionalSigners: additionalSigners
|
@@ -5888,7 +5784,7 @@ var PerpetualsClient = (function () {
|
|
5888
5784
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
5889
5785
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5890
5786
|
return __awaiter(_this, void 0, void 0, function () {
|
5891
|
-
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;
|
5892
5788
|
return __generator(this, function (_e) {
|
5893
5789
|
switch (_e.label) {
|
5894
5790
|
case 0:
|
@@ -6011,8 +5907,8 @@ var PerpetualsClient = (function () {
|
|
6011
5907
|
instructions.push(addCompoundingLiquidity);
|
6012
5908
|
return [3, 10];
|
6013
5909
|
case 9:
|
6014
|
-
|
6015
|
-
console.log("perpClient addCompoundingLiquidity error:: ",
|
5910
|
+
err_36 = _e.sent();
|
5911
|
+
console.log("perpClient addCompoundingLiquidity error:: ", err_36);
|
6016
5912
|
return [3, 10];
|
6017
5913
|
case 10: return [2, {
|
6018
5914
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6026,7 +5922,7 @@ var PerpetualsClient = (function () {
|
|
6026
5922
|
if (createUserATA === void 0) { createUserATA = true; }
|
6027
5923
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6028
5924
|
return __awaiter(_this, void 0, void 0, function () {
|
6029
|
-
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;
|
6030
5926
|
return __generator(this, function (_e) {
|
6031
5927
|
switch (_e.label) {
|
6032
5928
|
case 0:
|
@@ -6133,8 +6029,8 @@ var PerpetualsClient = (function () {
|
|
6133
6029
|
instructions.push(removeCompoundingLiquidity);
|
6134
6030
|
return [3, 8];
|
6135
6031
|
case 7:
|
6136
|
-
|
6137
|
-
console.log("perpClient removeCompoundingLiquidity error:: ",
|
6032
|
+
err_37 = _e.sent();
|
6033
|
+
console.log("perpClient removeCompoundingLiquidity error:: ", err_37);
|
6138
6034
|
return [3, 8];
|
6139
6035
|
case 8: return [2, {
|
6140
6036
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6147,7 +6043,7 @@ var PerpetualsClient = (function () {
|
|
6147
6043
|
this.migrateStake = function (amount, rewardTokenMint, poolConfig, createUserATA) {
|
6148
6044
|
if (createUserATA === void 0) { createUserATA = true; }
|
6149
6045
|
return __awaiter(_this, void 0, void 0, function () {
|
6150
|
-
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;
|
6151
6047
|
return __generator(this, function (_e) {
|
6152
6048
|
switch (_e.label) {
|
6153
6049
|
case 0:
|
@@ -6228,8 +6124,8 @@ var PerpetualsClient = (function () {
|
|
6228
6124
|
instructions.push(migrateStake);
|
6229
6125
|
return [3, 6];
|
6230
6126
|
case 5:
|
6231
|
-
|
6232
|
-
console.log("perpClient migrateStake error:: ",
|
6127
|
+
err_38 = _e.sent();
|
6128
|
+
console.log("perpClient migrateStake error:: ", err_38);
|
6233
6129
|
return [3, 6];
|
6234
6130
|
case 6: return [2, {
|
6235
6131
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6240,7 +6136,7 @@ var PerpetualsClient = (function () {
|
|
6240
6136
|
});
|
6241
6137
|
};
|
6242
6138
|
this.migrateFlp = function (amount, rewardTokenMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6243
|
-
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;
|
6244
6140
|
return __generator(this, function (_d) {
|
6245
6141
|
switch (_d.label) {
|
6246
6142
|
case 0:
|
@@ -6312,8 +6208,8 @@ var PerpetualsClient = (function () {
|
|
6312
6208
|
instructions.push(migrateFlp);
|
6313
6209
|
return [3, 4];
|
6314
6210
|
case 3:
|
6315
|
-
|
6316
|
-
console.log("perpClient migrateFlp error:: ",
|
6211
|
+
err_39 = _d.sent();
|
6212
|
+
console.log("perpClient migrateFlp error:: ", err_39);
|
6317
6213
|
return [3, 4];
|
6318
6214
|
case 4: return [2, {
|
6319
6215
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6325,7 +6221,7 @@ var PerpetualsClient = (function () {
|
|
6325
6221
|
this.compoundingFee = function (poolConfig, rewardTokenSymbol) {
|
6326
6222
|
if (rewardTokenSymbol === void 0) { rewardTokenSymbol = 'USDC'; }
|
6327
6223
|
return __awaiter(_this, void 0, void 0, function () {
|
6328
|
-
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;
|
6329
6225
|
return __generator(this, function (_d) {
|
6330
6226
|
switch (_d.label) {
|
6331
6227
|
case 0:
|
@@ -6382,8 +6278,8 @@ var PerpetualsClient = (function () {
|
|
6382
6278
|
instructions.push(compoundingFee);
|
6383
6279
|
return [3, 4];
|
6384
6280
|
case 3:
|
6385
|
-
|
6386
|
-
console.log("perpClient compoundingFee error:: ",
|
6281
|
+
err_40 = _d.sent();
|
6282
|
+
console.log("perpClient compoundingFee error:: ", err_40);
|
6387
6283
|
return [3, 4];
|
6388
6284
|
case 4: return [2, {
|
6389
6285
|
instructions: __spreadArray([], instructions, true),
|
@@ -6394,7 +6290,7 @@ var PerpetualsClient = (function () {
|
|
6394
6290
|
});
|
6395
6291
|
};
|
6396
6292
|
this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6397
|
-
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp,
|
6293
|
+
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_41;
|
6398
6294
|
return __generator(this, function (_a) {
|
6399
6295
|
switch (_a.label) {
|
6400
6296
|
case 0:
|
@@ -6432,8 +6328,8 @@ var PerpetualsClient = (function () {
|
|
6432
6328
|
instructions.push(renameFlp);
|
6433
6329
|
return [3, 4];
|
6434
6330
|
case 3:
|
6435
|
-
|
6436
|
-
console.log("perpClient renameFlp error:: ",
|
6331
|
+
err_41 = _a.sent();
|
6332
|
+
console.log("perpClient renameFlp error:: ", err_41);
|
6437
6333
|
return [3, 4];
|
6438
6334
|
case 4: return [2, {
|
6439
6335
|
instructions: __spreadArray([], instructions, true),
|
@@ -6443,7 +6339,7 @@ var PerpetualsClient = (function () {
|
|
6443
6339
|
});
|
6444
6340
|
}); };
|
6445
6341
|
this.initRewardDistribution = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6446
|
-
var publicKey, rewardMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, transferAuthority, initRewardVault,
|
6342
|
+
var publicKey, rewardMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, transferAuthority, initRewardVault, err_42;
|
6447
6343
|
return __generator(this, function (_a) {
|
6448
6344
|
switch (_a.label) {
|
6449
6345
|
case 0:
|
@@ -6477,9 +6373,9 @@ var PerpetualsClient = (function () {
|
|
6477
6373
|
instructions.push(initRewardVault);
|
6478
6374
|
return [3, 4];
|
6479
6375
|
case 3:
|
6480
|
-
|
6481
|
-
console.log("rewardDistribution InitRewardVault error:: ",
|
6482
|
-
throw
|
6376
|
+
err_42 = _a.sent();
|
6377
|
+
console.log("rewardDistribution InitRewardVault error:: ", err_42);
|
6378
|
+
throw err_42;
|
6483
6379
|
case 4: return [2, {
|
6484
6380
|
instructions: __spreadArray([], instructions, true),
|
6485
6381
|
additionalSigners: additionalSigners
|
@@ -6488,7 +6384,7 @@ var PerpetualsClient = (function () {
|
|
6488
6384
|
});
|
6489
6385
|
}); };
|
6490
6386
|
this.updateCounterReward = function () { return __awaiter(_this, void 0, void 0, function () {
|
6491
|
-
var publicKey, instructions, additionalSigners, rewardVault, updateCounter,
|
6387
|
+
var publicKey, instructions, additionalSigners, rewardVault, updateCounter, err_43;
|
6492
6388
|
return __generator(this, function (_a) {
|
6493
6389
|
switch (_a.label) {
|
6494
6390
|
case 0:
|
@@ -6511,9 +6407,9 @@ var PerpetualsClient = (function () {
|
|
6511
6407
|
instructions.push(updateCounter);
|
6512
6408
|
return [3, 4];
|
6513
6409
|
case 3:
|
6514
|
-
|
6515
|
-
console.log("rewardDistribution updateCounter error:: ",
|
6516
|
-
throw
|
6410
|
+
err_43 = _a.sent();
|
6411
|
+
console.log("rewardDistribution updateCounter error:: ", err_43);
|
6412
|
+
throw err_43;
|
6517
6413
|
case 4: return [2, {
|
6518
6414
|
instructions: __spreadArray([], instructions, true),
|
6519
6415
|
additionalSigners: additionalSigners
|
@@ -6522,7 +6418,7 @@ var PerpetualsClient = (function () {
|
|
6522
6418
|
});
|
6523
6419
|
}); };
|
6524
6420
|
this.rewardDistribution = function (counter, owner, rewardAmount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6525
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, rewardRecord, distributeReward,
|
6421
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, rewardRecord, distributeReward, err_44;
|
6526
6422
|
return __generator(this, function (_a) {
|
6527
6423
|
switch (_a.label) {
|
6528
6424
|
case 0:
|
@@ -6561,9 +6457,9 @@ var PerpetualsClient = (function () {
|
|
6561
6457
|
instructions.push(distributeReward);
|
6562
6458
|
return [3, 4];
|
6563
6459
|
case 3:
|
6564
|
-
|
6565
|
-
console.log("rewardDistribution distributeReward error:: ",
|
6566
|
-
throw
|
6460
|
+
err_44 = _a.sent();
|
6461
|
+
console.log("rewardDistribution distributeReward error:: ", err_44);
|
6462
|
+
throw err_44;
|
6567
6463
|
case 4: return [2, {
|
6568
6464
|
instructions: __spreadArray([], instructions, true),
|
6569
6465
|
additionalSigners: additionalSigners
|
@@ -6574,7 +6470,7 @@ var PerpetualsClient = (function () {
|
|
6574
6470
|
this.collectReward = function (counter, owner, rewardSymbol, poolConfig, createUserATA) {
|
6575
6471
|
if (createUserATA === void 0) { createUserATA = true; }
|
6576
6472
|
return __awaiter(_this, void 0, void 0, function () {
|
6577
|
-
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;
|
6578
6474
|
return __generator(this, function (_b) {
|
6579
6475
|
switch (_b.label) {
|
6580
6476
|
case 0:
|
@@ -6620,8 +6516,8 @@ var PerpetualsClient = (function () {
|
|
6620
6516
|
instructions.push(collectNftReward);
|
6621
6517
|
return [3, 6];
|
6622
6518
|
case 5:
|
6623
|
-
|
6624
|
-
throw
|
6519
|
+
err_45 = _b.sent();
|
6520
|
+
throw err_45;
|
6625
6521
|
case 6: return [2, {
|
6626
6522
|
instructions: __spreadArray([], instructions, true),
|
6627
6523
|
additionalSigners: additionalSigners
|