flash-sdk 11.10.1-alpha.0 → 11.11.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 +14 -52
- package/dist/PerpetualsClient.js +115 -183
- package/dist/PositionAccount.d.ts +1 -2
- package/dist/ViewHelper.d.ts +2 -1
- package/dist/ViewHelper.js +3 -3
- package/dist/idl/perpetuals.d.ts +304 -111
- package/dist/idl/perpetuals.js +305 -112
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js +1 -2
- package/package.json +1 -1
package/dist/PerpetualsClient.js
CHANGED
|
@@ -83,46 +83,34 @@ var PerpetualsClient = (function () {
|
|
|
83
83
|
if (useExtOracleAccount === void 0) { useExtOracleAccount = false; }
|
|
84
84
|
var _this = this;
|
|
85
85
|
var _a;
|
|
86
|
-
this.addressLookupTables = [];
|
|
87
86
|
this.poolAddressLookupTables = new Map();
|
|
88
87
|
this.poolPusherAddressLookupTables = new Map();
|
|
89
88
|
this.setPrioritizationFee = function (fee) {
|
|
90
89
|
_this.prioritizationFee = fee;
|
|
91
90
|
};
|
|
92
91
|
this.loadAddressLookupTable = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
93
|
-
var
|
|
94
|
-
return __generator(this, function (
|
|
95
|
-
switch (
|
|
96
|
-
case 0:
|
|
97
|
-
addresses = [];
|
|
98
|
-
_i = 0, _a = poolConfig.addressLookupTableAddresses;
|
|
99
|
-
_c.label = 1;
|
|
92
|
+
var addressLookupTables, _a, accCreationLamports;
|
|
93
|
+
return __generator(this, function (_b) {
|
|
94
|
+
switch (_b.label) {
|
|
95
|
+
case 0: return [4, this.getOrLoadAddressLookupTable(poolConfig)];
|
|
100
96
|
case 1:
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
97
|
+
addressLookupTables = (_b.sent()).addressLookupTables;
|
|
98
|
+
if (!(!this.pusherAddressLookupTables || this.pusherAddressLookupTables.isActive() === false)) return [3, 3];
|
|
99
|
+
_a = this;
|
|
100
|
+
return [4, this.provider.connection.getAddressLookupTable(poolConfig.pusherAddressLookupTableAddress)];
|
|
104
101
|
case 2:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
addresses.push(addressLookupTable);
|
|
108
|
-
}
|
|
109
|
-
_c.label = 3;
|
|
102
|
+
_a.pusherAddressLookupTables = (_b.sent()).value;
|
|
103
|
+
_b.label = 3;
|
|
110
104
|
case 3:
|
|
111
|
-
|
|
112
|
-
return [3, 1];
|
|
113
|
-
case 4:
|
|
114
|
-
this.addressLookupTables = addresses;
|
|
115
|
-
_b = this;
|
|
116
|
-
return [4, this.provider.connection.getAddressLookupTable(poolConfig.pusherAddressLookupTableAddress)];
|
|
117
|
-
case 5:
|
|
118
|
-
_b.pusherAddressLookupTables = (_c.sent()).value;
|
|
105
|
+
if (!!this.minimumBalanceForRentExemptAccountLamports) return [3, 5];
|
|
119
106
|
return [4, (0, spl_token_1.getMinimumBalanceForRentExemptAccount)(this.provider.connection)];
|
|
120
|
-
case
|
|
121
|
-
accCreationLamports = (
|
|
107
|
+
case 4:
|
|
108
|
+
accCreationLamports = (_b.sent());
|
|
122
109
|
if (accCreationLamports) {
|
|
123
110
|
this.minimumBalanceForRentExemptAccountLamports = accCreationLamports;
|
|
124
111
|
}
|
|
125
|
-
|
|
112
|
+
_b.label = 5;
|
|
113
|
+
case 5: return [2];
|
|
126
114
|
}
|
|
127
115
|
});
|
|
128
116
|
}); };
|
|
@@ -701,7 +689,7 @@ var PerpetualsClient = (function () {
|
|
|
701
689
|
currentMarginUsd = positionAccount.collateralUsd.sub(lossUsd);
|
|
702
690
|
}
|
|
703
691
|
else {
|
|
704
|
-
currentMarginUsd = positionAccount.collateralUsd.add(pnl.
|
|
692
|
+
currentMarginUsd = positionAccount.collateralUsd.add(pnl.profitUsd).sub(lossUsd);
|
|
705
693
|
}
|
|
706
694
|
if (currentMarginUsd.gt(constants_1.BN_ZERO)) {
|
|
707
695
|
return positionAccount.sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(currentMarginUsd);
|
|
@@ -1056,7 +1044,7 @@ var PerpetualsClient = (function () {
|
|
|
1056
1044
|
var totalFeesUsd = (exitFeeUsd.add(lockAndUnsettledFeeUsd));
|
|
1057
1045
|
var currentCollateralUsd = positionDelta.collateralUsd;
|
|
1058
1046
|
var liabilityUsd = newPnl.lossUsd.add(totalFeesUsd);
|
|
1059
|
-
var assetsUsd = anchor_1.BN.min(newPnl.
|
|
1047
|
+
var assetsUsd = anchor_1.BN.min(newPnl.profitUsd.add(currentCollateralUsd), collateralMinMaxPrice.max.getAssetAmountUsd(positionDelta.lockedAmount, collateralCustodyAccount.decimals));
|
|
1060
1048
|
if (debugLogs) {
|
|
1061
1049
|
console.log("assetsUsd.sub(liabilityUsd):", collateralCustodyAccount.decimals, assetsUsd.toString(), liabilityUsd.toString(), assetsUsd.sub(liabilityUsd).toString());
|
|
1062
1050
|
}
|
|
@@ -1193,7 +1181,7 @@ var PerpetualsClient = (function () {
|
|
|
1193
1181
|
var exitPriceAndFee = _this.getExitPriceAndFeeSync(positionAccount, marketCorrelation, positionAccount.collateralAmount, positionAccount.sizeAmount, side, targetPrice, targetEmaPrice, targetCustodyAccount, collateralPrice, collateralEmaPrice, collateralCustodyAccount, currentTimestamp);
|
|
1194
1182
|
var totalFeesUsd = (exitPriceAndFee.exitFeeUsd.add(exitPriceAndFee.borrowFeeUsd));
|
|
1195
1183
|
var liabilityUsd = newPnl.lossUsd.add(totalFeesUsd);
|
|
1196
|
-
var assetsUsd = anchor_1.BN.min(newPnl.
|
|
1184
|
+
var assetsUsd = anchor_1.BN.min(newPnl.profitUsd.add(positionAccount.collateralUsd), collateralMinMaxPrice.max.getAssetAmountUsd(positionAccount.lockedAmount, collateralCustodyAccount.decimals));
|
|
1197
1185
|
var closeAmountUsd, feesAmountUsd;
|
|
1198
1186
|
if (assetsUsd.gt(liabilityUsd)) {
|
|
1199
1187
|
closeAmountUsd = assetsUsd.sub(liabilityUsd);
|
|
@@ -1609,8 +1597,6 @@ var PerpetualsClient = (function () {
|
|
|
1609
1597
|
return {
|
|
1610
1598
|
profitUsd: constants_1.BN_ZERO,
|
|
1611
1599
|
lossUsd: constants_1.BN_ZERO,
|
|
1612
|
-
penaltyUsd: constants_1.BN_ZERO,
|
|
1613
|
-
finalProfitUsd: constants_1.BN_ZERO,
|
|
1614
1600
|
};
|
|
1615
1601
|
}
|
|
1616
1602
|
var side = poolConfig.getMarketConfigByPk(positionAccount.market).side;
|
|
@@ -1674,34 +1660,16 @@ var PerpetualsClient = (function () {
|
|
|
1674
1660
|
if (!priceDiffProfit.exponent.eq(priceDiffLoss.exponent)) {
|
|
1675
1661
|
throw new Error("exponent mistach");
|
|
1676
1662
|
}
|
|
1677
|
-
var totalPenaltyBps = positionAccount.oraclePenalty + positionAccount.previousPenalty;
|
|
1678
1663
|
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 finalProfitUsd = grossProfitUsd;
|
|
1682
|
-
if (totalPenaltyBps > 0 && grossProfitUsd.gt(constants_1.BN_ZERO)) {
|
|
1683
|
-
penaltyUsd = grossProfitUsd.muln(totalPenaltyBps).divn(constants_1.BPS_POWER);
|
|
1684
|
-
if (penaltyUsd.gte(grossProfitUsd)) {
|
|
1685
|
-
penaltyUsd = grossProfitUsd;
|
|
1686
|
-
finalProfitUsd = constants_1.BN_ZERO;
|
|
1687
|
-
}
|
|
1688
|
-
else {
|
|
1689
|
-
finalProfitUsd = grossProfitUsd.sub(penaltyUsd);
|
|
1690
|
-
}
|
|
1691
|
-
}
|
|
1692
1664
|
return {
|
|
1693
|
-
profitUsd:
|
|
1665
|
+
profitUsd: priceDiffProfit.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals),
|
|
1694
1666
|
lossUsd: constants_1.BN_ZERO,
|
|
1695
|
-
penaltyUsd: penaltyUsd,
|
|
1696
|
-
finalProfitUsd: finalProfitUsd,
|
|
1697
1667
|
};
|
|
1698
1668
|
}
|
|
1699
1669
|
else {
|
|
1700
1670
|
return {
|
|
1701
1671
|
profitUsd: constants_1.BN_ZERO,
|
|
1702
1672
|
lossUsd: priceDiffLoss.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals),
|
|
1703
|
-
penaltyUsd: constants_1.BN_ZERO,
|
|
1704
|
-
finalProfitUsd: constants_1.BN_ZERO,
|
|
1705
1673
|
};
|
|
1706
1674
|
}
|
|
1707
1675
|
};
|
|
@@ -1714,7 +1682,7 @@ var PerpetualsClient = (function () {
|
|
|
1714
1682
|
timestamp: constants_1.BN_ZERO
|
|
1715
1683
|
});
|
|
1716
1684
|
return {
|
|
1717
|
-
pnl: { profitUsd: constants_1.BN_ZERO, lossUsd: constants_1.BN_ZERO
|
|
1685
|
+
pnl: { profitUsd: constants_1.BN_ZERO, lossUsd: constants_1.BN_ZERO },
|
|
1718
1686
|
leverage: constants_1.BN_ZERO,
|
|
1719
1687
|
liquidationPrice: zeroOraclePrice,
|
|
1720
1688
|
fees: { exitFeeUsd: constants_1.BN_ZERO, exitFeeAmount: constants_1.BN_ZERO, lockAndUnsettledFeeUsd: constants_1.BN_ZERO }
|
|
@@ -1780,40 +1748,22 @@ var PerpetualsClient = (function () {
|
|
|
1780
1748
|
priceDiffLoss = new OraclePrice_1.OraclePrice({ price: exitOraclePrice.price.sub(entryOraclePrice.price), exponent: exitOraclePrice.exponent, confidence: constants_1.BN_ZERO, timestamp: constants_1.BN_ZERO });
|
|
1781
1749
|
}
|
|
1782
1750
|
}
|
|
1783
|
-
var totalPenaltyBps = positionAccount.oraclePenalty + positionAccount.previousPenalty;
|
|
1784
1751
|
if (priceDiffProfit.price.gt(constants_1.BN_ZERO)) {
|
|
1785
|
-
var grossProfitUsd = priceDiffProfit.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals);
|
|
1786
|
-
var penaltyUsd = constants_1.BN_ZERO;
|
|
1787
|
-
var finalProfitUsd = grossProfitUsd;
|
|
1788
|
-
if (totalPenaltyBps > 0 && grossProfitUsd.gt(constants_1.BN_ZERO)) {
|
|
1789
|
-
penaltyUsd = grossProfitUsd.muln(totalPenaltyBps).divn(constants_1.BPS_POWER);
|
|
1790
|
-
if (penaltyUsd.gte(grossProfitUsd)) {
|
|
1791
|
-
penaltyUsd = grossProfitUsd;
|
|
1792
|
-
finalProfitUsd = constants_1.BN_ZERO;
|
|
1793
|
-
}
|
|
1794
|
-
else {
|
|
1795
|
-
finalProfitUsd = grossProfitUsd.sub(penaltyUsd);
|
|
1796
|
-
}
|
|
1797
|
-
}
|
|
1798
1752
|
pnl = {
|
|
1799
|
-
profitUsd:
|
|
1753
|
+
profitUsd: priceDiffProfit.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals),
|
|
1800
1754
|
lossUsd: constants_1.BN_ZERO,
|
|
1801
|
-
penaltyUsd: penaltyUsd,
|
|
1802
|
-
finalProfitUsd: finalProfitUsd,
|
|
1803
1755
|
};
|
|
1804
1756
|
}
|
|
1805
1757
|
else {
|
|
1806
1758
|
pnl = {
|
|
1807
1759
|
profitUsd: constants_1.BN_ZERO,
|
|
1808
1760
|
lossUsd: priceDiffLoss.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals),
|
|
1809
|
-
penaltyUsd: constants_1.BN_ZERO,
|
|
1810
|
-
finalProfitUsd: constants_1.BN_ZERO,
|
|
1811
1761
|
};
|
|
1812
1762
|
}
|
|
1813
1763
|
var liquidationPrice = _this.getLiquidationPriceContractHelper(entryOraclePrice, lockAndUnsettledFeeUsd, side, targetCustodyAccount, positionAccount);
|
|
1814
1764
|
var unsettledFeesUsd = exitFeeUsd.add(lockAndUnsettledFeeUsd);
|
|
1815
1765
|
var lossUsd = pnl.lossUsd.add(unsettledFeesUsd);
|
|
1816
|
-
var currentMarginUsd = positionAccount.collateralUsd.add(pnl.
|
|
1766
|
+
var currentMarginUsd = positionAccount.collateralUsd.add(pnl.profitUsd).sub(lossUsd);
|
|
1817
1767
|
var leverage;
|
|
1818
1768
|
if (currentMarginUsd.gt(constants_1.BN_ZERO)) {
|
|
1819
1769
|
leverage = positionAccount.sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(currentMarginUsd);
|
|
@@ -2060,7 +2010,7 @@ var PerpetualsClient = (function () {
|
|
|
2060
2010
|
});
|
|
2061
2011
|
};
|
|
2062
2012
|
this.getStakedLpTokenPrice = function (poolKey, POOL_CONFIG) { return __awaiter(_this, void 0, void 0, function () {
|
|
2063
|
-
var backUpOracleInstructionPromise, custodies, custodyMetas, marketMetas, _i, custodies_1, token, _a, custodies_2, custody, _b, _c, market, transaction, backUpOracleInstruction, setCULimitIx, result, index, res;
|
|
2013
|
+
var backUpOracleInstructionPromise, custodies, custodyMetas, marketMetas, _i, custodies_1, token, _a, custodies_2, custody, _b, _c, market, transaction, backUpOracleInstruction, setCULimitIx, addressLookupTables, result, index, res;
|
|
2064
2014
|
var _d;
|
|
2065
2015
|
return __generator(this, function (_e) {
|
|
2066
2016
|
switch (_e.label) {
|
|
@@ -2111,8 +2061,11 @@ var PerpetualsClient = (function () {
|
|
|
2111
2061
|
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2112
2062
|
transaction.instructions.unshift(setCULimitIx);
|
|
2113
2063
|
(_d = transaction.instructions).unshift.apply(_d, backUpOracleInstruction);
|
|
2114
|
-
return [4, this.
|
|
2064
|
+
return [4, this.getOrLoadAddressLookupTable(POOL_CONFIG)];
|
|
2115
2065
|
case 3:
|
|
2066
|
+
addressLookupTables = (_e.sent()).addressLookupTables;
|
|
2067
|
+
return [4, this.viewHelper.simulateTransaction(transaction, addressLookupTables)];
|
|
2068
|
+
case 4:
|
|
2116
2069
|
result = _e.sent();
|
|
2117
2070
|
index = perpetuals_1.IDL.instructions.findIndex(function (f) { return f.name === 'getLpTokenPrice'; });
|
|
2118
2071
|
res = this.viewHelper.decodeLogs(result, index, 'getLpTokenPrice');
|
|
@@ -2176,7 +2129,7 @@ var PerpetualsClient = (function () {
|
|
|
2176
2129
|
args_1[_i - 4] = arguments[_i];
|
|
2177
2130
|
}
|
|
2178
2131
|
return __awaiter(_this, __spreadArray([amount_1, poolKey_1, depositCustodyKey_1, POOL_CONFIG_1], args_1, true), void 0, function (amount, poolKey, depositCustodyKey, POOL_CONFIG, userPublicKey, enableBackupOracle, whitelist) {
|
|
2179
|
-
var custodies, custodyMetas, marketMetas, _a, custodies_5, token, _b, custodies_6, custody, _c, _d, market, whitelistMeta, depositCustodyConfig, transaction, setCULimitIx, backUpOracleInstruction, result, index, res;
|
|
2132
|
+
var custodies, custodyMetas, marketMetas, _a, custodies_5, token, _b, custodies_6, custody, _c, _d, market, whitelistMeta, depositCustodyConfig, transaction, setCULimitIx, backUpOracleInstruction, addressLookupTables, result, index, res;
|
|
2180
2133
|
var _e;
|
|
2181
2134
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2182
2135
|
if (enableBackupOracle === void 0) { enableBackupOracle = false; }
|
|
@@ -2241,8 +2194,11 @@ var PerpetualsClient = (function () {
|
|
|
2241
2194
|
backUpOracleInstruction = _f.sent();
|
|
2242
2195
|
(_e = transaction.instructions).unshift.apply(_e, backUpOracleInstruction);
|
|
2243
2196
|
_f.label = 3;
|
|
2244
|
-
case 3: return [4, this.
|
|
2197
|
+
case 3: return [4, this.getOrLoadAddressLookupTable(POOL_CONFIG)];
|
|
2245
2198
|
case 4:
|
|
2199
|
+
addressLookupTables = (_f.sent()).addressLookupTables;
|
|
2200
|
+
return [4, this.viewHelper.simulateTransaction(transaction, addressLookupTables, userPublicKey)];
|
|
2201
|
+
case 5:
|
|
2246
2202
|
result = _f.sent();
|
|
2247
2203
|
if (result.value.err) {
|
|
2248
2204
|
console.error('error Simulation failed:::', result);
|
|
@@ -2268,7 +2224,7 @@ var PerpetualsClient = (function () {
|
|
|
2268
2224
|
args_1[_i - 4] = arguments[_i];
|
|
2269
2225
|
}
|
|
2270
2226
|
return __awaiter(_this, __spreadArray([amount_1, poolKey_1, removeTokenCustodyKey_1, POOL_CONFIG_1], args_1, true), void 0, function (amount, poolKey, removeTokenCustodyKey, POOL_CONFIG, userPublicKey, enableBackupOracle, whitelist) {
|
|
2271
|
-
var custodies, custodyMetas, marketMetas, _a, custodies_7, token, _b, custodies_8, custody, _c, _d, market, whitelistMeta, removeCustodyConfig, transaction, setCULimitIx, backUpOracleInstruction, result, index, res;
|
|
2227
|
+
var custodies, custodyMetas, marketMetas, _a, custodies_7, token, _b, custodies_8, custody, _c, _d, market, whitelistMeta, removeCustodyConfig, transaction, setCULimitIx, backUpOracleInstruction, addressLookupTables, result, index, res;
|
|
2272
2228
|
var _e;
|
|
2273
2229
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2274
2230
|
if (enableBackupOracle === void 0) { enableBackupOracle = false; }
|
|
@@ -2333,8 +2289,11 @@ var PerpetualsClient = (function () {
|
|
|
2333
2289
|
backUpOracleInstruction = _f.sent();
|
|
2334
2290
|
(_e = transaction.instructions).unshift.apply(_e, backUpOracleInstruction);
|
|
2335
2291
|
_f.label = 3;
|
|
2336
|
-
case 3: return [4, this.
|
|
2292
|
+
case 3: return [4, this.getOrLoadAddressLookupTable(POOL_CONFIG)];
|
|
2337
2293
|
case 4:
|
|
2294
|
+
addressLookupTables = (_f.sent()).addressLookupTables;
|
|
2295
|
+
return [4, this.viewHelper.simulateTransaction(transaction, addressLookupTables, userPublicKey)];
|
|
2296
|
+
case 5:
|
|
2338
2297
|
result = _f.sent();
|
|
2339
2298
|
index = perpetuals_1.IDL.instructions.findIndex(function (f) { return f.name === 'getRemoveLiquidityAmountAndFee'; });
|
|
2340
2299
|
if (result.value.err) {
|
|
@@ -2355,7 +2314,7 @@ var PerpetualsClient = (function () {
|
|
|
2355
2314
|
});
|
|
2356
2315
|
};
|
|
2357
2316
|
this.getCompoundingLPTokenPrice = function (poolKey, POOL_CONFIG) { return __awaiter(_this, void 0, void 0, function () {
|
|
2358
|
-
var backUpOracleInstructionPromise, custodies, custodyMetas, marketMetas, _i, custodies_9, token, _a, custodies_10, custody, _b, _c, market, backUpOracleInstruction, transaction, setCULimitIx, result, index, res;
|
|
2317
|
+
var backUpOracleInstructionPromise, custodies, custodyMetas, marketMetas, _i, custodies_9, token, _a, custodies_10, custody, _b, _c, market, backUpOracleInstruction, transaction, setCULimitIx, addressLookupTables, result, index, res;
|
|
2359
2318
|
var _d;
|
|
2360
2319
|
return __generator(this, function (_e) {
|
|
2361
2320
|
switch (_e.label) {
|
|
@@ -2406,8 +2365,11 @@ var PerpetualsClient = (function () {
|
|
|
2406
2365
|
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2407
2366
|
transaction.instructions.unshift(setCULimitIx);
|
|
2408
2367
|
(_d = transaction.instructions).unshift.apply(_d, backUpOracleInstruction);
|
|
2409
|
-
return [4, this.
|
|
2368
|
+
return [4, this.getOrLoadAddressLookupTable(POOL_CONFIG)];
|
|
2410
2369
|
case 3:
|
|
2370
|
+
addressLookupTables = (_e.sent()).addressLookupTables;
|
|
2371
|
+
return [4, this.viewHelper.simulateTransaction(transaction, addressLookupTables)];
|
|
2372
|
+
case 4:
|
|
2411
2373
|
result = _e.sent();
|
|
2412
2374
|
index = perpetuals_1.IDL.instructions.findIndex(function (f) { return f.name === 'getCompoundingTokenPrice'; });
|
|
2413
2375
|
res = this.viewHelper.decodeLogs(result, index, 'getCompoundingTokenPrice');
|
|
@@ -2421,7 +2383,7 @@ var PerpetualsClient = (function () {
|
|
|
2421
2383
|
args_1[_i - 4] = arguments[_i];
|
|
2422
2384
|
}
|
|
2423
2385
|
return __awaiter(_this, __spreadArray([amount_1, poolKey_1, depositCustodyKey_1, POOL_CONFIG_1], args_1, true), void 0, function (amount, poolKey, depositCustodyKey, POOL_CONFIG, userPublicKey, enableBackupOracle, whitelist) {
|
|
2424
|
-
var custodies, custodyMetas, marketMetas, _a, custodies_11, token, _b, custodies_12, custody, _c, _d, market, whitelistMeta, depositCustodyConfig, rewardCustody, transaction, setCULimitIx, backUpOracleInstruction, result, index, res;
|
|
2386
|
+
var custodies, custodyMetas, marketMetas, _a, custodies_11, token, _b, custodies_12, custody, _c, _d, market, whitelistMeta, depositCustodyConfig, rewardCustody, transaction, setCULimitIx, addressLookupTables, backUpOracleInstruction, result, index, res;
|
|
2425
2387
|
var _e;
|
|
2426
2388
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2427
2389
|
if (enableBackupOracle === void 0) { enableBackupOracle = false; }
|
|
@@ -2484,14 +2446,17 @@ var PerpetualsClient = (function () {
|
|
|
2484
2446
|
transaction = _f.sent();
|
|
2485
2447
|
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2486
2448
|
transaction.instructions.unshift(setCULimitIx);
|
|
2487
|
-
|
|
2488
|
-
return [4, (0, backupOracle_1.createBackupOracleInstruction)(POOL_CONFIG.poolAddress.toBase58(), true)];
|
|
2449
|
+
return [4, this.getOrLoadAddressLookupTable(POOL_CONFIG)];
|
|
2489
2450
|
case 2:
|
|
2451
|
+
addressLookupTables = (_f.sent()).addressLookupTables;
|
|
2452
|
+
if (!enableBackupOracle) return [3, 4];
|
|
2453
|
+
return [4, (0, backupOracle_1.createBackupOracleInstruction)(POOL_CONFIG.poolAddress.toBase58(), true)];
|
|
2454
|
+
case 3:
|
|
2490
2455
|
backUpOracleInstruction = _f.sent();
|
|
2491
2456
|
(_e = transaction.instructions).unshift.apply(_e, backUpOracleInstruction);
|
|
2492
|
-
_f.label =
|
|
2493
|
-
case
|
|
2494
|
-
case
|
|
2457
|
+
_f.label = 4;
|
|
2458
|
+
case 4: return [4, this.viewHelper.simulateTransaction(transaction, addressLookupTables, userPublicKey)];
|
|
2459
|
+
case 5:
|
|
2495
2460
|
result = _f.sent();
|
|
2496
2461
|
index = perpetuals_1.IDL.instructions.findIndex(function (f) { return f.name === 'getAddCompoundingLiquidityAmountAndFee'; });
|
|
2497
2462
|
res = this.viewHelper.decodeLogs(result, index, 'getAddCompoundingLiquidityAmountAndFee');
|
|
@@ -2509,7 +2474,7 @@ var PerpetualsClient = (function () {
|
|
|
2509
2474
|
args_1[_i - 4] = arguments[_i];
|
|
2510
2475
|
}
|
|
2511
2476
|
return __awaiter(_this, __spreadArray([amount_1, poolKey_1, removeTokenCustodyKey_1, POOL_CONFIG_1], args_1, true), void 0, function (amount, poolKey, removeTokenCustodyKey, POOL_CONFIG, userPublicKey, enableBackupOracle, whitelist) {
|
|
2512
|
-
var custodies, custodyMetas, marketMetas, _a, custodies_13, token, _b, custodies_14, custody, _c, _d, market, whitelistMeta, removeCustodyConfig, rewardCustody, transaction, setCULimitIx, backUpOracleInstruction, result, index, res;
|
|
2477
|
+
var custodies, custodyMetas, marketMetas, _a, custodies_13, token, _b, custodies_14, custody, _c, _d, market, whitelistMeta, removeCustodyConfig, rewardCustody, transaction, setCULimitIx, backUpOracleInstruction, addressLookupTables, result, index, res;
|
|
2513
2478
|
var _e;
|
|
2514
2479
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2515
2480
|
if (enableBackupOracle === void 0) { enableBackupOracle = false; }
|
|
@@ -2578,8 +2543,11 @@ var PerpetualsClient = (function () {
|
|
|
2578
2543
|
backUpOracleInstruction = _f.sent();
|
|
2579
2544
|
(_e = transaction.instructions).unshift.apply(_e, backUpOracleInstruction);
|
|
2580
2545
|
_f.label = 3;
|
|
2581
|
-
case 3: return [4, this.
|
|
2546
|
+
case 3: return [4, this.getOrLoadAddressLookupTable(POOL_CONFIG)];
|
|
2582
2547
|
case 4:
|
|
2548
|
+
addressLookupTables = (_f.sent()).addressLookupTables;
|
|
2549
|
+
return [4, this.viewHelper.simulateTransaction(transaction, addressLookupTables, userPublicKey)];
|
|
2550
|
+
case 5:
|
|
2583
2551
|
result = _f.sent();
|
|
2584
2552
|
index = perpetuals_1.IDL.instructions.findIndex(function (f) { return f.name === 'getRemoveCompoundingLiquidityAmountAndFee'; });
|
|
2585
2553
|
if (result.value.err) {
|
|
@@ -7631,44 +7599,8 @@ var PerpetualsClient = (function () {
|
|
|
7631
7599
|
}
|
|
7632
7600
|
});
|
|
7633
7601
|
}); };
|
|
7634
|
-
this.setPositionPenalty = function (positionPubkey, oraclePenalty, oracleAuthority) { return __awaiter(_this, void 0, void 0, function () {
|
|
7635
|
-
var instructions, additionalSigners, setPositionPenaltyIx, err_52;
|
|
7636
|
-
return __generator(this, function (_a) {
|
|
7637
|
-
switch (_a.label) {
|
|
7638
|
-
case 0:
|
|
7639
|
-
instructions = [];
|
|
7640
|
-
additionalSigners = [];
|
|
7641
|
-
_a.label = 1;
|
|
7642
|
-
case 1:
|
|
7643
|
-
_a.trys.push([1, 3, , 4]);
|
|
7644
|
-
return [4, this.program.methods
|
|
7645
|
-
.setPositionPenalty({
|
|
7646
|
-
oraclePenalty: oraclePenalty,
|
|
7647
|
-
})
|
|
7648
|
-
.accounts({
|
|
7649
|
-
authority: oracleAuthority,
|
|
7650
|
-
position: positionPubkey,
|
|
7651
|
-
eventAuthority: this.eventAuthority.publicKey,
|
|
7652
|
-
program: this.program.programId,
|
|
7653
|
-
})
|
|
7654
|
-
.instruction()];
|
|
7655
|
-
case 2:
|
|
7656
|
-
setPositionPenaltyIx = _a.sent();
|
|
7657
|
-
instructions.push(setPositionPenaltyIx);
|
|
7658
|
-
return [3, 4];
|
|
7659
|
-
case 3:
|
|
7660
|
-
err_52 = _a.sent();
|
|
7661
|
-
console.log("perpClient setPositionPenalty error:: ", err_52);
|
|
7662
|
-
throw err_52;
|
|
7663
|
-
case 4: return [2, {
|
|
7664
|
-
instructions: __spreadArray([], instructions, true),
|
|
7665
|
-
additionalSigners: additionalSigners
|
|
7666
|
-
}];
|
|
7667
|
-
}
|
|
7668
|
-
});
|
|
7669
|
-
}); };
|
|
7670
7602
|
this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7671
|
-
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp,
|
|
7603
|
+
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_52;
|
|
7672
7604
|
return __generator(this, function (_a) {
|
|
7673
7605
|
switch (_a.label) {
|
|
7674
7606
|
case 0:
|
|
@@ -7706,8 +7638,8 @@ var PerpetualsClient = (function () {
|
|
|
7706
7638
|
instructions.push(renameFlp);
|
|
7707
7639
|
return [3, 4];
|
|
7708
7640
|
case 3:
|
|
7709
|
-
|
|
7710
|
-
console.log("perpClient renameFlp error:: ",
|
|
7641
|
+
err_52 = _a.sent();
|
|
7642
|
+
console.log("perpClient renameFlp error:: ", err_52);
|
|
7711
7643
|
return [3, 4];
|
|
7712
7644
|
case 4: return [2, {
|
|
7713
7645
|
instructions: __spreadArray([], instructions, true),
|
|
@@ -7717,7 +7649,7 @@ var PerpetualsClient = (function () {
|
|
|
7717
7649
|
});
|
|
7718
7650
|
}); };
|
|
7719
7651
|
this.initStake = function (stakingFeeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7720
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction,
|
|
7652
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_53;
|
|
7721
7653
|
return __generator(this, function (_a) {
|
|
7722
7654
|
switch (_a.label) {
|
|
7723
7655
|
case 0:
|
|
@@ -7755,9 +7687,9 @@ var PerpetualsClient = (function () {
|
|
|
7755
7687
|
instructions.push(initStakeInstruction);
|
|
7756
7688
|
return [3, 4];
|
|
7757
7689
|
case 3:
|
|
7758
|
-
|
|
7759
|
-
console.log("perpClient InitStaking error:: ",
|
|
7760
|
-
throw
|
|
7690
|
+
err_53 = _a.sent();
|
|
7691
|
+
console.log("perpClient InitStaking error:: ", err_53);
|
|
7692
|
+
throw err_53;
|
|
7761
7693
|
case 4: return [2, {
|
|
7762
7694
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7763
7695
|
additionalSigners: additionalSigners
|
|
@@ -7766,7 +7698,7 @@ var PerpetualsClient = (function () {
|
|
|
7766
7698
|
});
|
|
7767
7699
|
}); };
|
|
7768
7700
|
this.initCompounding = function (feeShareBps, metadataTitle, metadataSymbol, metadataUri, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7769
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction,
|
|
7701
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_54;
|
|
7770
7702
|
return __generator(this, function (_a) {
|
|
7771
7703
|
switch (_a.label) {
|
|
7772
7704
|
case 0:
|
|
@@ -7810,9 +7742,9 @@ var PerpetualsClient = (function () {
|
|
|
7810
7742
|
instructions.push(initCompoundingInstruction);
|
|
7811
7743
|
return [3, 4];
|
|
7812
7744
|
case 3:
|
|
7813
|
-
|
|
7814
|
-
console.log("perpClient initCompounding error:: ",
|
|
7815
|
-
throw
|
|
7745
|
+
err_54 = _a.sent();
|
|
7746
|
+
console.log("perpClient initCompounding error:: ", err_54);
|
|
7747
|
+
throw err_54;
|
|
7816
7748
|
case 4: return [2, {
|
|
7817
7749
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7818
7750
|
additionalSigners: additionalSigners
|
|
@@ -7821,7 +7753,7 @@ var PerpetualsClient = (function () {
|
|
|
7821
7753
|
});
|
|
7822
7754
|
}); };
|
|
7823
7755
|
this.initTokenVault = function (token_permissions, tokens_to_distribute, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7824
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction,
|
|
7756
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_55;
|
|
7825
7757
|
return __generator(this, function (_a) {
|
|
7826
7758
|
switch (_a.label) {
|
|
7827
7759
|
case 0:
|
|
@@ -7862,9 +7794,9 @@ var PerpetualsClient = (function () {
|
|
|
7862
7794
|
instructions.push(initTokenVaultInstruction);
|
|
7863
7795
|
return [3, 4];
|
|
7864
7796
|
case 3:
|
|
7865
|
-
|
|
7866
|
-
console.log("perpClient InitTokenVaultInstruction error:: ",
|
|
7867
|
-
throw
|
|
7797
|
+
err_55 = _a.sent();
|
|
7798
|
+
console.log("perpClient InitTokenVaultInstruction error:: ", err_55);
|
|
7799
|
+
throw err_55;
|
|
7868
7800
|
case 4: return [2, {
|
|
7869
7801
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7870
7802
|
additionalSigners: additionalSigners
|
|
@@ -7873,7 +7805,7 @@ var PerpetualsClient = (function () {
|
|
|
7873
7805
|
});
|
|
7874
7806
|
}); };
|
|
7875
7807
|
this.setTokenVaultConfig = function (token_permissions, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7876
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction,
|
|
7808
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_56;
|
|
7877
7809
|
return __generator(this, function (_a) {
|
|
7878
7810
|
switch (_a.label) {
|
|
7879
7811
|
case 0:
|
|
@@ -7904,9 +7836,9 @@ var PerpetualsClient = (function () {
|
|
|
7904
7836
|
instructions.push(setTokenVaultConfigInstruction);
|
|
7905
7837
|
return [3, 4];
|
|
7906
7838
|
case 3:
|
|
7907
|
-
|
|
7908
|
-
console.log("perpClient setTokenVaultConfigInstruction error:: ",
|
|
7909
|
-
throw
|
|
7839
|
+
err_56 = _a.sent();
|
|
7840
|
+
console.log("perpClient setTokenVaultConfigInstruction error:: ", err_56);
|
|
7841
|
+
throw err_56;
|
|
7910
7842
|
case 4: return [2, {
|
|
7911
7843
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7912
7844
|
additionalSigners: additionalSigners
|
|
@@ -7915,7 +7847,7 @@ var PerpetualsClient = (function () {
|
|
|
7915
7847
|
});
|
|
7916
7848
|
}); };
|
|
7917
7849
|
this.withdrawInstantFee = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7918
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction,
|
|
7850
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_57;
|
|
7919
7851
|
return __generator(this, function (_a) {
|
|
7920
7852
|
switch (_a.label) {
|
|
7921
7853
|
case 0:
|
|
@@ -7954,9 +7886,9 @@ var PerpetualsClient = (function () {
|
|
|
7954
7886
|
instructions.push(withdrawInstantFeeInstruction);
|
|
7955
7887
|
return [3, 6];
|
|
7956
7888
|
case 5:
|
|
7957
|
-
|
|
7958
|
-
console.log("perpClient withdrawInstantFeeInstruction error:: ",
|
|
7959
|
-
throw
|
|
7889
|
+
err_57 = _a.sent();
|
|
7890
|
+
console.log("perpClient withdrawInstantFeeInstruction error:: ", err_57);
|
|
7891
|
+
throw err_57;
|
|
7960
7892
|
case 6: return [2, {
|
|
7961
7893
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7962
7894
|
additionalSigners: additionalSigners
|
|
@@ -7965,7 +7897,7 @@ var PerpetualsClient = (function () {
|
|
|
7965
7897
|
});
|
|
7966
7898
|
}); };
|
|
7967
7899
|
this.withdrawUnclaimedTokens = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7968
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction,
|
|
7900
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction, err_58;
|
|
7969
7901
|
return __generator(this, function (_a) {
|
|
7970
7902
|
switch (_a.label) {
|
|
7971
7903
|
case 0:
|
|
@@ -8004,9 +7936,9 @@ var PerpetualsClient = (function () {
|
|
|
8004
7936
|
instructions.push(withdrawUnclaimedTokensInstruction);
|
|
8005
7937
|
return [3, 6];
|
|
8006
7938
|
case 5:
|
|
8007
|
-
|
|
8008
|
-
console.log("perpClient withdrawUnclaimedTokensInstruction error:: ",
|
|
8009
|
-
throw
|
|
7939
|
+
err_58 = _a.sent();
|
|
7940
|
+
console.log("perpClient withdrawUnclaimedTokensInstruction error:: ", err_58);
|
|
7941
|
+
throw err_58;
|
|
8010
7942
|
case 6: return [2, {
|
|
8011
7943
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8012
7944
|
additionalSigners: additionalSigners
|
|
@@ -8015,7 +7947,7 @@ var PerpetualsClient = (function () {
|
|
|
8015
7947
|
});
|
|
8016
7948
|
}); };
|
|
8017
7949
|
this.initRevenueTokenAccount = function (feeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8018
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction,
|
|
7950
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_59;
|
|
8019
7951
|
return __generator(this, function (_a) {
|
|
8020
7952
|
switch (_a.label) {
|
|
8021
7953
|
case 0:
|
|
@@ -8052,9 +7984,9 @@ var PerpetualsClient = (function () {
|
|
|
8052
7984
|
instructions.push(initRevenueTokenAccountInstruction);
|
|
8053
7985
|
return [3, 4];
|
|
8054
7986
|
case 3:
|
|
8055
|
-
|
|
8056
|
-
console.log("perpClient initRevenueTokenAccountInstruction error:: ",
|
|
8057
|
-
throw
|
|
7987
|
+
err_59 = _a.sent();
|
|
7988
|
+
console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_59);
|
|
7989
|
+
throw err_59;
|
|
8058
7990
|
case 4: return [2, {
|
|
8059
7991
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8060
7992
|
additionalSigners: additionalSigners
|
|
@@ -8063,7 +7995,7 @@ var PerpetualsClient = (function () {
|
|
|
8063
7995
|
});
|
|
8064
7996
|
}); };
|
|
8065
7997
|
this.initRebateVault = function (allowRebatePayout, rebateSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8066
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateCustodyMint, initRebateVaultInstruction,
|
|
7998
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateCustodyMint, initRebateVaultInstruction, err_60;
|
|
8067
7999
|
return __generator(this, function (_a) {
|
|
8068
8000
|
switch (_a.label) {
|
|
8069
8001
|
case 0:
|
|
@@ -8098,9 +8030,9 @@ var PerpetualsClient = (function () {
|
|
|
8098
8030
|
instructions.push(initRebateVaultInstruction);
|
|
8099
8031
|
return [3, 4];
|
|
8100
8032
|
case 3:
|
|
8101
|
-
|
|
8102
|
-
console.log("perpClient initRebateVaultInstruction error:: ",
|
|
8103
|
-
throw
|
|
8033
|
+
err_60 = _a.sent();
|
|
8034
|
+
console.log("perpClient initRebateVaultInstruction error:: ", err_60);
|
|
8035
|
+
throw err_60;
|
|
8104
8036
|
case 4: return [2, {
|
|
8105
8037
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8106
8038
|
additionalSigners: additionalSigners
|
|
@@ -8109,7 +8041,7 @@ var PerpetualsClient = (function () {
|
|
|
8109
8041
|
});
|
|
8110
8042
|
}); };
|
|
8111
8043
|
this.distributeTokenReward = function (amount, epochCount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8112
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction,
|
|
8044
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_61;
|
|
8113
8045
|
return __generator(this, function (_a) {
|
|
8114
8046
|
switch (_a.label) {
|
|
8115
8047
|
case 0:
|
|
@@ -8148,9 +8080,9 @@ var PerpetualsClient = (function () {
|
|
|
8148
8080
|
instructions.push(distributeTokenRewardInstruction);
|
|
8149
8081
|
return [3, 4];
|
|
8150
8082
|
case 3:
|
|
8151
|
-
|
|
8152
|
-
console.log("perpClient distributeTokenRewardInstruction error:: ",
|
|
8153
|
-
throw
|
|
8083
|
+
err_61 = _a.sent();
|
|
8084
|
+
console.log("perpClient distributeTokenRewardInstruction error:: ", err_61);
|
|
8085
|
+
throw err_61;
|
|
8154
8086
|
case 4: return [2, {
|
|
8155
8087
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8156
8088
|
additionalSigners: additionalSigners
|
|
@@ -8159,7 +8091,7 @@ var PerpetualsClient = (function () {
|
|
|
8159
8091
|
});
|
|
8160
8092
|
}); };
|
|
8161
8093
|
this.setTokenStakeLevel = function (owner, stakeLevel) { return __awaiter(_this, void 0, void 0, function () {
|
|
8162
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction,
|
|
8094
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_62;
|
|
8163
8095
|
return __generator(this, function (_a) {
|
|
8164
8096
|
switch (_a.label) {
|
|
8165
8097
|
case 0:
|
|
@@ -8187,9 +8119,9 @@ var PerpetualsClient = (function () {
|
|
|
8187
8119
|
instructions.push(setTokenStakeLevelInstruction);
|
|
8188
8120
|
return [3, 4];
|
|
8189
8121
|
case 3:
|
|
8190
|
-
|
|
8191
|
-
console.log("perpClient setTokenStakeLevelInstruction error:: ",
|
|
8192
|
-
throw
|
|
8122
|
+
err_62 = _a.sent();
|
|
8123
|
+
console.log("perpClient setTokenStakeLevelInstruction error:: ", err_62);
|
|
8124
|
+
throw err_62;
|
|
8193
8125
|
case 4: return [2, {
|
|
8194
8126
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8195
8127
|
additionalSigners: additionalSigners
|
|
@@ -8198,7 +8130,7 @@ var PerpetualsClient = (function () {
|
|
|
8198
8130
|
});
|
|
8199
8131
|
}); };
|
|
8200
8132
|
this.setTokenReward = function (owner, amount, epochCount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8201
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction,
|
|
8133
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_63;
|
|
8202
8134
|
return __generator(this, function (_a) {
|
|
8203
8135
|
switch (_a.label) {
|
|
8204
8136
|
case 0:
|
|
@@ -8230,9 +8162,9 @@ var PerpetualsClient = (function () {
|
|
|
8230
8162
|
instructions.push(setTokenRewardInstruction);
|
|
8231
8163
|
return [3, 4];
|
|
8232
8164
|
case 3:
|
|
8233
|
-
|
|
8234
|
-
console.log("perpClient setTokenRewardInstruction error:: ",
|
|
8235
|
-
throw
|
|
8165
|
+
err_63 = _a.sent();
|
|
8166
|
+
console.log("perpClient setTokenRewardInstruction error:: ", err_63);
|
|
8167
|
+
throw err_63;
|
|
8236
8168
|
case 4: return [2, {
|
|
8237
8169
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8238
8170
|
additionalSigners: additionalSigners
|
|
@@ -8241,7 +8173,7 @@ var PerpetualsClient = (function () {
|
|
|
8241
8173
|
});
|
|
8242
8174
|
}); };
|
|
8243
8175
|
this.resizeInternalOracle = function (extOracle, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
|
|
8244
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction,
|
|
8176
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction, err_64;
|
|
8245
8177
|
return __generator(this, function (_a) {
|
|
8246
8178
|
switch (_a.label) {
|
|
8247
8179
|
case 0:
|
|
@@ -8270,9 +8202,9 @@ var PerpetualsClient = (function () {
|
|
|
8270
8202
|
instructions.push(resizeInternalOracleInstruction);
|
|
8271
8203
|
return [3, 4];
|
|
8272
8204
|
case 3:
|
|
8273
|
-
|
|
8274
|
-
console.log("perpClient resizeInternalOracleInstruction error:: ",
|
|
8275
|
-
throw
|
|
8205
|
+
err_64 = _a.sent();
|
|
8206
|
+
console.log("perpClient resizeInternalOracleInstruction error:: ", err_64);
|
|
8207
|
+
throw err_64;
|
|
8276
8208
|
case 4: return [2, {
|
|
8277
8209
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8278
8210
|
additionalSigners: additionalSigners
|
|
@@ -8281,7 +8213,7 @@ var PerpetualsClient = (function () {
|
|
|
8281
8213
|
});
|
|
8282
8214
|
}); };
|
|
8283
8215
|
this.createWhitelist = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
|
|
8284
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction,
|
|
8216
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction, err_65;
|
|
8285
8217
|
return __generator(this, function (_a) {
|
|
8286
8218
|
switch (_a.label) {
|
|
8287
8219
|
case 0:
|
|
@@ -8314,9 +8246,9 @@ var PerpetualsClient = (function () {
|
|
|
8314
8246
|
instructions.push(createWhitelistInstruction);
|
|
8315
8247
|
return [3, 4];
|
|
8316
8248
|
case 3:
|
|
8317
|
-
|
|
8318
|
-
console.log("perpClient createWhitelistInstruction error:: ",
|
|
8319
|
-
throw
|
|
8249
|
+
err_65 = _a.sent();
|
|
8250
|
+
console.log("perpClient createWhitelistInstruction error:: ", err_65);
|
|
8251
|
+
throw err_65;
|
|
8320
8252
|
case 4: return [2, {
|
|
8321
8253
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8322
8254
|
additionalSigners: additionalSigners
|
|
@@ -8325,7 +8257,7 @@ var PerpetualsClient = (function () {
|
|
|
8325
8257
|
});
|
|
8326
8258
|
}); };
|
|
8327
8259
|
this.setWhitelistConfig = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
|
|
8328
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction,
|
|
8260
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction, err_66;
|
|
8329
8261
|
return __generator(this, function (_a) {
|
|
8330
8262
|
switch (_a.label) {
|
|
8331
8263
|
case 0:
|
|
@@ -8358,9 +8290,9 @@ var PerpetualsClient = (function () {
|
|
|
8358
8290
|
instructions.push(setWhitelistConfigInstruction);
|
|
8359
8291
|
return [3, 4];
|
|
8360
8292
|
case 3:
|
|
8361
|
-
|
|
8362
|
-
console.log("perpClient setWhitelistConfigInstruction error:: ",
|
|
8363
|
-
throw
|
|
8293
|
+
err_66 = _a.sent();
|
|
8294
|
+
console.log("perpClient setWhitelistConfigInstruction error:: ", err_66);
|
|
8295
|
+
throw err_66;
|
|
8364
8296
|
case 4: return [2, {
|
|
8365
8297
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8366
8298
|
additionalSigners: additionalSigners
|