flash-sdk 15.13.2 → 15.14.1
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 +0 -12
- package/dist/PerpetualsClient.js +77 -188
- package/dist/idl/perpetuals.d.ts +30 -215
- package/dist/idl/perpetuals.json +30 -215
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/generated.d.ts +6 -6
- package/package.json +3 -2
|
@@ -936,10 +936,6 @@ export declare class PerpetualsClient {
|
|
|
936
936
|
instructions: TransactionInstruction[];
|
|
937
937
|
additionalSigners: Signer[];
|
|
938
938
|
}>;
|
|
939
|
-
resizeTokenStake: (tokenStakeAccounts: PublicKey[]) => Promise<{
|
|
940
|
-
instructions: TransactionInstruction[];
|
|
941
|
-
additionalSigners: Signer[];
|
|
942
|
-
}>;
|
|
943
939
|
setTokenReward: (owner: PublicKey, amount: BN, epochCount: number, poolConfig: PoolConfig) => Promise<{
|
|
944
940
|
instructions: TransactionInstruction[];
|
|
945
941
|
additionalSigners: Signer[];
|
|
@@ -992,14 +988,6 @@ export declare class PerpetualsClient {
|
|
|
992
988
|
instructions: TransactionInstruction[];
|
|
993
989
|
additionalSigners: Signer[];
|
|
994
990
|
}>;
|
|
995
|
-
refreshPositionsStatus: (positionAccounts: PublicKey[]) => Promise<{
|
|
996
|
-
instructions: TransactionInstruction[];
|
|
997
|
-
additionalSigners: Signer[];
|
|
998
|
-
}>;
|
|
999
|
-
refreshOrdersStatus: (orderAccounts: PublicKey[]) => Promise<{
|
|
1000
|
-
instructions: TransactionInstruction[];
|
|
1001
|
-
additionalSigners: Signer[];
|
|
1002
|
-
}>;
|
|
1003
991
|
migrateMarketPosition: (poolName: string, oldMarket: PublicKey, newMarket: PublicKey, oldCollateralCustody: PublicKey, newCollateralCustody: PublicKey, owner: PublicKey) => Promise<{
|
|
1004
992
|
instructions: TransactionInstruction[];
|
|
1005
993
|
additionalSigners: Signer[];
|
package/dist/PerpetualsClient.js
CHANGED
|
@@ -1446,8 +1446,13 @@ var PerpetualsClient = (function () {
|
|
|
1446
1446
|
if (positionAccount.sizeAmount.isZero()) {
|
|
1447
1447
|
return zeroOraclePrice;
|
|
1448
1448
|
}
|
|
1449
|
+
var lockedUsd = collateralPrice.getAssetAmountUsd(positionAccount.lockedAmount, collateralDecimals);
|
|
1450
|
+
var maxProfitUsd = lockedUsd.sub(positionAccount.collateralUsd);
|
|
1451
|
+
if (maxProfitUsd.isNeg() || maxProfitUsd.isZero()) {
|
|
1452
|
+
return zeroOraclePrice;
|
|
1453
|
+
}
|
|
1449
1454
|
var priceDiffProfit = OraclePrice_1.OraclePrice.from({
|
|
1450
|
-
price:
|
|
1455
|
+
price: maxProfitUsd.mul(new anchor_1.BN(10).pow(new anchor_1.BN(positionAccount.sizeDecimals + 3)))
|
|
1451
1456
|
.div(positionAccount.sizeAmount),
|
|
1452
1457
|
exponent: new anchor_1.BN(-1 * constants_1.RATE_DECIMALS),
|
|
1453
1458
|
confidence: constants_1.BN_ZERO,
|
|
@@ -1589,6 +1594,8 @@ var PerpetualsClient = (function () {
|
|
|
1589
1594
|
priceImpactUsd: constants_1.BN_ZERO,
|
|
1590
1595
|
};
|
|
1591
1596
|
}
|
|
1597
|
+
var lockedUsd = collateralPrice.getAssetAmountUsd(positionAccount.lockedAmount, collateralCustodyAccount.decimals);
|
|
1598
|
+
var maxProfitUsd = anchor_1.BN.max(lockedUsd.sub(positionAccount.collateralUsd), constants_1.BN_ZERO);
|
|
1592
1599
|
var side = poolConfig.getMarketConfigByPk(positionAccount.market).side;
|
|
1593
1600
|
var sizeUsd = positionAccount.sizeUsd;
|
|
1594
1601
|
var exitOraclePrice = _this.getExitOraclePriceSync(side, targetTokenPrice, targetTokenEmaPrice, targetCustodyAccount, sizeUsd);
|
|
@@ -1653,7 +1660,7 @@ var PerpetualsClient = (function () {
|
|
|
1653
1660
|
if (priceDiffProfit.price.gt(constants_1.BN_ZERO)) {
|
|
1654
1661
|
var grossProfitUsd = priceDiffProfit.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals);
|
|
1655
1662
|
return {
|
|
1656
|
-
profitUsd: grossProfitUsd,
|
|
1663
|
+
profitUsd: anchor_1.BN.min(grossProfitUsd, maxProfitUsd),
|
|
1657
1664
|
lossUsd: constants_1.BN_ZERO,
|
|
1658
1665
|
priceImpactUsd: positionAccount.priceImpactUsd,
|
|
1659
1666
|
};
|
|
@@ -8498,50 +8505,8 @@ var PerpetualsClient = (function () {
|
|
|
8498
8505
|
});
|
|
8499
8506
|
});
|
|
8500
8507
|
};
|
|
8501
|
-
this.resizeTokenStake = function (tokenStakeAccounts) { return __awaiter(_this, void 0, void 0, function () {
|
|
8502
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeTokenStakeInstruction, err_68;
|
|
8503
|
-
return __generator(this, function (_a) {
|
|
8504
|
-
switch (_a.label) {
|
|
8505
|
-
case 0:
|
|
8506
|
-
publicKey = this.provider.wallet.publicKey;
|
|
8507
|
-
preInstructions = [];
|
|
8508
|
-
instructions = [];
|
|
8509
|
-
postInstructions = [];
|
|
8510
|
-
additionalSigners = [];
|
|
8511
|
-
_a.label = 1;
|
|
8512
|
-
case 1:
|
|
8513
|
-
_a.trys.push([1, 3, , 4]);
|
|
8514
|
-
return [4, this.program.methods
|
|
8515
|
-
.resizeTokenStake({})
|
|
8516
|
-
.accountsPartial({
|
|
8517
|
-
admin: publicKey,
|
|
8518
|
-
multisig: this.multisig.publicKey,
|
|
8519
|
-
perpetuals: this.perpetuals.publicKey,
|
|
8520
|
-
systemProgram: web3_js_1.SystemProgram.programId,
|
|
8521
|
-
})
|
|
8522
|
-
.remainingAccounts(tokenStakeAccounts.map(function (acc) { return ({
|
|
8523
|
-
pubkey: acc,
|
|
8524
|
-
isSigner: false,
|
|
8525
|
-
isWritable: true,
|
|
8526
|
-
}); }))
|
|
8527
|
-
.instruction()];
|
|
8528
|
-
case 2:
|
|
8529
|
-
resizeTokenStakeInstruction = _a.sent();
|
|
8530
|
-
instructions.push(resizeTokenStakeInstruction);
|
|
8531
|
-
return [3, 4];
|
|
8532
|
-
case 3:
|
|
8533
|
-
err_68 = _a.sent();
|
|
8534
|
-
console.log("perpClient resizeTokenStakeInstruction error:: ", err_68);
|
|
8535
|
-
throw err_68;
|
|
8536
|
-
case 4: return [2, {
|
|
8537
|
-
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8538
|
-
additionalSigners: additionalSigners
|
|
8539
|
-
}];
|
|
8540
|
-
}
|
|
8541
|
-
});
|
|
8542
|
-
}); };
|
|
8543
8508
|
this.setTokenReward = function (owner, amount, epochCount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8544
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction,
|
|
8509
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_68;
|
|
8545
8510
|
return __generator(this, function (_a) {
|
|
8546
8511
|
switch (_a.label) {
|
|
8547
8512
|
case 0:
|
|
@@ -8572,9 +8537,9 @@ var PerpetualsClient = (function () {
|
|
|
8572
8537
|
instructions.push(setTokenRewardInstruction);
|
|
8573
8538
|
return [3, 4];
|
|
8574
8539
|
case 3:
|
|
8575
|
-
|
|
8576
|
-
console.log("perpClient setTokenRewardInstruction error:: ",
|
|
8577
|
-
throw
|
|
8540
|
+
err_68 = _a.sent();
|
|
8541
|
+
console.log("perpClient setTokenRewardInstruction error:: ", err_68);
|
|
8542
|
+
throw err_68;
|
|
8578
8543
|
case 4: return [2, {
|
|
8579
8544
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8580
8545
|
additionalSigners: additionalSigners
|
|
@@ -8583,7 +8548,7 @@ var PerpetualsClient = (function () {
|
|
|
8583
8548
|
});
|
|
8584
8549
|
}); };
|
|
8585
8550
|
this.resizeInternalOracle = function (lazerFeedId, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
|
|
8586
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction,
|
|
8551
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction, err_69;
|
|
8587
8552
|
return __generator(this, function (_a) {
|
|
8588
8553
|
switch (_a.label) {
|
|
8589
8554
|
case 0:
|
|
@@ -8612,9 +8577,9 @@ var PerpetualsClient = (function () {
|
|
|
8612
8577
|
instructions.push(resizeInternalOracleInstruction);
|
|
8613
8578
|
return [3, 4];
|
|
8614
8579
|
case 3:
|
|
8615
|
-
|
|
8616
|
-
console.log("perpClient resizeInternalOracleInstruction error:: ",
|
|
8617
|
-
throw
|
|
8580
|
+
err_69 = _a.sent();
|
|
8581
|
+
console.log("perpClient resizeInternalOracleInstruction error:: ", err_69);
|
|
8582
|
+
throw err_69;
|
|
8618
8583
|
case 4: return [2, {
|
|
8619
8584
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8620
8585
|
additionalSigners: additionalSigners
|
|
@@ -8623,7 +8588,7 @@ var PerpetualsClient = (function () {
|
|
|
8623
8588
|
});
|
|
8624
8589
|
}); };
|
|
8625
8590
|
this.createWhitelist = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
|
|
8626
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction,
|
|
8591
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction, err_70;
|
|
8627
8592
|
return __generator(this, function (_a) {
|
|
8628
8593
|
switch (_a.label) {
|
|
8629
8594
|
case 0:
|
|
@@ -8656,9 +8621,9 @@ var PerpetualsClient = (function () {
|
|
|
8656
8621
|
instructions.push(createWhitelistInstruction);
|
|
8657
8622
|
return [3, 4];
|
|
8658
8623
|
case 3:
|
|
8659
|
-
|
|
8660
|
-
console.log("perpClient createWhitelistInstruction error:: ",
|
|
8661
|
-
throw
|
|
8624
|
+
err_70 = _a.sent();
|
|
8625
|
+
console.log("perpClient createWhitelistInstruction error:: ", err_70);
|
|
8626
|
+
throw err_70;
|
|
8662
8627
|
case 4: return [2, {
|
|
8663
8628
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8664
8629
|
additionalSigners: additionalSigners
|
|
@@ -8667,7 +8632,7 @@ var PerpetualsClient = (function () {
|
|
|
8667
8632
|
});
|
|
8668
8633
|
}); };
|
|
8669
8634
|
this.setWhitelistConfig = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
|
|
8670
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction,
|
|
8635
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction, err_71;
|
|
8671
8636
|
return __generator(this, function (_a) {
|
|
8672
8637
|
switch (_a.label) {
|
|
8673
8638
|
case 0:
|
|
@@ -8700,9 +8665,9 @@ var PerpetualsClient = (function () {
|
|
|
8700
8665
|
instructions.push(setWhitelistConfigInstruction);
|
|
8701
8666
|
return [3, 4];
|
|
8702
8667
|
case 3:
|
|
8703
|
-
|
|
8704
|
-
console.log("perpClient setWhitelistConfigInstruction error:: ",
|
|
8705
|
-
throw
|
|
8668
|
+
err_71 = _a.sent();
|
|
8669
|
+
console.log("perpClient setWhitelistConfigInstruction error:: ", err_71);
|
|
8670
|
+
throw err_71;
|
|
8706
8671
|
case 4: return [2, {
|
|
8707
8672
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8708
8673
|
additionalSigners: additionalSigners
|
|
@@ -8711,7 +8676,7 @@ var PerpetualsClient = (function () {
|
|
|
8711
8676
|
});
|
|
8712
8677
|
}); };
|
|
8713
8678
|
this.setPerpetualsConfig = function (allowUngatedTrading, voltageMultiplier, tradingDiscount, referralRebate, defaultRebate, tradeLimit, triggerOrderLimit, rebateLimitUsd) { return __awaiter(_this, void 0, void 0, function () {
|
|
8714
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPerpetualsConfigInstruction,
|
|
8679
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPerpetualsConfigInstruction, err_72;
|
|
8715
8680
|
return __generator(this, function (_a) {
|
|
8716
8681
|
switch (_a.label) {
|
|
8717
8682
|
case 0:
|
|
@@ -8745,9 +8710,9 @@ var PerpetualsClient = (function () {
|
|
|
8745
8710
|
instructions.push(setPerpetualsConfigInstruction);
|
|
8746
8711
|
return [3, 4];
|
|
8747
8712
|
case 3:
|
|
8748
|
-
|
|
8749
|
-
console.log("perpClient setPerpetualsConfigInstruction error:: ",
|
|
8750
|
-
throw
|
|
8713
|
+
err_72 = _a.sent();
|
|
8714
|
+
console.log("perpClient setPerpetualsConfigInstruction error:: ", err_72);
|
|
8715
|
+
throw err_72;
|
|
8751
8716
|
case 4: return [2, {
|
|
8752
8717
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8753
8718
|
additionalSigners: additionalSigners
|
|
@@ -8756,7 +8721,7 @@ var PerpetualsClient = (function () {
|
|
|
8756
8721
|
});
|
|
8757
8722
|
}); };
|
|
8758
8723
|
this.setPoolConfig = function (name, permissions, maxAumUsd, oracleAuthority, stakingFeeShareBps, vpVolumeFactor, stakingFeeBoostBps, minLpPriceUsd, maxLpPriceUsd, thresholdUsd) { return __awaiter(_this, void 0, void 0, function () {
|
|
8759
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPoolConfigInstruction,
|
|
8724
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPoolConfigInstruction, err_73;
|
|
8760
8725
|
return __generator(this, function (_a) {
|
|
8761
8726
|
switch (_a.label) {
|
|
8762
8727
|
case 0:
|
|
@@ -8784,9 +8749,9 @@ var PerpetualsClient = (function () {
|
|
|
8784
8749
|
instructions.push(setPoolConfigInstruction);
|
|
8785
8750
|
return [3, 4];
|
|
8786
8751
|
case 3:
|
|
8787
|
-
|
|
8788
|
-
console.log("perpClient setPoolConfigInstruction error:: ",
|
|
8789
|
-
throw
|
|
8752
|
+
err_73 = _a.sent();
|
|
8753
|
+
console.log("perpClient setPoolConfigInstruction error:: ", err_73);
|
|
8754
|
+
throw err_73;
|
|
8790
8755
|
case 4: return [2, {
|
|
8791
8756
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8792
8757
|
additionalSigners: additionalSigners
|
|
@@ -8795,7 +8760,7 @@ var PerpetualsClient = (function () {
|
|
|
8795
8760
|
});
|
|
8796
8761
|
}); };
|
|
8797
8762
|
this.addCustodyToken22 = function (poolName, tokenMint, tokenAccountSpace, token22) { return __awaiter(_this, void 0, void 0, function () {
|
|
8798
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, addCustodyToken22Instruction,
|
|
8763
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, addCustodyToken22Instruction, err_74;
|
|
8799
8764
|
return __generator(this, function (_a) {
|
|
8800
8765
|
switch (_a.label) {
|
|
8801
8766
|
case 0:
|
|
@@ -8829,9 +8794,9 @@ var PerpetualsClient = (function () {
|
|
|
8829
8794
|
instructions.push(addCustodyToken22Instruction);
|
|
8830
8795
|
return [3, 4];
|
|
8831
8796
|
case 3:
|
|
8832
|
-
|
|
8833
|
-
console.log("perpClient addCustodyToken22Instruction error:: ",
|
|
8834
|
-
throw
|
|
8797
|
+
err_74 = _a.sent();
|
|
8798
|
+
console.log("perpClient addCustodyToken22Instruction error:: ", err_74);
|
|
8799
|
+
throw err_74;
|
|
8835
8800
|
case 4: return [2, {
|
|
8836
8801
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8837
8802
|
additionalSigners: additionalSigners
|
|
@@ -8840,7 +8805,7 @@ var PerpetualsClient = (function () {
|
|
|
8840
8805
|
});
|
|
8841
8806
|
}); };
|
|
8842
8807
|
this.addMarket = function (poolName, targetCustody, collateralCustody, side, correlation, maxPayoffBps, permissions) { return __awaiter(_this, void 0, void 0, function () {
|
|
8843
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, market, addMarketInstruction,
|
|
8808
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, market, addMarketInstruction, err_75;
|
|
8844
8809
|
return __generator(this, function (_a) {
|
|
8845
8810
|
switch (_a.label) {
|
|
8846
8811
|
case 0:
|
|
@@ -8883,9 +8848,9 @@ var PerpetualsClient = (function () {
|
|
|
8883
8848
|
instructions.push(addMarketInstruction);
|
|
8884
8849
|
return [3, 4];
|
|
8885
8850
|
case 3:
|
|
8886
|
-
|
|
8887
|
-
console.log("perpClient addMarketInstruction error:: ",
|
|
8888
|
-
throw
|
|
8851
|
+
err_75 = _a.sent();
|
|
8852
|
+
console.log("perpClient addMarketInstruction error:: ", err_75);
|
|
8853
|
+
throw err_75;
|
|
8889
8854
|
case 4: return [2, {
|
|
8890
8855
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8891
8856
|
additionalSigners: additionalSigners
|
|
@@ -8894,7 +8859,7 @@ var PerpetualsClient = (function () {
|
|
|
8894
8859
|
});
|
|
8895
8860
|
}); };
|
|
8896
8861
|
this.setCustody = function (poolName, tokenMint, isVirtual, depegAdjustment, inversePrice, oracle, pricingConfig, permissions, fees, borrowRate, ratios, minReserveUsd, limitPriceBufferBps, token22) { return __awaiter(_this, void 0, void 0, function () {
|
|
8897
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setCustodyConfigInstruction,
|
|
8862
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setCustodyConfigInstruction, err_76;
|
|
8898
8863
|
return __generator(this, function (_a) {
|
|
8899
8864
|
switch (_a.label) {
|
|
8900
8865
|
case 0:
|
|
@@ -8936,9 +8901,9 @@ var PerpetualsClient = (function () {
|
|
|
8936
8901
|
instructions.push(setCustodyConfigInstruction);
|
|
8937
8902
|
return [3, 4];
|
|
8938
8903
|
case 3:
|
|
8939
|
-
|
|
8940
|
-
console.log("perpClient setCustodyConfigInstruction error:: ",
|
|
8941
|
-
throw
|
|
8904
|
+
err_76 = _a.sent();
|
|
8905
|
+
console.log("perpClient setCustodyConfigInstruction error:: ", err_76);
|
|
8906
|
+
throw err_76;
|
|
8942
8907
|
case 4: return [2, {
|
|
8943
8908
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8944
8909
|
additionalSigners: additionalSigners
|
|
@@ -8947,7 +8912,7 @@ var PerpetualsClient = (function () {
|
|
|
8947
8912
|
});
|
|
8948
8913
|
}); };
|
|
8949
8914
|
this.setCustodyTokenMultiplier = function (poolName, tokenMint) { return __awaiter(_this, void 0, void 0, function () {
|
|
8950
|
-
var preInstructions, instructions, postInstructions, additionalSigners, ix,
|
|
8915
|
+
var preInstructions, instructions, postInstructions, additionalSigners, ix, err_77;
|
|
8951
8916
|
return __generator(this, function (_a) {
|
|
8952
8917
|
switch (_a.label) {
|
|
8953
8918
|
case 0:
|
|
@@ -8975,9 +8940,9 @@ var PerpetualsClient = (function () {
|
|
|
8975
8940
|
instructions.push(ix);
|
|
8976
8941
|
return [3, 4];
|
|
8977
8942
|
case 3:
|
|
8978
|
-
|
|
8979
|
-
console.log("perpClient setCustodyTokenMultiplier error:: ",
|
|
8980
|
-
throw
|
|
8943
|
+
err_77 = _a.sent();
|
|
8944
|
+
console.log("perpClient setCustodyTokenMultiplier error:: ", err_77);
|
|
8945
|
+
throw err_77;
|
|
8981
8946
|
case 4: return [2, {
|
|
8982
8947
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8983
8948
|
additionalSigners: additionalSigners
|
|
@@ -8986,7 +8951,7 @@ var PerpetualsClient = (function () {
|
|
|
8986
8951
|
});
|
|
8987
8952
|
}); };
|
|
8988
8953
|
this.addInternalOracle = function (exponent, lazerFeedId, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
|
|
8989
|
-
var preInstructions, instructions, postInstructions, additionalSigners, addInternalOracleInstruction,
|
|
8954
|
+
var preInstructions, instructions, postInstructions, additionalSigners, addInternalOracleInstruction, err_78;
|
|
8990
8955
|
return __generator(this, function (_a) {
|
|
8991
8956
|
switch (_a.label) {
|
|
8992
8957
|
case 0:
|
|
@@ -9016,9 +8981,9 @@ var PerpetualsClient = (function () {
|
|
|
9016
8981
|
instructions.push(addInternalOracleInstruction);
|
|
9017
8982
|
return [3, 4];
|
|
9018
8983
|
case 3:
|
|
9019
|
-
|
|
9020
|
-
console.log("perpClient setCustodyConfigInstruction error:: ",
|
|
9021
|
-
throw
|
|
8984
|
+
err_78 = _a.sent();
|
|
8985
|
+
console.log("perpClient setCustodyConfigInstruction error:: ", err_78);
|
|
8986
|
+
throw err_78;
|
|
9022
8987
|
case 4: return [2, {
|
|
9023
8988
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
9024
8989
|
additionalSigners: additionalSigners
|
|
@@ -9027,7 +8992,7 @@ var PerpetualsClient = (function () {
|
|
|
9027
8992
|
});
|
|
9028
8993
|
}); };
|
|
9029
8994
|
this.setMarket = function (poolName, targetCustody, collateralCustody, marketAccount, maxPayoffBps, permissions, correlation) { return __awaiter(_this, void 0, void 0, function () {
|
|
9030
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setMarketConfigInstruction,
|
|
8995
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setMarketConfigInstruction, err_79;
|
|
9031
8996
|
return __generator(this, function (_a) {
|
|
9032
8997
|
switch (_a.label) {
|
|
9033
8998
|
case 0:
|
|
@@ -9058,9 +9023,9 @@ var PerpetualsClient = (function () {
|
|
|
9058
9023
|
instructions.push(setMarketConfigInstruction);
|
|
9059
9024
|
return [3, 4];
|
|
9060
9025
|
case 3:
|
|
9061
|
-
|
|
9062
|
-
console.log("perpClient setCustodyConfigInstruction error:: ",
|
|
9063
|
-
throw
|
|
9026
|
+
err_79 = _a.sent();
|
|
9027
|
+
console.log("perpClient setCustodyConfigInstruction error:: ", err_79);
|
|
9028
|
+
throw err_79;
|
|
9064
9029
|
case 4: return [2, {
|
|
9065
9030
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
9066
9031
|
additionalSigners: additionalSigners
|
|
@@ -9069,7 +9034,7 @@ var PerpetualsClient = (function () {
|
|
|
9069
9034
|
});
|
|
9070
9035
|
}); };
|
|
9071
9036
|
this.removeMarket = function (poolName, market, targetMint, collateralMint) { return __awaiter(_this, void 0, void 0, function () {
|
|
9072
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, removeMarketInstruction,
|
|
9037
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, removeMarketInstruction, err_80;
|
|
9073
9038
|
return __generator(this, function (_a) {
|
|
9074
9039
|
switch (_a.label) {
|
|
9075
9040
|
case 0:
|
|
@@ -9101,9 +9066,9 @@ var PerpetualsClient = (function () {
|
|
|
9101
9066
|
instructions.push(removeMarketInstruction);
|
|
9102
9067
|
return [3, 4];
|
|
9103
9068
|
case 3:
|
|
9104
|
-
|
|
9105
|
-
console.log("perpClient setCustodyConfigInstruction error:: ",
|
|
9106
|
-
throw
|
|
9069
|
+
err_80 = _a.sent();
|
|
9070
|
+
console.log("perpClient setCustodyConfigInstruction error:: ", err_80);
|
|
9071
|
+
throw err_80;
|
|
9107
9072
|
case 4: return [2, {
|
|
9108
9073
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
9109
9074
|
additionalSigners: additionalSigners
|
|
@@ -9111,84 +9076,8 @@ var PerpetualsClient = (function () {
|
|
|
9111
9076
|
}
|
|
9112
9077
|
});
|
|
9113
9078
|
}); };
|
|
9114
|
-
this.refreshPositionsStatus = function (positionAccounts) { return __awaiter(_this, void 0, void 0, function () {
|
|
9115
|
-
var instructions, additionalSigners, remainingAccounts, refreshInstruction, err_82;
|
|
9116
|
-
return __generator(this, function (_a) {
|
|
9117
|
-
switch (_a.label) {
|
|
9118
|
-
case 0:
|
|
9119
|
-
instructions = [];
|
|
9120
|
-
additionalSigners = [];
|
|
9121
|
-
_a.label = 1;
|
|
9122
|
-
case 1:
|
|
9123
|
-
_a.trys.push([1, 3, , 4]);
|
|
9124
|
-
remainingAccounts = positionAccounts.map(function (pubkey) { return ({
|
|
9125
|
-
pubkey: pubkey,
|
|
9126
|
-
isSigner: false,
|
|
9127
|
-
isWritable: true,
|
|
9128
|
-
}); });
|
|
9129
|
-
return [4, this.program.methods
|
|
9130
|
-
.refreshPositionsStatus({})
|
|
9131
|
-
.accountsPartial({
|
|
9132
|
-
admin: this.provider.wallet.publicKey,
|
|
9133
|
-
multisig: this.multisig.publicKey,
|
|
9134
|
-
})
|
|
9135
|
-
.remainingAccounts(remainingAccounts)
|
|
9136
|
-
.instruction()];
|
|
9137
|
-
case 2:
|
|
9138
|
-
refreshInstruction = _a.sent();
|
|
9139
|
-
instructions.push(refreshInstruction);
|
|
9140
|
-
return [3, 4];
|
|
9141
|
-
case 3:
|
|
9142
|
-
err_82 = _a.sent();
|
|
9143
|
-
console.log("perpClient refreshPositionsStatus error:: ", err_82);
|
|
9144
|
-
throw err_82;
|
|
9145
|
-
case 4: return [2, {
|
|
9146
|
-
instructions: __spreadArray([], instructions, true),
|
|
9147
|
-
additionalSigners: additionalSigners
|
|
9148
|
-
}];
|
|
9149
|
-
}
|
|
9150
|
-
});
|
|
9151
|
-
}); };
|
|
9152
|
-
this.refreshOrdersStatus = function (orderAccounts) { return __awaiter(_this, void 0, void 0, function () {
|
|
9153
|
-
var instructions, additionalSigners, remainingAccounts, refreshInstruction, err_83;
|
|
9154
|
-
return __generator(this, function (_a) {
|
|
9155
|
-
switch (_a.label) {
|
|
9156
|
-
case 0:
|
|
9157
|
-
instructions = [];
|
|
9158
|
-
additionalSigners = [];
|
|
9159
|
-
_a.label = 1;
|
|
9160
|
-
case 1:
|
|
9161
|
-
_a.trys.push([1, 3, , 4]);
|
|
9162
|
-
remainingAccounts = orderAccounts.map(function (pubkey) { return ({
|
|
9163
|
-
pubkey: pubkey,
|
|
9164
|
-
isSigner: false,
|
|
9165
|
-
isWritable: true,
|
|
9166
|
-
}); });
|
|
9167
|
-
return [4, this.program.methods
|
|
9168
|
-
.refreshOrdersStatus({})
|
|
9169
|
-
.accountsPartial({
|
|
9170
|
-
admin: this.provider.wallet.publicKey,
|
|
9171
|
-
multisig: this.multisig.publicKey,
|
|
9172
|
-
})
|
|
9173
|
-
.remainingAccounts(remainingAccounts)
|
|
9174
|
-
.instruction()];
|
|
9175
|
-
case 2:
|
|
9176
|
-
refreshInstruction = _a.sent();
|
|
9177
|
-
instructions.push(refreshInstruction);
|
|
9178
|
-
return [3, 4];
|
|
9179
|
-
case 3:
|
|
9180
|
-
err_83 = _a.sent();
|
|
9181
|
-
console.log("perpClient refreshOrdersStatus error:: ", err_83);
|
|
9182
|
-
throw err_83;
|
|
9183
|
-
case 4: return [2, {
|
|
9184
|
-
instructions: __spreadArray([], instructions, true),
|
|
9185
|
-
additionalSigners: additionalSigners
|
|
9186
|
-
}];
|
|
9187
|
-
}
|
|
9188
|
-
});
|
|
9189
|
-
}); };
|
|
9190
9079
|
this.migrateMarketPosition = function (poolName, oldMarket, newMarket, oldCollateralCustody, newCollateralCustody, owner) { return __awaiter(_this, void 0, void 0, function () {
|
|
9191
|
-
var preInstructions, instructions, postInstructions, additionalSigners, oldPosition, newPosition, oldCollateralCustodyAccount, newCollateralCustodyAccount, migrateMarketPositionInstruction,
|
|
9080
|
+
var preInstructions, instructions, postInstructions, additionalSigners, oldPosition, newPosition, oldCollateralCustodyAccount, newCollateralCustodyAccount, migrateMarketPositionInstruction, err_81;
|
|
9192
9081
|
return __generator(this, function (_a) {
|
|
9193
9082
|
switch (_a.label) {
|
|
9194
9083
|
case 0:
|
|
@@ -9239,9 +9128,9 @@ var PerpetualsClient = (function () {
|
|
|
9239
9128
|
instructions.push(migrateMarketPositionInstruction);
|
|
9240
9129
|
return [3, 6];
|
|
9241
9130
|
case 5:
|
|
9242
|
-
|
|
9243
|
-
console.log("perpClient migrateMarketPosition error:: ",
|
|
9244
|
-
throw
|
|
9131
|
+
err_81 = _a.sent();
|
|
9132
|
+
console.log("perpClient migrateMarketPosition error:: ", err_81);
|
|
9133
|
+
throw err_81;
|
|
9245
9134
|
case 6: return [2, {
|
|
9246
9135
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
9247
9136
|
additionalSigners: additionalSigners
|
|
@@ -9255,7 +9144,7 @@ var PerpetualsClient = (function () {
|
|
|
9255
9144
|
args_1[_i - 5] = arguments[_i];
|
|
9256
9145
|
}
|
|
9257
9146
|
return __awaiter(_this, __spreadArray([poolName_1, oldMarket_1, newMarket_1, oldCollateralCustody_1, newCollateralCustody_1], args_1, true), void 0, function (poolName, oldMarket, newMarket, oldCollateralCustody, newCollateralCustody, owner) {
|
|
9258
|
-
var preInstructions, instructions, postInstructions, additionalSigners, oldOrder, newOrder, migrateMarketOrderInstruction,
|
|
9147
|
+
var preInstructions, instructions, postInstructions, additionalSigners, oldOrder, newOrder, migrateMarketOrderInstruction, err_82;
|
|
9259
9148
|
if (owner === void 0) { owner = this.provider.wallet.publicKey; }
|
|
9260
9149
|
return __generator(this, function (_a) {
|
|
9261
9150
|
switch (_a.label) {
|
|
@@ -9297,9 +9186,9 @@ var PerpetualsClient = (function () {
|
|
|
9297
9186
|
instructions.push(migrateMarketOrderInstruction);
|
|
9298
9187
|
return [3, 4];
|
|
9299
9188
|
case 3:
|
|
9300
|
-
|
|
9301
|
-
console.log("perpClient migrateMarketOrder error:: ",
|
|
9302
|
-
throw
|
|
9189
|
+
err_82 = _a.sent();
|
|
9190
|
+
console.log("perpClient migrateMarketOrder error:: ", err_82);
|
|
9191
|
+
throw err_82;
|
|
9303
9192
|
case 4: return [2, {
|
|
9304
9193
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
9305
9194
|
additionalSigners: additionalSigners
|
|
@@ -9309,7 +9198,7 @@ var PerpetualsClient = (function () {
|
|
|
9309
9198
|
});
|
|
9310
9199
|
};
|
|
9311
9200
|
this.forceSettlePosition = function (market, owner, receivingAccount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
9312
|
-
var instructions, additionalSigners, marketAccount, targetCustody_1, collateralCustody_1, targetCustodyConfig, collateralCustodyConfig, positionAccount, orderAccount, remainingAccounts, orderAccountInfo, forceSettlePositionIx,
|
|
9201
|
+
var instructions, additionalSigners, marketAccount, targetCustody_1, collateralCustody_1, targetCustodyConfig, collateralCustodyConfig, positionAccount, orderAccount, remainingAccounts, orderAccountInfo, forceSettlePositionIx, err_83;
|
|
9313
9202
|
return __generator(this, function (_a) {
|
|
9314
9203
|
switch (_a.label) {
|
|
9315
9204
|
case 0:
|
|
@@ -9373,9 +9262,9 @@ var PerpetualsClient = (function () {
|
|
|
9373
9262
|
instructions.push(forceSettlePositionIx);
|
|
9374
9263
|
return [3, 6];
|
|
9375
9264
|
case 5:
|
|
9376
|
-
|
|
9377
|
-
console.log("perpClient forceSettlePosition error:: ",
|
|
9378
|
-
throw
|
|
9265
|
+
err_83 = _a.sent();
|
|
9266
|
+
console.log("perpClient forceSettlePosition error:: ", err_83);
|
|
9267
|
+
throw err_83;
|
|
9379
9268
|
case 6: return [2, {
|
|
9380
9269
|
instructions: __spreadArray([], instructions, true),
|
|
9381
9270
|
additionalSigners: additionalSigners
|
|
@@ -9384,7 +9273,7 @@ var PerpetualsClient = (function () {
|
|
|
9384
9273
|
});
|
|
9385
9274
|
}); };
|
|
9386
9275
|
this.forceSettleOrder = function (market, owner, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
9387
|
-
var instructions, additionalSigners, marketAccount, targetCustody, orderKey, orderAccount, uidToCustodyConfig, _i, _a, custodyConfig, custody, _b, activeLimitOrders, uniqueUids, _c, uniqueUids_1, uid, reserveCustodyConfig, isToken2022, receivingAccount, forceSettleOrderIx, reserveCustodyConfig, isToken2022, receivingAccount, forceSettleOrderIx,
|
|
9276
|
+
var instructions, additionalSigners, marketAccount, targetCustody, orderKey, orderAccount, uidToCustodyConfig, _i, _a, custodyConfig, custody, _b, activeLimitOrders, uniqueUids, _c, uniqueUids_1, uid, reserveCustodyConfig, isToken2022, receivingAccount, forceSettleOrderIx, reserveCustodyConfig, isToken2022, receivingAccount, forceSettleOrderIx, err_84;
|
|
9388
9277
|
return __generator(this, function (_d) {
|
|
9389
9278
|
switch (_d.label) {
|
|
9390
9279
|
case 0:
|
|
@@ -9497,9 +9386,9 @@ var PerpetualsClient = (function () {
|
|
|
9497
9386
|
_d.label = 15;
|
|
9498
9387
|
case 15: return [3, 17];
|
|
9499
9388
|
case 16:
|
|
9500
|
-
|
|
9501
|
-
console.log("perpClient forceSettleOrder error:: ",
|
|
9502
|
-
throw
|
|
9389
|
+
err_84 = _d.sent();
|
|
9390
|
+
console.log("perpClient forceSettleOrder error:: ", err_84);
|
|
9391
|
+
throw err_84;
|
|
9503
9392
|
case 17: return [2, {
|
|
9504
9393
|
instructions: __spreadArray([], instructions, true),
|
|
9505
9394
|
additionalSigners: additionalSigners
|