flash-sdk 2.50.0 → 2.50.2
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 +1 -0
- package/dist/PerpetualsClient.js +299 -259
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/PerpetualsClient.js
CHANGED
@@ -719,8 +719,7 @@ var PerpetualsClient = (function () {
|
|
719
719
|
return { feeBps: fees.minFee, feeAmount: anchor_1.BN.max(amountAdd, amountRemove).mul(fees.minFee).div(new anchor_1.BN(constants_1.RATE_POWER)) };
|
720
720
|
}
|
721
721
|
var newRatio = _this.getNewRatioHelper(amountAdd, amountRemove, inputTokenCustodyAccount, maxOraclePrice, poolAumUsdMax);
|
722
|
-
var
|
723
|
-
var index = inputCustodyConfig.custodyId;
|
722
|
+
var index = poolAccount.custodies.findIndex(function (c) { return c.equals(inputTokenCustodyAccount.publicKey); });
|
724
723
|
var ratios = poolAccount.ratios[index];
|
725
724
|
var fee = constants_1.BN_ZERO;
|
726
725
|
if (action == types_1.FeesAction.AddLiquidity || action == types_1.FeesAction.SwapIn || action == types_1.FeesAction.StableSwapIn) {
|
@@ -2508,6 +2507,47 @@ var PerpetualsClient = (function () {
|
|
2508
2507
|
});
|
2509
2508
|
});
|
2510
2509
|
};
|
2510
|
+
this.getLiquidationPriceView = function (positionAccountKey, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
2511
|
+
var positionAccount_1, marketConfig_1, targetCustodyConfig, collateralCustodyConfig, err_2;
|
2512
|
+
return __generator(this, function (_a) {
|
2513
|
+
switch (_a.label) {
|
2514
|
+
case 0:
|
2515
|
+
_a.trys.push([0, 3, , 4]);
|
2516
|
+
return [4, this.getPosition(positionAccountKey)];
|
2517
|
+
case 1:
|
2518
|
+
positionAccount_1 = _a.sent();
|
2519
|
+
marketConfig_1 = poolConfig.markets.find(function (m) { return m.marketAccount.equals(positionAccount_1.market); });
|
2520
|
+
if (!marketConfig_1) {
|
2521
|
+
throw new Error("Market config not found for position account: ".concat(positionAccountKey.toBase58()));
|
2522
|
+
}
|
2523
|
+
targetCustodyConfig = poolConfig.custodies.find(function (f) { return f.custodyAccount.equals(marketConfig_1.targetCustody); });
|
2524
|
+
collateralCustodyConfig = poolConfig.custodies.find(function (f) { return f.custodyAccount.equals(marketConfig_1.collateralCustody); });
|
2525
|
+
return [4, this.program.methods
|
2526
|
+
.getLiquidationPrice({})
|
2527
|
+
.accounts({
|
2528
|
+
perpetuals: this.perpetuals.publicKey,
|
2529
|
+
pool: poolConfig.poolAddress,
|
2530
|
+
position: positionAccountKey,
|
2531
|
+
targetCustody: targetCustodyConfig.custodyAccount,
|
2532
|
+
targetOracleAccount: targetCustodyConfig.intOracleAccount,
|
2533
|
+
collateralCustody: collateralCustodyConfig.custodyAccount,
|
2534
|
+
collateralOracleAccount: collateralCustodyConfig.intOracleAccount,
|
2535
|
+
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
2536
|
+
})
|
2537
|
+
.view()
|
2538
|
+
.catch(function (err) {
|
2539
|
+
console.error(err);
|
2540
|
+
throw err;
|
2541
|
+
})];
|
2542
|
+
case 2: return [2, _a.sent()];
|
2543
|
+
case 3:
|
2544
|
+
err_2 = _a.sent();
|
2545
|
+
console.error("Error in getLiquidationPriceView:", err_2);
|
2546
|
+
throw err_2;
|
2547
|
+
case 4: return [2];
|
2548
|
+
}
|
2549
|
+
});
|
2550
|
+
}); };
|
2511
2551
|
this.getLiquidationStateView = function (positionAccount, poolName, tokenMint, collateralMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
2512
2552
|
var targetCustodyConfig, collateralCustodyConfig;
|
2513
2553
|
return __generator(this, function (_a) {
|
@@ -2853,7 +2893,7 @@ var PerpetualsClient = (function () {
|
|
2853
2893
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
2854
2894
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
2855
2895
|
return __awaiter(_this, void 0, void 0, function () {
|
2856
|
-
var publicKey, userInputCustodyConfig, collateralCustodyConfig, targetCustodyConfig, marketAccount, positionAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userInputTokenAccount, lamports, unWrappedSolBalance, _a, userOutputTokenAccount, tokenAccountBalance, _b, userOutputTokenAccount, inx,
|
2896
|
+
var publicKey, userInputCustodyConfig, collateralCustodyConfig, targetCustodyConfig, marketAccount, positionAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userInputTokenAccount, lamports, unWrappedSolBalance, _a, userOutputTokenAccount, tokenAccountBalance, _b, userOutputTokenAccount, inx, err_3;
|
2857
2897
|
return __generator(this, function (_c) {
|
2858
2898
|
switch (_c.label) {
|
2859
2899
|
case 0:
|
@@ -2982,9 +3022,9 @@ var PerpetualsClient = (function () {
|
|
2982
3022
|
instructions.push(inx);
|
2983
3023
|
return [3, 13];
|
2984
3024
|
case 12:
|
2985
|
-
|
2986
|
-
console.error("perpClient SwapAndOpen error:: ",
|
2987
|
-
throw
|
3025
|
+
err_3 = _c.sent();
|
3026
|
+
console.error("perpClient SwapAndOpen error:: ", err_3);
|
3027
|
+
throw err_3;
|
2988
3028
|
case 13: return [2, {
|
2989
3029
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
2990
3030
|
additionalSigners: additionalSigners
|
@@ -2999,7 +3039,7 @@ var PerpetualsClient = (function () {
|
|
2999
3039
|
if (rebateTokenAccount === void 0) { rebateTokenAccount = web3_js_1.PublicKey.default; }
|
3000
3040
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
3001
3041
|
return __awaiter(_this, void 0, void 0, function () {
|
3002
|
-
var publicKey, userOutputCustodyConfig, collateralCustodyConfig, targetCustodyConfig, marketAccount, positionAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userReceivingTokenAccount, lamports, userCollateralTokenAccount, inx,
|
3042
|
+
var publicKey, userOutputCustodyConfig, collateralCustodyConfig, targetCustodyConfig, marketAccount, positionAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userReceivingTokenAccount, lamports, userCollateralTokenAccount, inx, err_4;
|
3003
3043
|
return __generator(this, function (_a) {
|
3004
3044
|
switch (_a.label) {
|
3005
3045
|
case 0:
|
@@ -3102,9 +3142,9 @@ var PerpetualsClient = (function () {
|
|
3102
3142
|
instructions.push(inx);
|
3103
3143
|
return [3, 9];
|
3104
3144
|
case 8:
|
3105
|
-
|
3106
|
-
console.error("perpClient CloseAndSwap error:: ",
|
3107
|
-
throw
|
3145
|
+
err_4 = _a.sent();
|
3146
|
+
console.error("perpClient CloseAndSwap error:: ", err_4);
|
3147
|
+
throw err_4;
|
3108
3148
|
case 9: return [2, {
|
3109
3149
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
3110
3150
|
additionalSigners: additionalSigners
|
@@ -3120,7 +3160,7 @@ var PerpetualsClient = (function () {
|
|
3120
3160
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
3121
3161
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
3122
3162
|
return __awaiter(_this, void 0, void 0, function () {
|
3123
|
-
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, _i, _e, custody, params, inx, closeWsolATAIns,
|
3163
|
+
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, _i, _e, custody, params, inx, closeWsolATAIns, err_5;
|
3124
3164
|
return __generator(this, function (_f) {
|
3125
3165
|
switch (_f.label) {
|
3126
3166
|
case 0:
|
@@ -3317,9 +3357,9 @@ var PerpetualsClient = (function () {
|
|
3317
3357
|
}
|
3318
3358
|
return [3, 20];
|
3319
3359
|
case 19:
|
3320
|
-
|
3321
|
-
console.error("perpClient Swap error:: ",
|
3322
|
-
throw
|
3360
|
+
err_5 = _f.sent();
|
3361
|
+
console.error("perpClient Swap error:: ", err_5);
|
3362
|
+
throw err_5;
|
3323
3363
|
case 20: return [2, {
|
3324
3364
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
3325
3365
|
additionalSigners: additionalSigners
|
@@ -3329,7 +3369,7 @@ var PerpetualsClient = (function () {
|
|
3329
3369
|
});
|
3330
3370
|
};
|
3331
3371
|
this.swapFeeInternal = function (rewardTokenSymbol, swapTokenSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
3332
|
-
var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx,
|
3372
|
+
var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx, err_6;
|
3333
3373
|
return __generator(this, function (_b) {
|
3334
3374
|
switch (_b.label) {
|
3335
3375
|
case 0:
|
@@ -3389,9 +3429,9 @@ var PerpetualsClient = (function () {
|
|
3389
3429
|
instructions.push(inx);
|
3390
3430
|
return [3, 4];
|
3391
3431
|
case 3:
|
3392
|
-
|
3393
|
-
console.error("perpClient Swap error:: ",
|
3394
|
-
throw
|
3432
|
+
err_6 = _b.sent();
|
3433
|
+
console.error("perpClient Swap error:: ", err_6);
|
3434
|
+
throw err_6;
|
3395
3435
|
case 4: return [2, {
|
3396
3436
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
3397
3437
|
additionalSigners: additionalSigners
|
@@ -3938,7 +3978,7 @@ var PerpetualsClient = (function () {
|
|
3938
3978
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
3939
3979
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
3940
3980
|
return __awaiter(_this, void 0, void 0, function () {
|
3941
|
-
var publicKey, payTokenCustodyConfig, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userPayingTokenAccount, lpTokenAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, lamports, unWrappedSolBalance, _d, tokenAccountBalance, _e, instruction,
|
3981
|
+
var publicKey, payTokenCustodyConfig, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userPayingTokenAccount, lpTokenAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, lamports, unWrappedSolBalance, _d, tokenAccountBalance, _e, instruction, err_7;
|
3942
3982
|
return __generator(this, function (_f) {
|
3943
3983
|
switch (_f.label) {
|
3944
3984
|
case 0:
|
@@ -4059,9 +4099,9 @@ var PerpetualsClient = (function () {
|
|
4059
4099
|
instructions.push(instruction);
|
4060
4100
|
return [3, 11];
|
4061
4101
|
case 10:
|
4062
|
-
|
4063
|
-
console.error("perpClient addLiquidity error:: ",
|
4064
|
-
throw
|
4102
|
+
err_7 = _f.sent();
|
4103
|
+
console.error("perpClient addLiquidity error:: ", err_7);
|
4104
|
+
throw err_7;
|
4065
4105
|
case 11: return [2, {
|
4066
4106
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
4067
4107
|
additionalSigners: additionalSigners
|
@@ -4208,7 +4248,7 @@ var PerpetualsClient = (function () {
|
|
4208
4248
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
4209
4249
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
4210
4250
|
return __awaiter(_this, void 0, void 0, function () {
|
4211
|
-
var recieveTokenCustodyConfig, publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, stakedLpTokenAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, lamports, _d, removeLiquidityTx, closeInx, closeWsolATAIns,
|
4251
|
+
var recieveTokenCustodyConfig, publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, stakedLpTokenAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, lamports, _d, removeLiquidityTx, closeInx, closeWsolATAIns, err_8;
|
4212
4252
|
return __generator(this, function (_e) {
|
4213
4253
|
switch (_e.label) {
|
4214
4254
|
case 0:
|
@@ -4318,9 +4358,9 @@ var PerpetualsClient = (function () {
|
|
4318
4358
|
}
|
4319
4359
|
return [3, 8];
|
4320
4360
|
case 7:
|
4321
|
-
|
4322
|
-
console.log("perpClient removeLiquidity error:: ",
|
4323
|
-
throw
|
4361
|
+
err_8 = _e.sent();
|
4362
|
+
console.log("perpClient removeLiquidity error:: ", err_8);
|
4363
|
+
throw err_8;
|
4324
4364
|
case 8: return [2, {
|
4325
4365
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
4326
4366
|
additionalSigners: additionalSigners
|
@@ -4330,7 +4370,7 @@ var PerpetualsClient = (function () {
|
|
4330
4370
|
});
|
4331
4371
|
};
|
4332
4372
|
this.addReferral = function (tokenStakeAccount, nftReferralAccount) { return __awaiter(_this, void 0, void 0, function () {
|
4333
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, addReferralInstruction,
|
4373
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, addReferralInstruction, err_9;
|
4334
4374
|
return __generator(this, function (_a) {
|
4335
4375
|
switch (_a.label) {
|
4336
4376
|
case 0:
|
@@ -4357,9 +4397,9 @@ var PerpetualsClient = (function () {
|
|
4357
4397
|
instructions.push(addReferralInstruction);
|
4358
4398
|
return [3, 4];
|
4359
4399
|
case 3:
|
4360
|
-
|
4361
|
-
console.log("perpClient addReferral error:: ",
|
4362
|
-
throw
|
4400
|
+
err_9 = _a.sent();
|
4401
|
+
console.log("perpClient addReferral error:: ", err_9);
|
4402
|
+
throw err_9;
|
4363
4403
|
case 4: return [2, {
|
4364
4404
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
4365
4405
|
additionalSigners: additionalSigners
|
@@ -4368,7 +4408,7 @@ var PerpetualsClient = (function () {
|
|
4368
4408
|
});
|
4369
4409
|
}); };
|
4370
4410
|
this.createNftTradingAccount = function (nftMint, owner, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
4371
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, nftTradingAccount, metadataAccount, createNftTradingAccountInstruction,
|
4411
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, nftTradingAccount, metadataAccount, createNftTradingAccountInstruction, err_10;
|
4372
4412
|
return __generator(this, function (_a) {
|
4373
4413
|
switch (_a.label) {
|
4374
4414
|
case 0:
|
@@ -4403,9 +4443,9 @@ var PerpetualsClient = (function () {
|
|
4403
4443
|
instructions.push(createNftTradingAccountInstruction);
|
4404
4444
|
return [3, 4];
|
4405
4445
|
case 3:
|
4406
|
-
|
4407
|
-
console.log("perpClient createNftAccount error:: ",
|
4408
|
-
throw
|
4446
|
+
err_10 = _a.sent();
|
4447
|
+
console.log("perpClient createNftAccount error:: ", err_10);
|
4448
|
+
throw err_10;
|
4409
4449
|
case 4: return [2, {
|
4410
4450
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
4411
4451
|
additionalSigners: additionalSigners
|
@@ -4414,7 +4454,7 @@ var PerpetualsClient = (function () {
|
|
4414
4454
|
});
|
4415
4455
|
}); };
|
4416
4456
|
this.updateNftAccount = function (nftMint, updateReferer, updateBooster, flpStakeAccounts) { return __awaiter(_this, void 0, void 0, function () {
|
4417
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, nftTradingAccount, nftReferralAccount, nftTokenAccount, flpStakeAccountMetas, _i, flpStakeAccounts_1, flpStakeAccountPk, updateNftTradingAccountInstruction,
|
4457
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, nftTradingAccount, nftReferralAccount, nftTokenAccount, flpStakeAccountMetas, _i, flpStakeAccounts_1, flpStakeAccountPk, updateNftTradingAccountInstruction, err_11;
|
4418
4458
|
return __generator(this, function (_a) {
|
4419
4459
|
switch (_a.label) {
|
4420
4460
|
case 0:
|
@@ -4464,9 +4504,9 @@ var PerpetualsClient = (function () {
|
|
4464
4504
|
instructions.push(updateNftTradingAccountInstruction);
|
4465
4505
|
return [3, 5];
|
4466
4506
|
case 4:
|
4467
|
-
|
4468
|
-
console.log("perpClient updateNftAccount error:: ",
|
4469
|
-
throw
|
4507
|
+
err_11 = _a.sent();
|
4508
|
+
console.log("perpClient updateNftAccount error:: ", err_11);
|
4509
|
+
throw err_11;
|
4470
4510
|
case 5: return [2, {
|
4471
4511
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
4472
4512
|
additionalSigners: additionalSigners
|
@@ -4475,7 +4515,7 @@ var PerpetualsClient = (function () {
|
|
4475
4515
|
});
|
4476
4516
|
}); };
|
4477
4517
|
this.levelUp = function (poolConfig, nftMint, authorizationRulesAccount) { return __awaiter(_this, void 0, void 0, function () {
|
4478
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, nftTradingAccount, metadataAccount, levelUpInstruction,
|
4518
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, nftTradingAccount, metadataAccount, levelUpInstruction, err_12;
|
4479
4519
|
return __generator(this, function (_a) {
|
4480
4520
|
switch (_a.label) {
|
4481
4521
|
case 0:
|
@@ -4514,9 +4554,9 @@ var PerpetualsClient = (function () {
|
|
4514
4554
|
instructions.push(levelUpInstruction);
|
4515
4555
|
return [3, 4];
|
4516
4556
|
case 3:
|
4517
|
-
|
4518
|
-
console.log("perpClient levelUp error:: ",
|
4519
|
-
throw
|
4557
|
+
err_12 = _a.sent();
|
4558
|
+
console.log("perpClient levelUp error:: ", err_12);
|
4559
|
+
throw err_12;
|
4520
4560
|
case 4: return [2, {
|
4521
4561
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
4522
4562
|
additionalSigners: additionalSigners
|
@@ -4525,7 +4565,7 @@ var PerpetualsClient = (function () {
|
|
4525
4565
|
});
|
4526
4566
|
}); };
|
4527
4567
|
this.initStake = function (stakingFeeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
4528
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction,
|
4568
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_13;
|
4529
4569
|
return __generator(this, function (_a) {
|
4530
4570
|
switch (_a.label) {
|
4531
4571
|
case 0:
|
@@ -4563,9 +4603,9 @@ var PerpetualsClient = (function () {
|
|
4563
4603
|
instructions.push(initStakeInstruction);
|
4564
4604
|
return [3, 4];
|
4565
4605
|
case 3:
|
4566
|
-
|
4567
|
-
console.log("perpClient InitStaking error:: ",
|
4568
|
-
throw
|
4606
|
+
err_13 = _a.sent();
|
4607
|
+
console.log("perpClient InitStaking error:: ", err_13);
|
4608
|
+
throw err_13;
|
4569
4609
|
case 4: return [2, {
|
4570
4610
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
4571
4611
|
additionalSigners: additionalSigners
|
@@ -4574,7 +4614,7 @@ var PerpetualsClient = (function () {
|
|
4574
4614
|
});
|
4575
4615
|
}); };
|
4576
4616
|
this.initCompounding = function (feeShareBps, metadataTitle, metadataSymbol, metadataUri, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
4577
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction,
|
4617
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_14;
|
4578
4618
|
return __generator(this, function (_a) {
|
4579
4619
|
switch (_a.label) {
|
4580
4620
|
case 0:
|
@@ -4619,9 +4659,9 @@ var PerpetualsClient = (function () {
|
|
4619
4659
|
instructions.push(initCompoundingInstruction);
|
4620
4660
|
return [3, 4];
|
4621
4661
|
case 3:
|
4622
|
-
|
4623
|
-
console.log("perpClient initCompounding error:: ",
|
4624
|
-
throw
|
4662
|
+
err_14 = _a.sent();
|
4663
|
+
console.log("perpClient initCompounding error:: ", err_14);
|
4664
|
+
throw err_14;
|
4625
4665
|
case 4: return [2, {
|
4626
4666
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
4627
4667
|
additionalSigners: additionalSigners
|
@@ -4630,7 +4670,7 @@ var PerpetualsClient = (function () {
|
|
4630
4670
|
});
|
4631
4671
|
}); };
|
4632
4672
|
this.depositStake = function (owner, feePayer, depositAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
4633
|
-
var preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, depositStakeInstruction,
|
4673
|
+
var preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, depositStakeInstruction, err_15;
|
4634
4674
|
return __generator(this, function (_a) {
|
4635
4675
|
switch (_a.label) {
|
4636
4676
|
case 0:
|
@@ -4671,9 +4711,9 @@ var PerpetualsClient = (function () {
|
|
4671
4711
|
instructions.push(depositStakeInstruction);
|
4672
4712
|
return [3, 5];
|
4673
4713
|
case 4:
|
4674
|
-
|
4675
|
-
console.log("perpClient depositStaking error:: ",
|
4676
|
-
throw
|
4714
|
+
err_15 = _a.sent();
|
4715
|
+
console.log("perpClient depositStaking error:: ", err_15);
|
4716
|
+
throw err_15;
|
4677
4717
|
case 5: return [2, {
|
4678
4718
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
4679
4719
|
additionalSigners: additionalSigners
|
@@ -4682,7 +4722,7 @@ var PerpetualsClient = (function () {
|
|
4682
4722
|
});
|
4683
4723
|
}); };
|
4684
4724
|
this.refreshStakeWithAllFlpStakeAccounts = function (rewardSymbol, poolConfig, flpStakeAccountPks) { return __awaiter(_this, void 0, void 0, function () {
|
4685
|
-
var rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_1, flpStakeAccountPk, refreshStakeInstruction,
|
4725
|
+
var rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_1, flpStakeAccountPk, refreshStakeInstruction, err_16;
|
4686
4726
|
return __generator(this, function (_c) {
|
4687
4727
|
switch (_c.label) {
|
4688
4728
|
case 0:
|
@@ -4729,9 +4769,9 @@ var PerpetualsClient = (function () {
|
|
4729
4769
|
refreshStakeInstruction = _c.sent();
|
4730
4770
|
return [2, refreshStakeInstruction];
|
4731
4771
|
case 2:
|
4732
|
-
|
4733
|
-
console.log("perpClient refreshStaking error:: ",
|
4734
|
-
throw
|
4772
|
+
err_16 = _c.sent();
|
4773
|
+
console.log("perpClient refreshStaking error:: ", err_16);
|
4774
|
+
throw err_16;
|
4735
4775
|
case 3: return [2];
|
4736
4776
|
}
|
4737
4777
|
});
|
@@ -4739,7 +4779,7 @@ var PerpetualsClient = (function () {
|
|
4739
4779
|
this.refreshStakeWithTokenStake = function (rewardSymbol, poolConfig, flpStakeAccountPk, userPublicKey) {
|
4740
4780
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
4741
4781
|
return __awaiter(_this, void 0, void 0, function () {
|
4742
|
-
var publicKey, rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _i, _a, custody, stakeAccountMetas, tokenStakeAccount, refreshStakeInstruction,
|
4782
|
+
var publicKey, rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _i, _a, custody, stakeAccountMetas, tokenStakeAccount, refreshStakeInstruction, err_17;
|
4743
4783
|
return __generator(this, function (_b) {
|
4744
4784
|
switch (_b.label) {
|
4745
4785
|
case 0:
|
@@ -4786,9 +4826,9 @@ var PerpetualsClient = (function () {
|
|
4786
4826
|
refreshStakeInstruction = _b.sent();
|
4787
4827
|
return [2, refreshStakeInstruction];
|
4788
4828
|
case 2:
|
4789
|
-
|
4790
|
-
console.log("perpClient refreshStaking error:: ",
|
4791
|
-
throw
|
4829
|
+
err_17 = _b.sent();
|
4830
|
+
console.log("perpClient refreshStaking error:: ", err_17);
|
4831
|
+
throw err_17;
|
4792
4832
|
case 3: return [2];
|
4793
4833
|
}
|
4794
4834
|
});
|
@@ -4797,7 +4837,7 @@ var PerpetualsClient = (function () {
|
|
4797
4837
|
this.unstakeInstant = function (rewardSymbol, unstakeAmount, poolConfig, userPublicKey) {
|
4798
4838
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
4799
4839
|
return __awaiter(_this, void 0, void 0, function () {
|
4800
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, pool, flpStakeAccount, tokenStakeAccount, tokenStakeAccounts, _a, unstakeInstantInstruction,
|
4840
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, pool, flpStakeAccount, tokenStakeAccount, tokenStakeAccounts, _a, unstakeInstantInstruction, err_18;
|
4801
4841
|
return __generator(this, function (_b) {
|
4802
4842
|
switch (_b.label) {
|
4803
4843
|
case 0:
|
@@ -4848,9 +4888,9 @@ var PerpetualsClient = (function () {
|
|
4848
4888
|
instructions.push(unstakeInstantInstruction);
|
4849
4889
|
return [3, 6];
|
4850
4890
|
case 5:
|
4851
|
-
|
4852
|
-
console.log("perpClient unstakeInstant error:: ",
|
4853
|
-
throw
|
4891
|
+
err_18 = _b.sent();
|
4892
|
+
console.log("perpClient unstakeInstant error:: ", err_18);
|
4893
|
+
throw err_18;
|
4854
4894
|
case 6: return [2, {
|
4855
4895
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
4856
4896
|
additionalSigners: additionalSigners
|
@@ -4860,7 +4900,7 @@ var PerpetualsClient = (function () {
|
|
4860
4900
|
});
|
4861
4901
|
};
|
4862
4902
|
this.setFeeShareBps = function (poolConfig, flpStakeAccountPks) { return __awaiter(_this, void 0, void 0, function () {
|
4863
|
-
var publicKey, pool, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_2, flpStakeAccountPk, refreshStakeInstruction,
|
4903
|
+
var publicKey, pool, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_2, flpStakeAccountPk, refreshStakeInstruction, err_19;
|
4864
4904
|
return __generator(this, function (_c) {
|
4865
4905
|
switch (_c.label) {
|
4866
4906
|
case 0:
|
@@ -4904,15 +4944,15 @@ var PerpetualsClient = (function () {
|
|
4904
4944
|
refreshStakeInstruction = _c.sent();
|
4905
4945
|
return [2, refreshStakeInstruction];
|
4906
4946
|
case 2:
|
4907
|
-
|
4908
|
-
console.log("perpClient refreshStaking error:: ",
|
4909
|
-
throw
|
4947
|
+
err_19 = _c.sent();
|
4948
|
+
console.log("perpClient refreshStaking error:: ", err_19);
|
4949
|
+
throw err_19;
|
4910
4950
|
case 3: return [2];
|
4911
4951
|
}
|
4912
4952
|
});
|
4913
4953
|
}); };
|
4914
4954
|
this.unstakeRequest = function (unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
4915
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, unstakeRequestInstruction,
|
4955
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, unstakeRequestInstruction, err_20;
|
4916
4956
|
return __generator(this, function (_a) {
|
4917
4957
|
switch (_a.label) {
|
4918
4958
|
case 0:
|
@@ -4946,9 +4986,9 @@ var PerpetualsClient = (function () {
|
|
4946
4986
|
instructions.push(unstakeRequestInstruction);
|
4947
4987
|
return [3, 4];
|
4948
4988
|
case 3:
|
4949
|
-
|
4950
|
-
console.log("perpClient unstakeRequest error:: ",
|
4951
|
-
throw
|
4989
|
+
err_20 = _a.sent();
|
4990
|
+
console.log("perpClient unstakeRequest error:: ", err_20);
|
4991
|
+
throw err_20;
|
4952
4992
|
case 4: return [2, {
|
4953
4993
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
4954
4994
|
additionalSigners: additionalSigners
|
@@ -4962,7 +5002,7 @@ var PerpetualsClient = (function () {
|
|
4962
5002
|
if (createUserLPTA === void 0) { createUserLPTA = true; }
|
4963
5003
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
4964
5004
|
return __awaiter(_this, void 0, void 0, function () {
|
4965
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, pool, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, _a, withdrawStakeInstruction,
|
5005
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, pool, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, _a, withdrawStakeInstruction, err_21;
|
4966
5006
|
return __generator(this, function (_b) {
|
4967
5007
|
switch (_b.label) {
|
4968
5008
|
case 0:
|
@@ -5013,9 +5053,9 @@ var PerpetualsClient = (function () {
|
|
5013
5053
|
instructions.push(withdrawStakeInstruction);
|
5014
5054
|
return [3, 6];
|
5015
5055
|
case 5:
|
5016
|
-
|
5017
|
-
console.log("perpClient withdrawStake error:: ",
|
5018
|
-
throw
|
5056
|
+
err_21 = _b.sent();
|
5057
|
+
console.log("perpClient withdrawStake error:: ", err_21);
|
5058
|
+
throw err_21;
|
5019
5059
|
case 6: return [2, {
|
5020
5060
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5021
5061
|
additionalSigners: additionalSigners
|
@@ -5027,7 +5067,7 @@ var PerpetualsClient = (function () {
|
|
5027
5067
|
this.collectStakeFees = function (rewardSymbol, poolConfig, tokenStakeAccount, createUserATA) {
|
5028
5068
|
if (createUserATA === void 0) { createUserATA = true; }
|
5029
5069
|
return __awaiter(_this, void 0, void 0, function () {
|
5030
|
-
var publicKey, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tokenStakeAccounts, withdrawStakeInstruction,
|
5070
|
+
var publicKey, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tokenStakeAccounts, withdrawStakeInstruction, err_22;
|
5031
5071
|
return __generator(this, function (_b) {
|
5032
5072
|
switch (_b.label) {
|
5033
5073
|
case 0:
|
@@ -5086,9 +5126,9 @@ var PerpetualsClient = (function () {
|
|
5086
5126
|
instructions.push(withdrawStakeInstruction);
|
5087
5127
|
return [3, 6];
|
5088
5128
|
case 5:
|
5089
|
-
|
5090
|
-
console.log("perpClient withdrawStake error:: ",
|
5091
|
-
throw
|
5129
|
+
err_22 = _b.sent();
|
5130
|
+
console.log("perpClient withdrawStake error:: ", err_22);
|
5131
|
+
throw err_22;
|
5092
5132
|
case 6: return [2, {
|
5093
5133
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5094
5134
|
additionalSigners: additionalSigners
|
@@ -5098,7 +5138,7 @@ var PerpetualsClient = (function () {
|
|
5098
5138
|
});
|
5099
5139
|
};
|
5100
5140
|
this.initTokenVault = function (token_permissions, tokens_to_distribute, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5101
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction,
|
5141
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_23;
|
5102
5142
|
return __generator(this, function (_a) {
|
5103
5143
|
switch (_a.label) {
|
5104
5144
|
case 0:
|
@@ -5139,9 +5179,9 @@ var PerpetualsClient = (function () {
|
|
5139
5179
|
instructions.push(initTokenVaultInstruction);
|
5140
5180
|
return [3, 4];
|
5141
5181
|
case 3:
|
5142
|
-
|
5143
|
-
console.log("perpClient InitTokenVaultInstruction error:: ",
|
5144
|
-
throw
|
5182
|
+
err_23 = _a.sent();
|
5183
|
+
console.log("perpClient InitTokenVaultInstruction error:: ", err_23);
|
5184
|
+
throw err_23;
|
5145
5185
|
case 4: return [2, {
|
5146
5186
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5147
5187
|
additionalSigners: additionalSigners
|
@@ -5150,7 +5190,7 @@ var PerpetualsClient = (function () {
|
|
5150
5190
|
});
|
5151
5191
|
}); };
|
5152
5192
|
this.setTokenVaultConfig = function (token_permissions, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5153
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction,
|
5193
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_24;
|
5154
5194
|
return __generator(this, function (_a) {
|
5155
5195
|
switch (_a.label) {
|
5156
5196
|
case 0:
|
@@ -5181,9 +5221,9 @@ var PerpetualsClient = (function () {
|
|
5181
5221
|
instructions.push(setTokenVaultConfigInstruction);
|
5182
5222
|
return [3, 4];
|
5183
5223
|
case 3:
|
5184
|
-
|
5185
|
-
console.log("perpClient setTokenVaultConfigInstruction error:: ",
|
5186
|
-
throw
|
5224
|
+
err_24 = _a.sent();
|
5225
|
+
console.log("perpClient setTokenVaultConfigInstruction error:: ", err_24);
|
5226
|
+
throw err_24;
|
5187
5227
|
case 4: return [2, {
|
5188
5228
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5189
5229
|
additionalSigners: additionalSigners
|
@@ -5192,7 +5232,7 @@ var PerpetualsClient = (function () {
|
|
5192
5232
|
});
|
5193
5233
|
}); };
|
5194
5234
|
this.withdrawInstantFee = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5195
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction,
|
5235
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_25;
|
5196
5236
|
return __generator(this, function (_a) {
|
5197
5237
|
switch (_a.label) {
|
5198
5238
|
case 0:
|
@@ -5230,9 +5270,9 @@ var PerpetualsClient = (function () {
|
|
5230
5270
|
instructions.push(withdrawInstantFeeInstruction);
|
5231
5271
|
return [3, 6];
|
5232
5272
|
case 5:
|
5233
|
-
|
5234
|
-
console.log("perpClient withdrawInstantFeeInstruction error:: ",
|
5235
|
-
throw
|
5273
|
+
err_25 = _a.sent();
|
5274
|
+
console.log("perpClient withdrawInstantFeeInstruction error:: ", err_25);
|
5275
|
+
throw err_25;
|
5236
5276
|
case 6: return [2, {
|
5237
5277
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5238
5278
|
additionalSigners: additionalSigners
|
@@ -5241,7 +5281,7 @@ var PerpetualsClient = (function () {
|
|
5241
5281
|
});
|
5242
5282
|
}); };
|
5243
5283
|
this.initRevenueTokenAccount = function (feeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5244
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction,
|
5284
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_26;
|
5245
5285
|
return __generator(this, function (_a) {
|
5246
5286
|
switch (_a.label) {
|
5247
5287
|
case 0:
|
@@ -5278,9 +5318,9 @@ var PerpetualsClient = (function () {
|
|
5278
5318
|
instructions.push(initRevenueTokenAccountInstruction);
|
5279
5319
|
return [3, 4];
|
5280
5320
|
case 3:
|
5281
|
-
|
5282
|
-
console.log("perpClient initRevenueTokenAccountInstruction error:: ",
|
5283
|
-
throw
|
5321
|
+
err_26 = _a.sent();
|
5322
|
+
console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_26);
|
5323
|
+
throw err_26;
|
5284
5324
|
case 4: return [2, {
|
5285
5325
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5286
5326
|
additionalSigners: additionalSigners
|
@@ -5289,7 +5329,7 @@ var PerpetualsClient = (function () {
|
|
5289
5329
|
});
|
5290
5330
|
}); };
|
5291
5331
|
this.burnAndClaim = function (owner, nftMint, poolConfig, createAta) { return __awaiter(_this, void 0, void 0, function () {
|
5292
|
-
var preInstructions, instructions, postInstructions, additionalSigners, userTokenAccount, _a, nftTokenAccount, nftTradingAccount, metadataAccount, collectionMetadata, edition, tokenRecord, burnAndClaimInstruction,
|
5332
|
+
var preInstructions, instructions, postInstructions, additionalSigners, userTokenAccount, _a, nftTokenAccount, nftTradingAccount, metadataAccount, collectionMetadata, edition, tokenRecord, burnAndClaimInstruction, err_27;
|
5293
5333
|
return __generator(this, function (_b) {
|
5294
5334
|
switch (_b.label) {
|
5295
5335
|
case 0:
|
@@ -5353,9 +5393,9 @@ var PerpetualsClient = (function () {
|
|
5353
5393
|
instructions.push(burnAndClaimInstruction);
|
5354
5394
|
return [3, 8];
|
5355
5395
|
case 7:
|
5356
|
-
|
5357
|
-
console.log("perpClient burnAndClaimInstruction error:: ",
|
5358
|
-
throw
|
5396
|
+
err_27 = _b.sent();
|
5397
|
+
console.log("perpClient burnAndClaimInstruction error:: ", err_27);
|
5398
|
+
throw err_27;
|
5359
5399
|
case 8: return [2, {
|
5360
5400
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5361
5401
|
additionalSigners: additionalSigners
|
@@ -5364,7 +5404,7 @@ var PerpetualsClient = (function () {
|
|
5364
5404
|
});
|
5365
5405
|
}); };
|
5366
5406
|
this.burnAndStake = function (owner, feePayer, nftMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5367
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, nftTokenAccount, nftTradingAccount, metadataAccount, collectionMetadata, edition, tokenRecord, burnAndStakeInstruction,
|
5407
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, nftTokenAccount, nftTradingAccount, metadataAccount, collectionMetadata, edition, tokenRecord, burnAndStakeInstruction, err_28;
|
5368
5408
|
return __generator(this, function (_a) {
|
5369
5409
|
switch (_a.label) {
|
5370
5410
|
case 0:
|
@@ -5415,9 +5455,9 @@ var PerpetualsClient = (function () {
|
|
5415
5455
|
instructions.push(burnAndStakeInstruction);
|
5416
5456
|
return [3, 4];
|
5417
5457
|
case 3:
|
5418
|
-
|
5419
|
-
console.log("perpClient burnAndStakeInstruction error:: ",
|
5420
|
-
throw
|
5458
|
+
err_28 = _a.sent();
|
5459
|
+
console.log("perpClient burnAndStakeInstruction error:: ", err_28);
|
5460
|
+
throw err_28;
|
5421
5461
|
case 4: return [2, {
|
5422
5462
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5423
5463
|
additionalSigners: additionalSigners
|
@@ -5426,7 +5466,7 @@ var PerpetualsClient = (function () {
|
|
5426
5466
|
});
|
5427
5467
|
}); };
|
5428
5468
|
this.depositTokenStake = function (owner, feePayer, depositAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5429
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, depositTokenStakeInstruction,
|
5469
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, depositTokenStakeInstruction, err_29;
|
5430
5470
|
return __generator(this, function (_a) {
|
5431
5471
|
switch (_a.label) {
|
5432
5472
|
case 0:
|
@@ -5467,9 +5507,9 @@ var PerpetualsClient = (function () {
|
|
5467
5507
|
instructions.push(depositTokenStakeInstruction);
|
5468
5508
|
return [3, 5];
|
5469
5509
|
case 4:
|
5470
|
-
|
5471
|
-
console.log("perpClient depositStakingInstruction error:: ",
|
5472
|
-
throw
|
5510
|
+
err_29 = _a.sent();
|
5511
|
+
console.log("perpClient depositStakingInstruction error:: ", err_29);
|
5512
|
+
throw err_29;
|
5473
5513
|
case 5: return [2, {
|
5474
5514
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5475
5515
|
additionalSigners: additionalSigners
|
@@ -5478,7 +5518,7 @@ var PerpetualsClient = (function () {
|
|
5478
5518
|
});
|
5479
5519
|
}); };
|
5480
5520
|
this.unstakeTokenRequest = function (owner, unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5481
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, unstakeTokenRequestInstruction,
|
5521
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, unstakeTokenRequestInstruction, err_30;
|
5482
5522
|
return __generator(this, function (_a) {
|
5483
5523
|
switch (_a.label) {
|
5484
5524
|
case 0:
|
@@ -5507,9 +5547,9 @@ var PerpetualsClient = (function () {
|
|
5507
5547
|
instructions.push(unstakeTokenRequestInstruction);
|
5508
5548
|
return [3, 4];
|
5509
5549
|
case 3:
|
5510
|
-
|
5511
|
-
console.log("perpClient unstakeTokenRequestInstruction error:: ",
|
5512
|
-
throw
|
5550
|
+
err_30 = _a.sent();
|
5551
|
+
console.log("perpClient unstakeTokenRequestInstruction error:: ", err_30);
|
5552
|
+
throw err_30;
|
5513
5553
|
case 4: return [2, {
|
5514
5554
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5515
5555
|
additionalSigners: additionalSigners
|
@@ -5518,7 +5558,7 @@ var PerpetualsClient = (function () {
|
|
5518
5558
|
});
|
5519
5559
|
}); };
|
5520
5560
|
this.unstakeTokenInstant = function (owner, unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5521
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, unstakeTokenInstantInstruction,
|
5561
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, unstakeTokenInstantInstruction, err_31;
|
5522
5562
|
return __generator(this, function (_a) {
|
5523
5563
|
switch (_a.label) {
|
5524
5564
|
case 0:
|
@@ -5558,9 +5598,9 @@ var PerpetualsClient = (function () {
|
|
5558
5598
|
instructions.push(unstakeTokenInstantInstruction);
|
5559
5599
|
return [3, 5];
|
5560
5600
|
case 4:
|
5561
|
-
|
5562
|
-
console.log("perpClient unstakeTokenInstantInstruction error:: ",
|
5563
|
-
throw
|
5601
|
+
err_31 = _a.sent();
|
5602
|
+
console.log("perpClient unstakeTokenInstantInstruction error:: ", err_31);
|
5603
|
+
throw err_31;
|
5564
5604
|
case 5: return [2, {
|
5565
5605
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5566
5606
|
additionalSigners: additionalSigners
|
@@ -5569,7 +5609,7 @@ var PerpetualsClient = (function () {
|
|
5569
5609
|
});
|
5570
5610
|
}); };
|
5571
5611
|
this.withdrawToken = function (owner, withdrawRequestId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5572
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, withdrawTokenInstruction,
|
5612
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, withdrawTokenInstruction, err_32;
|
5573
5613
|
return __generator(this, function (_a) {
|
5574
5614
|
switch (_a.label) {
|
5575
5615
|
case 0:
|
@@ -5609,9 +5649,9 @@ var PerpetualsClient = (function () {
|
|
5609
5649
|
instructions.push(withdrawTokenInstruction);
|
5610
5650
|
return [3, 5];
|
5611
5651
|
case 4:
|
5612
|
-
|
5613
|
-
console.log("perpClient withdrawTokenInstruction error:: ",
|
5614
|
-
throw
|
5652
|
+
err_32 = _a.sent();
|
5653
|
+
console.log("perpClient withdrawTokenInstruction error:: ", err_32);
|
5654
|
+
throw err_32;
|
5615
5655
|
case 5: return [2, {
|
5616
5656
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5617
5657
|
additionalSigners: additionalSigners
|
@@ -5620,7 +5660,7 @@ var PerpetualsClient = (function () {
|
|
5620
5660
|
});
|
5621
5661
|
}); };
|
5622
5662
|
this.cancelUnstakeRequest = function (owner, withdrawRequestId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5623
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, cancelUnstakeRequestInstruction,
|
5663
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, cancelUnstakeRequestInstruction, err_33;
|
5624
5664
|
return __generator(this, function (_a) {
|
5625
5665
|
switch (_a.label) {
|
5626
5666
|
case 0:
|
@@ -5649,9 +5689,9 @@ var PerpetualsClient = (function () {
|
|
5649
5689
|
instructions.push(cancelUnstakeRequestInstruction);
|
5650
5690
|
return [3, 4];
|
5651
5691
|
case 3:
|
5652
|
-
|
5653
|
-
console.log("perpClient cancelUnstakeRequestInstruction error:: ",
|
5654
|
-
throw
|
5692
|
+
err_33 = _a.sent();
|
5693
|
+
console.log("perpClient cancelUnstakeRequestInstruction error:: ", err_33);
|
5694
|
+
throw err_33;
|
5655
5695
|
case 4: return [2, {
|
5656
5696
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5657
5697
|
additionalSigners: additionalSigners
|
@@ -5660,7 +5700,7 @@ var PerpetualsClient = (function () {
|
|
5660
5700
|
});
|
5661
5701
|
}); };
|
5662
5702
|
this.distributeTokenReward = function (amount, epochCount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5663
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction,
|
5703
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_34;
|
5664
5704
|
return __generator(this, function (_a) {
|
5665
5705
|
switch (_a.label) {
|
5666
5706
|
case 0:
|
@@ -5698,9 +5738,9 @@ var PerpetualsClient = (function () {
|
|
5698
5738
|
instructions.push(distributeTokenRewardInstruction);
|
5699
5739
|
return [3, 4];
|
5700
5740
|
case 3:
|
5701
|
-
|
5702
|
-
console.log("perpClient distributeTokenRewardInstruction error:: ",
|
5703
|
-
throw
|
5741
|
+
err_34 = _a.sent();
|
5742
|
+
console.log("perpClient distributeTokenRewardInstruction error:: ", err_34);
|
5743
|
+
throw err_34;
|
5704
5744
|
case 4: return [2, {
|
5705
5745
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5706
5746
|
additionalSigners: additionalSigners
|
@@ -5709,7 +5749,7 @@ var PerpetualsClient = (function () {
|
|
5709
5749
|
});
|
5710
5750
|
}); };
|
5711
5751
|
this.setTokenReward = function (owner, amount, epochCount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5712
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction,
|
5752
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_35;
|
5713
5753
|
return __generator(this, function (_a) {
|
5714
5754
|
switch (_a.label) {
|
5715
5755
|
case 0:
|
@@ -5741,9 +5781,9 @@ var PerpetualsClient = (function () {
|
|
5741
5781
|
instructions.push(setTokenRewardInstruction);
|
5742
5782
|
return [3, 4];
|
5743
5783
|
case 3:
|
5744
|
-
|
5745
|
-
console.log("perpClient setTokenRewardInstruction error:: ",
|
5746
|
-
throw
|
5784
|
+
err_35 = _a.sent();
|
5785
|
+
console.log("perpClient setTokenRewardInstruction error:: ", err_35);
|
5786
|
+
throw err_35;
|
5747
5787
|
case 4: return [2, {
|
5748
5788
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5749
5789
|
additionalSigners: additionalSigners
|
@@ -5754,7 +5794,7 @@ var PerpetualsClient = (function () {
|
|
5754
5794
|
this.collectTokenReward = function (owner, poolConfig, createUserATA) {
|
5755
5795
|
if (createUserATA === void 0) { createUserATA = true; }
|
5756
5796
|
return __awaiter(_this, void 0, void 0, function () {
|
5757
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, _a, collectTokenRewardInstruction,
|
5797
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, _a, collectTokenRewardInstruction, err_36;
|
5758
5798
|
return __generator(this, function (_b) {
|
5759
5799
|
switch (_b.label) {
|
5760
5800
|
case 0:
|
@@ -5798,9 +5838,9 @@ var PerpetualsClient = (function () {
|
|
5798
5838
|
instructions.push(collectTokenRewardInstruction);
|
5799
5839
|
return [3, 6];
|
5800
5840
|
case 5:
|
5801
|
-
|
5802
|
-
console.log("perpClient collectTokenRewardInstruction error:: ",
|
5803
|
-
throw
|
5841
|
+
err_36 = _b.sent();
|
5842
|
+
console.log("perpClient collectTokenRewardInstruction error:: ", err_36);
|
5843
|
+
throw err_36;
|
5804
5844
|
case 6: return [2, {
|
5805
5845
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5806
5846
|
additionalSigners: additionalSigners
|
@@ -5812,7 +5852,7 @@ var PerpetualsClient = (function () {
|
|
5812
5852
|
this.collectRevenue = function (owner, rewardSymbol, poolConfig, createUserATA) {
|
5813
5853
|
if (createUserATA === void 0) { createUserATA = true; }
|
5814
5854
|
return __awaiter(_this, void 0, void 0, function () {
|
5815
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, tokenStakeAccount, userTokenAccount, _a, collectRevenueInstruction,
|
5855
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, tokenStakeAccount, userTokenAccount, _a, collectRevenueInstruction, err_37;
|
5816
5856
|
return __generator(this, function (_b) {
|
5817
5857
|
switch (_b.label) {
|
5818
5858
|
case 0:
|
@@ -5857,9 +5897,9 @@ var PerpetualsClient = (function () {
|
|
5857
5897
|
instructions.push(collectRevenueInstruction);
|
5858
5898
|
return [3, 6];
|
5859
5899
|
case 5:
|
5860
|
-
|
5861
|
-
console.log("perpClient collectRevenueInstruction error:: ",
|
5862
|
-
throw
|
5900
|
+
err_37 = _b.sent();
|
5901
|
+
console.log("perpClient collectRevenueInstruction error:: ", err_37);
|
5902
|
+
throw err_37;
|
5863
5903
|
case 6: return [2, {
|
5864
5904
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5865
5905
|
additionalSigners: additionalSigners
|
@@ -5869,7 +5909,7 @@ var PerpetualsClient = (function () {
|
|
5869
5909
|
});
|
5870
5910
|
};
|
5871
5911
|
this.setTokenStakeLevel = function (owner, stakeLevel) { return __awaiter(_this, void 0, void 0, function () {
|
5872
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction,
|
5912
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_38;
|
5873
5913
|
return __generator(this, function (_a) {
|
5874
5914
|
switch (_a.label) {
|
5875
5915
|
case 0:
|
@@ -5897,9 +5937,9 @@ var PerpetualsClient = (function () {
|
|
5897
5937
|
instructions.push(setTokenStakeLevelInstruction);
|
5898
5938
|
return [3, 4];
|
5899
5939
|
case 3:
|
5900
|
-
|
5901
|
-
console.log("perpClient setTokenStakeLevelInstruction error:: ",
|
5902
|
-
throw
|
5940
|
+
err_38 = _a.sent();
|
5941
|
+
console.log("perpClient setTokenStakeLevelInstruction error:: ", err_38);
|
5942
|
+
throw err_38;
|
5903
5943
|
case 4: return [2, {
|
5904
5944
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5905
5945
|
additionalSigners: additionalSigners
|
@@ -5908,7 +5948,7 @@ var PerpetualsClient = (function () {
|
|
5908
5948
|
});
|
5909
5949
|
}); };
|
5910
5950
|
this.initRewardVault = function (nftCount, rewardSymbol, collectionMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5911
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, nftTransferAuthority, initRewardVault,
|
5951
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, nftTransferAuthority, initRewardVault, err_39;
|
5912
5952
|
return __generator(this, function (_a) {
|
5913
5953
|
switch (_a.label) {
|
5914
5954
|
case 0:
|
@@ -5945,9 +5985,9 @@ var PerpetualsClient = (function () {
|
|
5945
5985
|
instructions.push(initRewardVault);
|
5946
5986
|
return [3, 4];
|
5947
5987
|
case 3:
|
5948
|
-
|
5949
|
-
console.log("perpClient InitRewardVault error:: ",
|
5950
|
-
throw
|
5988
|
+
err_39 = _a.sent();
|
5989
|
+
console.log("perpClient InitRewardVault error:: ", err_39);
|
5990
|
+
throw err_39;
|
5951
5991
|
case 4: return [2, {
|
5952
5992
|
instructions: __spreadArray([], instructions, true),
|
5953
5993
|
additionalSigners: additionalSigners
|
@@ -5956,7 +5996,7 @@ var PerpetualsClient = (function () {
|
|
5956
5996
|
});
|
5957
5997
|
}); };
|
5958
5998
|
this.distributeReward = function (rewardAmount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5959
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, distributeReward,
|
5999
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, distributeReward, err_40;
|
5960
6000
|
return __generator(this, function (_a) {
|
5961
6001
|
switch (_a.label) {
|
5962
6002
|
case 0:
|
@@ -5987,9 +6027,9 @@ var PerpetualsClient = (function () {
|
|
5987
6027
|
instructions.push(distributeReward);
|
5988
6028
|
return [3, 4];
|
5989
6029
|
case 3:
|
5990
|
-
|
5991
|
-
console.log("perpClient distributeReward error:: ",
|
5992
|
-
throw
|
6030
|
+
err_40 = _a.sent();
|
6031
|
+
console.log("perpClient distributeReward error:: ", err_40);
|
6032
|
+
throw err_40;
|
5993
6033
|
case 4: return [2, {
|
5994
6034
|
instructions: __spreadArray([], instructions, true),
|
5995
6035
|
additionalSigners: additionalSigners
|
@@ -6000,7 +6040,7 @@ var PerpetualsClient = (function () {
|
|
6000
6040
|
this.collectNftReward = function (rewardSymbol, poolConfig, nftMint, createUserATA) {
|
6001
6041
|
if (createUserATA === void 0) { createUserATA = true; }
|
6002
6042
|
return __awaiter(_this, void 0, void 0, function () {
|
6003
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, nftTokenAccount, metadataAccount, receivingTokenAccount, _a, rewardRecord, rewardVault, rewardTokenAccount, nftTransferAuthority, collectNftReward,
|
6043
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, nftTokenAccount, metadataAccount, receivingTokenAccount, _a, rewardRecord, rewardVault, rewardTokenAccount, nftTransferAuthority, collectNftReward, err_41;
|
6004
6044
|
return __generator(this, function (_b) {
|
6005
6045
|
switch (_b.label) {
|
6006
6046
|
case 0:
|
@@ -6050,8 +6090,8 @@ var PerpetualsClient = (function () {
|
|
6050
6090
|
instructions.push(collectNftReward);
|
6051
6091
|
return [3, 6];
|
6052
6092
|
case 5:
|
6053
|
-
|
6054
|
-
throw
|
6093
|
+
err_41 = _b.sent();
|
6094
|
+
throw err_41;
|
6055
6095
|
case 6: return [2, {
|
6056
6096
|
instructions: __spreadArray([], instructions, true),
|
6057
6097
|
additionalSigners: additionalSigners
|
@@ -6063,7 +6103,7 @@ var PerpetualsClient = (function () {
|
|
6063
6103
|
this.collectAndDistributeFee = function (rewardSymbol, poolConfig, createUserATA, nftTradingAccount) {
|
6064
6104
|
if (createUserATA === void 0) { createUserATA = true; }
|
6065
6105
|
return __awaiter(_this, void 0, void 0, function () {
|
6066
|
-
var publicKey, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tradingAccount, rewardVault, rewardTokenAccount, withdrawStakeInstruction,
|
6106
|
+
var publicKey, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tradingAccount, rewardVault, rewardTokenAccount, withdrawStakeInstruction, err_42;
|
6067
6107
|
return __generator(this, function (_b) {
|
6068
6108
|
switch (_b.label) {
|
6069
6109
|
case 0:
|
@@ -6127,9 +6167,9 @@ var PerpetualsClient = (function () {
|
|
6127
6167
|
instructions.push(withdrawStakeInstruction);
|
6128
6168
|
return [3, 6];
|
6129
6169
|
case 5:
|
6130
|
-
|
6131
|
-
console.log("perpClient withdrawStake error:: ",
|
6132
|
-
throw
|
6170
|
+
err_42 = _b.sent();
|
6171
|
+
console.log("perpClient withdrawStake error:: ", err_42);
|
6172
|
+
throw err_42;
|
6133
6173
|
case 6: return [2, {
|
6134
6174
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6135
6175
|
additionalSigners: additionalSigners
|
@@ -6139,7 +6179,7 @@ var PerpetualsClient = (function () {
|
|
6139
6179
|
});
|
6140
6180
|
};
|
6141
6181
|
this.setTriggerPrice = function (targetSymbol, collateralSymbol, side, triggerPrice, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6142
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, positionAccount, instructions, additionalSigners, setTriggerPrice,
|
6182
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, positionAccount, instructions, additionalSigners, setTriggerPrice, err_43;
|
6143
6183
|
return __generator(this, function (_a) {
|
6144
6184
|
switch (_a.label) {
|
6145
6185
|
case 0:
|
@@ -6178,9 +6218,9 @@ var PerpetualsClient = (function () {
|
|
6178
6218
|
instructions.push(setTriggerPrice);
|
6179
6219
|
return [3, 4];
|
6180
6220
|
case 3:
|
6181
|
-
|
6182
|
-
console.log("perpClient setTriggerPrice error:: ",
|
6183
|
-
throw
|
6221
|
+
err_43 = _a.sent();
|
6222
|
+
console.log("perpClient setTriggerPrice error:: ", err_43);
|
6223
|
+
throw err_43;
|
6184
6224
|
case 4: return [2, {
|
6185
6225
|
instructions: __spreadArray([], instructions, true),
|
6186
6226
|
additionalSigners: additionalSigners
|
@@ -6193,7 +6233,7 @@ var PerpetualsClient = (function () {
|
|
6193
6233
|
if (closeUsersWSOLATA === void 0) { closeUsersWSOLATA = false; }
|
6194
6234
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6195
6235
|
return __awaiter(_this, void 0, void 0, function () {
|
6196
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, forceClosePosition, closeWsolATAIns,
|
6236
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, forceClosePosition, closeWsolATAIns, err_44;
|
6197
6237
|
return __generator(this, function (_b) {
|
6198
6238
|
switch (_b.label) {
|
6199
6239
|
case 0:
|
@@ -6254,9 +6294,9 @@ var PerpetualsClient = (function () {
|
|
6254
6294
|
}
|
6255
6295
|
return [3, 7];
|
6256
6296
|
case 6:
|
6257
|
-
|
6258
|
-
console.log("perpClient forceClosePosition error:: ",
|
6259
|
-
throw
|
6297
|
+
err_44 = _b.sent();
|
6298
|
+
console.log("perpClient forceClosePosition error:: ", err_44);
|
6299
|
+
throw err_44;
|
6260
6300
|
case 7: return [2, {
|
6261
6301
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6262
6302
|
additionalSigners: additionalSigners
|
@@ -6269,7 +6309,7 @@ var PerpetualsClient = (function () {
|
|
6269
6309
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
6270
6310
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6271
6311
|
return __awaiter(_this, void 0, void 0, function () {
|
6272
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder,
|
6312
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder, err_45;
|
6273
6313
|
return __generator(this, function (_c) {
|
6274
6314
|
switch (_c.label) {
|
6275
6315
|
case 0:
|
@@ -6374,9 +6414,9 @@ var PerpetualsClient = (function () {
|
|
6374
6414
|
instructions.push(placeLimitOrder);
|
6375
6415
|
return [3, 11];
|
6376
6416
|
case 10:
|
6377
|
-
|
6378
|
-
console.log("perpClient placeLimitOrder error:: ",
|
6379
|
-
throw
|
6417
|
+
err_45 = _c.sent();
|
6418
|
+
console.log("perpClient placeLimitOrder error:: ", err_45);
|
6419
|
+
throw err_45;
|
6380
6420
|
case 11: return [2, {
|
6381
6421
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6382
6422
|
additionalSigners: additionalSigners
|
@@ -6389,7 +6429,7 @@ var PerpetualsClient = (function () {
|
|
6389
6429
|
if (createUserATA === void 0) { createUserATA = true; }
|
6390
6430
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6391
6431
|
return __awaiter(_this, void 0, void 0, function () {
|
6392
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder,
|
6432
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder, err_46;
|
6393
6433
|
return __generator(this, function (_b) {
|
6394
6434
|
switch (_b.label) {
|
6395
6435
|
case 0:
|
@@ -6477,9 +6517,9 @@ var PerpetualsClient = (function () {
|
|
6477
6517
|
instructions.push(editLimitOrder);
|
6478
6518
|
return [3, 8];
|
6479
6519
|
case 7:
|
6480
|
-
|
6481
|
-
console.log("perpClient editLimitOrder error:: ",
|
6482
|
-
throw
|
6520
|
+
err_46 = _b.sent();
|
6521
|
+
console.log("perpClient editLimitOrder error:: ", err_46);
|
6522
|
+
throw err_46;
|
6483
6523
|
case 8: return [2, {
|
6484
6524
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6485
6525
|
additionalSigners: additionalSigners
|
@@ -6493,7 +6533,7 @@ var PerpetualsClient = (function () {
|
|
6493
6533
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
6494
6534
|
if (rebateTokenAccount === void 0) { rebateTokenAccount = web3_js_1.PublicKey.default; }
|
6495
6535
|
return __awaiter(_this, void 0, void 0, function () {
|
6496
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder,
|
6536
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder, err_47;
|
6497
6537
|
return __generator(this, function (_a) {
|
6498
6538
|
switch (_a.label) {
|
6499
6539
|
case 0:
|
@@ -6542,9 +6582,9 @@ var PerpetualsClient = (function () {
|
|
6542
6582
|
instructions.push(executeLimitOrder);
|
6543
6583
|
return [3, 4];
|
6544
6584
|
case 3:
|
6545
|
-
|
6546
|
-
console.log("perpClient executeLimitOrder error:: ",
|
6547
|
-
throw
|
6585
|
+
err_47 = _a.sent();
|
6586
|
+
console.log("perpClient executeLimitOrder error:: ", err_47);
|
6587
|
+
throw err_47;
|
6548
6588
|
case 4: return [2, {
|
6549
6589
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6550
6590
|
additionalSigners: additionalSigners
|
@@ -6558,7 +6598,7 @@ var PerpetualsClient = (function () {
|
|
6558
6598
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
6559
6599
|
if (rebateTokenAccount === void 0) { rebateTokenAccount = web3_js_1.PublicKey.default; }
|
6560
6600
|
return __awaiter(_this, void 0, void 0, function () {
|
6561
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap,
|
6601
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap, err_48;
|
6562
6602
|
return __generator(this, function (_a) {
|
6563
6603
|
switch (_a.label) {
|
6564
6604
|
case 0:
|
@@ -6610,9 +6650,9 @@ var PerpetualsClient = (function () {
|
|
6610
6650
|
instructions.push(executeLimitWithSwap);
|
6611
6651
|
return [3, 4];
|
6612
6652
|
case 3:
|
6613
|
-
|
6614
|
-
console.log("perpClient executeLimitWithSwap error:: ",
|
6615
|
-
throw
|
6653
|
+
err_48 = _a.sent();
|
6654
|
+
console.log("perpClient executeLimitWithSwap error:: ", err_48);
|
6655
|
+
throw err_48;
|
6616
6656
|
case 4: return [2, {
|
6617
6657
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6618
6658
|
additionalSigners: additionalSigners
|
@@ -6622,7 +6662,7 @@ var PerpetualsClient = (function () {
|
|
6622
6662
|
});
|
6623
6663
|
};
|
6624
6664
|
this.placeTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6625
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder,
|
6665
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder, err_49;
|
6626
6666
|
return __generator(this, function (_a) {
|
6627
6667
|
switch (_a.label) {
|
6628
6668
|
case 0:
|
@@ -6670,9 +6710,9 @@ var PerpetualsClient = (function () {
|
|
6670
6710
|
instructions.push(placeTriggerOrder);
|
6671
6711
|
return [3, 4];
|
6672
6712
|
case 3:
|
6673
|
-
|
6674
|
-
console.log("perpClient placeTriggerOrder error:: ",
|
6675
|
-
throw
|
6713
|
+
err_49 = _a.sent();
|
6714
|
+
console.log("perpClient placeTriggerOrder error:: ", err_49);
|
6715
|
+
throw err_49;
|
6676
6716
|
case 4: return [2, {
|
6677
6717
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6678
6718
|
additionalSigners: additionalSigners
|
@@ -6681,7 +6721,7 @@ var PerpetualsClient = (function () {
|
|
6681
6721
|
});
|
6682
6722
|
}); };
|
6683
6723
|
this.editTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, orderId, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6684
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder,
|
6724
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder, err_50;
|
6685
6725
|
return __generator(this, function (_a) {
|
6686
6726
|
switch (_a.label) {
|
6687
6727
|
case 0:
|
@@ -6728,9 +6768,9 @@ var PerpetualsClient = (function () {
|
|
6728
6768
|
instructions.push(editTriggerOrder);
|
6729
6769
|
return [3, 4];
|
6730
6770
|
case 3:
|
6731
|
-
|
6732
|
-
console.log("perpClient editTriggerOrder error:: ",
|
6733
|
-
throw
|
6771
|
+
err_50 = _a.sent();
|
6772
|
+
console.log("perpClient editTriggerOrder error:: ", err_50);
|
6773
|
+
throw err_50;
|
6734
6774
|
case 4: return [2, {
|
6735
6775
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6736
6776
|
additionalSigners: additionalSigners
|
@@ -6739,7 +6779,7 @@ var PerpetualsClient = (function () {
|
|
6739
6779
|
});
|
6740
6780
|
}); };
|
6741
6781
|
this.cancelTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6742
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder,
|
6782
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder, err_51;
|
6743
6783
|
return __generator(this, function (_a) {
|
6744
6784
|
switch (_a.label) {
|
6745
6785
|
case 0:
|
@@ -6772,9 +6812,9 @@ var PerpetualsClient = (function () {
|
|
6772
6812
|
instructions.push(cancelTriggerOrder);
|
6773
6813
|
return [3, 4];
|
6774
6814
|
case 3:
|
6775
|
-
|
6776
|
-
console.log("perpClient cancelTriggerOrder error:: ",
|
6777
|
-
throw
|
6815
|
+
err_51 = _a.sent();
|
6816
|
+
console.log("perpClient cancelTriggerOrder error:: ", err_51);
|
6817
|
+
throw err_51;
|
6778
6818
|
case 4: return [2, {
|
6779
6819
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6780
6820
|
additionalSigners: additionalSigners
|
@@ -6783,7 +6823,7 @@ var PerpetualsClient = (function () {
|
|
6783
6823
|
});
|
6784
6824
|
}); };
|
6785
6825
|
this.cancelAllTriggerOrders = function (targetSymbol, collateralSymbol, side, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6786
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders,
|
6826
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders, err_52;
|
6787
6827
|
return __generator(this, function (_a) {
|
6788
6828
|
switch (_a.label) {
|
6789
6829
|
case 0:
|
@@ -6814,9 +6854,9 @@ var PerpetualsClient = (function () {
|
|
6814
6854
|
instructions.push(cancelAllTriggerOrders);
|
6815
6855
|
return [3, 4];
|
6816
6856
|
case 3:
|
6817
|
-
|
6818
|
-
console.log("perpClient cancelAllTriggerOrders error:: ",
|
6819
|
-
throw
|
6857
|
+
err_52 = _a.sent();
|
6858
|
+
console.log("perpClient cancelAllTriggerOrders error:: ", err_52);
|
6859
|
+
throw err_52;
|
6820
6860
|
case 4: return [2, {
|
6821
6861
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6822
6862
|
additionalSigners: additionalSigners
|
@@ -6831,7 +6871,7 @@ var PerpetualsClient = (function () {
|
|
6831
6871
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
6832
6872
|
if (rebateTokenAccount === void 0) { rebateTokenAccount = web3_js_1.PublicKey.default; }
|
6833
6873
|
return __awaiter(_this, void 0, void 0, function () {
|
6834
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, userReceivingTokenAccount, userReceivingTokenAccountCollateral, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, _b, positionAccount, orderAccount, custodyAccountMetas, custodyOracleAccountMetas, _i, _c, custody, executeTriggerWithSwap,
|
6874
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, userReceivingTokenAccount, userReceivingTokenAccountCollateral, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, _b, positionAccount, orderAccount, custodyAccountMetas, custodyOracleAccountMetas, _i, _c, custody, executeTriggerWithSwap, err_53;
|
6835
6875
|
return __generator(this, function (_d) {
|
6836
6876
|
switch (_d.label) {
|
6837
6877
|
case 0:
|
@@ -6928,9 +6968,9 @@ var PerpetualsClient = (function () {
|
|
6928
6968
|
instructions.push(executeTriggerWithSwap);
|
6929
6969
|
return [3, 10];
|
6930
6970
|
case 9:
|
6931
|
-
|
6932
|
-
console.log("perpClient executeTriggerWithSwap error:: ",
|
6933
|
-
throw
|
6971
|
+
err_53 = _d.sent();
|
6972
|
+
console.log("perpClient executeTriggerWithSwap error:: ", err_53);
|
6973
|
+
throw err_53;
|
6934
6974
|
case 10: return [2, {
|
6935
6975
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6936
6976
|
additionalSigners: additionalSigners
|
@@ -6946,7 +6986,7 @@ var PerpetualsClient = (function () {
|
|
6946
6986
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
6947
6987
|
if (rebateTokenAccount === void 0) { rebateTokenAccount = web3_js_1.PublicKey.default; }
|
6948
6988
|
return __awaiter(_this, void 0, void 0, function () {
|
6949
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder,
|
6989
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder, err_54;
|
6950
6990
|
return __generator(this, function (_b) {
|
6951
6991
|
switch (_b.label) {
|
6952
6992
|
case 0:
|
@@ -7012,9 +7052,9 @@ var PerpetualsClient = (function () {
|
|
7012
7052
|
instructions.push(executeTriggerOrder);
|
7013
7053
|
return [3, 8];
|
7014
7054
|
case 7:
|
7015
|
-
|
7016
|
-
console.log("perpClient executeTriggerOrder error:: ",
|
7017
|
-
throw
|
7055
|
+
err_54 = _b.sent();
|
7056
|
+
console.log("perpClient executeTriggerOrder error:: ", err_54);
|
7057
|
+
throw err_54;
|
7018
7058
|
case 8: return [2, {
|
7019
7059
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
7020
7060
|
additionalSigners: additionalSigners
|
@@ -7024,7 +7064,7 @@ var PerpetualsClient = (function () {
|
|
7024
7064
|
});
|
7025
7065
|
};
|
7026
7066
|
this.migrateTriggerOrder = function (owner, marketAccount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7027
|
-
var payerPubkey, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, migrateTriggerOrder,
|
7067
|
+
var payerPubkey, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, migrateTriggerOrder, err_55;
|
7028
7068
|
return __generator(this, function (_a) {
|
7029
7069
|
switch (_a.label) {
|
7030
7070
|
case 0:
|
@@ -7054,9 +7094,9 @@ var PerpetualsClient = (function () {
|
|
7054
7094
|
instructions.push(migrateTriggerOrder);
|
7055
7095
|
return [3, 4];
|
7056
7096
|
case 3:
|
7057
|
-
|
7058
|
-
console.log("perpClient migrateTriggerOrder error:: ",
|
7059
|
-
throw
|
7097
|
+
err_55 = _a.sent();
|
7098
|
+
console.log("perpClient migrateTriggerOrder error:: ", err_55);
|
7099
|
+
throw err_55;
|
7060
7100
|
case 4: return [2, {
|
7061
7101
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
7062
7102
|
additionalSigners: additionalSigners
|
@@ -7065,7 +7105,7 @@ var PerpetualsClient = (function () {
|
|
7065
7105
|
});
|
7066
7106
|
}); };
|
7067
7107
|
this.getPositionData = function (position, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7068
|
-
var marketConfig, targetCustodyConfig, collateralCustodyConfig, getPositionData,
|
7108
|
+
var marketConfig, targetCustodyConfig, collateralCustodyConfig, getPositionData, err_56;
|
7069
7109
|
return __generator(this, function (_a) {
|
7070
7110
|
switch (_a.label) {
|
7071
7111
|
case 0:
|
@@ -7094,15 +7134,15 @@ var PerpetualsClient = (function () {
|
|
7094
7134
|
console.log(getPositionData);
|
7095
7135
|
return [2, getPositionData];
|
7096
7136
|
case 3:
|
7097
|
-
|
7098
|
-
console.log("perpClient setPool error:: ",
|
7099
|
-
throw
|
7137
|
+
err_56 = _a.sent();
|
7138
|
+
console.log("perpClient setPool error:: ", err_56);
|
7139
|
+
throw err_56;
|
7100
7140
|
case 4: return [2];
|
7101
7141
|
}
|
7102
7142
|
});
|
7103
7143
|
}); };
|
7104
7144
|
this.protocolWithdrawFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7105
|
-
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx,
|
7145
|
+
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_57;
|
7106
7146
|
return __generator(this, function (_a) {
|
7107
7147
|
switch (_a.label) {
|
7108
7148
|
case 0:
|
@@ -7134,9 +7174,9 @@ var PerpetualsClient = (function () {
|
|
7134
7174
|
instructions.push(withdrawFeesIx);
|
7135
7175
|
return [3, 5];
|
7136
7176
|
case 4:
|
7137
|
-
|
7138
|
-
console.log("perpClient setPool error:: ",
|
7139
|
-
throw
|
7177
|
+
err_57 = _a.sent();
|
7178
|
+
console.log("perpClient setPool error:: ", err_57);
|
7179
|
+
throw err_57;
|
7140
7180
|
case 5: return [2, {
|
7141
7181
|
instructions: __spreadArray([], instructions, true),
|
7142
7182
|
additionalSigners: additionalSigners
|
@@ -7145,7 +7185,7 @@ var PerpetualsClient = (function () {
|
|
7145
7185
|
});
|
7146
7186
|
}); };
|
7147
7187
|
this.moveProtocolFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7148
|
-
var publicKey, custodyConfig, instructions, additionalSigners, moveProtocolFeesIx,
|
7188
|
+
var publicKey, custodyConfig, instructions, additionalSigners, moveProtocolFeesIx, err_58;
|
7149
7189
|
return __generator(this, function (_a) {
|
7150
7190
|
switch (_a.label) {
|
7151
7191
|
case 0:
|
@@ -7178,9 +7218,9 @@ var PerpetualsClient = (function () {
|
|
7178
7218
|
instructions.push(moveProtocolFeesIx);
|
7179
7219
|
return [3, 4];
|
7180
7220
|
case 3:
|
7181
|
-
|
7182
|
-
console.log("perpClient setPool error:: ",
|
7183
|
-
throw
|
7221
|
+
err_58 = _a.sent();
|
7222
|
+
console.log("perpClient setPool error:: ", err_58);
|
7223
|
+
throw err_58;
|
7184
7224
|
case 4: return [2, {
|
7185
7225
|
instructions: __spreadArray([], instructions, true),
|
7186
7226
|
additionalSigners: additionalSigners
|
@@ -7189,7 +7229,7 @@ var PerpetualsClient = (function () {
|
|
7189
7229
|
});
|
7190
7230
|
}); };
|
7191
7231
|
this.setProtocolFeeShareBps = function (feeShareBps, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7192
|
-
var publicKey, setProtocolFeeShareBpsIx,
|
7232
|
+
var publicKey, setProtocolFeeShareBpsIx, err_59;
|
7193
7233
|
return __generator(this, function (_a) {
|
7194
7234
|
switch (_a.label) {
|
7195
7235
|
case 0:
|
@@ -7209,15 +7249,15 @@ var PerpetualsClient = (function () {
|
|
7209
7249
|
setProtocolFeeShareBpsIx = _a.sent();
|
7210
7250
|
return [2, setProtocolFeeShareBpsIx];
|
7211
7251
|
case 2:
|
7212
|
-
|
7213
|
-
console.log("perpClient setProtocolFeeShareBpsIx error:: ",
|
7214
|
-
throw
|
7252
|
+
err_59 = _a.sent();
|
7253
|
+
console.log("perpClient setProtocolFeeShareBpsIx error:: ", err_59);
|
7254
|
+
throw err_59;
|
7215
7255
|
case 3: return [2];
|
7216
7256
|
}
|
7217
7257
|
});
|
7218
7258
|
}); };
|
7219
7259
|
this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
|
7220
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction,
|
7260
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_60;
|
7221
7261
|
return __generator(this, function (_a) {
|
7222
7262
|
switch (_a.label) {
|
7223
7263
|
case 0:
|
@@ -7244,9 +7284,9 @@ var PerpetualsClient = (function () {
|
|
7244
7284
|
instructions.push(setPermissionsInstruction);
|
7245
7285
|
return [3, 4];
|
7246
7286
|
case 3:
|
7247
|
-
|
7248
|
-
console.log("perpClient setPool error:: ",
|
7249
|
-
throw
|
7287
|
+
err_60 = _a.sent();
|
7288
|
+
console.log("perpClient setPool error:: ", err_60);
|
7289
|
+
throw err_60;
|
7250
7290
|
case 4: return [2, {
|
7251
7291
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
7252
7292
|
additionalSigners: additionalSigners
|
@@ -7255,7 +7295,7 @@ var PerpetualsClient = (function () {
|
|
7255
7295
|
});
|
7256
7296
|
}); };
|
7257
7297
|
this.reimburse = function (tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7258
|
-
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e,
|
7298
|
+
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_61;
|
7259
7299
|
var _f;
|
7260
7300
|
return __generator(this, function (_g) {
|
7261
7301
|
switch (_g.label) {
|
@@ -7315,9 +7355,9 @@ var PerpetualsClient = (function () {
|
|
7315
7355
|
instructions.push(reimburse);
|
7316
7356
|
return [3, 5];
|
7317
7357
|
case 4:
|
7318
|
-
|
7319
|
-
console.log("perpClient setPool error:: ",
|
7320
|
-
throw
|
7358
|
+
err_61 = _g.sent();
|
7359
|
+
console.log("perpClient setPool error:: ", err_61);
|
7360
|
+
throw err_61;
|
7321
7361
|
case 5: return [2, {
|
7322
7362
|
instructions: __spreadArray([], instructions, true),
|
7323
7363
|
additionalSigners: additionalSigners
|
@@ -7326,7 +7366,7 @@ var PerpetualsClient = (function () {
|
|
7326
7366
|
});
|
7327
7367
|
}); };
|
7328
7368
|
this.setInternalOraclePrice = function (tokenMint, price, expo, conf, ema, publishTime, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7329
|
-
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice,
|
7369
|
+
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_62;
|
7330
7370
|
return __generator(this, function (_a) {
|
7331
7371
|
switch (_a.label) {
|
7332
7372
|
case 0:
|
@@ -7359,9 +7399,9 @@ var PerpetualsClient = (function () {
|
|
7359
7399
|
instructions.push(setInternalOraclePrice);
|
7360
7400
|
return [3, 4];
|
7361
7401
|
case 3:
|
7362
|
-
|
7363
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
7364
|
-
throw
|
7402
|
+
err_62 = _a.sent();
|
7403
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_62);
|
7404
|
+
throw err_62;
|
7365
7405
|
case 4: return [2, {
|
7366
7406
|
instructions: __spreadArray([], instructions, true),
|
7367
7407
|
additionalSigners: additionalSigners
|
@@ -7374,7 +7414,7 @@ var PerpetualsClient = (function () {
|
|
7374
7414
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
7375
7415
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
7376
7416
|
return __awaiter(_this, void 0, void 0, function () {
|
7377
|
-
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,
|
7417
|
+
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_63;
|
7378
7418
|
return __generator(this, function (_e) {
|
7379
7419
|
switch (_e.label) {
|
7380
7420
|
case 0:
|
@@ -7497,8 +7537,8 @@ var PerpetualsClient = (function () {
|
|
7497
7537
|
instructions.push(addCompoundingLiquidity);
|
7498
7538
|
return [3, 10];
|
7499
7539
|
case 9:
|
7500
|
-
|
7501
|
-
console.log("perpClient addCompoundingLiquidity error:: ",
|
7540
|
+
err_63 = _e.sent();
|
7541
|
+
console.log("perpClient addCompoundingLiquidity error:: ", err_63);
|
7502
7542
|
return [3, 10];
|
7503
7543
|
case 10: return [2, {
|
7504
7544
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -7513,7 +7553,7 @@ var PerpetualsClient = (function () {
|
|
7513
7553
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
7514
7554
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
7515
7555
|
return __awaiter(_this, void 0, void 0, function () {
|
7516
|
-
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,
|
7556
|
+
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_64;
|
7517
7557
|
return __generator(this, function (_e) {
|
7518
7558
|
switch (_e.label) {
|
7519
7559
|
case 0:
|
@@ -7620,8 +7660,8 @@ var PerpetualsClient = (function () {
|
|
7620
7660
|
instructions.push(removeCompoundingLiquidity);
|
7621
7661
|
return [3, 8];
|
7622
7662
|
case 7:
|
7623
|
-
|
7624
|
-
console.log("perpClient removeCompoundingLiquidity error:: ",
|
7663
|
+
err_64 = _e.sent();
|
7664
|
+
console.log("perpClient removeCompoundingLiquidity error:: ", err_64);
|
7625
7665
|
return [3, 8];
|
7626
7666
|
case 8: return [2, {
|
7627
7667
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -7634,7 +7674,7 @@ var PerpetualsClient = (function () {
|
|
7634
7674
|
this.migrateStake = function (amount, rewardTokenMint, poolConfig, createUserATA) {
|
7635
7675
|
if (createUserATA === void 0) { createUserATA = true; }
|
7636
7676
|
return __awaiter(_this, void 0, void 0, function () {
|
7637
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, _a, flpStakeAccount, tokenStakeAccount, tokenStakeAccounts, _b, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _c, custody, _d, _e, market, migrateStake,
|
7677
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, _a, flpStakeAccount, tokenStakeAccount, tokenStakeAccounts, _b, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _c, custody, _d, _e, market, migrateStake, err_65;
|
7638
7678
|
return __generator(this, function (_f) {
|
7639
7679
|
switch (_f.label) {
|
7640
7680
|
case 0:
|
@@ -7731,8 +7771,8 @@ var PerpetualsClient = (function () {
|
|
7731
7771
|
instructions.push(migrateStake);
|
7732
7772
|
return [3, 8];
|
7733
7773
|
case 7:
|
7734
|
-
|
7735
|
-
console.log("perpClient migrateStake error:: ",
|
7774
|
+
err_65 = _f.sent();
|
7775
|
+
console.log("perpClient migrateStake error:: ", err_65);
|
7736
7776
|
return [3, 8];
|
7737
7777
|
case 8: return [2, {
|
7738
7778
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -7743,7 +7783,7 @@ var PerpetualsClient = (function () {
|
|
7743
7783
|
});
|
7744
7784
|
};
|
7745
7785
|
this.migrateFlp = function (amount, rewardTokenMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7746
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp,
|
7786
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp, err_66;
|
7747
7787
|
return __generator(this, function (_d) {
|
7748
7788
|
switch (_d.label) {
|
7749
7789
|
case 0:
|
@@ -7815,8 +7855,8 @@ var PerpetualsClient = (function () {
|
|
7815
7855
|
instructions.push(migrateFlp);
|
7816
7856
|
return [3, 4];
|
7817
7857
|
case 3:
|
7818
|
-
|
7819
|
-
console.log("perpClient migrateFlp error:: ",
|
7858
|
+
err_66 = _d.sent();
|
7859
|
+
console.log("perpClient migrateFlp error:: ", err_66);
|
7820
7860
|
return [3, 4];
|
7821
7861
|
case 4: return [2, {
|
7822
7862
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -7828,7 +7868,7 @@ var PerpetualsClient = (function () {
|
|
7828
7868
|
this.compoundingFee = function (poolConfig, rewardTokenSymbol) {
|
7829
7869
|
if (rewardTokenSymbol === void 0) { rewardTokenSymbol = 'USDC'; }
|
7830
7870
|
return __awaiter(_this, void 0, void 0, function () {
|
7831
|
-
var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, compoundingFee,
|
7871
|
+
var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, compoundingFee, err_67;
|
7832
7872
|
return __generator(this, function (_d) {
|
7833
7873
|
switch (_d.label) {
|
7834
7874
|
case 0:
|
@@ -7885,8 +7925,8 @@ var PerpetualsClient = (function () {
|
|
7885
7925
|
instructions.push(compoundingFee);
|
7886
7926
|
return [3, 4];
|
7887
7927
|
case 3:
|
7888
|
-
|
7889
|
-
console.log("perpClient compoundingFee error:: ",
|
7928
|
+
err_67 = _d.sent();
|
7929
|
+
console.log("perpClient compoundingFee error:: ", err_67);
|
7890
7930
|
return [3, 4];
|
7891
7931
|
case 4: return [2, {
|
7892
7932
|
instructions: __spreadArray([], instructions, true),
|
@@ -7897,7 +7937,7 @@ var PerpetualsClient = (function () {
|
|
7897
7937
|
});
|
7898
7938
|
};
|
7899
7939
|
this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
7900
|
-
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp,
|
7940
|
+
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_68;
|
7901
7941
|
return __generator(this, function (_a) {
|
7902
7942
|
switch (_a.label) {
|
7903
7943
|
case 0:
|
@@ -7935,8 +7975,8 @@ var PerpetualsClient = (function () {
|
|
7935
7975
|
instructions.push(renameFlp);
|
7936
7976
|
return [3, 4];
|
7937
7977
|
case 3:
|
7938
|
-
|
7939
|
-
console.log("perpClient renameFlp error:: ",
|
7978
|
+
err_68 = _a.sent();
|
7979
|
+
console.log("perpClient renameFlp error:: ", err_68);
|
7940
7980
|
return [3, 4];
|
7941
7981
|
case 4: return [2, {
|
7942
7982
|
instructions: __spreadArray([], instructions, true),
|