flash-sdk 11.10.2-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 -173
- 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
|
-
netProfitUsd: constants_1.BN_ZERO,
|
|
1614
1600
|
};
|
|
1615
1601
|
}
|
|
1616
1602
|
var side = poolConfig.getMarketConfigByPk(positionAccount.market).side;
|
|
@@ -1674,29 +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 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
|
-
}
|
|
1687
1664
|
return {
|
|
1688
|
-
profitUsd:
|
|
1665
|
+
profitUsd: priceDiffProfit.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals),
|
|
1689
1666
|
lossUsd: constants_1.BN_ZERO,
|
|
1690
|
-
penaltyUsd: penaltyUsd,
|
|
1691
|
-
netProfitUsd: netProfitUsd,
|
|
1692
1667
|
};
|
|
1693
1668
|
}
|
|
1694
1669
|
else {
|
|
1695
1670
|
return {
|
|
1696
1671
|
profitUsd: constants_1.BN_ZERO,
|
|
1697
1672
|
lossUsd: priceDiffLoss.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals),
|
|
1698
|
-
penaltyUsd: constants_1.BN_ZERO,
|
|
1699
|
-
netProfitUsd: constants_1.BN_ZERO,
|
|
1700
1673
|
};
|
|
1701
1674
|
}
|
|
1702
1675
|
};
|
|
@@ -1709,7 +1682,7 @@ var PerpetualsClient = (function () {
|
|
|
1709
1682
|
timestamp: constants_1.BN_ZERO
|
|
1710
1683
|
});
|
|
1711
1684
|
return {
|
|
1712
|
-
pnl: { profitUsd: constants_1.BN_ZERO, lossUsd: constants_1.BN_ZERO
|
|
1685
|
+
pnl: { profitUsd: constants_1.BN_ZERO, lossUsd: constants_1.BN_ZERO },
|
|
1713
1686
|
leverage: constants_1.BN_ZERO,
|
|
1714
1687
|
liquidationPrice: zeroOraclePrice,
|
|
1715
1688
|
fees: { exitFeeUsd: constants_1.BN_ZERO, exitFeeAmount: constants_1.BN_ZERO, lockAndUnsettledFeeUsd: constants_1.BN_ZERO }
|
|
@@ -1775,35 +1748,22 @@ var PerpetualsClient = (function () {
|
|
|
1775
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 });
|
|
1776
1749
|
}
|
|
1777
1750
|
}
|
|
1778
|
-
var totalPenaltyBps = positionAccount.oraclePenalty + positionAccount.previousPenalty;
|
|
1779
1751
|
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
|
-
}
|
|
1788
1752
|
pnl = {
|
|
1789
|
-
profitUsd:
|
|
1753
|
+
profitUsd: priceDiffProfit.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals),
|
|
1790
1754
|
lossUsd: constants_1.BN_ZERO,
|
|
1791
|
-
penaltyUsd: penaltyUsd,
|
|
1792
|
-
netProfitUsd: netProfitUsd,
|
|
1793
1755
|
};
|
|
1794
1756
|
}
|
|
1795
1757
|
else {
|
|
1796
1758
|
pnl = {
|
|
1797
1759
|
profitUsd: constants_1.BN_ZERO,
|
|
1798
1760
|
lossUsd: priceDiffLoss.getAssetAmountUsd(positionAccount.sizeAmount, positionAccount.sizeDecimals),
|
|
1799
|
-
penaltyUsd: constants_1.BN_ZERO,
|
|
1800
|
-
netProfitUsd: constants_1.BN_ZERO,
|
|
1801
1761
|
};
|
|
1802
1762
|
}
|
|
1803
1763
|
var liquidationPrice = _this.getLiquidationPriceContractHelper(entryOraclePrice, lockAndUnsettledFeeUsd, side, targetCustodyAccount, positionAccount);
|
|
1804
1764
|
var unsettledFeesUsd = exitFeeUsd.add(lockAndUnsettledFeeUsd);
|
|
1805
1765
|
var lossUsd = pnl.lossUsd.add(unsettledFeesUsd);
|
|
1806
|
-
var currentMarginUsd = positionAccount.collateralUsd.add(pnl.
|
|
1766
|
+
var currentMarginUsd = positionAccount.collateralUsd.add(pnl.profitUsd).sub(lossUsd);
|
|
1807
1767
|
var leverage;
|
|
1808
1768
|
if (currentMarginUsd.gt(constants_1.BN_ZERO)) {
|
|
1809
1769
|
leverage = positionAccount.sizeUsd.mul(new anchor_1.BN(constants_1.BPS_POWER)).div(currentMarginUsd);
|
|
@@ -2050,7 +2010,7 @@ var PerpetualsClient = (function () {
|
|
|
2050
2010
|
});
|
|
2051
2011
|
};
|
|
2052
2012
|
this.getStakedLpTokenPrice = function (poolKey, POOL_CONFIG) { return __awaiter(_this, void 0, void 0, function () {
|
|
2053
|
-
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;
|
|
2054
2014
|
var _d;
|
|
2055
2015
|
return __generator(this, function (_e) {
|
|
2056
2016
|
switch (_e.label) {
|
|
@@ -2101,8 +2061,11 @@ var PerpetualsClient = (function () {
|
|
|
2101
2061
|
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2102
2062
|
transaction.instructions.unshift(setCULimitIx);
|
|
2103
2063
|
(_d = transaction.instructions).unshift.apply(_d, backUpOracleInstruction);
|
|
2104
|
-
return [4, this.
|
|
2064
|
+
return [4, this.getOrLoadAddressLookupTable(POOL_CONFIG)];
|
|
2105
2065
|
case 3:
|
|
2066
|
+
addressLookupTables = (_e.sent()).addressLookupTables;
|
|
2067
|
+
return [4, this.viewHelper.simulateTransaction(transaction, addressLookupTables)];
|
|
2068
|
+
case 4:
|
|
2106
2069
|
result = _e.sent();
|
|
2107
2070
|
index = perpetuals_1.IDL.instructions.findIndex(function (f) { return f.name === 'getLpTokenPrice'; });
|
|
2108
2071
|
res = this.viewHelper.decodeLogs(result, index, 'getLpTokenPrice');
|
|
@@ -2166,7 +2129,7 @@ var PerpetualsClient = (function () {
|
|
|
2166
2129
|
args_1[_i - 4] = arguments[_i];
|
|
2167
2130
|
}
|
|
2168
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) {
|
|
2169
|
-
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;
|
|
2170
2133
|
var _e;
|
|
2171
2134
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2172
2135
|
if (enableBackupOracle === void 0) { enableBackupOracle = false; }
|
|
@@ -2231,8 +2194,11 @@ var PerpetualsClient = (function () {
|
|
|
2231
2194
|
backUpOracleInstruction = _f.sent();
|
|
2232
2195
|
(_e = transaction.instructions).unshift.apply(_e, backUpOracleInstruction);
|
|
2233
2196
|
_f.label = 3;
|
|
2234
|
-
case 3: return [4, this.
|
|
2197
|
+
case 3: return [4, this.getOrLoadAddressLookupTable(POOL_CONFIG)];
|
|
2235
2198
|
case 4:
|
|
2199
|
+
addressLookupTables = (_f.sent()).addressLookupTables;
|
|
2200
|
+
return [4, this.viewHelper.simulateTransaction(transaction, addressLookupTables, userPublicKey)];
|
|
2201
|
+
case 5:
|
|
2236
2202
|
result = _f.sent();
|
|
2237
2203
|
if (result.value.err) {
|
|
2238
2204
|
console.error('error Simulation failed:::', result);
|
|
@@ -2258,7 +2224,7 @@ var PerpetualsClient = (function () {
|
|
|
2258
2224
|
args_1[_i - 4] = arguments[_i];
|
|
2259
2225
|
}
|
|
2260
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) {
|
|
2261
|
-
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;
|
|
2262
2228
|
var _e;
|
|
2263
2229
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2264
2230
|
if (enableBackupOracle === void 0) { enableBackupOracle = false; }
|
|
@@ -2323,8 +2289,11 @@ var PerpetualsClient = (function () {
|
|
|
2323
2289
|
backUpOracleInstruction = _f.sent();
|
|
2324
2290
|
(_e = transaction.instructions).unshift.apply(_e, backUpOracleInstruction);
|
|
2325
2291
|
_f.label = 3;
|
|
2326
|
-
case 3: return [4, this.
|
|
2292
|
+
case 3: return [4, this.getOrLoadAddressLookupTable(POOL_CONFIG)];
|
|
2327
2293
|
case 4:
|
|
2294
|
+
addressLookupTables = (_f.sent()).addressLookupTables;
|
|
2295
|
+
return [4, this.viewHelper.simulateTransaction(transaction, addressLookupTables, userPublicKey)];
|
|
2296
|
+
case 5:
|
|
2328
2297
|
result = _f.sent();
|
|
2329
2298
|
index = perpetuals_1.IDL.instructions.findIndex(function (f) { return f.name === 'getRemoveLiquidityAmountAndFee'; });
|
|
2330
2299
|
if (result.value.err) {
|
|
@@ -2345,7 +2314,7 @@ var PerpetualsClient = (function () {
|
|
|
2345
2314
|
});
|
|
2346
2315
|
};
|
|
2347
2316
|
this.getCompoundingLPTokenPrice = function (poolKey, POOL_CONFIG) { return __awaiter(_this, void 0, void 0, function () {
|
|
2348
|
-
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;
|
|
2349
2318
|
var _d;
|
|
2350
2319
|
return __generator(this, function (_e) {
|
|
2351
2320
|
switch (_e.label) {
|
|
@@ -2396,8 +2365,11 @@ var PerpetualsClient = (function () {
|
|
|
2396
2365
|
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2397
2366
|
transaction.instructions.unshift(setCULimitIx);
|
|
2398
2367
|
(_d = transaction.instructions).unshift.apply(_d, backUpOracleInstruction);
|
|
2399
|
-
return [4, this.
|
|
2368
|
+
return [4, this.getOrLoadAddressLookupTable(POOL_CONFIG)];
|
|
2400
2369
|
case 3:
|
|
2370
|
+
addressLookupTables = (_e.sent()).addressLookupTables;
|
|
2371
|
+
return [4, this.viewHelper.simulateTransaction(transaction, addressLookupTables)];
|
|
2372
|
+
case 4:
|
|
2401
2373
|
result = _e.sent();
|
|
2402
2374
|
index = perpetuals_1.IDL.instructions.findIndex(function (f) { return f.name === 'getCompoundingTokenPrice'; });
|
|
2403
2375
|
res = this.viewHelper.decodeLogs(result, index, 'getCompoundingTokenPrice');
|
|
@@ -2411,7 +2383,7 @@ var PerpetualsClient = (function () {
|
|
|
2411
2383
|
args_1[_i - 4] = arguments[_i];
|
|
2412
2384
|
}
|
|
2413
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) {
|
|
2414
|
-
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;
|
|
2415
2387
|
var _e;
|
|
2416
2388
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2417
2389
|
if (enableBackupOracle === void 0) { enableBackupOracle = false; }
|
|
@@ -2474,14 +2446,17 @@ var PerpetualsClient = (function () {
|
|
|
2474
2446
|
transaction = _f.sent();
|
|
2475
2447
|
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2476
2448
|
transaction.instructions.unshift(setCULimitIx);
|
|
2477
|
-
|
|
2478
|
-
return [4, (0, backupOracle_1.createBackupOracleInstruction)(POOL_CONFIG.poolAddress.toBase58(), true)];
|
|
2449
|
+
return [4, this.getOrLoadAddressLookupTable(POOL_CONFIG)];
|
|
2479
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:
|
|
2480
2455
|
backUpOracleInstruction = _f.sent();
|
|
2481
2456
|
(_e = transaction.instructions).unshift.apply(_e, backUpOracleInstruction);
|
|
2482
|
-
_f.label =
|
|
2483
|
-
case
|
|
2484
|
-
case
|
|
2457
|
+
_f.label = 4;
|
|
2458
|
+
case 4: return [4, this.viewHelper.simulateTransaction(transaction, addressLookupTables, userPublicKey)];
|
|
2459
|
+
case 5:
|
|
2485
2460
|
result = _f.sent();
|
|
2486
2461
|
index = perpetuals_1.IDL.instructions.findIndex(function (f) { return f.name === 'getAddCompoundingLiquidityAmountAndFee'; });
|
|
2487
2462
|
res = this.viewHelper.decodeLogs(result, index, 'getAddCompoundingLiquidityAmountAndFee');
|
|
@@ -2499,7 +2474,7 @@ var PerpetualsClient = (function () {
|
|
|
2499
2474
|
args_1[_i - 4] = arguments[_i];
|
|
2500
2475
|
}
|
|
2501
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) {
|
|
2502
|
-
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;
|
|
2503
2478
|
var _e;
|
|
2504
2479
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2505
2480
|
if (enableBackupOracle === void 0) { enableBackupOracle = false; }
|
|
@@ -2568,8 +2543,11 @@ var PerpetualsClient = (function () {
|
|
|
2568
2543
|
backUpOracleInstruction = _f.sent();
|
|
2569
2544
|
(_e = transaction.instructions).unshift.apply(_e, backUpOracleInstruction);
|
|
2570
2545
|
_f.label = 3;
|
|
2571
|
-
case 3: return [4, this.
|
|
2546
|
+
case 3: return [4, this.getOrLoadAddressLookupTable(POOL_CONFIG)];
|
|
2572
2547
|
case 4:
|
|
2548
|
+
addressLookupTables = (_f.sent()).addressLookupTables;
|
|
2549
|
+
return [4, this.viewHelper.simulateTransaction(transaction, addressLookupTables, userPublicKey)];
|
|
2550
|
+
case 5:
|
|
2573
2551
|
result = _f.sent();
|
|
2574
2552
|
index = perpetuals_1.IDL.instructions.findIndex(function (f) { return f.name === 'getRemoveCompoundingLiquidityAmountAndFee'; });
|
|
2575
2553
|
if (result.value.err) {
|
|
@@ -7621,44 +7599,8 @@ var PerpetualsClient = (function () {
|
|
|
7621
7599
|
}
|
|
7622
7600
|
});
|
|
7623
7601
|
}); };
|
|
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
|
-
}); };
|
|
7660
7602
|
this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7661
|
-
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp,
|
|
7603
|
+
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_52;
|
|
7662
7604
|
return __generator(this, function (_a) {
|
|
7663
7605
|
switch (_a.label) {
|
|
7664
7606
|
case 0:
|
|
@@ -7696,8 +7638,8 @@ var PerpetualsClient = (function () {
|
|
|
7696
7638
|
instructions.push(renameFlp);
|
|
7697
7639
|
return [3, 4];
|
|
7698
7640
|
case 3:
|
|
7699
|
-
|
|
7700
|
-
console.log("perpClient renameFlp error:: ",
|
|
7641
|
+
err_52 = _a.sent();
|
|
7642
|
+
console.log("perpClient renameFlp error:: ", err_52);
|
|
7701
7643
|
return [3, 4];
|
|
7702
7644
|
case 4: return [2, {
|
|
7703
7645
|
instructions: __spreadArray([], instructions, true),
|
|
@@ -7707,7 +7649,7 @@ var PerpetualsClient = (function () {
|
|
|
7707
7649
|
});
|
|
7708
7650
|
}); };
|
|
7709
7651
|
this.initStake = function (stakingFeeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7710
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction,
|
|
7652
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_53;
|
|
7711
7653
|
return __generator(this, function (_a) {
|
|
7712
7654
|
switch (_a.label) {
|
|
7713
7655
|
case 0:
|
|
@@ -7745,9 +7687,9 @@ var PerpetualsClient = (function () {
|
|
|
7745
7687
|
instructions.push(initStakeInstruction);
|
|
7746
7688
|
return [3, 4];
|
|
7747
7689
|
case 3:
|
|
7748
|
-
|
|
7749
|
-
console.log("perpClient InitStaking error:: ",
|
|
7750
|
-
throw
|
|
7690
|
+
err_53 = _a.sent();
|
|
7691
|
+
console.log("perpClient InitStaking error:: ", err_53);
|
|
7692
|
+
throw err_53;
|
|
7751
7693
|
case 4: return [2, {
|
|
7752
7694
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7753
7695
|
additionalSigners: additionalSigners
|
|
@@ -7756,7 +7698,7 @@ var PerpetualsClient = (function () {
|
|
|
7756
7698
|
});
|
|
7757
7699
|
}); };
|
|
7758
7700
|
this.initCompounding = function (feeShareBps, metadataTitle, metadataSymbol, metadataUri, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7759
|
-
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;
|
|
7760
7702
|
return __generator(this, function (_a) {
|
|
7761
7703
|
switch (_a.label) {
|
|
7762
7704
|
case 0:
|
|
@@ -7800,9 +7742,9 @@ var PerpetualsClient = (function () {
|
|
|
7800
7742
|
instructions.push(initCompoundingInstruction);
|
|
7801
7743
|
return [3, 4];
|
|
7802
7744
|
case 3:
|
|
7803
|
-
|
|
7804
|
-
console.log("perpClient initCompounding error:: ",
|
|
7805
|
-
throw
|
|
7745
|
+
err_54 = _a.sent();
|
|
7746
|
+
console.log("perpClient initCompounding error:: ", err_54);
|
|
7747
|
+
throw err_54;
|
|
7806
7748
|
case 4: return [2, {
|
|
7807
7749
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7808
7750
|
additionalSigners: additionalSigners
|
|
@@ -7811,7 +7753,7 @@ var PerpetualsClient = (function () {
|
|
|
7811
7753
|
});
|
|
7812
7754
|
}); };
|
|
7813
7755
|
this.initTokenVault = function (token_permissions, tokens_to_distribute, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7814
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction,
|
|
7756
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_55;
|
|
7815
7757
|
return __generator(this, function (_a) {
|
|
7816
7758
|
switch (_a.label) {
|
|
7817
7759
|
case 0:
|
|
@@ -7852,9 +7794,9 @@ var PerpetualsClient = (function () {
|
|
|
7852
7794
|
instructions.push(initTokenVaultInstruction);
|
|
7853
7795
|
return [3, 4];
|
|
7854
7796
|
case 3:
|
|
7855
|
-
|
|
7856
|
-
console.log("perpClient InitTokenVaultInstruction error:: ",
|
|
7857
|
-
throw
|
|
7797
|
+
err_55 = _a.sent();
|
|
7798
|
+
console.log("perpClient InitTokenVaultInstruction error:: ", err_55);
|
|
7799
|
+
throw err_55;
|
|
7858
7800
|
case 4: return [2, {
|
|
7859
7801
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7860
7802
|
additionalSigners: additionalSigners
|
|
@@ -7863,7 +7805,7 @@ var PerpetualsClient = (function () {
|
|
|
7863
7805
|
});
|
|
7864
7806
|
}); };
|
|
7865
7807
|
this.setTokenVaultConfig = function (token_permissions, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7866
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction,
|
|
7808
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_56;
|
|
7867
7809
|
return __generator(this, function (_a) {
|
|
7868
7810
|
switch (_a.label) {
|
|
7869
7811
|
case 0:
|
|
@@ -7894,9 +7836,9 @@ var PerpetualsClient = (function () {
|
|
|
7894
7836
|
instructions.push(setTokenVaultConfigInstruction);
|
|
7895
7837
|
return [3, 4];
|
|
7896
7838
|
case 3:
|
|
7897
|
-
|
|
7898
|
-
console.log("perpClient setTokenVaultConfigInstruction error:: ",
|
|
7899
|
-
throw
|
|
7839
|
+
err_56 = _a.sent();
|
|
7840
|
+
console.log("perpClient setTokenVaultConfigInstruction error:: ", err_56);
|
|
7841
|
+
throw err_56;
|
|
7900
7842
|
case 4: return [2, {
|
|
7901
7843
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7902
7844
|
additionalSigners: additionalSigners
|
|
@@ -7905,7 +7847,7 @@ var PerpetualsClient = (function () {
|
|
|
7905
7847
|
});
|
|
7906
7848
|
}); };
|
|
7907
7849
|
this.withdrawInstantFee = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7908
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction,
|
|
7850
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_57;
|
|
7909
7851
|
return __generator(this, function (_a) {
|
|
7910
7852
|
switch (_a.label) {
|
|
7911
7853
|
case 0:
|
|
@@ -7944,9 +7886,9 @@ var PerpetualsClient = (function () {
|
|
|
7944
7886
|
instructions.push(withdrawInstantFeeInstruction);
|
|
7945
7887
|
return [3, 6];
|
|
7946
7888
|
case 5:
|
|
7947
|
-
|
|
7948
|
-
console.log("perpClient withdrawInstantFeeInstruction error:: ",
|
|
7949
|
-
throw
|
|
7889
|
+
err_57 = _a.sent();
|
|
7890
|
+
console.log("perpClient withdrawInstantFeeInstruction error:: ", err_57);
|
|
7891
|
+
throw err_57;
|
|
7950
7892
|
case 6: return [2, {
|
|
7951
7893
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7952
7894
|
additionalSigners: additionalSigners
|
|
@@ -7955,7 +7897,7 @@ var PerpetualsClient = (function () {
|
|
|
7955
7897
|
});
|
|
7956
7898
|
}); };
|
|
7957
7899
|
this.withdrawUnclaimedTokens = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7958
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction,
|
|
7900
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction, err_58;
|
|
7959
7901
|
return __generator(this, function (_a) {
|
|
7960
7902
|
switch (_a.label) {
|
|
7961
7903
|
case 0:
|
|
@@ -7994,9 +7936,9 @@ var PerpetualsClient = (function () {
|
|
|
7994
7936
|
instructions.push(withdrawUnclaimedTokensInstruction);
|
|
7995
7937
|
return [3, 6];
|
|
7996
7938
|
case 5:
|
|
7997
|
-
|
|
7998
|
-
console.log("perpClient withdrawUnclaimedTokensInstruction error:: ",
|
|
7999
|
-
throw
|
|
7939
|
+
err_58 = _a.sent();
|
|
7940
|
+
console.log("perpClient withdrawUnclaimedTokensInstruction error:: ", err_58);
|
|
7941
|
+
throw err_58;
|
|
8000
7942
|
case 6: return [2, {
|
|
8001
7943
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8002
7944
|
additionalSigners: additionalSigners
|
|
@@ -8005,7 +7947,7 @@ var PerpetualsClient = (function () {
|
|
|
8005
7947
|
});
|
|
8006
7948
|
}); };
|
|
8007
7949
|
this.initRevenueTokenAccount = function (feeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8008
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction,
|
|
7950
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_59;
|
|
8009
7951
|
return __generator(this, function (_a) {
|
|
8010
7952
|
switch (_a.label) {
|
|
8011
7953
|
case 0:
|
|
@@ -8042,9 +7984,9 @@ var PerpetualsClient = (function () {
|
|
|
8042
7984
|
instructions.push(initRevenueTokenAccountInstruction);
|
|
8043
7985
|
return [3, 4];
|
|
8044
7986
|
case 3:
|
|
8045
|
-
|
|
8046
|
-
console.log("perpClient initRevenueTokenAccountInstruction error:: ",
|
|
8047
|
-
throw
|
|
7987
|
+
err_59 = _a.sent();
|
|
7988
|
+
console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_59);
|
|
7989
|
+
throw err_59;
|
|
8048
7990
|
case 4: return [2, {
|
|
8049
7991
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8050
7992
|
additionalSigners: additionalSigners
|
|
@@ -8053,7 +7995,7 @@ var PerpetualsClient = (function () {
|
|
|
8053
7995
|
});
|
|
8054
7996
|
}); };
|
|
8055
7997
|
this.initRebateVault = function (allowRebatePayout, rebateSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8056
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateCustodyMint, initRebateVaultInstruction,
|
|
7998
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateCustodyMint, initRebateVaultInstruction, err_60;
|
|
8057
7999
|
return __generator(this, function (_a) {
|
|
8058
8000
|
switch (_a.label) {
|
|
8059
8001
|
case 0:
|
|
@@ -8088,9 +8030,9 @@ var PerpetualsClient = (function () {
|
|
|
8088
8030
|
instructions.push(initRebateVaultInstruction);
|
|
8089
8031
|
return [3, 4];
|
|
8090
8032
|
case 3:
|
|
8091
|
-
|
|
8092
|
-
console.log("perpClient initRebateVaultInstruction error:: ",
|
|
8093
|
-
throw
|
|
8033
|
+
err_60 = _a.sent();
|
|
8034
|
+
console.log("perpClient initRebateVaultInstruction error:: ", err_60);
|
|
8035
|
+
throw err_60;
|
|
8094
8036
|
case 4: return [2, {
|
|
8095
8037
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8096
8038
|
additionalSigners: additionalSigners
|
|
@@ -8099,7 +8041,7 @@ var PerpetualsClient = (function () {
|
|
|
8099
8041
|
});
|
|
8100
8042
|
}); };
|
|
8101
8043
|
this.distributeTokenReward = function (amount, epochCount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8102
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction,
|
|
8044
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_61;
|
|
8103
8045
|
return __generator(this, function (_a) {
|
|
8104
8046
|
switch (_a.label) {
|
|
8105
8047
|
case 0:
|
|
@@ -8138,9 +8080,9 @@ var PerpetualsClient = (function () {
|
|
|
8138
8080
|
instructions.push(distributeTokenRewardInstruction);
|
|
8139
8081
|
return [3, 4];
|
|
8140
8082
|
case 3:
|
|
8141
|
-
|
|
8142
|
-
console.log("perpClient distributeTokenRewardInstruction error:: ",
|
|
8143
|
-
throw
|
|
8083
|
+
err_61 = _a.sent();
|
|
8084
|
+
console.log("perpClient distributeTokenRewardInstruction error:: ", err_61);
|
|
8085
|
+
throw err_61;
|
|
8144
8086
|
case 4: return [2, {
|
|
8145
8087
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8146
8088
|
additionalSigners: additionalSigners
|
|
@@ -8149,7 +8091,7 @@ var PerpetualsClient = (function () {
|
|
|
8149
8091
|
});
|
|
8150
8092
|
}); };
|
|
8151
8093
|
this.setTokenStakeLevel = function (owner, stakeLevel) { return __awaiter(_this, void 0, void 0, function () {
|
|
8152
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction,
|
|
8094
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_62;
|
|
8153
8095
|
return __generator(this, function (_a) {
|
|
8154
8096
|
switch (_a.label) {
|
|
8155
8097
|
case 0:
|
|
@@ -8177,9 +8119,9 @@ var PerpetualsClient = (function () {
|
|
|
8177
8119
|
instructions.push(setTokenStakeLevelInstruction);
|
|
8178
8120
|
return [3, 4];
|
|
8179
8121
|
case 3:
|
|
8180
|
-
|
|
8181
|
-
console.log("perpClient setTokenStakeLevelInstruction error:: ",
|
|
8182
|
-
throw
|
|
8122
|
+
err_62 = _a.sent();
|
|
8123
|
+
console.log("perpClient setTokenStakeLevelInstruction error:: ", err_62);
|
|
8124
|
+
throw err_62;
|
|
8183
8125
|
case 4: return [2, {
|
|
8184
8126
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8185
8127
|
additionalSigners: additionalSigners
|
|
@@ -8188,7 +8130,7 @@ var PerpetualsClient = (function () {
|
|
|
8188
8130
|
});
|
|
8189
8131
|
}); };
|
|
8190
8132
|
this.setTokenReward = function (owner, amount, epochCount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8191
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction,
|
|
8133
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_63;
|
|
8192
8134
|
return __generator(this, function (_a) {
|
|
8193
8135
|
switch (_a.label) {
|
|
8194
8136
|
case 0:
|
|
@@ -8220,9 +8162,9 @@ var PerpetualsClient = (function () {
|
|
|
8220
8162
|
instructions.push(setTokenRewardInstruction);
|
|
8221
8163
|
return [3, 4];
|
|
8222
8164
|
case 3:
|
|
8223
|
-
|
|
8224
|
-
console.log("perpClient setTokenRewardInstruction error:: ",
|
|
8225
|
-
throw
|
|
8165
|
+
err_63 = _a.sent();
|
|
8166
|
+
console.log("perpClient setTokenRewardInstruction error:: ", err_63);
|
|
8167
|
+
throw err_63;
|
|
8226
8168
|
case 4: return [2, {
|
|
8227
8169
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8228
8170
|
additionalSigners: additionalSigners
|
|
@@ -8231,7 +8173,7 @@ var PerpetualsClient = (function () {
|
|
|
8231
8173
|
});
|
|
8232
8174
|
}); };
|
|
8233
8175
|
this.resizeInternalOracle = function (extOracle, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
|
|
8234
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction,
|
|
8176
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction, err_64;
|
|
8235
8177
|
return __generator(this, function (_a) {
|
|
8236
8178
|
switch (_a.label) {
|
|
8237
8179
|
case 0:
|
|
@@ -8260,9 +8202,9 @@ var PerpetualsClient = (function () {
|
|
|
8260
8202
|
instructions.push(resizeInternalOracleInstruction);
|
|
8261
8203
|
return [3, 4];
|
|
8262
8204
|
case 3:
|
|
8263
|
-
|
|
8264
|
-
console.log("perpClient resizeInternalOracleInstruction error:: ",
|
|
8265
|
-
throw
|
|
8205
|
+
err_64 = _a.sent();
|
|
8206
|
+
console.log("perpClient resizeInternalOracleInstruction error:: ", err_64);
|
|
8207
|
+
throw err_64;
|
|
8266
8208
|
case 4: return [2, {
|
|
8267
8209
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8268
8210
|
additionalSigners: additionalSigners
|
|
@@ -8271,7 +8213,7 @@ var PerpetualsClient = (function () {
|
|
|
8271
8213
|
});
|
|
8272
8214
|
}); };
|
|
8273
8215
|
this.createWhitelist = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
|
|
8274
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction,
|
|
8216
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction, err_65;
|
|
8275
8217
|
return __generator(this, function (_a) {
|
|
8276
8218
|
switch (_a.label) {
|
|
8277
8219
|
case 0:
|
|
@@ -8304,9 +8246,9 @@ var PerpetualsClient = (function () {
|
|
|
8304
8246
|
instructions.push(createWhitelistInstruction);
|
|
8305
8247
|
return [3, 4];
|
|
8306
8248
|
case 3:
|
|
8307
|
-
|
|
8308
|
-
console.log("perpClient createWhitelistInstruction error:: ",
|
|
8309
|
-
throw
|
|
8249
|
+
err_65 = _a.sent();
|
|
8250
|
+
console.log("perpClient createWhitelistInstruction error:: ", err_65);
|
|
8251
|
+
throw err_65;
|
|
8310
8252
|
case 4: return [2, {
|
|
8311
8253
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8312
8254
|
additionalSigners: additionalSigners
|
|
@@ -8315,7 +8257,7 @@ var PerpetualsClient = (function () {
|
|
|
8315
8257
|
});
|
|
8316
8258
|
}); };
|
|
8317
8259
|
this.setWhitelistConfig = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
|
|
8318
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction,
|
|
8260
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction, err_66;
|
|
8319
8261
|
return __generator(this, function (_a) {
|
|
8320
8262
|
switch (_a.label) {
|
|
8321
8263
|
case 0:
|
|
@@ -8348,9 +8290,9 @@ var PerpetualsClient = (function () {
|
|
|
8348
8290
|
instructions.push(setWhitelistConfigInstruction);
|
|
8349
8291
|
return [3, 4];
|
|
8350
8292
|
case 3:
|
|
8351
|
-
|
|
8352
|
-
console.log("perpClient setWhitelistConfigInstruction error:: ",
|
|
8353
|
-
throw
|
|
8293
|
+
err_66 = _a.sent();
|
|
8294
|
+
console.log("perpClient setWhitelistConfigInstruction error:: ", err_66);
|
|
8295
|
+
throw err_66;
|
|
8354
8296
|
case 4: return [2, {
|
|
8355
8297
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8356
8298
|
additionalSigners: additionalSigners
|