flash-sdk 11.7.0-alpha.0 → 11.8.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PerpetualsClient.js +21 -12
- package/package.json +1 -1
package/dist/PerpetualsClient.js
CHANGED
|
@@ -4526,28 +4526,37 @@ var PerpetualsClient = (function () {
|
|
|
4526
4526
|
args_1[_i - 1] = arguments[_i];
|
|
4527
4527
|
}
|
|
4528
4528
|
return __awaiter(_this, __spreadArray([poolConfig_1], args_1, true), void 0, function (poolConfig, pendingActivation, deactivated, createUserLPTA, userPublicKey) {
|
|
4529
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, pool, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, withdrawStakeInstruction, err_14;
|
|
4529
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, pool, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, _a, withdrawStakeInstruction, err_14;
|
|
4530
4530
|
if (pendingActivation === void 0) { pendingActivation = true; }
|
|
4531
4531
|
if (deactivated === void 0) { deactivated = true; }
|
|
4532
4532
|
if (createUserLPTA === void 0) { createUserLPTA = true; }
|
|
4533
4533
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
4534
|
-
return __generator(this, function (
|
|
4535
|
-
switch (
|
|
4534
|
+
return __generator(this, function (_b) {
|
|
4535
|
+
switch (_b.label) {
|
|
4536
4536
|
case 0:
|
|
4537
4537
|
publicKey = userPublicKey !== null && userPublicKey !== void 0 ? userPublicKey : this.provider.wallet.publicKey;
|
|
4538
4538
|
preInstructions = [];
|
|
4539
4539
|
instructions = [];
|
|
4540
4540
|
postInstructions = [];
|
|
4541
4541
|
additionalSigners = [];
|
|
4542
|
-
|
|
4542
|
+
_b.label = 1;
|
|
4543
4543
|
case 1:
|
|
4544
|
-
|
|
4544
|
+
_b.trys.push([1, 5, , 6]);
|
|
4545
4545
|
lpTokenMint = poolConfig.stakedLpTokenMint;
|
|
4546
4546
|
pool = poolConfig.poolAddress;
|
|
4547
4547
|
poolStakedLpVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("staked_lp_token_account"), pool.toBuffer(), lpTokenMint.toBuffer()], this.program.programId)[0];
|
|
4548
4548
|
flpStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("stake"), publicKey.toBuffer(), pool.toBuffer()], this.program.programId)[0];
|
|
4549
4549
|
userLpTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(poolConfig.stakedLpTokenMint, publicKey, true);
|
|
4550
|
-
|
|
4550
|
+
_a = createUserLPTA;
|
|
4551
|
+
if (!_a) return [3, 3];
|
|
4552
|
+
return [4, (0, utils_1.checkIfAccountExists)(userLpTokenAccount, this.provider.connection)];
|
|
4553
|
+
case 2:
|
|
4554
|
+
_a = !(_b.sent());
|
|
4555
|
+
_b.label = 3;
|
|
4556
|
+
case 3:
|
|
4557
|
+
if (_a) {
|
|
4558
|
+
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, userLpTokenAccount, publicKey, poolConfig.stakedLpTokenMint));
|
|
4559
|
+
}
|
|
4551
4560
|
return [4, this.program.methods
|
|
4552
4561
|
.withdrawStake({
|
|
4553
4562
|
pendingActivation: pendingActivation,
|
|
@@ -4568,15 +4577,15 @@ var PerpetualsClient = (function () {
|
|
|
4568
4577
|
lpMint: poolConfig.stakedLpTokenMint,
|
|
4569
4578
|
})
|
|
4570
4579
|
.instruction()];
|
|
4571
|
-
case
|
|
4572
|
-
withdrawStakeInstruction =
|
|
4580
|
+
case 4:
|
|
4581
|
+
withdrawStakeInstruction = _b.sent();
|
|
4573
4582
|
instructions.push(withdrawStakeInstruction);
|
|
4574
|
-
return [3,
|
|
4575
|
-
case
|
|
4576
|
-
err_14 =
|
|
4583
|
+
return [3, 6];
|
|
4584
|
+
case 5:
|
|
4585
|
+
err_14 = _b.sent();
|
|
4577
4586
|
console.log("perpClient withdrawStake error:: ", err_14);
|
|
4578
4587
|
throw err_14;
|
|
4579
|
-
case
|
|
4588
|
+
case 6: return [2, {
|
|
4580
4589
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4581
4590
|
additionalSigners: additionalSigners
|
|
4582
4591
|
}];
|