flash-sdk 9.0.0-alpha.10 → 9.0.0-alpha.11
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 +162 -55
- package/dist/PerpetualsClient.js +314 -139
- package/dist/PoolConfig.d.ts +3 -1
- package/dist/PoolConfig.js +4 -2
- package/dist/PoolConfig.json +42 -14
- package/dist/PositionAccount.d.ts +3 -2
- package/dist/idl/perpetuals.d.ts +2456 -478
- package/dist/idl/perpetuals.js +2456 -478
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.js +3 -2
- package/package.json +1 -1
package/dist/PerpetualsClient.js
CHANGED
|
@@ -862,7 +862,7 @@ var PerpetualsClient = (function () {
|
|
|
862
862
|
return constants_1.BN_ZERO;
|
|
863
863
|
}
|
|
864
864
|
var slope = ((targetCustodyAccount.pricing.tradeSpreadMax.sub(targetCustodyAccount.pricing.tradeSpreadMin)).mul(new anchor_1.BN(Math.pow(10, (constants_1.RATE_DECIMALS + constants_1.BPS_DECIMALS)))))
|
|
865
|
-
.div(targetCustodyAccount.pricing.
|
|
865
|
+
.div(targetCustodyAccount.pricing.maxPositionSizeUsd);
|
|
866
866
|
var variable = (slope.mul(sizeUsd)).div(new anchor_1.BN(Math.pow(10, (constants_1.RATE_DECIMALS + constants_1.BPS_DECIMALS))));
|
|
867
867
|
var finalSpread = targetCustodyAccount.pricing.tradeSpreadMin.add(variable);
|
|
868
868
|
return finalSpread;
|
|
@@ -5382,13 +5382,143 @@ var PerpetualsClient = (function () {
|
|
|
5382
5382
|
});
|
|
5383
5383
|
});
|
|
5384
5384
|
};
|
|
5385
|
+
this.collectRebate = function (owner_1, rebateSymbol_1, poolConfig_1) {
|
|
5386
|
+
var args_1 = [];
|
|
5387
|
+
for (var _i = 3; _i < arguments.length; _i++) {
|
|
5388
|
+
args_1[_i - 3] = arguments[_i];
|
|
5389
|
+
}
|
|
5390
|
+
return __awaiter(_this, __spreadArray([owner_1, rebateSymbol_1, poolConfig_1], args_1, true), void 0, function (owner, rebateSymbol, poolConfig, createUserATA) {
|
|
5391
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateMint, tokenStakeAccount, userTokenAccount, _a, collectRebateInstruction, err_28;
|
|
5392
|
+
if (createUserATA === void 0) { createUserATA = true; }
|
|
5393
|
+
return __generator(this, function (_b) {
|
|
5394
|
+
switch (_b.label) {
|
|
5395
|
+
case 0:
|
|
5396
|
+
publicKey = this.provider.wallet.publicKey;
|
|
5397
|
+
preInstructions = [];
|
|
5398
|
+
instructions = [];
|
|
5399
|
+
postInstructions = [];
|
|
5400
|
+
additionalSigners = [];
|
|
5401
|
+
_b.label = 1;
|
|
5402
|
+
case 1:
|
|
5403
|
+
_b.trys.push([1, 5, , 6]);
|
|
5404
|
+
rebateMint = poolConfig.getTokenFromSymbol(rebateSymbol).mintKey;
|
|
5405
|
+
tokenStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("token_stake"), owner.toBuffer()], this.programId)[0];
|
|
5406
|
+
userTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(rebateMint, owner, true);
|
|
5407
|
+
_a = createUserATA;
|
|
5408
|
+
if (!_a) return [3, 3];
|
|
5409
|
+
return [4, (0, utils_1.checkIfAccountExists)(userTokenAccount, this.provider.connection)];
|
|
5410
|
+
case 2:
|
|
5411
|
+
_a = !(_b.sent());
|
|
5412
|
+
_b.label = 3;
|
|
5413
|
+
case 3:
|
|
5414
|
+
if (_a) {
|
|
5415
|
+
instructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, userTokenAccount, publicKey, rebateMint));
|
|
5416
|
+
}
|
|
5417
|
+
return [4, this.program.methods
|
|
5418
|
+
.collectRebate()
|
|
5419
|
+
.accounts({
|
|
5420
|
+
owner: owner,
|
|
5421
|
+
receivingTokenAccount: userTokenAccount,
|
|
5422
|
+
perpetuals: this.perpetuals.publicKey,
|
|
5423
|
+
transferAuthority: poolConfig.transferAuthority,
|
|
5424
|
+
rebateVault: poolConfig.rebateVault,
|
|
5425
|
+
rebateTokenAccount: poolConfig.rebateTokenAccount,
|
|
5426
|
+
tokenStakeAccount: tokenStakeAccount,
|
|
5427
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
5428
|
+
eventAuthority: this.eventAuthority.publicKey,
|
|
5429
|
+
program: this.programId,
|
|
5430
|
+
receivingTokenMint: rebateMint,
|
|
5431
|
+
})
|
|
5432
|
+
.instruction()];
|
|
5433
|
+
case 4:
|
|
5434
|
+
collectRebateInstruction = _b.sent();
|
|
5435
|
+
instructions.push(collectRebateInstruction);
|
|
5436
|
+
return [3, 6];
|
|
5437
|
+
case 5:
|
|
5438
|
+
err_28 = _b.sent();
|
|
5439
|
+
console.log("perpClient collectRebateInstruction error:: ", err_28);
|
|
5440
|
+
throw err_28;
|
|
5441
|
+
case 6: return [2, {
|
|
5442
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5443
|
+
additionalSigners: additionalSigners
|
|
5444
|
+
}];
|
|
5445
|
+
}
|
|
5446
|
+
});
|
|
5447
|
+
});
|
|
5448
|
+
};
|
|
5449
|
+
this.settleRebates = function (owner_1, rebateSymbol_1, rewardSymbol_1, poolConfig_1) {
|
|
5450
|
+
var args_1 = [];
|
|
5451
|
+
for (var _i = 4; _i < arguments.length; _i++) {
|
|
5452
|
+
args_1[_i - 4] = arguments[_i];
|
|
5453
|
+
}
|
|
5454
|
+
return __awaiter(_this, __spreadArray([owner_1, rebateSymbol_1, rewardSymbol_1, poolConfig_1], args_1, true), void 0, function (owner, rebateSymbol, rewardSymbol, poolConfig, createUserATA) {
|
|
5455
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, rebateMint, userTokenAccount, _a, settleRebatesInstruction, err_29;
|
|
5456
|
+
if (createUserATA === void 0) { createUserATA = true; }
|
|
5457
|
+
return __generator(this, function (_b) {
|
|
5458
|
+
switch (_b.label) {
|
|
5459
|
+
case 0:
|
|
5460
|
+
publicKey = this.provider.wallet.publicKey;
|
|
5461
|
+
preInstructions = [];
|
|
5462
|
+
instructions = [];
|
|
5463
|
+
postInstructions = [];
|
|
5464
|
+
additionalSigners = [];
|
|
5465
|
+
_b.label = 1;
|
|
5466
|
+
case 1:
|
|
5467
|
+
_b.trys.push([1, 5, , 6]);
|
|
5468
|
+
rewardCustody = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(rewardSymbol).mintKey); });
|
|
5469
|
+
rebateMint = poolConfig.getTokenFromSymbol(rebateSymbol).mintKey;
|
|
5470
|
+
userTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(rebateMint, owner, true);
|
|
5471
|
+
_a = createUserATA;
|
|
5472
|
+
if (!_a) return [3, 3];
|
|
5473
|
+
return [4, (0, utils_1.checkIfAccountExists)(userTokenAccount, this.provider.connection)];
|
|
5474
|
+
case 2:
|
|
5475
|
+
_a = !(_b.sent());
|
|
5476
|
+
_b.label = 3;
|
|
5477
|
+
case 3:
|
|
5478
|
+
if (_a) {
|
|
5479
|
+
instructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, userTokenAccount, publicKey, rebateMint));
|
|
5480
|
+
}
|
|
5481
|
+
return [4, this.program.methods
|
|
5482
|
+
.settleRebates()
|
|
5483
|
+
.accounts({
|
|
5484
|
+
transferAuthority: poolConfig.transferAuthority,
|
|
5485
|
+
perpetuals: this.perpetuals.publicKey,
|
|
5486
|
+
pool: poolConfig.poolAddress,
|
|
5487
|
+
rewardCustody: rewardCustody.custodyAccount,
|
|
5488
|
+
rewardCustodyOracleAccount: this.useExtOracleAccount ? rewardCustody.extOracleAccount : rewardCustody.intOracleAccount,
|
|
5489
|
+
rewardCustodyTokenAccount: rewardCustody.tokenAccount,
|
|
5490
|
+
rebateVault: poolConfig.rebateVault,
|
|
5491
|
+
rebateTokenAccount: poolConfig.rebateTokenAccount,
|
|
5492
|
+
tokenMint: rebateMint,
|
|
5493
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
5494
|
+
eventAuthority: this.eventAuthority.publicKey,
|
|
5495
|
+
program: this.programId,
|
|
5496
|
+
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
|
5497
|
+
})
|
|
5498
|
+
.instruction()];
|
|
5499
|
+
case 4:
|
|
5500
|
+
settleRebatesInstruction = _b.sent();
|
|
5501
|
+
instructions.push(settleRebatesInstruction);
|
|
5502
|
+
return [3, 6];
|
|
5503
|
+
case 5:
|
|
5504
|
+
err_29 = _b.sent();
|
|
5505
|
+
console.log("perpClient settleRebatesInstruction error:: ", err_29);
|
|
5506
|
+
throw err_29;
|
|
5507
|
+
case 6: return [2, {
|
|
5508
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5509
|
+
additionalSigners: additionalSigners
|
|
5510
|
+
}];
|
|
5511
|
+
}
|
|
5512
|
+
});
|
|
5513
|
+
});
|
|
5514
|
+
};
|
|
5385
5515
|
this.placeLimitOrder = function (targetSymbol_1, collateralSymbol_1, reserveSymbol_1, receiveSymbol_1, side_1, limitPrice_1, reserveAmount_1, sizeAmount_1, stopLossPrice_1, takeProfitPrice_1, poolConfig_1) {
|
|
5386
5516
|
var args_1 = [];
|
|
5387
5517
|
for (var _i = 11; _i < arguments.length; _i++) {
|
|
5388
5518
|
args_1[_i - 11] = arguments[_i];
|
|
5389
5519
|
}
|
|
5390
5520
|
return __awaiter(_this, __spreadArray([targetSymbol_1, collateralSymbol_1, reserveSymbol_1, receiveSymbol_1, side_1, limitPrice_1, reserveAmount_1, sizeAmount_1, stopLossPrice_1, takeProfitPrice_1, poolConfig_1], args_1, true), void 0, function (targetSymbol, collateralSymbol, reserveSymbol, receiveSymbol, side, limitPrice, reserveAmount, sizeAmount, stopLossPrice, takeProfitPrice, poolConfig, skipBalanceChecks, ephemeralSignerPubkey) {
|
|
5391
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder,
|
|
5521
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder, err_30;
|
|
5392
5522
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
|
5393
5523
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
5394
5524
|
return __generator(this, function (_c) {
|
|
@@ -5494,9 +5624,9 @@ var PerpetualsClient = (function () {
|
|
|
5494
5624
|
instructions.push(placeLimitOrder);
|
|
5495
5625
|
return [3, 10];
|
|
5496
5626
|
case 9:
|
|
5497
|
-
|
|
5498
|
-
console.log("perpClient placeLimitOrder error:: ",
|
|
5499
|
-
throw
|
|
5627
|
+
err_30 = _c.sent();
|
|
5628
|
+
console.log("perpClient placeLimitOrder error:: ", err_30);
|
|
5629
|
+
throw err_30;
|
|
5500
5630
|
case 10: return [2, {
|
|
5501
5631
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5502
5632
|
additionalSigners: additionalSigners
|
|
@@ -5511,7 +5641,7 @@ var PerpetualsClient = (function () {
|
|
|
5511
5641
|
args_1[_i - 11] = arguments[_i];
|
|
5512
5642
|
}
|
|
5513
5643
|
return __awaiter(_this, __spreadArray([targetSymbol_1, collateralSymbol_1, reserveSymbol_1, receiveSymbol_1, side_1, orderId_1, limitPrice_1, sizeAmount_1, stopLossPrice_1, takeProfitPrice_1, poolConfig_1], args_1, true), void 0, function (targetSymbol, collateralSymbol, reserveSymbol, receiveSymbol, side, orderId, limitPrice, sizeAmount, stopLossPrice, takeProfitPrice, poolConfig, createUserATA, ephemeralSignerPubkey) {
|
|
5514
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder,
|
|
5644
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder, err_31;
|
|
5515
5645
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5516
5646
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
5517
5647
|
return __generator(this, function (_b) {
|
|
@@ -5602,9 +5732,9 @@ var PerpetualsClient = (function () {
|
|
|
5602
5732
|
instructions.push(editLimitOrder);
|
|
5603
5733
|
return [3, 8];
|
|
5604
5734
|
case 7:
|
|
5605
|
-
|
|
5606
|
-
console.log("perpClient editLimitOrder error:: ",
|
|
5607
|
-
throw
|
|
5735
|
+
err_31 = _b.sent();
|
|
5736
|
+
console.log("perpClient editLimitOrder error:: ", err_31);
|
|
5737
|
+
throw err_31;
|
|
5608
5738
|
case 8: return [2, {
|
|
5609
5739
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5610
5740
|
additionalSigners: additionalSigners
|
|
@@ -5619,7 +5749,7 @@ var PerpetualsClient = (function () {
|
|
|
5619
5749
|
args_1[_i - 7] = arguments[_i];
|
|
5620
5750
|
}
|
|
5621
5751
|
return __awaiter(_this, __spreadArray([userPubkey_1, targetSymbol_1, collateralSymbol_1, side_1, orderId_1, poolConfig_1, privilege_1], args_1, true), void 0, function (userPubkey, targetSymbol, collateralSymbol, side, orderId, poolConfig, privilege, tokenStakeAccount, userReferralAccount) {
|
|
5622
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder,
|
|
5752
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder, err_32;
|
|
5623
5753
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
5624
5754
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
|
5625
5755
|
return __generator(this, function (_a) {
|
|
@@ -5671,9 +5801,9 @@ var PerpetualsClient = (function () {
|
|
|
5671
5801
|
instructions.push(executeLimitOrder);
|
|
5672
5802
|
return [3, 4];
|
|
5673
5803
|
case 3:
|
|
5674
|
-
|
|
5675
|
-
console.log("perpClient executeLimitOrder error:: ",
|
|
5676
|
-
throw
|
|
5804
|
+
err_32 = _a.sent();
|
|
5805
|
+
console.log("perpClient executeLimitOrder error:: ", err_32);
|
|
5806
|
+
throw err_32;
|
|
5677
5807
|
case 4: return [2, {
|
|
5678
5808
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5679
5809
|
additionalSigners: additionalSigners
|
|
@@ -5688,7 +5818,7 @@ var PerpetualsClient = (function () {
|
|
|
5688
5818
|
args_1[_i - 8] = arguments[_i];
|
|
5689
5819
|
}
|
|
5690
5820
|
return __awaiter(_this, __spreadArray([userPubkey_1, targetSymbol_1, collateralSymbol_1, reserveSymbol_1, side_1, orderId_1, poolConfig_1, privilege_1], args_1, true), void 0, function (userPubkey, targetSymbol, collateralSymbol, reserveSymbol, side, orderId, poolConfig, privilege, tokenStakeAccount, userReferralAccount) {
|
|
5691
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap,
|
|
5821
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap, err_33;
|
|
5692
5822
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
5693
5823
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
|
5694
5824
|
return __generator(this, function (_a) {
|
|
@@ -5743,9 +5873,9 @@ var PerpetualsClient = (function () {
|
|
|
5743
5873
|
instructions.push(executeLimitWithSwap);
|
|
5744
5874
|
return [3, 4];
|
|
5745
5875
|
case 3:
|
|
5746
|
-
|
|
5747
|
-
console.log("perpClient executeLimitWithSwap error:: ",
|
|
5748
|
-
throw
|
|
5876
|
+
err_33 = _a.sent();
|
|
5877
|
+
console.log("perpClient executeLimitWithSwap error:: ", err_33);
|
|
5878
|
+
throw err_33;
|
|
5749
5879
|
case 4: return [2, {
|
|
5750
5880
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5751
5881
|
additionalSigners: additionalSigners
|
|
@@ -5755,7 +5885,7 @@ var PerpetualsClient = (function () {
|
|
|
5755
5885
|
});
|
|
5756
5886
|
};
|
|
5757
5887
|
this.placeTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5758
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder,
|
|
5888
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder, err_34;
|
|
5759
5889
|
return __generator(this, function (_a) {
|
|
5760
5890
|
switch (_a.label) {
|
|
5761
5891
|
case 0:
|
|
@@ -5803,9 +5933,9 @@ var PerpetualsClient = (function () {
|
|
|
5803
5933
|
instructions.push(placeTriggerOrder);
|
|
5804
5934
|
return [3, 4];
|
|
5805
5935
|
case 3:
|
|
5806
|
-
|
|
5807
|
-
console.log("perpClient placeTriggerOrder error:: ",
|
|
5808
|
-
throw
|
|
5936
|
+
err_34 = _a.sent();
|
|
5937
|
+
console.log("perpClient placeTriggerOrder error:: ", err_34);
|
|
5938
|
+
throw err_34;
|
|
5809
5939
|
case 4: return [2, {
|
|
5810
5940
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5811
5941
|
additionalSigners: additionalSigners
|
|
@@ -5814,7 +5944,7 @@ var PerpetualsClient = (function () {
|
|
|
5814
5944
|
});
|
|
5815
5945
|
}); };
|
|
5816
5946
|
this.editTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, orderId, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5817
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder,
|
|
5947
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder, err_35;
|
|
5818
5948
|
return __generator(this, function (_a) {
|
|
5819
5949
|
switch (_a.label) {
|
|
5820
5950
|
case 0:
|
|
@@ -5861,9 +5991,9 @@ var PerpetualsClient = (function () {
|
|
|
5861
5991
|
instructions.push(editTriggerOrder);
|
|
5862
5992
|
return [3, 4];
|
|
5863
5993
|
case 3:
|
|
5864
|
-
|
|
5865
|
-
console.log("perpClient editTriggerOrder error:: ",
|
|
5866
|
-
throw
|
|
5994
|
+
err_35 = _a.sent();
|
|
5995
|
+
console.log("perpClient editTriggerOrder error:: ", err_35);
|
|
5996
|
+
throw err_35;
|
|
5867
5997
|
case 4: return [2, {
|
|
5868
5998
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5869
5999
|
additionalSigners: additionalSigners
|
|
@@ -5872,7 +6002,7 @@ var PerpetualsClient = (function () {
|
|
|
5872
6002
|
});
|
|
5873
6003
|
}); };
|
|
5874
6004
|
this.cancelTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5875
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder,
|
|
6005
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder, err_36;
|
|
5876
6006
|
return __generator(this, function (_a) {
|
|
5877
6007
|
switch (_a.label) {
|
|
5878
6008
|
case 0:
|
|
@@ -5905,9 +6035,9 @@ var PerpetualsClient = (function () {
|
|
|
5905
6035
|
instructions.push(cancelTriggerOrder);
|
|
5906
6036
|
return [3, 4];
|
|
5907
6037
|
case 3:
|
|
5908
|
-
|
|
5909
|
-
console.log("perpClient cancelTriggerOrder error:: ",
|
|
5910
|
-
throw
|
|
6038
|
+
err_36 = _a.sent();
|
|
6039
|
+
console.log("perpClient cancelTriggerOrder error:: ", err_36);
|
|
6040
|
+
throw err_36;
|
|
5911
6041
|
case 4: return [2, {
|
|
5912
6042
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5913
6043
|
additionalSigners: additionalSigners
|
|
@@ -5916,7 +6046,7 @@ var PerpetualsClient = (function () {
|
|
|
5916
6046
|
});
|
|
5917
6047
|
}); };
|
|
5918
6048
|
this.cancelAllTriggerOrders = function (targetSymbol, collateralSymbol, side, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5919
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders,
|
|
6049
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders, err_37;
|
|
5920
6050
|
return __generator(this, function (_a) {
|
|
5921
6051
|
switch (_a.label) {
|
|
5922
6052
|
case 0:
|
|
@@ -5947,9 +6077,9 @@ var PerpetualsClient = (function () {
|
|
|
5947
6077
|
instructions.push(cancelAllTriggerOrders);
|
|
5948
6078
|
return [3, 4];
|
|
5949
6079
|
case 3:
|
|
5950
|
-
|
|
5951
|
-
console.log("perpClient cancelAllTriggerOrders error:: ",
|
|
5952
|
-
throw
|
|
6080
|
+
err_37 = _a.sent();
|
|
6081
|
+
console.log("perpClient cancelAllTriggerOrders error:: ", err_37);
|
|
6082
|
+
throw err_37;
|
|
5953
6083
|
case 4: return [2, {
|
|
5954
6084
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5955
6085
|
additionalSigners: additionalSigners
|
|
@@ -5963,7 +6093,7 @@ var PerpetualsClient = (function () {
|
|
|
5963
6093
|
args_1[_i - 9] = arguments[_i];
|
|
5964
6094
|
}
|
|
5965
6095
|
return __awaiter(_this, __spreadArray([owner_1, targetSymbol_1, collateralSymbol_1, receivingSymbol_1, side_1, orderId_1, isStopLoss_1, privilege_1, poolConfig_1], args_1, true), void 0, function (owner, targetSymbol, collateralSymbol, receivingSymbol, side, orderId, isStopLoss, privilege, poolConfig, createUserATA, ephemeralSignerPubkey, tokenStakeAccount, userReferralAccount) {
|
|
5966
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, userReceivingTokenAccount, userReceivingTokenAccountCollateral, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, collateralToken, receivingToken, _a, _b, positionAccount, orderAccount, custodyAccountMetas, custodyOracleAccountMetas, _c, _d, custody, executeTriggerWithSwap,
|
|
6096
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, userReceivingTokenAccount, userReceivingTokenAccountCollateral, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, collateralToken, receivingToken, _a, _b, positionAccount, orderAccount, custodyAccountMetas, custodyOracleAccountMetas, _c, _d, custody, executeTriggerWithSwap, err_38;
|
|
5967
6097
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5968
6098
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
5969
6099
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6069,9 +6199,9 @@ var PerpetualsClient = (function () {
|
|
|
6069
6199
|
instructions.push(executeTriggerWithSwap);
|
|
6070
6200
|
return [3, 10];
|
|
6071
6201
|
case 9:
|
|
6072
|
-
|
|
6073
|
-
console.log("perpClient executeTriggerWithSwap error:: ",
|
|
6074
|
-
throw
|
|
6202
|
+
err_38 = _e.sent();
|
|
6203
|
+
console.log("perpClient executeTriggerWithSwap error:: ", err_38);
|
|
6204
|
+
throw err_38;
|
|
6075
6205
|
case 10: return [2, {
|
|
6076
6206
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6077
6207
|
additionalSigners: additionalSigners
|
|
@@ -6086,7 +6216,7 @@ var PerpetualsClient = (function () {
|
|
|
6086
6216
|
args_1[_i - 8] = arguments[_i];
|
|
6087
6217
|
}
|
|
6088
6218
|
return __awaiter(_this, __spreadArray([owner_1, targetSymbol_1, collateralSymbol_1, side_1, orderId_1, isStopLoss_1, privilege_1, poolConfig_1], args_1, true), void 0, function (owner, targetSymbol, collateralSymbol, side, orderId, isStopLoss, privilege, poolConfig, createUserATA, ephemeralSignerPubkey, tokenStakeAccount, userReferralAccount) {
|
|
6089
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder,
|
|
6219
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder, err_39;
|
|
6090
6220
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6091
6221
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
6092
6222
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6157,9 +6287,9 @@ var PerpetualsClient = (function () {
|
|
|
6157
6287
|
instructions.push(executeTriggerOrder);
|
|
6158
6288
|
return [3, 8];
|
|
6159
6289
|
case 7:
|
|
6160
|
-
|
|
6161
|
-
console.log("perpClient executeTriggerOrder error:: ",
|
|
6162
|
-
throw
|
|
6290
|
+
err_39 = _b.sent();
|
|
6291
|
+
console.log("perpClient executeTriggerOrder error:: ", err_39);
|
|
6292
|
+
throw err_39;
|
|
6163
6293
|
case 8: return [2, {
|
|
6164
6294
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6165
6295
|
additionalSigners: additionalSigners
|
|
@@ -6174,7 +6304,7 @@ var PerpetualsClient = (function () {
|
|
|
6174
6304
|
args_1[_i - 5] = arguments[_i];
|
|
6175
6305
|
}
|
|
6176
6306
|
return __awaiter(_this, __spreadArray([userInputTokenSymbol_1, userOutputTokenSymbol_1, amountIn_1, minAmountOut_1, poolConfig_1], args_1, true), void 0, function (userInputTokenSymbol, userOutputTokenSymbol, amountIn, minAmountOut, poolConfig, useFeesPool, createUserATA, unWrapSol, skipBalanceChecks, ephemeralSignerPubkey) {
|
|
6177
|
-
var userInputCustodyConfig, userOutputCustodyConfig, publicKey, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userOutputTokenAccount, userInputTokenAccount, wsolAssociatedTokenAccount, wsolATAExist, unWrappedSolBalance, _a, wsolAssociatedTokenAccount, closeWsolATAIns, accCreationLamports, lamports, unWrappedSolBalance, _b, tokenAccountBalance, _c, lamports, _d, custodyAccountMetas, custodyOracleAccountMetas, _e, _f, custody, params, inx, closeWsolATAIns,
|
|
6307
|
+
var userInputCustodyConfig, userOutputCustodyConfig, publicKey, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userOutputTokenAccount, userInputTokenAccount, wsolAssociatedTokenAccount, wsolATAExist, unWrappedSolBalance, _a, wsolAssociatedTokenAccount, closeWsolATAIns, accCreationLamports, lamports, unWrappedSolBalance, _b, tokenAccountBalance, _c, lamports, _d, custodyAccountMetas, custodyOracleAccountMetas, _e, _f, custody, params, inx, closeWsolATAIns, err_40;
|
|
6178
6308
|
if (useFeesPool === void 0) { useFeesPool = false; }
|
|
6179
6309
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6180
6310
|
if (unWrapSol === void 0) { unWrapSol = false; }
|
|
@@ -6379,9 +6509,9 @@ var PerpetualsClient = (function () {
|
|
|
6379
6509
|
}
|
|
6380
6510
|
return [3, 20];
|
|
6381
6511
|
case 19:
|
|
6382
|
-
|
|
6383
|
-
console.error("perpClient Swap error:: ",
|
|
6384
|
-
throw
|
|
6512
|
+
err_40 = _g.sent();
|
|
6513
|
+
console.error("perpClient Swap error:: ", err_40);
|
|
6514
|
+
throw err_40;
|
|
6385
6515
|
case 20: return [2, {
|
|
6386
6516
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6387
6517
|
additionalSigners: additionalSigners
|
|
@@ -6391,7 +6521,7 @@ var PerpetualsClient = (function () {
|
|
|
6391
6521
|
});
|
|
6392
6522
|
};
|
|
6393
6523
|
this.swapFeeInternal = function (rewardTokenSymbol, swapTokenSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6394
|
-
var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx,
|
|
6524
|
+
var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx, err_41;
|
|
6395
6525
|
return __generator(this, function (_b) {
|
|
6396
6526
|
switch (_b.label) {
|
|
6397
6527
|
case 0:
|
|
@@ -6447,9 +6577,9 @@ var PerpetualsClient = (function () {
|
|
|
6447
6577
|
instructions.push(inx);
|
|
6448
6578
|
return [3, 4];
|
|
6449
6579
|
case 3:
|
|
6450
|
-
|
|
6451
|
-
console.error("perpClient Swap error:: ",
|
|
6452
|
-
throw
|
|
6580
|
+
err_41 = _b.sent();
|
|
6581
|
+
console.error("perpClient Swap error:: ", err_41);
|
|
6582
|
+
throw err_41;
|
|
6453
6583
|
case 4: return [2, {
|
|
6454
6584
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6455
6585
|
additionalSigners: additionalSigners
|
|
@@ -6458,7 +6588,7 @@ var PerpetualsClient = (function () {
|
|
|
6458
6588
|
});
|
|
6459
6589
|
}); };
|
|
6460
6590
|
this.setLpTokenPrice = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6461
|
-
var instructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, setLpTokenPriceInstruction,
|
|
6591
|
+
var instructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, setLpTokenPriceInstruction, err_42;
|
|
6462
6592
|
return __generator(this, function (_d) {
|
|
6463
6593
|
switch (_d.label) {
|
|
6464
6594
|
case 0:
|
|
@@ -6506,9 +6636,9 @@ var PerpetualsClient = (function () {
|
|
|
6506
6636
|
instructions.push(setLpTokenPriceInstruction);
|
|
6507
6637
|
return [3, 4];
|
|
6508
6638
|
case 3:
|
|
6509
|
-
|
|
6510
|
-
console.log("perpClient setLpTokenPriceInstruction error:: ",
|
|
6511
|
-
throw
|
|
6639
|
+
err_42 = _d.sent();
|
|
6640
|
+
console.log("perpClient setLpTokenPriceInstruction error:: ", err_42);
|
|
6641
|
+
throw err_42;
|
|
6512
6642
|
case 4: return [2, {
|
|
6513
6643
|
instructions: __spreadArray([], instructions, true),
|
|
6514
6644
|
additionalSigners: additionalSigners
|
|
@@ -6556,7 +6686,7 @@ var PerpetualsClient = (function () {
|
|
|
6556
6686
|
});
|
|
6557
6687
|
}); };
|
|
6558
6688
|
this.setAdminSigners = function (admins, minSignatures) { return __awaiter(_this, void 0, void 0, function () {
|
|
6559
|
-
var adminMetas, _i, admins_2, admin,
|
|
6689
|
+
var adminMetas, _i, admins_2, admin, err_43;
|
|
6560
6690
|
return __generator(this, function (_a) {
|
|
6561
6691
|
switch (_a.label) {
|
|
6562
6692
|
case 0:
|
|
@@ -6586,11 +6716,11 @@ var PerpetualsClient = (function () {
|
|
|
6586
6716
|
_a.sent();
|
|
6587
6717
|
return [3, 4];
|
|
6588
6718
|
case 3:
|
|
6589
|
-
|
|
6719
|
+
err_43 = _a.sent();
|
|
6590
6720
|
if (this.printErrors) {
|
|
6591
|
-
console.error("setAdminSigners err:",
|
|
6721
|
+
console.error("setAdminSigners err:", err_43);
|
|
6592
6722
|
}
|
|
6593
|
-
throw
|
|
6723
|
+
throw err_43;
|
|
6594
6724
|
case 4: return [2];
|
|
6595
6725
|
}
|
|
6596
6726
|
});
|
|
@@ -6779,7 +6909,7 @@ var PerpetualsClient = (function () {
|
|
|
6779
6909
|
});
|
|
6780
6910
|
}); };
|
|
6781
6911
|
this.protocolWithdrawFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6782
|
-
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx,
|
|
6912
|
+
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_44;
|
|
6783
6913
|
return __generator(this, function (_a) {
|
|
6784
6914
|
switch (_a.label) {
|
|
6785
6915
|
case 0:
|
|
@@ -6812,9 +6942,9 @@ var PerpetualsClient = (function () {
|
|
|
6812
6942
|
instructions.push(withdrawFeesIx);
|
|
6813
6943
|
return [3, 5];
|
|
6814
6944
|
case 4:
|
|
6815
|
-
|
|
6816
|
-
console.log("perpClient setPool error:: ",
|
|
6817
|
-
throw
|
|
6945
|
+
err_44 = _a.sent();
|
|
6946
|
+
console.log("perpClient setPool error:: ", err_44);
|
|
6947
|
+
throw err_44;
|
|
6818
6948
|
case 5: return [2, {
|
|
6819
6949
|
instructions: __spreadArray([], instructions, true),
|
|
6820
6950
|
additionalSigners: additionalSigners
|
|
@@ -6823,7 +6953,7 @@ var PerpetualsClient = (function () {
|
|
|
6823
6953
|
});
|
|
6824
6954
|
}); };
|
|
6825
6955
|
this.moveProtocolFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6826
|
-
var publicKey, custodyConfig, instructions, additionalSigners, moveProtocolFeesIx,
|
|
6956
|
+
var publicKey, custodyConfig, instructions, additionalSigners, moveProtocolFeesIx, err_45;
|
|
6827
6957
|
return __generator(this, function (_a) {
|
|
6828
6958
|
switch (_a.label) {
|
|
6829
6959
|
case 0:
|
|
@@ -6857,9 +6987,9 @@ var PerpetualsClient = (function () {
|
|
|
6857
6987
|
instructions.push(moveProtocolFeesIx);
|
|
6858
6988
|
return [3, 4];
|
|
6859
6989
|
case 3:
|
|
6860
|
-
|
|
6861
|
-
console.log("perpClient setPool error:: ",
|
|
6862
|
-
throw
|
|
6990
|
+
err_45 = _a.sent();
|
|
6991
|
+
console.log("perpClient setPool error:: ", err_45);
|
|
6992
|
+
throw err_45;
|
|
6863
6993
|
case 4: return [2, {
|
|
6864
6994
|
instructions: __spreadArray([], instructions, true),
|
|
6865
6995
|
additionalSigners: additionalSigners
|
|
@@ -6868,7 +6998,7 @@ var PerpetualsClient = (function () {
|
|
|
6868
6998
|
});
|
|
6869
6999
|
}); };
|
|
6870
7000
|
this.setProtocolFeeShareBps = function (feeShareBps, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6871
|
-
var publicKey, setProtocolFeeShareBpsIx,
|
|
7001
|
+
var publicKey, setProtocolFeeShareBpsIx, err_46;
|
|
6872
7002
|
return __generator(this, function (_a) {
|
|
6873
7003
|
switch (_a.label) {
|
|
6874
7004
|
case 0:
|
|
@@ -6888,15 +7018,15 @@ var PerpetualsClient = (function () {
|
|
|
6888
7018
|
setProtocolFeeShareBpsIx = _a.sent();
|
|
6889
7019
|
return [2, setProtocolFeeShareBpsIx];
|
|
6890
7020
|
case 2:
|
|
6891
|
-
|
|
6892
|
-
console.log("perpClient setProtocolFeeShareBpsIx error:: ",
|
|
6893
|
-
throw
|
|
7021
|
+
err_46 = _a.sent();
|
|
7022
|
+
console.log("perpClient setProtocolFeeShareBpsIx error:: ", err_46);
|
|
7023
|
+
throw err_46;
|
|
6894
7024
|
case 3: return [2];
|
|
6895
7025
|
}
|
|
6896
7026
|
});
|
|
6897
7027
|
}); };
|
|
6898
7028
|
this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
|
|
6899
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction,
|
|
7029
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_47;
|
|
6900
7030
|
return __generator(this, function (_a) {
|
|
6901
7031
|
switch (_a.label) {
|
|
6902
7032
|
case 0:
|
|
@@ -6923,9 +7053,9 @@ var PerpetualsClient = (function () {
|
|
|
6923
7053
|
instructions.push(setPermissionsInstruction);
|
|
6924
7054
|
return [3, 4];
|
|
6925
7055
|
case 3:
|
|
6926
|
-
|
|
6927
|
-
console.log("perpClient setPool error:: ",
|
|
6928
|
-
throw
|
|
7056
|
+
err_47 = _a.sent();
|
|
7057
|
+
console.log("perpClient setPool error:: ", err_47);
|
|
7058
|
+
throw err_47;
|
|
6929
7059
|
case 4: return [2, {
|
|
6930
7060
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6931
7061
|
additionalSigners: additionalSigners
|
|
@@ -6934,7 +7064,7 @@ var PerpetualsClient = (function () {
|
|
|
6934
7064
|
});
|
|
6935
7065
|
}); };
|
|
6936
7066
|
this.reimburse = function (tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6937
|
-
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e,
|
|
7067
|
+
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_48;
|
|
6938
7068
|
var _f;
|
|
6939
7069
|
return __generator(this, function (_g) {
|
|
6940
7070
|
switch (_g.label) {
|
|
@@ -6995,9 +7125,9 @@ var PerpetualsClient = (function () {
|
|
|
6995
7125
|
instructions.push(reimburse);
|
|
6996
7126
|
return [3, 5];
|
|
6997
7127
|
case 4:
|
|
6998
|
-
|
|
6999
|
-
console.log("perpClient setPool error:: ",
|
|
7000
|
-
throw
|
|
7128
|
+
err_48 = _g.sent();
|
|
7129
|
+
console.log("perpClient setPool error:: ", err_48);
|
|
7130
|
+
throw err_48;
|
|
7001
7131
|
case 5: return [2, {
|
|
7002
7132
|
instructions: __spreadArray([], instructions, true),
|
|
7003
7133
|
additionalSigners: additionalSigners
|
|
@@ -7006,7 +7136,7 @@ var PerpetualsClient = (function () {
|
|
|
7006
7136
|
});
|
|
7007
7137
|
}); };
|
|
7008
7138
|
this.setInternalOraclePrice = function (tokenMint, useCurrentTime, price, expo, conf, ema, publishTime, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7009
|
-
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice,
|
|
7139
|
+
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_49;
|
|
7010
7140
|
return __generator(this, function (_a) {
|
|
7011
7141
|
switch (_a.label) {
|
|
7012
7142
|
case 0:
|
|
@@ -7040,9 +7170,9 @@ var PerpetualsClient = (function () {
|
|
|
7040
7170
|
instructions.push(setInternalOraclePrice);
|
|
7041
7171
|
return [3, 4];
|
|
7042
7172
|
case 3:
|
|
7043
|
-
|
|
7044
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
|
7045
|
-
throw
|
|
7173
|
+
err_49 = _a.sent();
|
|
7174
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_49);
|
|
7175
|
+
throw err_49;
|
|
7046
7176
|
case 4: return [2, {
|
|
7047
7177
|
instructions: __spreadArray([], instructions, true),
|
|
7048
7178
|
additionalSigners: additionalSigners
|
|
@@ -7051,7 +7181,7 @@ var PerpetualsClient = (function () {
|
|
|
7051
7181
|
});
|
|
7052
7182
|
}); };
|
|
7053
7183
|
this.setInternalOraclePriceBatch = function (useCurrentTime, tokenMintList, tokenInternalPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
|
7054
|
-
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice,
|
|
7184
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_50;
|
|
7055
7185
|
return __generator(this, function (_a) {
|
|
7056
7186
|
switch (_a.label) {
|
|
7057
7187
|
case 0:
|
|
@@ -7062,11 +7192,6 @@ var PerpetualsClient = (function () {
|
|
|
7062
7192
|
accountMetas = [];
|
|
7063
7193
|
_loop_1 = function (tokenMint) {
|
|
7064
7194
|
var custody = ALL_CUSTODY_CONFIGS.find(function (i) { return i.mintKey.equals(tokenMint); });
|
|
7065
|
-
accountMetas.push({
|
|
7066
|
-
pubkey: custody.custodyAccount,
|
|
7067
|
-
isSigner: false,
|
|
7068
|
-
isWritable: false,
|
|
7069
|
-
});
|
|
7070
7195
|
accountMetas.push({
|
|
7071
7196
|
pubkey: custody.intOracleAccount,
|
|
7072
7197
|
isSigner: false,
|
|
@@ -7089,8 +7214,8 @@ var PerpetualsClient = (function () {
|
|
|
7089
7214
|
_a.trys.push([1, 3, , 4]);
|
|
7090
7215
|
return [4, this.program.methods
|
|
7091
7216
|
.setInternalCurrentPrice({
|
|
7092
|
-
|
|
7093
|
-
|
|
7217
|
+
useCurrentTime: useCurrentTime,
|
|
7218
|
+
prices: tokenInternalPrices
|
|
7094
7219
|
})
|
|
7095
7220
|
.accounts({
|
|
7096
7221
|
authority: POOL_CONFIGS[0].backupOracle,
|
|
@@ -7102,9 +7227,9 @@ var PerpetualsClient = (function () {
|
|
|
7102
7227
|
instructions.push(setInternalOraclePrice);
|
|
7103
7228
|
return [3, 4];
|
|
7104
7229
|
case 3:
|
|
7105
|
-
|
|
7106
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
|
7107
|
-
throw
|
|
7230
|
+
err_50 = _a.sent();
|
|
7231
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_50);
|
|
7232
|
+
throw err_50;
|
|
7108
7233
|
case 4: return [2, {
|
|
7109
7234
|
instructions: __spreadArray([], instructions, true),
|
|
7110
7235
|
additionalSigners: additionalSigners
|
|
@@ -7113,7 +7238,7 @@ var PerpetualsClient = (function () {
|
|
|
7113
7238
|
});
|
|
7114
7239
|
}); };
|
|
7115
7240
|
this.setInternalOracleEmaPriceBatch = function (tokenMintList, tokenInternalEmaPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
|
7116
|
-
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalOraclePrice,
|
|
7241
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_51;
|
|
7117
7242
|
return __generator(this, function (_a) {
|
|
7118
7243
|
switch (_a.label) {
|
|
7119
7244
|
case 0:
|
|
@@ -7153,9 +7278,9 @@ var PerpetualsClient = (function () {
|
|
|
7153
7278
|
instructions.push(setInternalOraclePrice);
|
|
7154
7279
|
return [3, 4];
|
|
7155
7280
|
case 3:
|
|
7156
|
-
|
|
7157
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
|
7158
|
-
throw
|
|
7281
|
+
err_51 = _a.sent();
|
|
7282
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_51);
|
|
7283
|
+
throw err_51;
|
|
7159
7284
|
case 4: return [2, {
|
|
7160
7285
|
instructions: __spreadArray([], instructions, true),
|
|
7161
7286
|
additionalSigners: additionalSigners
|
|
@@ -7164,7 +7289,7 @@ var PerpetualsClient = (function () {
|
|
|
7164
7289
|
});
|
|
7165
7290
|
}); };
|
|
7166
7291
|
this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7167
|
-
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp,
|
|
7292
|
+
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_52;
|
|
7168
7293
|
return __generator(this, function (_a) {
|
|
7169
7294
|
switch (_a.label) {
|
|
7170
7295
|
case 0:
|
|
@@ -7202,8 +7327,8 @@ var PerpetualsClient = (function () {
|
|
|
7202
7327
|
instructions.push(renameFlp);
|
|
7203
7328
|
return [3, 4];
|
|
7204
7329
|
case 3:
|
|
7205
|
-
|
|
7206
|
-
console.log("perpClient renameFlp error:: ",
|
|
7330
|
+
err_52 = _a.sent();
|
|
7331
|
+
console.log("perpClient renameFlp error:: ", err_52);
|
|
7207
7332
|
return [3, 4];
|
|
7208
7333
|
case 4: return [2, {
|
|
7209
7334
|
instructions: __spreadArray([], instructions, true),
|
|
@@ -7213,7 +7338,7 @@ var PerpetualsClient = (function () {
|
|
|
7213
7338
|
});
|
|
7214
7339
|
}); };
|
|
7215
7340
|
this.initStake = function (stakingFeeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7216
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction,
|
|
7341
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_53;
|
|
7217
7342
|
return __generator(this, function (_a) {
|
|
7218
7343
|
switch (_a.label) {
|
|
7219
7344
|
case 0:
|
|
@@ -7251,9 +7376,9 @@ var PerpetualsClient = (function () {
|
|
|
7251
7376
|
instructions.push(initStakeInstruction);
|
|
7252
7377
|
return [3, 4];
|
|
7253
7378
|
case 3:
|
|
7254
|
-
|
|
7255
|
-
console.log("perpClient InitStaking error:: ",
|
|
7256
|
-
throw
|
|
7379
|
+
err_53 = _a.sent();
|
|
7380
|
+
console.log("perpClient InitStaking error:: ", err_53);
|
|
7381
|
+
throw err_53;
|
|
7257
7382
|
case 4: return [2, {
|
|
7258
7383
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7259
7384
|
additionalSigners: additionalSigners
|
|
@@ -7262,7 +7387,7 @@ var PerpetualsClient = (function () {
|
|
|
7262
7387
|
});
|
|
7263
7388
|
}); };
|
|
7264
7389
|
this.initCompounding = function (feeShareBps, metadataTitle, metadataSymbol, metadataUri, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7265
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction,
|
|
7390
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_54;
|
|
7266
7391
|
return __generator(this, function (_a) {
|
|
7267
7392
|
switch (_a.label) {
|
|
7268
7393
|
case 0:
|
|
@@ -7307,9 +7432,9 @@ var PerpetualsClient = (function () {
|
|
|
7307
7432
|
instructions.push(initCompoundingInstruction);
|
|
7308
7433
|
return [3, 4];
|
|
7309
7434
|
case 3:
|
|
7310
|
-
|
|
7311
|
-
console.log("perpClient initCompounding error:: ",
|
|
7312
|
-
throw
|
|
7435
|
+
err_54 = _a.sent();
|
|
7436
|
+
console.log("perpClient initCompounding error:: ", err_54);
|
|
7437
|
+
throw err_54;
|
|
7313
7438
|
case 4: return [2, {
|
|
7314
7439
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7315
7440
|
additionalSigners: additionalSigners
|
|
@@ -7318,7 +7443,7 @@ var PerpetualsClient = (function () {
|
|
|
7318
7443
|
});
|
|
7319
7444
|
}); };
|
|
7320
7445
|
this.initTokenVault = function (token_permissions, tokens_to_distribute, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7321
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction,
|
|
7446
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_55;
|
|
7322
7447
|
return __generator(this, function (_a) {
|
|
7323
7448
|
switch (_a.label) {
|
|
7324
7449
|
case 0:
|
|
@@ -7359,9 +7484,9 @@ var PerpetualsClient = (function () {
|
|
|
7359
7484
|
instructions.push(initTokenVaultInstruction);
|
|
7360
7485
|
return [3, 4];
|
|
7361
7486
|
case 3:
|
|
7362
|
-
|
|
7363
|
-
console.log("perpClient InitTokenVaultInstruction error:: ",
|
|
7364
|
-
throw
|
|
7487
|
+
err_55 = _a.sent();
|
|
7488
|
+
console.log("perpClient InitTokenVaultInstruction error:: ", err_55);
|
|
7489
|
+
throw err_55;
|
|
7365
7490
|
case 4: return [2, {
|
|
7366
7491
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7367
7492
|
additionalSigners: additionalSigners
|
|
@@ -7370,7 +7495,7 @@ var PerpetualsClient = (function () {
|
|
|
7370
7495
|
});
|
|
7371
7496
|
}); };
|
|
7372
7497
|
this.setTokenVaultConfig = function (token_permissions, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7373
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction,
|
|
7498
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_56;
|
|
7374
7499
|
return __generator(this, function (_a) {
|
|
7375
7500
|
switch (_a.label) {
|
|
7376
7501
|
case 0:
|
|
@@ -7401,9 +7526,9 @@ var PerpetualsClient = (function () {
|
|
|
7401
7526
|
instructions.push(setTokenVaultConfigInstruction);
|
|
7402
7527
|
return [3, 4];
|
|
7403
7528
|
case 3:
|
|
7404
|
-
|
|
7405
|
-
console.log("perpClient setTokenVaultConfigInstruction error:: ",
|
|
7406
|
-
throw
|
|
7529
|
+
err_56 = _a.sent();
|
|
7530
|
+
console.log("perpClient setTokenVaultConfigInstruction error:: ", err_56);
|
|
7531
|
+
throw err_56;
|
|
7407
7532
|
case 4: return [2, {
|
|
7408
7533
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7409
7534
|
additionalSigners: additionalSigners
|
|
@@ -7412,7 +7537,7 @@ var PerpetualsClient = (function () {
|
|
|
7412
7537
|
});
|
|
7413
7538
|
}); };
|
|
7414
7539
|
this.withdrawInstantFee = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7415
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction,
|
|
7540
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_57;
|
|
7416
7541
|
return __generator(this, function (_a) {
|
|
7417
7542
|
switch (_a.label) {
|
|
7418
7543
|
case 0:
|
|
@@ -7451,9 +7576,59 @@ var PerpetualsClient = (function () {
|
|
|
7451
7576
|
instructions.push(withdrawInstantFeeInstruction);
|
|
7452
7577
|
return [3, 6];
|
|
7453
7578
|
case 5:
|
|
7454
|
-
|
|
7455
|
-
console.log("perpClient withdrawInstantFeeInstruction error:: ",
|
|
7456
|
-
throw
|
|
7579
|
+
err_57 = _a.sent();
|
|
7580
|
+
console.log("perpClient withdrawInstantFeeInstruction error:: ", err_57);
|
|
7581
|
+
throw err_57;
|
|
7582
|
+
case 6: return [2, {
|
|
7583
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7584
|
+
additionalSigners: additionalSigners
|
|
7585
|
+
}];
|
|
7586
|
+
}
|
|
7587
|
+
});
|
|
7588
|
+
}); };
|
|
7589
|
+
this.withdrawUnclaimedTokens = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7590
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction, err_58;
|
|
7591
|
+
return __generator(this, function (_a) {
|
|
7592
|
+
switch (_a.label) {
|
|
7593
|
+
case 0:
|
|
7594
|
+
publicKey = this.provider.wallet.publicKey;
|
|
7595
|
+
preInstructions = [];
|
|
7596
|
+
instructions = [];
|
|
7597
|
+
postInstructions = [];
|
|
7598
|
+
additionalSigners = [];
|
|
7599
|
+
_a.label = 1;
|
|
7600
|
+
case 1:
|
|
7601
|
+
_a.trys.push([1, 5, , 6]);
|
|
7602
|
+
return [4, (0, spl_token_1.getAssociatedTokenAddress)(poolConfig.tokenMint, publicKey, true)];
|
|
7603
|
+
case 2:
|
|
7604
|
+
receivingTokenAccount = _a.sent();
|
|
7605
|
+
return [4, (0, utils_1.checkIfAccountExists)(receivingTokenAccount, this.provider.connection)];
|
|
7606
|
+
case 3:
|
|
7607
|
+
if (!(_a.sent())) {
|
|
7608
|
+
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, receivingTokenAccount, publicKey, poolConfig.tokenMint));
|
|
7609
|
+
}
|
|
7610
|
+
return [4, this.program.methods
|
|
7611
|
+
.withdrawUnclaimedTokens({})
|
|
7612
|
+
.accounts({
|
|
7613
|
+
admin: publicKey,
|
|
7614
|
+
multisig: this.multisig.publicKey,
|
|
7615
|
+
perpetuals: this.perpetuals.publicKey,
|
|
7616
|
+
transferAuthority: poolConfig.transferAuthority,
|
|
7617
|
+
tokenVault: poolConfig.tokenVault,
|
|
7618
|
+
tokenVaultTokenAccount: poolConfig.tokenVaultTokenAccount,
|
|
7619
|
+
receivingTokenAccount: receivingTokenAccount,
|
|
7620
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
7621
|
+
receivingTokenMint: poolConfig.tokenMint,
|
|
7622
|
+
})
|
|
7623
|
+
.instruction()];
|
|
7624
|
+
case 4:
|
|
7625
|
+
withdrawUnclaimedTokensInstruction = _a.sent();
|
|
7626
|
+
instructions.push(withdrawUnclaimedTokensInstruction);
|
|
7627
|
+
return [3, 6];
|
|
7628
|
+
case 5:
|
|
7629
|
+
err_58 = _a.sent();
|
|
7630
|
+
console.log("perpClient withdrawUnclaimedTokensInstruction error:: ", err_58);
|
|
7631
|
+
throw err_58;
|
|
7457
7632
|
case 6: return [2, {
|
|
7458
7633
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7459
7634
|
additionalSigners: additionalSigners
|
|
@@ -7462,7 +7637,7 @@ var PerpetualsClient = (function () {
|
|
|
7462
7637
|
});
|
|
7463
7638
|
}); };
|
|
7464
7639
|
this.initRevenueTokenAccount = function (feeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7465
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction,
|
|
7640
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_59;
|
|
7466
7641
|
return __generator(this, function (_a) {
|
|
7467
7642
|
switch (_a.label) {
|
|
7468
7643
|
case 0:
|
|
@@ -7499,9 +7674,9 @@ var PerpetualsClient = (function () {
|
|
|
7499
7674
|
instructions.push(initRevenueTokenAccountInstruction);
|
|
7500
7675
|
return [3, 4];
|
|
7501
7676
|
case 3:
|
|
7502
|
-
|
|
7503
|
-
console.log("perpClient initRevenueTokenAccountInstruction error:: ",
|
|
7504
|
-
throw
|
|
7677
|
+
err_59 = _a.sent();
|
|
7678
|
+
console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_59);
|
|
7679
|
+
throw err_59;
|
|
7505
7680
|
case 4: return [2, {
|
|
7506
7681
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7507
7682
|
additionalSigners: additionalSigners
|
|
@@ -7510,7 +7685,7 @@ var PerpetualsClient = (function () {
|
|
|
7510
7685
|
});
|
|
7511
7686
|
}); };
|
|
7512
7687
|
this.distributeTokenReward = function (amount, epochCount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7513
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction,
|
|
7688
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_60;
|
|
7514
7689
|
return __generator(this, function (_a) {
|
|
7515
7690
|
switch (_a.label) {
|
|
7516
7691
|
case 0:
|
|
@@ -7549,9 +7724,9 @@ var PerpetualsClient = (function () {
|
|
|
7549
7724
|
instructions.push(distributeTokenRewardInstruction);
|
|
7550
7725
|
return [3, 4];
|
|
7551
7726
|
case 3:
|
|
7552
|
-
|
|
7553
|
-
console.log("perpClient distributeTokenRewardInstruction error:: ",
|
|
7554
|
-
throw
|
|
7727
|
+
err_60 = _a.sent();
|
|
7728
|
+
console.log("perpClient distributeTokenRewardInstruction error:: ", err_60);
|
|
7729
|
+
throw err_60;
|
|
7555
7730
|
case 4: return [2, {
|
|
7556
7731
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7557
7732
|
additionalSigners: additionalSigners
|
|
@@ -7560,7 +7735,7 @@ var PerpetualsClient = (function () {
|
|
|
7560
7735
|
});
|
|
7561
7736
|
}); };
|
|
7562
7737
|
this.setTokenStakeLevel = function (owner, stakeLevel) { return __awaiter(_this, void 0, void 0, function () {
|
|
7563
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction,
|
|
7738
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_61;
|
|
7564
7739
|
return __generator(this, function (_a) {
|
|
7565
7740
|
switch (_a.label) {
|
|
7566
7741
|
case 0:
|
|
@@ -7588,9 +7763,9 @@ var PerpetualsClient = (function () {
|
|
|
7588
7763
|
instructions.push(setTokenStakeLevelInstruction);
|
|
7589
7764
|
return [3, 4];
|
|
7590
7765
|
case 3:
|
|
7591
|
-
|
|
7592
|
-
console.log("perpClient setTokenStakeLevelInstruction error:: ",
|
|
7593
|
-
throw
|
|
7766
|
+
err_61 = _a.sent();
|
|
7767
|
+
console.log("perpClient setTokenStakeLevelInstruction error:: ", err_61);
|
|
7768
|
+
throw err_61;
|
|
7594
7769
|
case 4: return [2, {
|
|
7595
7770
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7596
7771
|
additionalSigners: additionalSigners
|
|
@@ -7599,7 +7774,7 @@ var PerpetualsClient = (function () {
|
|
|
7599
7774
|
});
|
|
7600
7775
|
}); };
|
|
7601
7776
|
this.setTokenReward = function (owner, amount, epochCount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7602
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction,
|
|
7777
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_62;
|
|
7603
7778
|
return __generator(this, function (_a) {
|
|
7604
7779
|
switch (_a.label) {
|
|
7605
7780
|
case 0:
|
|
@@ -7631,9 +7806,9 @@ var PerpetualsClient = (function () {
|
|
|
7631
7806
|
instructions.push(setTokenRewardInstruction);
|
|
7632
7807
|
return [3, 4];
|
|
7633
7808
|
case 3:
|
|
7634
|
-
|
|
7635
|
-
console.log("perpClient setTokenRewardInstruction error:: ",
|
|
7636
|
-
throw
|
|
7809
|
+
err_62 = _a.sent();
|
|
7810
|
+
console.log("perpClient setTokenRewardInstruction error:: ", err_62);
|
|
7811
|
+
throw err_62;
|
|
7637
7812
|
case 4: return [2, {
|
|
7638
7813
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7639
7814
|
additionalSigners: additionalSigners
|
|
@@ -7642,7 +7817,7 @@ var PerpetualsClient = (function () {
|
|
|
7642
7817
|
});
|
|
7643
7818
|
}); };
|
|
7644
7819
|
this.resizeInternalOracle = function (extOracle, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
|
|
7645
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction,
|
|
7820
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction, err_63;
|
|
7646
7821
|
return __generator(this, function (_a) {
|
|
7647
7822
|
switch (_a.label) {
|
|
7648
7823
|
case 0:
|
|
@@ -7671,9 +7846,9 @@ var PerpetualsClient = (function () {
|
|
|
7671
7846
|
instructions.push(resizeInternalOracleInstruction);
|
|
7672
7847
|
return [3, 4];
|
|
7673
7848
|
case 3:
|
|
7674
|
-
|
|
7675
|
-
console.log("perpClient resizeInternalOracleInstruction error:: ",
|
|
7676
|
-
throw
|
|
7849
|
+
err_63 = _a.sent();
|
|
7850
|
+
console.log("perpClient resizeInternalOracleInstruction error:: ", err_63);
|
|
7851
|
+
throw err_63;
|
|
7677
7852
|
case 4: return [2, {
|
|
7678
7853
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7679
7854
|
additionalSigners: additionalSigners
|