flash-sdk 11.8.7 → 11.10.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PerpetualsClient.d.ts +51 -14
- package/dist/PerpetualsClient.js +130 -66
- package/dist/PositionAccount.d.ts +2 -1
- package/dist/idl/perpetuals.d.ts +111 -304
- package/dist/idl/perpetuals.js +112 -305
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +2 -1
- package/package.json +1 -1
package/dist/PerpetualsClient.js
CHANGED
|
@@ -701,7 +701,7 @@ var PerpetualsClient = (function () {
|
|
|
701
701
|
currentMarginUsd = positionAccount.collateralUsd.sub(lossUsd);
|
|
702
702
|
}
|
|
703
703
|
else {
|
|
704
|
-
currentMarginUsd = positionAccount.collateralUsd.add(pnl.
|
|
704
|
+
currentMarginUsd = positionAccount.collateralUsd.add(pnl.netProfitUsd).sub(lossUsd);
|
|
705
705
|
}
|
|
706
706
|
if (currentMarginUsd.gt(constants_1.BN_ZERO)) {
|
|
707
707
|
return positionAccount.sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(currentMarginUsd);
|
|
@@ -1056,7 +1056,7 @@ var PerpetualsClient = (function () {
|
|
|
1056
1056
|
var totalFeesUsd = (exitFeeUsd.add(lockAndUnsettledFeeUsd));
|
|
1057
1057
|
var currentCollateralUsd = positionDelta.collateralUsd;
|
|
1058
1058
|
var liabilityUsd = newPnl.lossUsd.add(totalFeesUsd);
|
|
1059
|
-
var assetsUsd = anchor_1.BN.min(newPnl.
|
|
1059
|
+
var assetsUsd = anchor_1.BN.min(newPnl.netProfitUsd.add(currentCollateralUsd), collateralMinMaxPrice.max.getAssetAmountUsd(positionDelta.lockedAmount, collateralCustodyAccount.decimals));
|
|
1060
1060
|
if (debugLogs) {
|
|
1061
1061
|
console.log("assetsUsd.sub(liabilityUsd):", collateralCustodyAccount.decimals, assetsUsd.toString(), liabilityUsd.toString(), assetsUsd.sub(liabilityUsd).toString());
|
|
1062
1062
|
}
|
|
@@ -1193,7 +1193,7 @@ var PerpetualsClient = (function () {
|
|
|
1193
1193
|
var exitPriceAndFee = _this.getExitPriceAndFeeSync(positionAccount, marketCorrelation, positionAccount.collateralAmount, positionAccount.sizeAmount, side, targetPrice, targetEmaPrice, targetCustodyAccount, collateralPrice, collateralEmaPrice, collateralCustodyAccount, currentTimestamp);
|
|
1194
1194
|
var totalFeesUsd = (exitPriceAndFee.exitFeeUsd.add(exitPriceAndFee.borrowFeeUsd));
|
|
1195
1195
|
var liabilityUsd = newPnl.lossUsd.add(totalFeesUsd);
|
|
1196
|
-
var assetsUsd = anchor_1.BN.min(newPnl.
|
|
1196
|
+
var assetsUsd = anchor_1.BN.min(newPnl.netProfitUsd.add(positionAccount.collateralUsd), collateralMinMaxPrice.max.getAssetAmountUsd(positionAccount.lockedAmount, collateralCustodyAccount.decimals));
|
|
1197
1197
|
var closeAmountUsd, feesAmountUsd;
|
|
1198
1198
|
if (assetsUsd.gt(liabilityUsd)) {
|
|
1199
1199
|
closeAmountUsd = assetsUsd.sub(liabilityUsd);
|
|
@@ -1609,6 +1609,8 @@ var PerpetualsClient = (function () {
|
|
|
1609
1609
|
return {
|
|
1610
1610
|
profitUsd: constants_1.BN_ZERO,
|
|
1611
1611
|
lossUsd: constants_1.BN_ZERO,
|
|
1612
|
+
penaltyUsd: constants_1.BN_ZERO,
|
|
1613
|
+
netProfitUsd: constants_1.BN_ZERO,
|
|
1612
1614
|
};
|
|
1613
1615
|
}
|
|
1614
1616
|
var side = poolConfig.getMarketConfigByPk(positionAccount.market).side;
|
|
@@ -1672,16 +1674,29 @@ var PerpetualsClient = (function () {
|
|
|
1672
1674
|
if (!priceDiffProfit.exponent.eq(priceDiffLoss.exponent)) {
|
|
1673
1675
|
throw new Error("exponent mistach");
|
|
1674
1676
|
}
|
|
1677
|
+
var totalPenaltyBps = positionAccount.oraclePenalty + positionAccount.previousPenalty;
|
|
1675
1678
|
if (priceDiffProfit.price.gt(constants_1.BN_ZERO)) {
|
|
1679
|
+
var grossProfitUsd = priceDiffProfit.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals);
|
|
1680
|
+
var penaltyUsd = constants_1.BN_ZERO;
|
|
1681
|
+
var netProfitUsd = grossProfitUsd;
|
|
1682
|
+
if (totalPenaltyBps > 0 && grossProfitUsd.gt(constants_1.BN_ZERO)) {
|
|
1683
|
+
penaltyUsd = positionAccount.sizeUsd.muln(totalPenaltyBps).divn(constants_1.BPS_POWER);
|
|
1684
|
+
penaltyUsd = anchor_1.BN.min(penaltyUsd, grossProfitUsd);
|
|
1685
|
+
netProfitUsd = grossProfitUsd.sub(penaltyUsd);
|
|
1686
|
+
}
|
|
1676
1687
|
return {
|
|
1677
|
-
profitUsd:
|
|
1688
|
+
profitUsd: grossProfitUsd,
|
|
1678
1689
|
lossUsd: constants_1.BN_ZERO,
|
|
1690
|
+
penaltyUsd: penaltyUsd,
|
|
1691
|
+
netProfitUsd: netProfitUsd,
|
|
1679
1692
|
};
|
|
1680
1693
|
}
|
|
1681
1694
|
else {
|
|
1682
1695
|
return {
|
|
1683
1696
|
profitUsd: constants_1.BN_ZERO,
|
|
1684
1697
|
lossUsd: priceDiffLoss.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals),
|
|
1698
|
+
penaltyUsd: constants_1.BN_ZERO,
|
|
1699
|
+
netProfitUsd: constants_1.BN_ZERO,
|
|
1685
1700
|
};
|
|
1686
1701
|
}
|
|
1687
1702
|
};
|
|
@@ -1694,7 +1709,7 @@ var PerpetualsClient = (function () {
|
|
|
1694
1709
|
timestamp: constants_1.BN_ZERO
|
|
1695
1710
|
});
|
|
1696
1711
|
return {
|
|
1697
|
-
pnl: { profitUsd: constants_1.BN_ZERO, lossUsd: constants_1.BN_ZERO },
|
|
1712
|
+
pnl: { profitUsd: constants_1.BN_ZERO, lossUsd: constants_1.BN_ZERO, penaltyUsd: constants_1.BN_ZERO, netProfitUsd: constants_1.BN_ZERO },
|
|
1698
1713
|
leverage: constants_1.BN_ZERO,
|
|
1699
1714
|
liquidationPrice: zeroOraclePrice,
|
|
1700
1715
|
fees: { exitFeeUsd: constants_1.BN_ZERO, exitFeeAmount: constants_1.BN_ZERO, lockAndUnsettledFeeUsd: constants_1.BN_ZERO }
|
|
@@ -1760,22 +1775,35 @@ var PerpetualsClient = (function () {
|
|
|
1760
1775
|
priceDiffLoss = new OraclePrice_1.OraclePrice({ price: exitOraclePrice.price.sub(entryOraclePrice.price), exponent: exitOraclePrice.exponent, confidence: constants_1.BN_ZERO, timestamp: constants_1.BN_ZERO });
|
|
1761
1776
|
}
|
|
1762
1777
|
}
|
|
1778
|
+
var totalPenaltyBps = positionAccount.oraclePenalty + positionAccount.previousPenalty;
|
|
1763
1779
|
if (priceDiffProfit.price.gt(constants_1.BN_ZERO)) {
|
|
1780
|
+
var grossProfitUsd = priceDiffProfit.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals);
|
|
1781
|
+
var penaltyUsd = constants_1.BN_ZERO;
|
|
1782
|
+
var netProfitUsd = grossProfitUsd;
|
|
1783
|
+
if (totalPenaltyBps > 0 && grossProfitUsd.gt(constants_1.BN_ZERO)) {
|
|
1784
|
+
penaltyUsd = positionAccount.sizeUsd.muln(totalPenaltyBps).divn(constants_1.BPS_POWER);
|
|
1785
|
+
penaltyUsd = anchor_1.BN.min(penaltyUsd, grossProfitUsd);
|
|
1786
|
+
netProfitUsd = grossProfitUsd.sub(penaltyUsd);
|
|
1787
|
+
}
|
|
1764
1788
|
pnl = {
|
|
1765
|
-
profitUsd:
|
|
1789
|
+
profitUsd: grossProfitUsd,
|
|
1766
1790
|
lossUsd: constants_1.BN_ZERO,
|
|
1791
|
+
penaltyUsd: penaltyUsd,
|
|
1792
|
+
netProfitUsd: netProfitUsd,
|
|
1767
1793
|
};
|
|
1768
1794
|
}
|
|
1769
1795
|
else {
|
|
1770
1796
|
pnl = {
|
|
1771
1797
|
profitUsd: constants_1.BN_ZERO,
|
|
1772
1798
|
lossUsd: priceDiffLoss.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals),
|
|
1799
|
+
penaltyUsd: constants_1.BN_ZERO,
|
|
1800
|
+
netProfitUsd: constants_1.BN_ZERO,
|
|
1773
1801
|
};
|
|
1774
1802
|
}
|
|
1775
1803
|
var liquidationPrice = _this.getLiquidationPriceContractHelper(entryOraclePrice, lockAndUnsettledFeeUsd, side, targetCustodyAccount, positionAccount);
|
|
1776
1804
|
var unsettledFeesUsd = exitFeeUsd.add(lockAndUnsettledFeeUsd);
|
|
1777
1805
|
var lossUsd = pnl.lossUsd.add(unsettledFeesUsd);
|
|
1778
|
-
var currentMarginUsd = positionAccount.collateralUsd.add(pnl.
|
|
1806
|
+
var currentMarginUsd = positionAccount.collateralUsd.add(pnl.netProfitUsd).sub(lossUsd);
|
|
1779
1807
|
var leverage;
|
|
1780
1808
|
if (currentMarginUsd.gt(constants_1.BN_ZERO)) {
|
|
1781
1809
|
leverage = positionAccount.sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(currentMarginUsd);
|
|
@@ -7593,8 +7621,44 @@ var PerpetualsClient = (function () {
|
|
|
7593
7621
|
}
|
|
7594
7622
|
});
|
|
7595
7623
|
}); };
|
|
7624
|
+
this.setPositionPenalty = function (positionPubkey, oraclePenalty, oracleAuthority) { return __awaiter(_this, void 0, void 0, function () {
|
|
7625
|
+
var instructions, additionalSigners, setPositionPenaltyIx, err_52;
|
|
7626
|
+
return __generator(this, function (_a) {
|
|
7627
|
+
switch (_a.label) {
|
|
7628
|
+
case 0:
|
|
7629
|
+
instructions = [];
|
|
7630
|
+
additionalSigners = [];
|
|
7631
|
+
_a.label = 1;
|
|
7632
|
+
case 1:
|
|
7633
|
+
_a.trys.push([1, 3, , 4]);
|
|
7634
|
+
return [4, this.program.methods
|
|
7635
|
+
.setPositionPenalty({
|
|
7636
|
+
oraclePenalty: oraclePenalty,
|
|
7637
|
+
})
|
|
7638
|
+
.accounts({
|
|
7639
|
+
authority: oracleAuthority,
|
|
7640
|
+
position: positionPubkey,
|
|
7641
|
+
eventAuthority: this.eventAuthority.publicKey,
|
|
7642
|
+
program: this.program.programId,
|
|
7643
|
+
})
|
|
7644
|
+
.instruction()];
|
|
7645
|
+
case 2:
|
|
7646
|
+
setPositionPenaltyIx = _a.sent();
|
|
7647
|
+
instructions.push(setPositionPenaltyIx);
|
|
7648
|
+
return [3, 4];
|
|
7649
|
+
case 3:
|
|
7650
|
+
err_52 = _a.sent();
|
|
7651
|
+
console.log("perpClient setPositionPenalty error:: ", err_52);
|
|
7652
|
+
throw err_52;
|
|
7653
|
+
case 4: return [2, {
|
|
7654
|
+
instructions: __spreadArray([], instructions, true),
|
|
7655
|
+
additionalSigners: additionalSigners
|
|
7656
|
+
}];
|
|
7657
|
+
}
|
|
7658
|
+
});
|
|
7659
|
+
}); };
|
|
7596
7660
|
this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7597
|
-
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp,
|
|
7661
|
+
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_53;
|
|
7598
7662
|
return __generator(this, function (_a) {
|
|
7599
7663
|
switch (_a.label) {
|
|
7600
7664
|
case 0:
|
|
@@ -7632,8 +7696,8 @@ var PerpetualsClient = (function () {
|
|
|
7632
7696
|
instructions.push(renameFlp);
|
|
7633
7697
|
return [3, 4];
|
|
7634
7698
|
case 3:
|
|
7635
|
-
|
|
7636
|
-
console.log("perpClient renameFlp error:: ",
|
|
7699
|
+
err_53 = _a.sent();
|
|
7700
|
+
console.log("perpClient renameFlp error:: ", err_53);
|
|
7637
7701
|
return [3, 4];
|
|
7638
7702
|
case 4: return [2, {
|
|
7639
7703
|
instructions: __spreadArray([], instructions, true),
|
|
@@ -7643,7 +7707,7 @@ var PerpetualsClient = (function () {
|
|
|
7643
7707
|
});
|
|
7644
7708
|
}); };
|
|
7645
7709
|
this.initStake = function (stakingFeeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7646
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction,
|
|
7710
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_54;
|
|
7647
7711
|
return __generator(this, function (_a) {
|
|
7648
7712
|
switch (_a.label) {
|
|
7649
7713
|
case 0:
|
|
@@ -7681,9 +7745,9 @@ var PerpetualsClient = (function () {
|
|
|
7681
7745
|
instructions.push(initStakeInstruction);
|
|
7682
7746
|
return [3, 4];
|
|
7683
7747
|
case 3:
|
|
7684
|
-
|
|
7685
|
-
console.log("perpClient InitStaking error:: ",
|
|
7686
|
-
throw
|
|
7748
|
+
err_54 = _a.sent();
|
|
7749
|
+
console.log("perpClient InitStaking error:: ", err_54);
|
|
7750
|
+
throw err_54;
|
|
7687
7751
|
case 4: return [2, {
|
|
7688
7752
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7689
7753
|
additionalSigners: additionalSigners
|
|
@@ -7692,7 +7756,7 @@ var PerpetualsClient = (function () {
|
|
|
7692
7756
|
});
|
|
7693
7757
|
}); };
|
|
7694
7758
|
this.initCompounding = function (feeShareBps, metadataTitle, metadataSymbol, metadataUri, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7695
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction,
|
|
7759
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_55;
|
|
7696
7760
|
return __generator(this, function (_a) {
|
|
7697
7761
|
switch (_a.label) {
|
|
7698
7762
|
case 0:
|
|
@@ -7736,9 +7800,9 @@ var PerpetualsClient = (function () {
|
|
|
7736
7800
|
instructions.push(initCompoundingInstruction);
|
|
7737
7801
|
return [3, 4];
|
|
7738
7802
|
case 3:
|
|
7739
|
-
|
|
7740
|
-
console.log("perpClient initCompounding error:: ",
|
|
7741
|
-
throw
|
|
7803
|
+
err_55 = _a.sent();
|
|
7804
|
+
console.log("perpClient initCompounding error:: ", err_55);
|
|
7805
|
+
throw err_55;
|
|
7742
7806
|
case 4: return [2, {
|
|
7743
7807
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7744
7808
|
additionalSigners: additionalSigners
|
|
@@ -7747,7 +7811,7 @@ var PerpetualsClient = (function () {
|
|
|
7747
7811
|
});
|
|
7748
7812
|
}); };
|
|
7749
7813
|
this.initTokenVault = function (token_permissions, tokens_to_distribute, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7750
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction,
|
|
7814
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_56;
|
|
7751
7815
|
return __generator(this, function (_a) {
|
|
7752
7816
|
switch (_a.label) {
|
|
7753
7817
|
case 0:
|
|
@@ -7788,9 +7852,9 @@ var PerpetualsClient = (function () {
|
|
|
7788
7852
|
instructions.push(initTokenVaultInstruction);
|
|
7789
7853
|
return [3, 4];
|
|
7790
7854
|
case 3:
|
|
7791
|
-
|
|
7792
|
-
console.log("perpClient InitTokenVaultInstruction error:: ",
|
|
7793
|
-
throw
|
|
7855
|
+
err_56 = _a.sent();
|
|
7856
|
+
console.log("perpClient InitTokenVaultInstruction error:: ", err_56);
|
|
7857
|
+
throw err_56;
|
|
7794
7858
|
case 4: return [2, {
|
|
7795
7859
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7796
7860
|
additionalSigners: additionalSigners
|
|
@@ -7799,7 +7863,7 @@ var PerpetualsClient = (function () {
|
|
|
7799
7863
|
});
|
|
7800
7864
|
}); };
|
|
7801
7865
|
this.setTokenVaultConfig = function (token_permissions, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7802
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction,
|
|
7866
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_57;
|
|
7803
7867
|
return __generator(this, function (_a) {
|
|
7804
7868
|
switch (_a.label) {
|
|
7805
7869
|
case 0:
|
|
@@ -7830,9 +7894,9 @@ var PerpetualsClient = (function () {
|
|
|
7830
7894
|
instructions.push(setTokenVaultConfigInstruction);
|
|
7831
7895
|
return [3, 4];
|
|
7832
7896
|
case 3:
|
|
7833
|
-
|
|
7834
|
-
console.log("perpClient setTokenVaultConfigInstruction error:: ",
|
|
7835
|
-
throw
|
|
7897
|
+
err_57 = _a.sent();
|
|
7898
|
+
console.log("perpClient setTokenVaultConfigInstruction error:: ", err_57);
|
|
7899
|
+
throw err_57;
|
|
7836
7900
|
case 4: return [2, {
|
|
7837
7901
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7838
7902
|
additionalSigners: additionalSigners
|
|
@@ -7841,7 +7905,7 @@ var PerpetualsClient = (function () {
|
|
|
7841
7905
|
});
|
|
7842
7906
|
}); };
|
|
7843
7907
|
this.withdrawInstantFee = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7844
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction,
|
|
7908
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_58;
|
|
7845
7909
|
return __generator(this, function (_a) {
|
|
7846
7910
|
switch (_a.label) {
|
|
7847
7911
|
case 0:
|
|
@@ -7880,9 +7944,9 @@ var PerpetualsClient = (function () {
|
|
|
7880
7944
|
instructions.push(withdrawInstantFeeInstruction);
|
|
7881
7945
|
return [3, 6];
|
|
7882
7946
|
case 5:
|
|
7883
|
-
|
|
7884
|
-
console.log("perpClient withdrawInstantFeeInstruction error:: ",
|
|
7885
|
-
throw
|
|
7947
|
+
err_58 = _a.sent();
|
|
7948
|
+
console.log("perpClient withdrawInstantFeeInstruction error:: ", err_58);
|
|
7949
|
+
throw err_58;
|
|
7886
7950
|
case 6: return [2, {
|
|
7887
7951
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7888
7952
|
additionalSigners: additionalSigners
|
|
@@ -7891,7 +7955,7 @@ var PerpetualsClient = (function () {
|
|
|
7891
7955
|
});
|
|
7892
7956
|
}); };
|
|
7893
7957
|
this.withdrawUnclaimedTokens = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7894
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction,
|
|
7958
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction, err_59;
|
|
7895
7959
|
return __generator(this, function (_a) {
|
|
7896
7960
|
switch (_a.label) {
|
|
7897
7961
|
case 0:
|
|
@@ -7930,9 +7994,9 @@ var PerpetualsClient = (function () {
|
|
|
7930
7994
|
instructions.push(withdrawUnclaimedTokensInstruction);
|
|
7931
7995
|
return [3, 6];
|
|
7932
7996
|
case 5:
|
|
7933
|
-
|
|
7934
|
-
console.log("perpClient withdrawUnclaimedTokensInstruction error:: ",
|
|
7935
|
-
throw
|
|
7997
|
+
err_59 = _a.sent();
|
|
7998
|
+
console.log("perpClient withdrawUnclaimedTokensInstruction error:: ", err_59);
|
|
7999
|
+
throw err_59;
|
|
7936
8000
|
case 6: return [2, {
|
|
7937
8001
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7938
8002
|
additionalSigners: additionalSigners
|
|
@@ -7941,7 +8005,7 @@ var PerpetualsClient = (function () {
|
|
|
7941
8005
|
});
|
|
7942
8006
|
}); };
|
|
7943
8007
|
this.initRevenueTokenAccount = function (feeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7944
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction,
|
|
8008
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_60;
|
|
7945
8009
|
return __generator(this, function (_a) {
|
|
7946
8010
|
switch (_a.label) {
|
|
7947
8011
|
case 0:
|
|
@@ -7978,9 +8042,9 @@ var PerpetualsClient = (function () {
|
|
|
7978
8042
|
instructions.push(initRevenueTokenAccountInstruction);
|
|
7979
8043
|
return [3, 4];
|
|
7980
8044
|
case 3:
|
|
7981
|
-
|
|
7982
|
-
console.log("perpClient initRevenueTokenAccountInstruction error:: ",
|
|
7983
|
-
throw
|
|
8045
|
+
err_60 = _a.sent();
|
|
8046
|
+
console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_60);
|
|
8047
|
+
throw err_60;
|
|
7984
8048
|
case 4: return [2, {
|
|
7985
8049
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7986
8050
|
additionalSigners: additionalSigners
|
|
@@ -7989,7 +8053,7 @@ var PerpetualsClient = (function () {
|
|
|
7989
8053
|
});
|
|
7990
8054
|
}); };
|
|
7991
8055
|
this.initRebateVault = function (allowRebatePayout, rebateSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7992
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateCustodyMint, initRebateVaultInstruction,
|
|
8056
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateCustodyMint, initRebateVaultInstruction, err_61;
|
|
7993
8057
|
return __generator(this, function (_a) {
|
|
7994
8058
|
switch (_a.label) {
|
|
7995
8059
|
case 0:
|
|
@@ -8024,9 +8088,9 @@ var PerpetualsClient = (function () {
|
|
|
8024
8088
|
instructions.push(initRebateVaultInstruction);
|
|
8025
8089
|
return [3, 4];
|
|
8026
8090
|
case 3:
|
|
8027
|
-
|
|
8028
|
-
console.log("perpClient initRebateVaultInstruction error:: ",
|
|
8029
|
-
throw
|
|
8091
|
+
err_61 = _a.sent();
|
|
8092
|
+
console.log("perpClient initRebateVaultInstruction error:: ", err_61);
|
|
8093
|
+
throw err_61;
|
|
8030
8094
|
case 4: return [2, {
|
|
8031
8095
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8032
8096
|
additionalSigners: additionalSigners
|
|
@@ -8035,7 +8099,7 @@ var PerpetualsClient = (function () {
|
|
|
8035
8099
|
});
|
|
8036
8100
|
}); };
|
|
8037
8101
|
this.distributeTokenReward = function (amount, epochCount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8038
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction,
|
|
8102
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_62;
|
|
8039
8103
|
return __generator(this, function (_a) {
|
|
8040
8104
|
switch (_a.label) {
|
|
8041
8105
|
case 0:
|
|
@@ -8074,9 +8138,9 @@ var PerpetualsClient = (function () {
|
|
|
8074
8138
|
instructions.push(distributeTokenRewardInstruction);
|
|
8075
8139
|
return [3, 4];
|
|
8076
8140
|
case 3:
|
|
8077
|
-
|
|
8078
|
-
console.log("perpClient distributeTokenRewardInstruction error:: ",
|
|
8079
|
-
throw
|
|
8141
|
+
err_62 = _a.sent();
|
|
8142
|
+
console.log("perpClient distributeTokenRewardInstruction error:: ", err_62);
|
|
8143
|
+
throw err_62;
|
|
8080
8144
|
case 4: return [2, {
|
|
8081
8145
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8082
8146
|
additionalSigners: additionalSigners
|
|
@@ -8085,7 +8149,7 @@ var PerpetualsClient = (function () {
|
|
|
8085
8149
|
});
|
|
8086
8150
|
}); };
|
|
8087
8151
|
this.setTokenStakeLevel = function (owner, stakeLevel) { return __awaiter(_this, void 0, void 0, function () {
|
|
8088
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction,
|
|
8152
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_63;
|
|
8089
8153
|
return __generator(this, function (_a) {
|
|
8090
8154
|
switch (_a.label) {
|
|
8091
8155
|
case 0:
|
|
@@ -8113,9 +8177,9 @@ var PerpetualsClient = (function () {
|
|
|
8113
8177
|
instructions.push(setTokenStakeLevelInstruction);
|
|
8114
8178
|
return [3, 4];
|
|
8115
8179
|
case 3:
|
|
8116
|
-
|
|
8117
|
-
console.log("perpClient setTokenStakeLevelInstruction error:: ",
|
|
8118
|
-
throw
|
|
8180
|
+
err_63 = _a.sent();
|
|
8181
|
+
console.log("perpClient setTokenStakeLevelInstruction error:: ", err_63);
|
|
8182
|
+
throw err_63;
|
|
8119
8183
|
case 4: return [2, {
|
|
8120
8184
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8121
8185
|
additionalSigners: additionalSigners
|
|
@@ -8124,7 +8188,7 @@ var PerpetualsClient = (function () {
|
|
|
8124
8188
|
});
|
|
8125
8189
|
}); };
|
|
8126
8190
|
this.setTokenReward = function (owner, amount, epochCount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8127
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction,
|
|
8191
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_64;
|
|
8128
8192
|
return __generator(this, function (_a) {
|
|
8129
8193
|
switch (_a.label) {
|
|
8130
8194
|
case 0:
|
|
@@ -8156,9 +8220,9 @@ var PerpetualsClient = (function () {
|
|
|
8156
8220
|
instructions.push(setTokenRewardInstruction);
|
|
8157
8221
|
return [3, 4];
|
|
8158
8222
|
case 3:
|
|
8159
|
-
|
|
8160
|
-
console.log("perpClient setTokenRewardInstruction error:: ",
|
|
8161
|
-
throw
|
|
8223
|
+
err_64 = _a.sent();
|
|
8224
|
+
console.log("perpClient setTokenRewardInstruction error:: ", err_64);
|
|
8225
|
+
throw err_64;
|
|
8162
8226
|
case 4: return [2, {
|
|
8163
8227
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8164
8228
|
additionalSigners: additionalSigners
|
|
@@ -8167,7 +8231,7 @@ var PerpetualsClient = (function () {
|
|
|
8167
8231
|
});
|
|
8168
8232
|
}); };
|
|
8169
8233
|
this.resizeInternalOracle = function (extOracle, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
|
|
8170
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction,
|
|
8234
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction, err_65;
|
|
8171
8235
|
return __generator(this, function (_a) {
|
|
8172
8236
|
switch (_a.label) {
|
|
8173
8237
|
case 0:
|
|
@@ -8196,9 +8260,9 @@ var PerpetualsClient = (function () {
|
|
|
8196
8260
|
instructions.push(resizeInternalOracleInstruction);
|
|
8197
8261
|
return [3, 4];
|
|
8198
8262
|
case 3:
|
|
8199
|
-
|
|
8200
|
-
console.log("perpClient resizeInternalOracleInstruction error:: ",
|
|
8201
|
-
throw
|
|
8263
|
+
err_65 = _a.sent();
|
|
8264
|
+
console.log("perpClient resizeInternalOracleInstruction error:: ", err_65);
|
|
8265
|
+
throw err_65;
|
|
8202
8266
|
case 4: return [2, {
|
|
8203
8267
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8204
8268
|
additionalSigners: additionalSigners
|
|
@@ -8207,7 +8271,7 @@ var PerpetualsClient = (function () {
|
|
|
8207
8271
|
});
|
|
8208
8272
|
}); };
|
|
8209
8273
|
this.createWhitelist = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
|
|
8210
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction,
|
|
8274
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction, err_66;
|
|
8211
8275
|
return __generator(this, function (_a) {
|
|
8212
8276
|
switch (_a.label) {
|
|
8213
8277
|
case 0:
|
|
@@ -8240,9 +8304,9 @@ var PerpetualsClient = (function () {
|
|
|
8240
8304
|
instructions.push(createWhitelistInstruction);
|
|
8241
8305
|
return [3, 4];
|
|
8242
8306
|
case 3:
|
|
8243
|
-
|
|
8244
|
-
console.log("perpClient createWhitelistInstruction error:: ",
|
|
8245
|
-
throw
|
|
8307
|
+
err_66 = _a.sent();
|
|
8308
|
+
console.log("perpClient createWhitelistInstruction error:: ", err_66);
|
|
8309
|
+
throw err_66;
|
|
8246
8310
|
case 4: return [2, {
|
|
8247
8311
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8248
8312
|
additionalSigners: additionalSigners
|
|
@@ -8251,7 +8315,7 @@ var PerpetualsClient = (function () {
|
|
|
8251
8315
|
});
|
|
8252
8316
|
}); };
|
|
8253
8317
|
this.setWhitelistConfig = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
|
|
8254
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction,
|
|
8318
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction, err_67;
|
|
8255
8319
|
return __generator(this, function (_a) {
|
|
8256
8320
|
switch (_a.label) {
|
|
8257
8321
|
case 0:
|
|
@@ -8284,9 +8348,9 @@ var PerpetualsClient = (function () {
|
|
|
8284
8348
|
instructions.push(setWhitelistConfigInstruction);
|
|
8285
8349
|
return [3, 4];
|
|
8286
8350
|
case 3:
|
|
8287
|
-
|
|
8288
|
-
console.log("perpClient setWhitelistConfigInstruction error:: ",
|
|
8289
|
-
throw
|
|
8351
|
+
err_67 = _a.sent();
|
|
8352
|
+
console.log("perpClient setWhitelistConfigInstruction error:: ", err_67);
|
|
8353
|
+
throw err_67;
|
|
8290
8354
|
case 4: return [2, {
|
|
8291
8355
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8292
8356
|
additionalSigners: additionalSigners
|
|
@@ -21,7 +21,8 @@ export declare class PositionAccount implements Position {
|
|
|
21
21
|
cumulativeLockFeeSnapshot: BN;
|
|
22
22
|
degenSizeUsd: BN;
|
|
23
23
|
referencePrice: ContractOraclePrice;
|
|
24
|
-
|
|
24
|
+
oraclePenalty: number;
|
|
25
|
+
previousPenalty: number;
|
|
25
26
|
sizeDecimals: number;
|
|
26
27
|
lockedDecimals: number;
|
|
27
28
|
collateralDecimals: number;
|