flash-sdk 15.8.2 → 15.8.3
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 +67 -4
- package/dist/PerpetualsClient.js +708 -398
- package/dist/ViewHelper.js +9 -15
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/PerpetualsClient.js
CHANGED
|
@@ -267,43 +267,6 @@ var PerpetualsClient = (function () {
|
|
|
267
267
|
return [2, this.program.account.position.fetch(postionKey)];
|
|
268
268
|
});
|
|
269
269
|
}); };
|
|
270
|
-
this.getPositionData = function (position, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
271
|
-
var marketConfig, targetCustodyConfig, collateralCustodyConfig, getPositionData, err_1;
|
|
272
|
-
return __generator(this, function (_a) {
|
|
273
|
-
switch (_a.label) {
|
|
274
|
-
case 0:
|
|
275
|
-
marketConfig = poolConfig.markets.find(function (i) { return i.marketAccount.equals(position.market); });
|
|
276
|
-
targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.custodyAccount.equals(marketConfig.targetCustody); });
|
|
277
|
-
collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.custodyAccount.equals(marketConfig.collateralCustody); });
|
|
278
|
-
_a.label = 1;
|
|
279
|
-
case 1:
|
|
280
|
-
_a.trys.push([1, 3, , 4]);
|
|
281
|
-
return [4, this.program.methods
|
|
282
|
-
.getPositionData({})
|
|
283
|
-
.accountsPartial({
|
|
284
|
-
perpetuals: this.perpetuals.publicKey,
|
|
285
|
-
pool: poolConfig.poolAddress,
|
|
286
|
-
position: position.publicKey,
|
|
287
|
-
market: marketConfig.marketAccount,
|
|
288
|
-
targetCustody: targetCustodyConfig.custodyAccount,
|
|
289
|
-
custodyOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
|
|
290
|
-
collateralCustody: collateralCustodyConfig.custodyAccount,
|
|
291
|
-
collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
|
|
292
|
-
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
|
293
|
-
})
|
|
294
|
-
.view()];
|
|
295
|
-
case 2:
|
|
296
|
-
getPositionData = _a.sent();
|
|
297
|
-
console.log(getPositionData);
|
|
298
|
-
return [2, getPositionData];
|
|
299
|
-
case 3:
|
|
300
|
-
err_1 = _a.sent();
|
|
301
|
-
console.log("perpClient setPool error:: ", err_1);
|
|
302
|
-
throw err_1;
|
|
303
|
-
case 4: return [2];
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
}); };
|
|
307
270
|
this.getOrderAccount = function (orderAccountKey) { return __awaiter(_this, void 0, void 0, function () {
|
|
308
271
|
return __generator(this, function (_a) {
|
|
309
272
|
return [2, this.program.account.order.fetch(orderAccountKey)];
|
|
@@ -341,6 +304,32 @@ var PerpetualsClient = (function () {
|
|
|
341
304
|
}
|
|
342
305
|
});
|
|
343
306
|
}); };
|
|
307
|
+
this.getUserPositionsMultiPool = function (wallet, poolConfigs) { return __awaiter(_this, void 0, void 0, function () {
|
|
308
|
+
var positionKeys, chunks, i, results;
|
|
309
|
+
var _this = this;
|
|
310
|
+
return __generator(this, function (_a) {
|
|
311
|
+
switch (_a.label) {
|
|
312
|
+
case 0:
|
|
313
|
+
positionKeys = poolConfigs.flatMap(function (poolConfig) {
|
|
314
|
+
return poolConfig.getAllMarketPks().map(function (f) {
|
|
315
|
+
return _this.findProgramAddress("position", [wallet, f]).publicKey;
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
chunks = [];
|
|
319
|
+
for (i = 0; i < positionKeys.length; i += 100) {
|
|
320
|
+
chunks.push(positionKeys.slice(i, i + 100));
|
|
321
|
+
}
|
|
322
|
+
return [4, Promise.all(chunks.map(function (chunk) { return _this.provider.connection.getMultipleAccountsInfo(chunk); }))];
|
|
323
|
+
case 1:
|
|
324
|
+
results = (_a.sent()).flat();
|
|
325
|
+
return [2, results
|
|
326
|
+
.map(function (p, i) { return ({ pubkey: positionKeys[i], data: p }); })
|
|
327
|
+
.filter(function (f) { return f.data !== null; })
|
|
328
|
+
.map(function (k) { return (__assign({ pubkey: k.pubkey }, _this.program.account.position.coder.accounts.decode('position', k.data.data))); })
|
|
329
|
+
.filter(function (f) { return f.isActive; })];
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
}); };
|
|
344
333
|
this.getUserOrderAccounts = function (wallet, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
345
334
|
var marketAccountsPks, orderAccountKeys, orderAccountsDatas;
|
|
346
335
|
var _this = this;
|
|
@@ -363,6 +352,32 @@ var PerpetualsClient = (function () {
|
|
|
363
352
|
}
|
|
364
353
|
});
|
|
365
354
|
}); };
|
|
355
|
+
this.getUserOrderAccountsMultiPool = function (wallet, poolConfigs) { return __awaiter(_this, void 0, void 0, function () {
|
|
356
|
+
var orderKeys, chunks, i, results;
|
|
357
|
+
var _this = this;
|
|
358
|
+
return __generator(this, function (_a) {
|
|
359
|
+
switch (_a.label) {
|
|
360
|
+
case 0:
|
|
361
|
+
orderKeys = poolConfigs.flatMap(function (poolConfig) {
|
|
362
|
+
return poolConfig.getAllMarketPks().map(function (f) {
|
|
363
|
+
return _this.findProgramAddress("order", [wallet, f]).publicKey;
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
chunks = [];
|
|
367
|
+
for (i = 0; i < orderKeys.length; i += 100) {
|
|
368
|
+
chunks.push(orderKeys.slice(i, i + 100));
|
|
369
|
+
}
|
|
370
|
+
return [4, Promise.all(chunks.map(function (chunk) { return _this.provider.connection.getMultipleAccountsInfo(chunk); }))];
|
|
371
|
+
case 1:
|
|
372
|
+
results = (_a.sent()).flat();
|
|
373
|
+
return [2, results
|
|
374
|
+
.map(function (p, i) { return ({ pubkey: orderKeys[i], data: p }); })
|
|
375
|
+
.filter(function (f) { return f.data !== null; })
|
|
376
|
+
.map(function (k) { return (__assign({ pubkey: k.pubkey }, _this.program.account.position.coder.accounts.decode('order', k.data.data))); })
|
|
377
|
+
.filter(function (f) { return f.isActive; })];
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
}); };
|
|
366
381
|
this.getAllPositions = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
367
382
|
return __generator(this, function (_a) {
|
|
368
383
|
return [2, this.program.account.position.all()];
|
|
@@ -436,33 +451,6 @@ var PerpetualsClient = (function () {
|
|
|
436
451
|
this.prettyPrint = function (object) {
|
|
437
452
|
console.log(JSON.stringify(object, null, 2));
|
|
438
453
|
};
|
|
439
|
-
this.liquidate = function (positionAccount, poolConfig, tokenMint, collateralMint, marketPk) { return __awaiter(_this, void 0, void 0, function () {
|
|
440
|
-
var targetCustodyConfig, collateralCustodyConfig;
|
|
441
|
-
return __generator(this, function (_a) {
|
|
442
|
-
switch (_a.label) {
|
|
443
|
-
case 0:
|
|
444
|
-
targetCustodyConfig = poolConfig.custodies.find(function (f) { return f.mintKey.equals(tokenMint); });
|
|
445
|
-
collateralCustodyConfig = poolConfig.custodies.find(function (f) { return f.mintKey.equals(collateralMint); });
|
|
446
|
-
return [4, this.program.methods
|
|
447
|
-
.liquidate({})
|
|
448
|
-
.accountsPartial({
|
|
449
|
-
signer: this.provider.wallet.publicKey,
|
|
450
|
-
perpetuals: this.perpetuals.publicKey,
|
|
451
|
-
pool: poolConfig.poolAddress,
|
|
452
|
-
position: positionAccount,
|
|
453
|
-
market: marketPk,
|
|
454
|
-
targetCustody: targetCustodyConfig.custodyAccount,
|
|
455
|
-
targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
|
|
456
|
-
collateralCustody: collateralCustodyConfig.custodyAccount,
|
|
457
|
-
collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
|
|
458
|
-
program: this.program.programId,
|
|
459
|
-
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
|
460
|
-
})
|
|
461
|
-
.instruction()];
|
|
462
|
-
case 1: return [2, _a.sent()];
|
|
463
|
-
}
|
|
464
|
-
});
|
|
465
|
-
}); };
|
|
466
454
|
this.getApyPercentageUi = function (rewardCustodyAccount, previousSnapShotRewardPerLpStaked, lpTokenUsdPrice) {
|
|
467
455
|
var currentRewardPerLpStaked = rewardCustodyAccount.feesStats.rewardPerLpStaked;
|
|
468
456
|
var difference = currentRewardPerLpStaked.sub(previousSnapShotRewardPerLpStaked);
|
|
@@ -2000,6 +1988,301 @@ var PerpetualsClient = (function () {
|
|
|
2000
1988
|
}
|
|
2001
1989
|
});
|
|
2002
1990
|
}); };
|
|
1991
|
+
this.getPositionData = function (position_1, poolConfig_1) {
|
|
1992
|
+
var args_1 = [];
|
|
1993
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1994
|
+
args_1[_i - 2] = arguments[_i];
|
|
1995
|
+
}
|
|
1996
|
+
return __awaiter(_this, __spreadArray([position_1, poolConfig_1], args_1, true), void 0, function (position, poolConfig, userPublicKey) {
|
|
1997
|
+
var marketConfig, targetCustodyConfig, collateralCustodyConfig, transaction, setCULimitIx, addressLookupTables, result, index, res;
|
|
1998
|
+
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
1999
|
+
return __generator(this, function (_a) {
|
|
2000
|
+
switch (_a.label) {
|
|
2001
|
+
case 0:
|
|
2002
|
+
marketConfig = poolConfig.markets.find(function (i) { return i.marketAccount.equals(position.market); });
|
|
2003
|
+
targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.custodyAccount.equals(marketConfig.targetCustody); });
|
|
2004
|
+
collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.custodyAccount.equals(marketConfig.collateralCustody); });
|
|
2005
|
+
return [4, this.program.methods
|
|
2006
|
+
.getPositionData({})
|
|
2007
|
+
.accountsPartial({
|
|
2008
|
+
perpetuals: this.perpetuals.publicKey,
|
|
2009
|
+
pool: poolConfig.poolAddress,
|
|
2010
|
+
position: position.publicKey,
|
|
2011
|
+
market: marketConfig.marketAccount,
|
|
2012
|
+
targetCustody: targetCustodyConfig.custodyAccount,
|
|
2013
|
+
custodyOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
|
|
2014
|
+
collateralCustody: collateralCustodyConfig.custodyAccount,
|
|
2015
|
+
collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
|
|
2016
|
+
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
|
2017
|
+
})
|
|
2018
|
+
.transaction()];
|
|
2019
|
+
case 1:
|
|
2020
|
+
transaction = _a.sent();
|
|
2021
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2022
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
2023
|
+
return [4, this.getOrLoadAddressLookupTable(poolConfig)];
|
|
2024
|
+
case 2:
|
|
2025
|
+
addressLookupTables = (_a.sent()).addressLookupTables;
|
|
2026
|
+
return [4, this.viewHelper.simulateTransaction(transaction, addressLookupTables, userPublicKey)];
|
|
2027
|
+
case 3:
|
|
2028
|
+
result = _a.sent();
|
|
2029
|
+
if (result.value.err) {
|
|
2030
|
+
console.error('error Simulation failed:::', result);
|
|
2031
|
+
throw new Error('Simulation failed: ' + JSON.stringify(result.value.err));
|
|
2032
|
+
}
|
|
2033
|
+
index = perpetuals_json_1.default.instructions.findIndex(function (f) { return f.name === 'get_position_data'; });
|
|
2034
|
+
res = this.viewHelper.decodeLogs(result, index, 'get_position_data');
|
|
2035
|
+
return [2, res];
|
|
2036
|
+
}
|
|
2037
|
+
});
|
|
2038
|
+
});
|
|
2039
|
+
};
|
|
2040
|
+
this.getOpenPositionQuote = function (amountIn_1, leverage_1, marketConfig_1, poolConfig_1) {
|
|
2041
|
+
var args_1 = [];
|
|
2042
|
+
for (var _i = 4; _i < arguments.length; _i++) {
|
|
2043
|
+
args_1[_i - 4] = arguments[_i];
|
|
2044
|
+
}
|
|
2045
|
+
return __awaiter(_this, __spreadArray([amountIn_1, leverage_1, marketConfig_1, poolConfig_1], args_1, true), void 0, function (amountIn, leverage, marketConfig, poolConfig, privilege, receivingCustodyConfig, existingPositionPk, discountIndex, limitPrice, userPublicKey, takeProfitPrice, stopLossPrice) {
|
|
2046
|
+
var targetCustodyConfig, collateralCustodyConfig, recvCustodyConfig, builder, transaction, setCULimitIx, addressLookupTables, result, index, res;
|
|
2047
|
+
if (privilege === void 0) { privilege = { none: {} }; }
|
|
2048
|
+
if (discountIndex === void 0) { discountIndex = null; }
|
|
2049
|
+
if (limitPrice === void 0) { limitPrice = null; }
|
|
2050
|
+
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2051
|
+
if (takeProfitPrice === void 0) { takeProfitPrice = null; }
|
|
2052
|
+
if (stopLossPrice === void 0) { stopLossPrice = null; }
|
|
2053
|
+
return __generator(this, function (_a) {
|
|
2054
|
+
switch (_a.label) {
|
|
2055
|
+
case 0:
|
|
2056
|
+
targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.custodyAccount.equals(marketConfig.targetCustody); });
|
|
2057
|
+
collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.custodyAccount.equals(marketConfig.collateralCustody); });
|
|
2058
|
+
recvCustodyConfig = receivingCustodyConfig !== null && receivingCustodyConfig !== void 0 ? receivingCustodyConfig : collateralCustodyConfig;
|
|
2059
|
+
builder = this.program.methods
|
|
2060
|
+
.getOpenPositionQuote({
|
|
2061
|
+
amountIn: amountIn,
|
|
2062
|
+
leverage: leverage,
|
|
2063
|
+
privilege: privilege,
|
|
2064
|
+
discountIndex: discountIndex,
|
|
2065
|
+
limitPrice: limitPrice,
|
|
2066
|
+
takeProfitPrice: takeProfitPrice,
|
|
2067
|
+
stopLossPrice: stopLossPrice,
|
|
2068
|
+
})
|
|
2069
|
+
.accountsPartial({
|
|
2070
|
+
perpetuals: this.perpetuals.publicKey,
|
|
2071
|
+
pool: poolConfig.poolAddress,
|
|
2072
|
+
market: marketConfig.marketAccount,
|
|
2073
|
+
targetCustody: targetCustodyConfig.custodyAccount,
|
|
2074
|
+
targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
|
|
2075
|
+
collateralCustody: collateralCustodyConfig.custodyAccount,
|
|
2076
|
+
collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
|
|
2077
|
+
receivingCustody: recvCustodyConfig.custodyAccount,
|
|
2078
|
+
receivingCustodyOracleAccount: this.useExtOracleAccount ? recvCustodyConfig.extOracleAccount : recvCustodyConfig.intOracleAccount,
|
|
2079
|
+
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
2080
|
+
});
|
|
2081
|
+
if (existingPositionPk) {
|
|
2082
|
+
builder = builder.remainingAccounts([
|
|
2083
|
+
{ pubkey: existingPositionPk, isSigner: false, isWritable: false },
|
|
2084
|
+
]);
|
|
2085
|
+
}
|
|
2086
|
+
return [4, builder.transaction()];
|
|
2087
|
+
case 1:
|
|
2088
|
+
transaction = _a.sent();
|
|
2089
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2090
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
2091
|
+
return [4, this.getOrLoadAddressLookupTable(poolConfig)];
|
|
2092
|
+
case 2:
|
|
2093
|
+
addressLookupTables = (_a.sent()).addressLookupTables;
|
|
2094
|
+
return [4, this.viewHelper.simulateTransaction(transaction, addressLookupTables, userPublicKey)];
|
|
2095
|
+
case 3:
|
|
2096
|
+
result = _a.sent();
|
|
2097
|
+
if (result.value.err) {
|
|
2098
|
+
console.error('error Simulation failed:::', result);
|
|
2099
|
+
throw new Error('Simulation failed: ' + JSON.stringify(result.value.err));
|
|
2100
|
+
}
|
|
2101
|
+
index = perpetuals_json_1.default.instructions.findIndex(function (f) { return f.name === 'get_open_position_quote'; });
|
|
2102
|
+
res = this.viewHelper.decodeLogs(result, index, 'get_open_position_quote');
|
|
2103
|
+
return [2, res];
|
|
2104
|
+
}
|
|
2105
|
+
});
|
|
2106
|
+
});
|
|
2107
|
+
};
|
|
2108
|
+
this.getClosePositionQuote = function (positionPk_1, positionAccount_1, poolConfig_1) {
|
|
2109
|
+
var args_1 = [];
|
|
2110
|
+
for (var _i = 3; _i < arguments.length; _i++) {
|
|
2111
|
+
args_1[_i - 3] = arguments[_i];
|
|
2112
|
+
}
|
|
2113
|
+
return __awaiter(_this, __spreadArray([positionPk_1, positionAccount_1, poolConfig_1], args_1, true), void 0, function (positionPk, positionAccount, poolConfig, sizeDeltaUsd, privilege, dispensingCustodyConfig, discountIndex, triggerPrice, userPublicKey) {
|
|
2114
|
+
var marketConfig, targetCustodyConfig, collateralCustodyConfig, dispCustodyConfig, transaction, setCULimitIx, addressLookupTables, result, index, res;
|
|
2115
|
+
var _a, _b;
|
|
2116
|
+
if (sizeDeltaUsd === void 0) { sizeDeltaUsd = new anchor_1.BN(0); }
|
|
2117
|
+
if (privilege === void 0) { privilege = { none: {} }; }
|
|
2118
|
+
if (discountIndex === void 0) { discountIndex = null; }
|
|
2119
|
+
if (triggerPrice === void 0) { triggerPrice = null; }
|
|
2120
|
+
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2121
|
+
return __generator(this, function (_c) {
|
|
2122
|
+
switch (_c.label) {
|
|
2123
|
+
case 0:
|
|
2124
|
+
marketConfig = (_a = poolConfig.markets.find(function (i) { return i.marketAccount.equals(positionAccount.market); })) !== null && _a !== void 0 ? _a : (_b = poolConfig.marketsDeprecated) === null || _b === void 0 ? void 0 : _b.find(function (i) { return i.marketAccount.equals(positionAccount.market); });
|
|
2125
|
+
if (!marketConfig)
|
|
2126
|
+
throw new Error("Market not found for position market=".concat(positionAccount.market.toBase58()));
|
|
2127
|
+
targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.custodyAccount.equals(marketConfig.targetCustody); });
|
|
2128
|
+
collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.custodyAccount.equals(marketConfig.collateralCustody); });
|
|
2129
|
+
dispCustodyConfig = dispensingCustodyConfig !== null && dispensingCustodyConfig !== void 0 ? dispensingCustodyConfig : collateralCustodyConfig;
|
|
2130
|
+
return [4, this.program.methods
|
|
2131
|
+
.getClosePositionQuote({
|
|
2132
|
+
sizeDeltaUsd: sizeDeltaUsd,
|
|
2133
|
+
privilege: privilege,
|
|
2134
|
+
discountIndex: discountIndex,
|
|
2135
|
+
triggerPrice: triggerPrice,
|
|
2136
|
+
})
|
|
2137
|
+
.accountsPartial({
|
|
2138
|
+
perpetuals: this.perpetuals.publicKey,
|
|
2139
|
+
pool: poolConfig.poolAddress,
|
|
2140
|
+
market: marketConfig.marketAccount,
|
|
2141
|
+
position: positionPk,
|
|
2142
|
+
targetCustody: targetCustodyConfig.custodyAccount,
|
|
2143
|
+
targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
|
|
2144
|
+
collateralCustody: collateralCustodyConfig.custodyAccount,
|
|
2145
|
+
collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
|
|
2146
|
+
dispensingCustody: dispCustodyConfig.custodyAccount,
|
|
2147
|
+
dispensingOracleAccount: this.useExtOracleAccount ? dispCustodyConfig.extOracleAccount : dispCustodyConfig.intOracleAccount,
|
|
2148
|
+
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
2149
|
+
})
|
|
2150
|
+
.transaction()];
|
|
2151
|
+
case 1:
|
|
2152
|
+
transaction = _c.sent();
|
|
2153
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2154
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
2155
|
+
return [4, this.getOrLoadAddressLookupTable(poolConfig)];
|
|
2156
|
+
case 2:
|
|
2157
|
+
addressLookupTables = (_c.sent()).addressLookupTables;
|
|
2158
|
+
return [4, this.viewHelper.simulateTransaction(transaction, addressLookupTables, userPublicKey)];
|
|
2159
|
+
case 3:
|
|
2160
|
+
result = _c.sent();
|
|
2161
|
+
if (result.value.err) {
|
|
2162
|
+
console.error('error Simulation failed:::', result);
|
|
2163
|
+
throw new Error('Simulation failed: ' + JSON.stringify(result.value.err));
|
|
2164
|
+
}
|
|
2165
|
+
index = perpetuals_json_1.default.instructions.findIndex(function (f) { return f.name === 'get_close_position_quote'; });
|
|
2166
|
+
res = this.viewHelper.decodeLogs(result, index, 'get_close_position_quote');
|
|
2167
|
+
return [2, res];
|
|
2168
|
+
}
|
|
2169
|
+
});
|
|
2170
|
+
});
|
|
2171
|
+
};
|
|
2172
|
+
this.getAddCollateralQuote = function (amountIn_1, positionPk_1, positionAccount_1, poolConfig_1, receivingCustodyConfig_1) {
|
|
2173
|
+
var args_1 = [];
|
|
2174
|
+
for (var _i = 5; _i < arguments.length; _i++) {
|
|
2175
|
+
args_1[_i - 5] = arguments[_i];
|
|
2176
|
+
}
|
|
2177
|
+
return __awaiter(_this, __spreadArray([amountIn_1, positionPk_1, positionAccount_1, poolConfig_1, receivingCustodyConfig_1], args_1, true), void 0, function (amountIn, positionPk, positionAccount, poolConfig, receivingCustodyConfig, userPublicKey) {
|
|
2178
|
+
var marketConfig, targetCustodyConfig, collateralCustodyConfig, recvCustodyConfig, transaction, setCULimitIx, addressLookupTables, result, index, res;
|
|
2179
|
+
var _a, _b;
|
|
2180
|
+
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2181
|
+
return __generator(this, function (_c) {
|
|
2182
|
+
switch (_c.label) {
|
|
2183
|
+
case 0:
|
|
2184
|
+
marketConfig = (_a = poolConfig.markets.find(function (i) { return i.marketAccount.equals(positionAccount.market); })) !== null && _a !== void 0 ? _a : (_b = poolConfig.marketsDeprecated) === null || _b === void 0 ? void 0 : _b.find(function (i) { return i.marketAccount.equals(positionAccount.market); });
|
|
2185
|
+
if (!marketConfig)
|
|
2186
|
+
throw new Error("Market not found for position market=".concat(positionAccount.market.toBase58()));
|
|
2187
|
+
targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.custodyAccount.equals(marketConfig.targetCustody); });
|
|
2188
|
+
collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.custodyAccount.equals(marketConfig.collateralCustody); });
|
|
2189
|
+
recvCustodyConfig = receivingCustodyConfig !== null && receivingCustodyConfig !== void 0 ? receivingCustodyConfig : collateralCustodyConfig;
|
|
2190
|
+
return [4, this.program.methods
|
|
2191
|
+
.getAddCollateralQuote({
|
|
2192
|
+
amountIn: amountIn,
|
|
2193
|
+
})
|
|
2194
|
+
.accountsPartial({
|
|
2195
|
+
perpetuals: this.perpetuals.publicKey,
|
|
2196
|
+
pool: poolConfig.poolAddress,
|
|
2197
|
+
position: positionPk,
|
|
2198
|
+
market: marketConfig.marketAccount,
|
|
2199
|
+
targetCustody: targetCustodyConfig.custodyAccount,
|
|
2200
|
+
targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
|
|
2201
|
+
collateralCustody: collateralCustodyConfig.custodyAccount,
|
|
2202
|
+
collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
|
|
2203
|
+
receivingCustody: recvCustodyConfig.custodyAccount,
|
|
2204
|
+
receivingOracleAccount: this.useExtOracleAccount ? recvCustodyConfig.extOracleAccount : recvCustodyConfig.intOracleAccount,
|
|
2205
|
+
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
2206
|
+
})
|
|
2207
|
+
.transaction()];
|
|
2208
|
+
case 1:
|
|
2209
|
+
transaction = _c.sent();
|
|
2210
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2211
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
2212
|
+
return [4, this.getOrLoadAddressLookupTable(poolConfig)];
|
|
2213
|
+
case 2:
|
|
2214
|
+
addressLookupTables = (_c.sent()).addressLookupTables;
|
|
2215
|
+
return [4, this.viewHelper.simulateTransaction(transaction, addressLookupTables, userPublicKey)];
|
|
2216
|
+
case 3:
|
|
2217
|
+
result = _c.sent();
|
|
2218
|
+
if (result.value.err) {
|
|
2219
|
+
console.error('error Simulation failed:::', result);
|
|
2220
|
+
throw new Error('Simulation failed: ' + JSON.stringify(result.value.err));
|
|
2221
|
+
}
|
|
2222
|
+
index = perpetuals_json_1.default.instructions.findIndex(function (f) { return f.name === 'get_add_collateral_quote'; });
|
|
2223
|
+
res = this.viewHelper.decodeLogs(result, index, 'get_add_collateral_quote');
|
|
2224
|
+
return [2, res];
|
|
2225
|
+
}
|
|
2226
|
+
});
|
|
2227
|
+
});
|
|
2228
|
+
};
|
|
2229
|
+
this.getRemoveCollateralQuote = function (collateralDeltaUsd_1, positionPk_1, positionAccount_1, poolConfig_1, dispensingCustodyConfig_1) {
|
|
2230
|
+
var args_1 = [];
|
|
2231
|
+
for (var _i = 5; _i < arguments.length; _i++) {
|
|
2232
|
+
args_1[_i - 5] = arguments[_i];
|
|
2233
|
+
}
|
|
2234
|
+
return __awaiter(_this, __spreadArray([collateralDeltaUsd_1, positionPk_1, positionAccount_1, poolConfig_1, dispensingCustodyConfig_1], args_1, true), void 0, function (collateralDeltaUsd, positionPk, positionAccount, poolConfig, dispensingCustodyConfig, userPublicKey) {
|
|
2235
|
+
var marketConfig, targetCustodyConfig, collateralCustodyConfig, dispCustodyConfig, transaction, setCULimitIx, addressLookupTables, result, index, res;
|
|
2236
|
+
var _a, _b;
|
|
2237
|
+
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
2238
|
+
return __generator(this, function (_c) {
|
|
2239
|
+
switch (_c.label) {
|
|
2240
|
+
case 0:
|
|
2241
|
+
marketConfig = (_a = poolConfig.markets.find(function (i) { return i.marketAccount.equals(positionAccount.market); })) !== null && _a !== void 0 ? _a : (_b = poolConfig.marketsDeprecated) === null || _b === void 0 ? void 0 : _b.find(function (i) { return i.marketAccount.equals(positionAccount.market); });
|
|
2242
|
+
if (!marketConfig)
|
|
2243
|
+
throw new Error("Market not found for position market=".concat(positionAccount.market.toBase58()));
|
|
2244
|
+
targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.custodyAccount.equals(marketConfig.targetCustody); });
|
|
2245
|
+
collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.custodyAccount.equals(marketConfig.collateralCustody); });
|
|
2246
|
+
dispCustodyConfig = dispensingCustodyConfig !== null && dispensingCustodyConfig !== void 0 ? dispensingCustodyConfig : collateralCustodyConfig;
|
|
2247
|
+
return [4, this.program.methods
|
|
2248
|
+
.getRemoveCollateralQuote({
|
|
2249
|
+
collateralDeltaUsd: collateralDeltaUsd,
|
|
2250
|
+
})
|
|
2251
|
+
.accountsPartial({
|
|
2252
|
+
perpetuals: this.perpetuals.publicKey,
|
|
2253
|
+
pool: poolConfig.poolAddress,
|
|
2254
|
+
position: positionPk,
|
|
2255
|
+
market: marketConfig.marketAccount,
|
|
2256
|
+
targetCustody: targetCustodyConfig.custodyAccount,
|
|
2257
|
+
targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
|
|
2258
|
+
collateralCustody: collateralCustodyConfig.custodyAccount,
|
|
2259
|
+
collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
|
|
2260
|
+
dispensingCustody: dispCustodyConfig.custodyAccount,
|
|
2261
|
+
dispensingOracleAccount: this.useExtOracleAccount ? dispCustodyConfig.extOracleAccount : dispCustodyConfig.intOracleAccount,
|
|
2262
|
+
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
2263
|
+
})
|
|
2264
|
+
.transaction()];
|
|
2265
|
+
case 1:
|
|
2266
|
+
transaction = _c.sent();
|
|
2267
|
+
setCULimitIx = web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 450000 });
|
|
2268
|
+
transaction.instructions.unshift(setCULimitIx);
|
|
2269
|
+
return [4, this.getOrLoadAddressLookupTable(poolConfig)];
|
|
2270
|
+
case 2:
|
|
2271
|
+
addressLookupTables = (_c.sent()).addressLookupTables;
|
|
2272
|
+
return [4, this.viewHelper.simulateTransaction(transaction, addressLookupTables, userPublicKey)];
|
|
2273
|
+
case 3:
|
|
2274
|
+
result = _c.sent();
|
|
2275
|
+
if (result.value.err) {
|
|
2276
|
+
console.error('error Simulation failed:::', result);
|
|
2277
|
+
throw new Error('Simulation failed: ' + JSON.stringify(result.value.err));
|
|
2278
|
+
}
|
|
2279
|
+
index = perpetuals_json_1.default.instructions.findIndex(function (f) { return f.name === 'get_remove_collateral_quote'; });
|
|
2280
|
+
res = this.viewHelper.decodeLogs(result, index, 'get_remove_collateral_quote');
|
|
2281
|
+
return [2, res];
|
|
2282
|
+
}
|
|
2283
|
+
});
|
|
2284
|
+
});
|
|
2285
|
+
};
|
|
2003
2286
|
this.getLpTokenPriceView = function (poolConfig_1) {
|
|
2004
2287
|
var args_1 = [];
|
|
2005
2288
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
@@ -2625,7 +2908,7 @@ var PerpetualsClient = (function () {
|
|
|
2625
2908
|
});
|
|
2626
2909
|
};
|
|
2627
2910
|
this.getLiquidationPriceView = function (positionAccountKey, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
2628
|
-
var positionAccount_1, marketConfig_1, targetCustodyConfig, collateralCustodyConfig,
|
|
2911
|
+
var positionAccount_1, marketConfig_1, targetCustodyConfig, collateralCustodyConfig, err_1;
|
|
2629
2912
|
return __generator(this, function (_a) {
|
|
2630
2913
|
switch (_a.label) {
|
|
2631
2914
|
case 0:
|
|
@@ -2659,9 +2942,9 @@ var PerpetualsClient = (function () {
|
|
|
2659
2942
|
})];
|
|
2660
2943
|
case 2: return [2, _a.sent()];
|
|
2661
2944
|
case 3:
|
|
2662
|
-
|
|
2663
|
-
console.error("Error in getLiquidationPriceView:",
|
|
2664
|
-
throw
|
|
2945
|
+
err_1 = _a.sent();
|
|
2946
|
+
console.error("Error in getLiquidationPriceView:", err_1);
|
|
2947
|
+
throw err_1;
|
|
2665
2948
|
case 4: return [2];
|
|
2666
2949
|
}
|
|
2667
2950
|
});
|
|
@@ -2967,7 +3250,7 @@ var PerpetualsClient = (function () {
|
|
|
2967
3250
|
args_1[_i - 9] = arguments[_i];
|
|
2968
3251
|
}
|
|
2969
3252
|
return __awaiter(_this, __spreadArray([targetTokenSymbol_1, collateralTokenSymbol_1, userInputTokenSymbol_1, amountIn_1, priceWithSlippage_1, sizeAmount_1, side_1, poolConfig_1, privilege_1], args_1, true), void 0, function (targetTokenSymbol, collateralTokenSymbol, userInputTokenSymbol, amountIn, priceWithSlippage, sizeAmount, side, poolConfig, privilege, tokenStakeAccount, userReferralAccount, skipBalanceChecks, ephemeralSignerPubkey) {
|
|
2970
|
-
var publicKey, userInputCustodyConfig, collateralCustodyConfig, targetCustodyConfig, marketAccount, positionAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, targetToken, userInputTokenAccount, userInputToken, lamports, unWrappedSolBalance, _a, userOutputTokenAccount, tokenAccountBalance, _b, userOutputTokenAccount, inx,
|
|
3253
|
+
var publicKey, userInputCustodyConfig, collateralCustodyConfig, targetCustodyConfig, marketAccount, positionAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, targetToken, userInputTokenAccount, userInputToken, lamports, unWrappedSolBalance, _a, userOutputTokenAccount, tokenAccountBalance, _b, userOutputTokenAccount, inx, err_2;
|
|
2971
3254
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
2972
3255
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
|
2973
3256
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
|
@@ -3103,9 +3386,9 @@ var PerpetualsClient = (function () {
|
|
|
3103
3386
|
instructions.push(inx);
|
|
3104
3387
|
return [3, 13];
|
|
3105
3388
|
case 12:
|
|
3106
|
-
|
|
3107
|
-
console.error("perpClient SwapAndOpen error:: ",
|
|
3108
|
-
throw
|
|
3389
|
+
err_2 = _c.sent();
|
|
3390
|
+
console.error("perpClient SwapAndOpen error:: ", err_2);
|
|
3391
|
+
throw err_2;
|
|
3109
3392
|
case 13: return [2, {
|
|
3110
3393
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
3111
3394
|
additionalSigners: additionalSigners
|
|
@@ -3120,7 +3403,7 @@ var PerpetualsClient = (function () {
|
|
|
3120
3403
|
args_1[_i - 7] = arguments[_i];
|
|
3121
3404
|
}
|
|
3122
3405
|
return __awaiter(_this, __spreadArray([targetTokenSymbol_1, userOutputTokenSymbol_1, collateralTokenSymbol_1, priceWithSlippage_1, side_1, poolConfig_1, privilege_1], args_1, true), void 0, function (targetTokenSymbol, userOutputTokenSymbol, collateralTokenSymbol, priceWithSlippage, side, poolConfig, privilege, tokenStakeAccount, userReferralAccount, ephemeralSignerPubkey) {
|
|
3123
|
-
var publicKey, userOutputCustodyConfig, collateralCustodyConfig, targetCustodyConfig, marketAccount, positionAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userReceivingTokenAccount, collateralToken, userOutputToken, lamports, userCollateralTokenAccount, inx,
|
|
3406
|
+
var publicKey, userOutputCustodyConfig, collateralCustodyConfig, targetCustodyConfig, marketAccount, positionAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userReceivingTokenAccount, collateralToken, userOutputToken, lamports, userCollateralTokenAccount, inx, err_3;
|
|
3124
3407
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
3125
3408
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
|
3126
3409
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
@@ -3227,9 +3510,9 @@ var PerpetualsClient = (function () {
|
|
|
3227
3510
|
instructions.push(inx);
|
|
3228
3511
|
return [3, 8];
|
|
3229
3512
|
case 7:
|
|
3230
|
-
|
|
3231
|
-
console.error("perpClient CloseAndSwap error:: ",
|
|
3232
|
-
throw
|
|
3513
|
+
err_3 = _a.sent();
|
|
3514
|
+
console.error("perpClient CloseAndSwap error:: ", err_3);
|
|
3515
|
+
throw err_3;
|
|
3233
3516
|
case 8: return [2, {
|
|
3234
3517
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
3235
3518
|
additionalSigners: additionalSigners
|
|
@@ -3792,13 +4075,40 @@ var PerpetualsClient = (function () {
|
|
|
3792
4075
|
});
|
|
3793
4076
|
});
|
|
3794
4077
|
};
|
|
4078
|
+
this.liquidate = function (positionAccount, poolConfig, tokenMint, collateralMint, marketPk) { return __awaiter(_this, void 0, void 0, function () {
|
|
4079
|
+
var targetCustodyConfig, collateralCustodyConfig;
|
|
4080
|
+
return __generator(this, function (_a) {
|
|
4081
|
+
switch (_a.label) {
|
|
4082
|
+
case 0:
|
|
4083
|
+
targetCustodyConfig = poolConfig.custodies.find(function (f) { return f.mintKey.equals(tokenMint); });
|
|
4084
|
+
collateralCustodyConfig = poolConfig.custodies.find(function (f) { return f.mintKey.equals(collateralMint); });
|
|
4085
|
+
return [4, this.program.methods
|
|
4086
|
+
.liquidate({})
|
|
4087
|
+
.accountsPartial({
|
|
4088
|
+
signer: this.provider.wallet.publicKey,
|
|
4089
|
+
perpetuals: this.perpetuals.publicKey,
|
|
4090
|
+
pool: poolConfig.poolAddress,
|
|
4091
|
+
position: positionAccount,
|
|
4092
|
+
market: marketPk,
|
|
4093
|
+
targetCustody: targetCustodyConfig.custodyAccount,
|
|
4094
|
+
targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
|
|
4095
|
+
collateralCustody: collateralCustodyConfig.custodyAccount,
|
|
4096
|
+
collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
|
|
4097
|
+
program: this.program.programId,
|
|
4098
|
+
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
|
4099
|
+
})
|
|
4100
|
+
.instruction()];
|
|
4101
|
+
case 1: return [2, _a.sent()];
|
|
4102
|
+
}
|
|
4103
|
+
});
|
|
4104
|
+
}); };
|
|
3795
4105
|
this.addLiquidity = function (payTokenSymbol_1, tokenAmountIn_1, minLpAmountOut_1, poolConfig_1) {
|
|
3796
4106
|
var args_1 = [];
|
|
3797
4107
|
for (var _i = 4; _i < arguments.length; _i++) {
|
|
3798
4108
|
args_1[_i - 4] = arguments[_i];
|
|
3799
4109
|
}
|
|
3800
4110
|
return __awaiter(_this, __spreadArray([payTokenSymbol_1, tokenAmountIn_1, minLpAmountOut_1, poolConfig_1], args_1, true), void 0, function (payTokenSymbol, tokenAmountIn, minLpAmountOut, poolConfig, skipBalanceChecks, ephemeralSignerPubkey, isWhitelistedUser, includeRemainingAccounts) {
|
|
3801
|
-
var publicKey, payTokenCustodyConfig, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, payToken, userPayingTokenAccount, lpTokenAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, lamports, unWrappedSolBalance, _e, tokenAccountBalance, _f, whitelistPda, whitelistMeta, instruction,
|
|
4111
|
+
var publicKey, payTokenCustodyConfig, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, payToken, userPayingTokenAccount, lpTokenAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, lamports, unWrappedSolBalance, _e, tokenAccountBalance, _f, whitelistPda, whitelistMeta, instruction, err_4;
|
|
3802
4112
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
|
3803
4113
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
3804
4114
|
if (isWhitelistedUser === void 0) { isWhitelistedUser = false; }
|
|
@@ -3932,9 +4242,9 @@ var PerpetualsClient = (function () {
|
|
|
3932
4242
|
instructions.push(instruction);
|
|
3933
4243
|
return [3, 11];
|
|
3934
4244
|
case 10:
|
|
3935
|
-
|
|
3936
|
-
console.error("perpClient addLiquidity error:: ",
|
|
3937
|
-
throw
|
|
4245
|
+
err_4 = _g.sent();
|
|
4246
|
+
console.error("perpClient addLiquidity error:: ", err_4);
|
|
4247
|
+
throw err_4;
|
|
3938
4248
|
case 11: return [2, {
|
|
3939
4249
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
3940
4250
|
additionalSigners: additionalSigners
|
|
@@ -4093,7 +4403,7 @@ var PerpetualsClient = (function () {
|
|
|
4093
4403
|
args_1[_i - 4] = arguments[_i];
|
|
4094
4404
|
}
|
|
4095
4405
|
return __awaiter(_this, __spreadArray([recieveTokenSymbol_1, liquidityAmountIn_1, minTokenAmountOut_1, poolConfig_1], args_1, true), void 0, function (recieveTokenSymbol, liquidityAmountIn, minTokenAmountOut, poolConfig, closeLpATA, createUserATA, closeUsersWSOLATA, ephemeralSignerPubkey, userPublicKey, isWhitelistedUser, includeRemainingAccounts) {
|
|
4096
|
-
var recieveTokenCustodyConfig, publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, recieveToken, stakedLpTokenAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, lamports, _e, whitelistPda, whitelistMeta, removeLiquidityTx, closeInx, closeWsolATAIns,
|
|
4406
|
+
var recieveTokenCustodyConfig, publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, recieveToken, stakedLpTokenAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, lamports, _e, whitelistPda, whitelistMeta, removeLiquidityTx, closeInx, closeWsolATAIns, err_5;
|
|
4097
4407
|
if (closeLpATA === void 0) { closeLpATA = false; }
|
|
4098
4408
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
4099
4409
|
if (closeUsersWSOLATA === void 0) { closeUsersWSOLATA = false; }
|
|
@@ -4219,9 +4529,9 @@ var PerpetualsClient = (function () {
|
|
|
4219
4529
|
}
|
|
4220
4530
|
return [3, 8];
|
|
4221
4531
|
case 7:
|
|
4222
|
-
|
|
4223
|
-
console.log("perpClient removeLiquidity error:: ",
|
|
4224
|
-
throw
|
|
4532
|
+
err_5 = _f.sent();
|
|
4533
|
+
console.log("perpClient removeLiquidity error:: ", err_5);
|
|
4534
|
+
throw err_5;
|
|
4225
4535
|
case 8: return [2, {
|
|
4226
4536
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4227
4537
|
additionalSigners: additionalSigners
|
|
@@ -4231,7 +4541,7 @@ var PerpetualsClient = (function () {
|
|
|
4231
4541
|
});
|
|
4232
4542
|
};
|
|
4233
4543
|
this.addReferral = function (tokenStakeAccount, nftReferralAccount) { return __awaiter(_this, void 0, void 0, function () {
|
|
4234
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, addReferralInstruction,
|
|
4544
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, addReferralInstruction, err_6;
|
|
4235
4545
|
return __generator(this, function (_a) {
|
|
4236
4546
|
switch (_a.label) {
|
|
4237
4547
|
case 0:
|
|
@@ -4258,9 +4568,9 @@ var PerpetualsClient = (function () {
|
|
|
4258
4568
|
instructions.push(addReferralInstruction);
|
|
4259
4569
|
return [3, 4];
|
|
4260
4570
|
case 3:
|
|
4261
|
-
|
|
4262
|
-
console.log("perpClient addReferral error:: ",
|
|
4263
|
-
throw
|
|
4571
|
+
err_6 = _a.sent();
|
|
4572
|
+
console.log("perpClient addReferral error:: ", err_6);
|
|
4573
|
+
throw err_6;
|
|
4264
4574
|
case 4: return [2, {
|
|
4265
4575
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4266
4576
|
additionalSigners: additionalSigners
|
|
@@ -4269,7 +4579,7 @@ var PerpetualsClient = (function () {
|
|
|
4269
4579
|
});
|
|
4270
4580
|
}); };
|
|
4271
4581
|
this.depositStake = function (owner, feePayer, depositAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
4272
|
-
var preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, depositStakeInstruction,
|
|
4582
|
+
var preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, depositStakeInstruction, err_7;
|
|
4273
4583
|
return __generator(this, function (_a) {
|
|
4274
4584
|
switch (_a.label) {
|
|
4275
4585
|
case 0:
|
|
@@ -4309,9 +4619,9 @@ var PerpetualsClient = (function () {
|
|
|
4309
4619
|
instructions.push(depositStakeInstruction);
|
|
4310
4620
|
return [3, 5];
|
|
4311
4621
|
case 4:
|
|
4312
|
-
|
|
4313
|
-
console.log("perpClient depositStaking error:: ",
|
|
4314
|
-
throw
|
|
4622
|
+
err_7 = _a.sent();
|
|
4623
|
+
console.log("perpClient depositStaking error:: ", err_7);
|
|
4624
|
+
throw err_7;
|
|
4315
4625
|
case 5: return [2, {
|
|
4316
4626
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4317
4627
|
additionalSigners: additionalSigners
|
|
@@ -4320,7 +4630,7 @@ var PerpetualsClient = (function () {
|
|
|
4320
4630
|
});
|
|
4321
4631
|
}); };
|
|
4322
4632
|
this.refreshStakeWithAllFlpStakeAccounts = function (rewardSymbol, poolConfig, flpStakeAccountPks) { return __awaiter(_this, void 0, void 0, function () {
|
|
4323
|
-
var rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_1, flpStakeAccountPk, refreshStakeInstruction,
|
|
4633
|
+
var rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_1, flpStakeAccountPk, refreshStakeInstruction, err_8;
|
|
4324
4634
|
return __generator(this, function (_c) {
|
|
4325
4635
|
switch (_c.label) {
|
|
4326
4636
|
case 0:
|
|
@@ -4366,9 +4676,9 @@ var PerpetualsClient = (function () {
|
|
|
4366
4676
|
refreshStakeInstruction = _c.sent();
|
|
4367
4677
|
return [2, refreshStakeInstruction];
|
|
4368
4678
|
case 2:
|
|
4369
|
-
|
|
4370
|
-
console.log("perpClient refreshStaking error:: ",
|
|
4371
|
-
throw
|
|
4679
|
+
err_8 = _c.sent();
|
|
4680
|
+
console.log("perpClient refreshStaking error:: ", err_8);
|
|
4681
|
+
throw err_8;
|
|
4372
4682
|
case 3: return [2];
|
|
4373
4683
|
}
|
|
4374
4684
|
});
|
|
@@ -4379,7 +4689,7 @@ var PerpetualsClient = (function () {
|
|
|
4379
4689
|
args_1[_i - 3] = arguments[_i];
|
|
4380
4690
|
}
|
|
4381
4691
|
return __awaiter(_this, __spreadArray([rewardSymbol_1, poolConfig_1, flpStakeAccountPk_1], args_1, true), void 0, function (rewardSymbol, poolConfig, flpStakeAccountPk, userPublicKey) {
|
|
4382
|
-
var publicKey, rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _a, _b, custody, stakeAccountMetas, tokenStakeAccount, refreshStakeInstruction,
|
|
4692
|
+
var publicKey, rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _a, _b, custody, stakeAccountMetas, tokenStakeAccount, refreshStakeInstruction, err_9;
|
|
4383
4693
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
4384
4694
|
return __generator(this, function (_c) {
|
|
4385
4695
|
switch (_c.label) {
|
|
@@ -4426,9 +4736,9 @@ var PerpetualsClient = (function () {
|
|
|
4426
4736
|
refreshStakeInstruction = _c.sent();
|
|
4427
4737
|
return [2, refreshStakeInstruction];
|
|
4428
4738
|
case 2:
|
|
4429
|
-
|
|
4430
|
-
console.log("perpClient refreshStaking error:: ",
|
|
4431
|
-
throw
|
|
4739
|
+
err_9 = _c.sent();
|
|
4740
|
+
console.log("perpClient refreshStaking error:: ", err_9);
|
|
4741
|
+
throw err_9;
|
|
4432
4742
|
case 3: return [2];
|
|
4433
4743
|
}
|
|
4434
4744
|
});
|
|
@@ -4440,7 +4750,7 @@ var PerpetualsClient = (function () {
|
|
|
4440
4750
|
args_1[_i - 3] = arguments[_i];
|
|
4441
4751
|
}
|
|
4442
4752
|
return __awaiter(_this, __spreadArray([rewardSymbol_1, unstakeAmount_1, poolConfig_1], args_1, true), void 0, function (rewardSymbol, unstakeAmount, poolConfig, userPublicKey) {
|
|
4443
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, pool, flpStakeAccount, tokenStakeAccount, tokenStakeAccounts, _a, unstakeInstantInstruction,
|
|
4753
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, pool, flpStakeAccount, tokenStakeAccount, tokenStakeAccounts, _a, unstakeInstantInstruction, err_10;
|
|
4444
4754
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
4445
4755
|
return __generator(this, function (_b) {
|
|
4446
4756
|
switch (_b.label) {
|
|
@@ -4491,9 +4801,9 @@ var PerpetualsClient = (function () {
|
|
|
4491
4801
|
instructions.push(unstakeInstantInstruction);
|
|
4492
4802
|
return [3, 6];
|
|
4493
4803
|
case 5:
|
|
4494
|
-
|
|
4495
|
-
console.log("perpClient unstakeInstant error:: ",
|
|
4496
|
-
throw
|
|
4804
|
+
err_10 = _b.sent();
|
|
4805
|
+
console.log("perpClient unstakeInstant error:: ", err_10);
|
|
4806
|
+
throw err_10;
|
|
4497
4807
|
case 6: return [2, {
|
|
4498
4808
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4499
4809
|
additionalSigners: additionalSigners
|
|
@@ -4503,7 +4813,7 @@ var PerpetualsClient = (function () {
|
|
|
4503
4813
|
});
|
|
4504
4814
|
};
|
|
4505
4815
|
this.setFeeShareBps = function (poolConfig, flpStakeAccountPks) { return __awaiter(_this, void 0, void 0, function () {
|
|
4506
|
-
var publicKey, pool, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_2, flpStakeAccountPk, refreshStakeInstruction,
|
|
4816
|
+
var publicKey, pool, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_2, flpStakeAccountPk, refreshStakeInstruction, err_11;
|
|
4507
4817
|
return __generator(this, function (_c) {
|
|
4508
4818
|
switch (_c.label) {
|
|
4509
4819
|
case 0:
|
|
@@ -4547,15 +4857,15 @@ var PerpetualsClient = (function () {
|
|
|
4547
4857
|
refreshStakeInstruction = _c.sent();
|
|
4548
4858
|
return [2, refreshStakeInstruction];
|
|
4549
4859
|
case 2:
|
|
4550
|
-
|
|
4551
|
-
console.log("perpClient refreshStaking error:: ",
|
|
4552
|
-
throw
|
|
4860
|
+
err_11 = _c.sent();
|
|
4861
|
+
console.log("perpClient refreshStaking error:: ", err_11);
|
|
4862
|
+
throw err_11;
|
|
4553
4863
|
case 3: return [2];
|
|
4554
4864
|
}
|
|
4555
4865
|
});
|
|
4556
4866
|
}); };
|
|
4557
4867
|
this.unstakeRequest = function (unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
4558
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, unstakeRequestInstruction,
|
|
4868
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, unstakeRequestInstruction, err_12;
|
|
4559
4869
|
return __generator(this, function (_a) {
|
|
4560
4870
|
switch (_a.label) {
|
|
4561
4871
|
case 0:
|
|
@@ -4588,9 +4898,9 @@ var PerpetualsClient = (function () {
|
|
|
4588
4898
|
instructions.push(unstakeRequestInstruction);
|
|
4589
4899
|
return [3, 4];
|
|
4590
4900
|
case 3:
|
|
4591
|
-
|
|
4592
|
-
console.log("perpClient unstakeRequest error:: ",
|
|
4593
|
-
throw
|
|
4901
|
+
err_12 = _a.sent();
|
|
4902
|
+
console.log("perpClient unstakeRequest error:: ", err_12);
|
|
4903
|
+
throw err_12;
|
|
4594
4904
|
case 4: return [2, {
|
|
4595
4905
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4596
4906
|
additionalSigners: additionalSigners
|
|
@@ -4604,7 +4914,7 @@ var PerpetualsClient = (function () {
|
|
|
4604
4914
|
args_1[_i - 1] = arguments[_i];
|
|
4605
4915
|
}
|
|
4606
4916
|
return __awaiter(_this, __spreadArray([poolConfig_1], args_1, true), void 0, function (poolConfig, pendingActivation, deactivated, createUserLPTA, userPublicKey) {
|
|
4607
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, pool, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, _a, withdrawStakeInstruction,
|
|
4917
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, pool, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, _a, withdrawStakeInstruction, err_13;
|
|
4608
4918
|
if (pendingActivation === void 0) { pendingActivation = true; }
|
|
4609
4919
|
if (deactivated === void 0) { deactivated = true; }
|
|
4610
4920
|
if (createUserLPTA === void 0) { createUserLPTA = true; }
|
|
@@ -4659,9 +4969,9 @@ var PerpetualsClient = (function () {
|
|
|
4659
4969
|
instructions.push(withdrawStakeInstruction);
|
|
4660
4970
|
return [3, 6];
|
|
4661
4971
|
case 5:
|
|
4662
|
-
|
|
4663
|
-
console.log("perpClient withdrawStake error:: ",
|
|
4664
|
-
throw
|
|
4972
|
+
err_13 = _b.sent();
|
|
4973
|
+
console.log("perpClient withdrawStake error:: ", err_13);
|
|
4974
|
+
throw err_13;
|
|
4665
4975
|
case 6: return [2, {
|
|
4666
4976
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4667
4977
|
additionalSigners: additionalSigners
|
|
@@ -4676,7 +4986,7 @@ var PerpetualsClient = (function () {
|
|
|
4676
4986
|
args_1[_i - 3] = arguments[_i];
|
|
4677
4987
|
}
|
|
4678
4988
|
return __awaiter(_this, __spreadArray([rewardSymbol_1, poolConfig_1, tokenStakeAccount_1], args_1, true), void 0, function (rewardSymbol, poolConfig, tokenStakeAccount, createUserATA) {
|
|
4679
|
-
var publicKey, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tokenStakeAccounts, withdrawStakeInstruction,
|
|
4989
|
+
var publicKey, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tokenStakeAccounts, withdrawStakeInstruction, err_14;
|
|
4680
4990
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
4681
4991
|
return __generator(this, function (_b) {
|
|
4682
4992
|
switch (_b.label) {
|
|
@@ -4736,9 +5046,9 @@ var PerpetualsClient = (function () {
|
|
|
4736
5046
|
instructions.push(withdrawStakeInstruction);
|
|
4737
5047
|
return [3, 6];
|
|
4738
5048
|
case 5:
|
|
4739
|
-
|
|
4740
|
-
console.log("perpClient withdrawStake error:: ",
|
|
4741
|
-
throw
|
|
5049
|
+
err_14 = _b.sent();
|
|
5050
|
+
console.log("perpClient withdrawStake error:: ", err_14);
|
|
5051
|
+
throw err_14;
|
|
4742
5052
|
case 6: return [2, {
|
|
4743
5053
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4744
5054
|
additionalSigners: additionalSigners
|
|
@@ -4753,7 +5063,7 @@ var PerpetualsClient = (function () {
|
|
|
4753
5063
|
args_1[_i - 5] = arguments[_i];
|
|
4754
5064
|
}
|
|
4755
5065
|
return __awaiter(_this, __spreadArray([amountIn_1, minCompoundingAmountOut_1, inTokenSymbol_1, rewardTokenMint_1, poolConfig_1], args_1, true), void 0, function (amountIn, minCompoundingAmountOut, inTokenSymbol, rewardTokenMint, poolConfig, skipBalanceChecks, ephemeralSignerPubkey, userPublicKey, enableHeapSizeIx, isWhitelistedUser, includeRemainingAccounts) {
|
|
4756
|
-
var publicKey, preInstructions, instructions, additionalSigners, postInstructions, rewardCustody, inCustodyConfig, lpTokenMint, compoundingTokenMint, wrappedSolAccount, lpTokenAccount, compoundingTokenAccount, fundingAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, lamports, unWrappedSolBalance, _e, heapSizeIx, whitelistPda, whitelistMeta, addCompoundingLiquidity,
|
|
5066
|
+
var publicKey, preInstructions, instructions, additionalSigners, postInstructions, rewardCustody, inCustodyConfig, lpTokenMint, compoundingTokenMint, wrappedSolAccount, lpTokenAccount, compoundingTokenAccount, fundingAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, lamports, unWrappedSolBalance, _e, heapSizeIx, whitelistPda, whitelistMeta, addCompoundingLiquidity, err_15;
|
|
4757
5067
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
|
4758
5068
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
4759
5069
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
@@ -4895,8 +5205,8 @@ var PerpetualsClient = (function () {
|
|
|
4895
5205
|
instructions.push(addCompoundingLiquidity);
|
|
4896
5206
|
return [3, 10];
|
|
4897
5207
|
case 9:
|
|
4898
|
-
|
|
4899
|
-
console.log("perpClient addCompoundingLiquidity error:: ",
|
|
5208
|
+
err_15 = _f.sent();
|
|
5209
|
+
console.log("perpClient addCompoundingLiquidity error:: ", err_15);
|
|
4900
5210
|
return [3, 10];
|
|
4901
5211
|
case 10: return [2, {
|
|
4902
5212
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -4912,7 +5222,7 @@ var PerpetualsClient = (function () {
|
|
|
4912
5222
|
args_1[_i - 5] = arguments[_i];
|
|
4913
5223
|
}
|
|
4914
5224
|
return __awaiter(_this, __spreadArray([compoundingAmountIn_1, minAmountOut_1, outTokenSymbol_1, rewardTokenMint_1, poolConfig_1], args_1, true), void 0, function (compoundingAmountIn, minAmountOut, outTokenSymbol, rewardTokenMint, poolConfig, createUserATA, ephemeralSignerPubkey, userPublicKey, enableHeapSizeIx, isWhitelistedUser, includeRemainingAccounts) {
|
|
4915
|
-
var publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, outCustodyConfig, lpTokenMint, compoundingTokenMint, lamports, _a, custodyAccountMetas, custodyOracleAccountMetas, markets, _b, _c, custody, _d, _e, market, compoundingTokenAccount, heapSizeIx, whitelistPda, whitelistMeta, removeCompoundingLiquidity,
|
|
5225
|
+
var publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, outCustodyConfig, lpTokenMint, compoundingTokenMint, lamports, _a, custodyAccountMetas, custodyOracleAccountMetas, markets, _b, _c, custody, _d, _e, market, compoundingTokenAccount, heapSizeIx, whitelistPda, whitelistMeta, removeCompoundingLiquidity, err_16;
|
|
4916
5226
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
4917
5227
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
4918
5228
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
@@ -5038,8 +5348,8 @@ var PerpetualsClient = (function () {
|
|
|
5038
5348
|
instructions.push(removeCompoundingLiquidity);
|
|
5039
5349
|
return [3, 8];
|
|
5040
5350
|
case 7:
|
|
5041
|
-
|
|
5042
|
-
console.log("perpClient removeCompoundingLiquidity error:: ",
|
|
5351
|
+
err_16 = _f.sent();
|
|
5352
|
+
console.log("perpClient removeCompoundingLiquidity error:: ", err_16);
|
|
5043
5353
|
return [3, 8];
|
|
5044
5354
|
case 8: return [2, {
|
|
5045
5355
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -5055,7 +5365,7 @@ var PerpetualsClient = (function () {
|
|
|
5055
5365
|
args_1[_i - 3] = arguments[_i];
|
|
5056
5366
|
}
|
|
5057
5367
|
return __awaiter(_this, __spreadArray([amount_1, rewardTokenMint_1, poolConfig_1], args_1, true), void 0, function (amount, rewardTokenMint, poolConfig, createUserATA) {
|
|
5058
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, _a, flpStakeAccount, tokenStakeAccount, tokenStakeAccounts, _b, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _c, _d, custody, _e, _f, market, migrateStake,
|
|
5368
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, _a, flpStakeAccount, tokenStakeAccount, tokenStakeAccounts, _b, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _c, _d, custody, _e, _f, market, migrateStake, err_17;
|
|
5059
5369
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5060
5370
|
return __generator(this, function (_g) {
|
|
5061
5371
|
switch (_g.label) {
|
|
@@ -5152,8 +5462,8 @@ var PerpetualsClient = (function () {
|
|
|
5152
5462
|
instructions.push(migrateStake);
|
|
5153
5463
|
return [3, 8];
|
|
5154
5464
|
case 7:
|
|
5155
|
-
|
|
5156
|
-
console.log("perpClient migrateStake error:: ",
|
|
5465
|
+
err_17 = _g.sent();
|
|
5466
|
+
console.log("perpClient migrateStake error:: ", err_17);
|
|
5157
5467
|
return [3, 8];
|
|
5158
5468
|
case 8: return [2, {
|
|
5159
5469
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -5164,7 +5474,7 @@ var PerpetualsClient = (function () {
|
|
|
5164
5474
|
});
|
|
5165
5475
|
};
|
|
5166
5476
|
this.migrateFlp = function (amount, rewardTokenMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5167
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp,
|
|
5477
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp, err_18;
|
|
5168
5478
|
return __generator(this, function (_d) {
|
|
5169
5479
|
switch (_d.label) {
|
|
5170
5480
|
case 0:
|
|
@@ -5235,8 +5545,8 @@ var PerpetualsClient = (function () {
|
|
|
5235
5545
|
instructions.push(migrateFlp);
|
|
5236
5546
|
return [3, 4];
|
|
5237
5547
|
case 3:
|
|
5238
|
-
|
|
5239
|
-
console.log("perpClient migrateFlp error:: ",
|
|
5548
|
+
err_18 = _d.sent();
|
|
5549
|
+
console.log("perpClient migrateFlp error:: ", err_18);
|
|
5240
5550
|
return [3, 4];
|
|
5241
5551
|
case 4: return [2, {
|
|
5242
5552
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -5251,7 +5561,7 @@ var PerpetualsClient = (function () {
|
|
|
5251
5561
|
args_1[_i - 1] = arguments[_i];
|
|
5252
5562
|
}
|
|
5253
5563
|
return __awaiter(_this, __spreadArray([poolConfig_1], args_1, true), void 0, function (poolConfig, rewardTokenSymbol) {
|
|
5254
|
-
var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, compoundingFee,
|
|
5564
|
+
var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, compoundingFee, err_19;
|
|
5255
5565
|
if (rewardTokenSymbol === void 0) { rewardTokenSymbol = 'USDC'; }
|
|
5256
5566
|
return __generator(this, function (_e) {
|
|
5257
5567
|
switch (_e.label) {
|
|
@@ -5308,8 +5618,8 @@ var PerpetualsClient = (function () {
|
|
|
5308
5618
|
instructions.push(compoundingFee);
|
|
5309
5619
|
return [3, 4];
|
|
5310
5620
|
case 3:
|
|
5311
|
-
|
|
5312
|
-
console.log("perpClient compoundingFee error:: ",
|
|
5621
|
+
err_19 = _e.sent();
|
|
5622
|
+
console.log("perpClient compoundingFee error:: ", err_19);
|
|
5313
5623
|
return [3, 4];
|
|
5314
5624
|
case 4: return [2, {
|
|
5315
5625
|
instructions: __spreadArray([], instructions, true),
|
|
@@ -5320,7 +5630,7 @@ var PerpetualsClient = (function () {
|
|
|
5320
5630
|
});
|
|
5321
5631
|
};
|
|
5322
5632
|
this.depositTokenStake = function (owner, feePayer, depositAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5323
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, depositTokenStakeInstruction,
|
|
5633
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, depositTokenStakeInstruction, err_20;
|
|
5324
5634
|
return __generator(this, function (_a) {
|
|
5325
5635
|
switch (_a.label) {
|
|
5326
5636
|
case 0:
|
|
@@ -5360,9 +5670,9 @@ var PerpetualsClient = (function () {
|
|
|
5360
5670
|
instructions.push(depositTokenStakeInstruction);
|
|
5361
5671
|
return [3, 5];
|
|
5362
5672
|
case 4:
|
|
5363
|
-
|
|
5364
|
-
console.log("perpClient depositStakingInstruction error:: ",
|
|
5365
|
-
throw
|
|
5673
|
+
err_20 = _a.sent();
|
|
5674
|
+
console.log("perpClient depositStakingInstruction error:: ", err_20);
|
|
5675
|
+
throw err_20;
|
|
5366
5676
|
case 5: return [2, {
|
|
5367
5677
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5368
5678
|
additionalSigners: additionalSigners
|
|
@@ -5371,7 +5681,7 @@ var PerpetualsClient = (function () {
|
|
|
5371
5681
|
});
|
|
5372
5682
|
}); };
|
|
5373
5683
|
this.unstakeTokenRequest = function (owner, unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5374
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, unstakeTokenRequestInstruction,
|
|
5684
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, unstakeTokenRequestInstruction, err_21;
|
|
5375
5685
|
return __generator(this, function (_a) {
|
|
5376
5686
|
switch (_a.label) {
|
|
5377
5687
|
case 0:
|
|
@@ -5399,9 +5709,9 @@ var PerpetualsClient = (function () {
|
|
|
5399
5709
|
instructions.push(unstakeTokenRequestInstruction);
|
|
5400
5710
|
return [3, 4];
|
|
5401
5711
|
case 3:
|
|
5402
|
-
|
|
5403
|
-
console.log("perpClient unstakeTokenRequestInstruction error:: ",
|
|
5404
|
-
throw
|
|
5712
|
+
err_21 = _a.sent();
|
|
5713
|
+
console.log("perpClient unstakeTokenRequestInstruction error:: ", err_21);
|
|
5714
|
+
throw err_21;
|
|
5405
5715
|
case 4: return [2, {
|
|
5406
5716
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5407
5717
|
additionalSigners: additionalSigners
|
|
@@ -5410,7 +5720,7 @@ var PerpetualsClient = (function () {
|
|
|
5410
5720
|
});
|
|
5411
5721
|
}); };
|
|
5412
5722
|
this.withdrawToken = function (owner, withdrawRequestId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5413
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, withdrawTokenInstruction,
|
|
5723
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, withdrawTokenInstruction, err_22;
|
|
5414
5724
|
return __generator(this, function (_a) {
|
|
5415
5725
|
switch (_a.label) {
|
|
5416
5726
|
case 0:
|
|
@@ -5449,9 +5759,9 @@ var PerpetualsClient = (function () {
|
|
|
5449
5759
|
instructions.push(withdrawTokenInstruction);
|
|
5450
5760
|
return [3, 5];
|
|
5451
5761
|
case 4:
|
|
5452
|
-
|
|
5453
|
-
console.log("perpClient withdrawTokenInstruction error:: ",
|
|
5454
|
-
throw
|
|
5762
|
+
err_22 = _a.sent();
|
|
5763
|
+
console.log("perpClient withdrawTokenInstruction error:: ", err_22);
|
|
5764
|
+
throw err_22;
|
|
5455
5765
|
case 5: return [2, {
|
|
5456
5766
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5457
5767
|
additionalSigners: additionalSigners
|
|
@@ -5460,7 +5770,7 @@ var PerpetualsClient = (function () {
|
|
|
5460
5770
|
});
|
|
5461
5771
|
}); };
|
|
5462
5772
|
this.cancelUnstakeTokenRequest = function (owner, withdrawRequestId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5463
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, cancelUnstakeTokenRequestInstruction,
|
|
5773
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, cancelUnstakeTokenRequestInstruction, err_23;
|
|
5464
5774
|
return __generator(this, function (_a) {
|
|
5465
5775
|
switch (_a.label) {
|
|
5466
5776
|
case 0:
|
|
@@ -5488,9 +5798,9 @@ var PerpetualsClient = (function () {
|
|
|
5488
5798
|
instructions.push(cancelUnstakeTokenRequestInstruction);
|
|
5489
5799
|
return [3, 4];
|
|
5490
5800
|
case 3:
|
|
5491
|
-
|
|
5492
|
-
console.log("perpClient cancelUnstakeTokenRequestInstruction error:: ",
|
|
5493
|
-
throw
|
|
5801
|
+
err_23 = _a.sent();
|
|
5802
|
+
console.log("perpClient cancelUnstakeTokenRequestInstruction error:: ", err_23);
|
|
5803
|
+
throw err_23;
|
|
5494
5804
|
case 4: return [2, {
|
|
5495
5805
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5496
5806
|
additionalSigners: additionalSigners
|
|
@@ -5504,7 +5814,7 @@ var PerpetualsClient = (function () {
|
|
|
5504
5814
|
args_1[_i - 2] = arguments[_i];
|
|
5505
5815
|
}
|
|
5506
5816
|
return __awaiter(_this, __spreadArray([owner_1, poolConfig_1], args_1, true), void 0, function (owner, poolConfig, createUserATA) {
|
|
5507
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, _a, collectTokenRewardInstruction,
|
|
5817
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, _a, collectTokenRewardInstruction, err_24;
|
|
5508
5818
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5509
5819
|
return __generator(this, function (_b) {
|
|
5510
5820
|
switch (_b.label) {
|
|
@@ -5548,9 +5858,9 @@ var PerpetualsClient = (function () {
|
|
|
5548
5858
|
instructions.push(collectTokenRewardInstruction);
|
|
5549
5859
|
return [3, 6];
|
|
5550
5860
|
case 5:
|
|
5551
|
-
|
|
5552
|
-
console.log("perpClient collectTokenRewardInstruction error:: ",
|
|
5553
|
-
throw
|
|
5861
|
+
err_24 = _b.sent();
|
|
5862
|
+
console.log("perpClient collectTokenRewardInstruction error:: ", err_24);
|
|
5863
|
+
throw err_24;
|
|
5554
5864
|
case 6: return [2, {
|
|
5555
5865
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5556
5866
|
additionalSigners: additionalSigners
|
|
@@ -5565,7 +5875,7 @@ var PerpetualsClient = (function () {
|
|
|
5565
5875
|
args_1[_i - 3] = arguments[_i];
|
|
5566
5876
|
}
|
|
5567
5877
|
return __awaiter(_this, __spreadArray([owner_1, rewardSymbol_1, poolConfig_1], args_1, true), void 0, function (owner, rewardSymbol, poolConfig, createUserATA) {
|
|
5568
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, tokenStakeAccount, userTokenAccount, _a, collectRevenueInstruction,
|
|
5878
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, tokenStakeAccount, userTokenAccount, _a, collectRevenueInstruction, err_25;
|
|
5569
5879
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5570
5880
|
return __generator(this, function (_b) {
|
|
5571
5881
|
switch (_b.label) {
|
|
@@ -5610,9 +5920,9 @@ var PerpetualsClient = (function () {
|
|
|
5610
5920
|
instructions.push(collectRevenueInstruction);
|
|
5611
5921
|
return [3, 6];
|
|
5612
5922
|
case 5:
|
|
5613
|
-
|
|
5614
|
-
console.log("perpClient collectRevenueInstruction error:: ",
|
|
5615
|
-
throw
|
|
5923
|
+
err_25 = _b.sent();
|
|
5924
|
+
console.log("perpClient collectRevenueInstruction error:: ", err_25);
|
|
5925
|
+
throw err_25;
|
|
5616
5926
|
case 6: return [2, {
|
|
5617
5927
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5618
5928
|
additionalSigners: additionalSigners
|
|
@@ -5622,7 +5932,7 @@ var PerpetualsClient = (function () {
|
|
|
5622
5932
|
});
|
|
5623
5933
|
};
|
|
5624
5934
|
this.refreshTokenStake = function (tokenStakeAccounts, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5625
|
-
var instructions, additionalSigners, remainingAccounts, refreshTokenStakeInstruction,
|
|
5935
|
+
var instructions, additionalSigners, remainingAccounts, refreshTokenStakeInstruction, err_26;
|
|
5626
5936
|
return __generator(this, function (_a) {
|
|
5627
5937
|
switch (_a.label) {
|
|
5628
5938
|
case 0:
|
|
@@ -5650,9 +5960,9 @@ var PerpetualsClient = (function () {
|
|
|
5650
5960
|
instructions.push(refreshTokenStakeInstruction);
|
|
5651
5961
|
return [3, 4];
|
|
5652
5962
|
case 3:
|
|
5653
|
-
|
|
5654
|
-
console.log("perpClient refreshTokenStakeInstruction error:: ",
|
|
5655
|
-
throw
|
|
5963
|
+
err_26 = _a.sent();
|
|
5964
|
+
console.log("perpClient refreshTokenStakeInstruction error:: ", err_26);
|
|
5965
|
+
throw err_26;
|
|
5656
5966
|
case 4: return [2, {
|
|
5657
5967
|
instructions: instructions,
|
|
5658
5968
|
additionalSigners: additionalSigners
|
|
@@ -5666,7 +5976,7 @@ var PerpetualsClient = (function () {
|
|
|
5666
5976
|
args_1[_i - 3] = arguments[_i];
|
|
5667
5977
|
}
|
|
5668
5978
|
return __awaiter(_this, __spreadArray([owner_1, rebateSymbol_1, poolConfig_1], args_1, true), void 0, function (owner, rebateSymbol, poolConfig, createUserATA) {
|
|
5669
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateMint, tokenStakeAccount, userTokenAccount, _a, collectRebateInstruction,
|
|
5979
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateMint, tokenStakeAccount, userTokenAccount, _a, collectRebateInstruction, err_27;
|
|
5670
5980
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5671
5981
|
return __generator(this, function (_b) {
|
|
5672
5982
|
switch (_b.label) {
|
|
@@ -5711,9 +6021,9 @@ var PerpetualsClient = (function () {
|
|
|
5711
6021
|
instructions.push(collectRebateInstruction);
|
|
5712
6022
|
return [3, 6];
|
|
5713
6023
|
case 5:
|
|
5714
|
-
|
|
5715
|
-
console.log("perpClient collectRebateInstruction error:: ",
|
|
5716
|
-
throw
|
|
6024
|
+
err_27 = _b.sent();
|
|
6025
|
+
console.log("perpClient collectRebateInstruction error:: ", err_27);
|
|
6026
|
+
throw err_27;
|
|
5717
6027
|
case 6: return [2, {
|
|
5718
6028
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5719
6029
|
additionalSigners: additionalSigners
|
|
@@ -5723,7 +6033,7 @@ var PerpetualsClient = (function () {
|
|
|
5723
6033
|
});
|
|
5724
6034
|
};
|
|
5725
6035
|
this.settleRebates = function (rebateSymbol, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5726
|
-
var preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, rebateMint, settleRebatesInstruction,
|
|
6036
|
+
var preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, rebateMint, settleRebatesInstruction, err_28;
|
|
5727
6037
|
return __generator(this, function (_a) {
|
|
5728
6038
|
switch (_a.label) {
|
|
5729
6039
|
case 0:
|
|
@@ -5757,9 +6067,9 @@ var PerpetualsClient = (function () {
|
|
|
5757
6067
|
instructions.push(settleRebatesInstruction);
|
|
5758
6068
|
return [3, 4];
|
|
5759
6069
|
case 3:
|
|
5760
|
-
|
|
5761
|
-
console.log("perpClient settleRebatesInstruction error:: ",
|
|
5762
|
-
throw
|
|
6070
|
+
err_28 = _a.sent();
|
|
6071
|
+
console.log("perpClient settleRebatesInstruction error:: ", err_28);
|
|
6072
|
+
throw err_28;
|
|
5763
6073
|
case 4: return [2, {
|
|
5764
6074
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5765
6075
|
additionalSigners: additionalSigners
|
|
@@ -5773,7 +6083,7 @@ var PerpetualsClient = (function () {
|
|
|
5773
6083
|
args_1[_i - 11] = arguments[_i];
|
|
5774
6084
|
}
|
|
5775
6085
|
return __awaiter(_this, __spreadArray([targetSymbol_1, collateralSymbol_1, reserveSymbol_1, receiveSymbol_1, side_1, limitPrice_1, reserveAmount_1, sizeAmount_1, stopLossPrice_1, takeProfitPrice_1, poolConfig_1], args_1, true), void 0, function (targetSymbol, collateralSymbol, reserveSymbol, receiveSymbol, side, limitPrice, reserveAmount, sizeAmount, stopLossPrice, takeProfitPrice, poolConfig, skipBalanceChecks, ephemeralSignerPubkey) {
|
|
5776
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder,
|
|
6086
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder, err_29;
|
|
5777
6087
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
|
5778
6088
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
5779
6089
|
return __generator(this, function (_c) {
|
|
@@ -5877,9 +6187,9 @@ var PerpetualsClient = (function () {
|
|
|
5877
6187
|
instructions.push(placeLimitOrder);
|
|
5878
6188
|
return [3, 10];
|
|
5879
6189
|
case 9:
|
|
5880
|
-
|
|
5881
|
-
console.log("perpClient placeLimitOrder error:: ",
|
|
5882
|
-
throw
|
|
6190
|
+
err_29 = _c.sent();
|
|
6191
|
+
console.log("perpClient placeLimitOrder error:: ", err_29);
|
|
6192
|
+
throw err_29;
|
|
5883
6193
|
case 10: return [2, {
|
|
5884
6194
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5885
6195
|
additionalSigners: additionalSigners
|
|
@@ -5894,7 +6204,7 @@ var PerpetualsClient = (function () {
|
|
|
5894
6204
|
args_1[_i - 11] = arguments[_i];
|
|
5895
6205
|
}
|
|
5896
6206
|
return __awaiter(_this, __spreadArray([targetSymbol_1, collateralSymbol_1, reserveSymbol_1, receiveSymbol_1, side_1, orderId_1, limitPrice_1, sizeAmount_1, stopLossPrice_1, takeProfitPrice_1, poolConfig_1], args_1, true), void 0, function (targetSymbol, collateralSymbol, reserveSymbol, receiveSymbol, side, orderId, limitPrice, sizeAmount, stopLossPrice, takeProfitPrice, poolConfig, createUserATA, ephemeralSignerPubkey) {
|
|
5897
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder,
|
|
6207
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder, err_30;
|
|
5898
6208
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5899
6209
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
5900
6210
|
return __generator(this, function (_b) {
|
|
@@ -5983,9 +6293,9 @@ var PerpetualsClient = (function () {
|
|
|
5983
6293
|
instructions.push(editLimitOrder);
|
|
5984
6294
|
return [3, 8];
|
|
5985
6295
|
case 7:
|
|
5986
|
-
|
|
5987
|
-
console.log("perpClient editLimitOrder error:: ",
|
|
5988
|
-
throw
|
|
6296
|
+
err_30 = _b.sent();
|
|
6297
|
+
console.log("perpClient editLimitOrder error:: ", err_30);
|
|
6298
|
+
throw err_30;
|
|
5989
6299
|
case 8: return [2, {
|
|
5990
6300
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5991
6301
|
additionalSigners: additionalSigners
|
|
@@ -6000,7 +6310,7 @@ var PerpetualsClient = (function () {
|
|
|
6000
6310
|
args_1[_i - 7] = arguments[_i];
|
|
6001
6311
|
}
|
|
6002
6312
|
return __awaiter(_this, __spreadArray([userPubkey_1, targetSymbol_1, collateralSymbol_1, side_1, orderId_1, poolConfig_1, privilege_1], args_1, true), void 0, function (userPubkey, targetSymbol, collateralSymbol, side, orderId, poolConfig, privilege, tokenStakeAccount, userReferralAccount) {
|
|
6003
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder,
|
|
6313
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder, err_31;
|
|
6004
6314
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
6005
6315
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
|
6006
6316
|
return __generator(this, function (_a) {
|
|
@@ -6050,9 +6360,9 @@ var PerpetualsClient = (function () {
|
|
|
6050
6360
|
instructions.push(executeLimitOrder);
|
|
6051
6361
|
return [3, 4];
|
|
6052
6362
|
case 3:
|
|
6053
|
-
|
|
6054
|
-
console.log("perpClient executeLimitOrder error:: ",
|
|
6055
|
-
throw
|
|
6363
|
+
err_31 = _a.sent();
|
|
6364
|
+
console.log("perpClient executeLimitOrder error:: ", err_31);
|
|
6365
|
+
throw err_31;
|
|
6056
6366
|
case 4: return [2, {
|
|
6057
6367
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6058
6368
|
additionalSigners: additionalSigners
|
|
@@ -6067,7 +6377,7 @@ var PerpetualsClient = (function () {
|
|
|
6067
6377
|
args_1[_i - 8] = arguments[_i];
|
|
6068
6378
|
}
|
|
6069
6379
|
return __awaiter(_this, __spreadArray([userPubkey_1, targetSymbol_1, collateralSymbol_1, reserveSymbol_1, side_1, orderId_1, poolConfig_1, privilege_1], args_1, true), void 0, function (userPubkey, targetSymbol, collateralSymbol, reserveSymbol, side, orderId, poolConfig, privilege, tokenStakeAccount, userReferralAccount) {
|
|
6070
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap,
|
|
6380
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap, err_32;
|
|
6071
6381
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
6072
6382
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
|
6073
6383
|
return __generator(this, function (_a) {
|
|
@@ -6120,9 +6430,9 @@ var PerpetualsClient = (function () {
|
|
|
6120
6430
|
instructions.push(executeLimitWithSwap);
|
|
6121
6431
|
return [3, 4];
|
|
6122
6432
|
case 3:
|
|
6123
|
-
|
|
6124
|
-
console.log("perpClient executeLimitWithSwap error:: ",
|
|
6125
|
-
throw
|
|
6433
|
+
err_32 = _a.sent();
|
|
6434
|
+
console.log("perpClient executeLimitWithSwap error:: ", err_32);
|
|
6435
|
+
throw err_32;
|
|
6126
6436
|
case 4: return [2, {
|
|
6127
6437
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6128
6438
|
additionalSigners: additionalSigners
|
|
@@ -6132,7 +6442,7 @@ var PerpetualsClient = (function () {
|
|
|
6132
6442
|
});
|
|
6133
6443
|
};
|
|
6134
6444
|
this.placeTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6135
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder,
|
|
6445
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder, err_33;
|
|
6136
6446
|
return __generator(this, function (_a) {
|
|
6137
6447
|
switch (_a.label) {
|
|
6138
6448
|
case 0:
|
|
@@ -6178,9 +6488,9 @@ var PerpetualsClient = (function () {
|
|
|
6178
6488
|
instructions.push(placeTriggerOrder);
|
|
6179
6489
|
return [3, 4];
|
|
6180
6490
|
case 3:
|
|
6181
|
-
|
|
6182
|
-
console.log("perpClient placeTriggerOrder error:: ",
|
|
6183
|
-
throw
|
|
6491
|
+
err_33 = _a.sent();
|
|
6492
|
+
console.log("perpClient placeTriggerOrder error:: ", err_33);
|
|
6493
|
+
throw err_33;
|
|
6184
6494
|
case 4: return [2, {
|
|
6185
6495
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6186
6496
|
additionalSigners: additionalSigners
|
|
@@ -6189,7 +6499,7 @@ var PerpetualsClient = (function () {
|
|
|
6189
6499
|
});
|
|
6190
6500
|
}); };
|
|
6191
6501
|
this.editTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, orderId, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6192
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder,
|
|
6502
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder, err_34;
|
|
6193
6503
|
return __generator(this, function (_a) {
|
|
6194
6504
|
switch (_a.label) {
|
|
6195
6505
|
case 0:
|
|
@@ -6234,9 +6544,9 @@ var PerpetualsClient = (function () {
|
|
|
6234
6544
|
instructions.push(editTriggerOrder);
|
|
6235
6545
|
return [3, 4];
|
|
6236
6546
|
case 3:
|
|
6237
|
-
|
|
6238
|
-
console.log("perpClient editTriggerOrder error:: ",
|
|
6239
|
-
throw
|
|
6547
|
+
err_34 = _a.sent();
|
|
6548
|
+
console.log("perpClient editTriggerOrder error:: ", err_34);
|
|
6549
|
+
throw err_34;
|
|
6240
6550
|
case 4: return [2, {
|
|
6241
6551
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6242
6552
|
additionalSigners: additionalSigners
|
|
@@ -6245,7 +6555,7 @@ var PerpetualsClient = (function () {
|
|
|
6245
6555
|
});
|
|
6246
6556
|
}); };
|
|
6247
6557
|
this.cancelTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6248
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder,
|
|
6558
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder, err_35;
|
|
6249
6559
|
return __generator(this, function (_a) {
|
|
6250
6560
|
switch (_a.label) {
|
|
6251
6561
|
case 0:
|
|
@@ -6276,9 +6586,9 @@ var PerpetualsClient = (function () {
|
|
|
6276
6586
|
instructions.push(cancelTriggerOrder);
|
|
6277
6587
|
return [3, 4];
|
|
6278
6588
|
case 3:
|
|
6279
|
-
|
|
6280
|
-
console.log("perpClient cancelTriggerOrder error:: ",
|
|
6281
|
-
throw
|
|
6589
|
+
err_35 = _a.sent();
|
|
6590
|
+
console.log("perpClient cancelTriggerOrder error:: ", err_35);
|
|
6591
|
+
throw err_35;
|
|
6282
6592
|
case 4: return [2, {
|
|
6283
6593
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6284
6594
|
additionalSigners: additionalSigners
|
|
@@ -6287,7 +6597,7 @@ var PerpetualsClient = (function () {
|
|
|
6287
6597
|
});
|
|
6288
6598
|
}); };
|
|
6289
6599
|
this.cancelAllTriggerOrders = function (targetSymbol, collateralSymbol, side, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6290
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders,
|
|
6600
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders, err_36;
|
|
6291
6601
|
return __generator(this, function (_a) {
|
|
6292
6602
|
switch (_a.label) {
|
|
6293
6603
|
case 0:
|
|
@@ -6316,9 +6626,9 @@ var PerpetualsClient = (function () {
|
|
|
6316
6626
|
instructions.push(cancelAllTriggerOrders);
|
|
6317
6627
|
return [3, 4];
|
|
6318
6628
|
case 3:
|
|
6319
|
-
|
|
6320
|
-
console.log("perpClient cancelAllTriggerOrders error:: ",
|
|
6321
|
-
throw
|
|
6629
|
+
err_36 = _a.sent();
|
|
6630
|
+
console.log("perpClient cancelAllTriggerOrders error:: ", err_36);
|
|
6631
|
+
throw err_36;
|
|
6322
6632
|
case 4: return [2, {
|
|
6323
6633
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6324
6634
|
additionalSigners: additionalSigners
|
|
@@ -6332,7 +6642,7 @@ var PerpetualsClient = (function () {
|
|
|
6332
6642
|
args_1[_i - 9] = arguments[_i];
|
|
6333
6643
|
}
|
|
6334
6644
|
return __awaiter(_this, __spreadArray([owner_1, targetSymbol_1, collateralSymbol_1, receivingSymbol_1, side_1, orderId_1, isStopLoss_1, privilege_1, poolConfig_1], args_1, true), void 0, function (owner, targetSymbol, collateralSymbol, receivingSymbol, side, orderId, isStopLoss, privilege, poolConfig, createUserATA, ephemeralSignerPubkey, tokenStakeAccount, userReferralAccount) {
|
|
6335
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, userReceivingTokenAccount, userReceivingTokenAccountCollateral, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, collateralToken, receivingToken, _a, _b, positionAccount, orderAccount, custodyAccountMetas, custodyOracleAccountMetas, _c, _d, custody, executeTriggerWithSwap,
|
|
6645
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, userReceivingTokenAccount, userReceivingTokenAccountCollateral, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, collateralToken, receivingToken, _a, _b, positionAccount, orderAccount, custodyAccountMetas, custodyOracleAccountMetas, _c, _d, custody, executeTriggerWithSwap, err_37;
|
|
6336
6646
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6337
6647
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
6338
6648
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6436,9 +6746,9 @@ var PerpetualsClient = (function () {
|
|
|
6436
6746
|
instructions.push(executeTriggerWithSwap);
|
|
6437
6747
|
return [3, 10];
|
|
6438
6748
|
case 9:
|
|
6439
|
-
|
|
6440
|
-
console.log("perpClient executeTriggerWithSwap error:: ",
|
|
6441
|
-
throw
|
|
6749
|
+
err_37 = _e.sent();
|
|
6750
|
+
console.log("perpClient executeTriggerWithSwap error:: ", err_37);
|
|
6751
|
+
throw err_37;
|
|
6442
6752
|
case 10: return [2, {
|
|
6443
6753
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6444
6754
|
additionalSigners: additionalSigners
|
|
@@ -6453,7 +6763,7 @@ var PerpetualsClient = (function () {
|
|
|
6453
6763
|
args_1[_i - 8] = arguments[_i];
|
|
6454
6764
|
}
|
|
6455
6765
|
return __awaiter(_this, __spreadArray([owner_1, targetSymbol_1, collateralSymbol_1, side_1, orderId_1, isStopLoss_1, privilege_1, poolConfig_1], args_1, true), void 0, function (owner, targetSymbol, collateralSymbol, side, orderId, isStopLoss, privilege, poolConfig, createUserATA, ephemeralSignerPubkey, tokenStakeAccount, userReferralAccount) {
|
|
6456
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder,
|
|
6766
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder, err_38;
|
|
6457
6767
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6458
6768
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
6459
6769
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6522,9 +6832,9 @@ var PerpetualsClient = (function () {
|
|
|
6522
6832
|
instructions.push(executeTriggerOrder);
|
|
6523
6833
|
return [3, 8];
|
|
6524
6834
|
case 7:
|
|
6525
|
-
|
|
6526
|
-
console.log("perpClient executeTriggerOrder error:: ",
|
|
6527
|
-
throw
|
|
6835
|
+
err_38 = _b.sent();
|
|
6836
|
+
console.log("perpClient executeTriggerOrder error:: ", err_38);
|
|
6837
|
+
throw err_38;
|
|
6528
6838
|
case 8: return [2, {
|
|
6529
6839
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6530
6840
|
additionalSigners: additionalSigners
|
|
@@ -6539,7 +6849,7 @@ var PerpetualsClient = (function () {
|
|
|
6539
6849
|
args_1[_i - 5] = arguments[_i];
|
|
6540
6850
|
}
|
|
6541
6851
|
return __awaiter(_this, __spreadArray([userInputTokenSymbol_1, userOutputTokenSymbol_1, amountIn_1, minAmountOut_1, poolConfig_1], args_1, true), void 0, function (userInputTokenSymbol, userOutputTokenSymbol, amountIn, minAmountOut, poolConfig, useFeesPool, createUserATA, unWrapSol, skipBalanceChecks, ephemeralSignerPubkey, isWhitelistedUser) {
|
|
6542
|
-
var userInputCustodyConfig, userOutputCustodyConfig, publicKey, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userOutputTokenAccount, userInputTokenAccount, wsolAssociatedTokenAccount, wsolATAExist, unWrappedSolBalance, _a, wsolAssociatedTokenAccount, closeWsolATAIns, accCreationLamports, lamports, unWrappedSolBalance, _b, tokenAccountBalance, _c, lamports, _d, custodyAccountMetas, custodyOracleAccountMetas, _e, _f, custody, whitelistPda, whitelistMeta, params, inx, closeWsolATAIns,
|
|
6852
|
+
var userInputCustodyConfig, userOutputCustodyConfig, publicKey, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userOutputTokenAccount, userInputTokenAccount, wsolAssociatedTokenAccount, wsolATAExist, unWrappedSolBalance, _a, wsolAssociatedTokenAccount, closeWsolATAIns, accCreationLamports, lamports, unWrappedSolBalance, _b, tokenAccountBalance, _c, lamports, _d, custodyAccountMetas, custodyOracleAccountMetas, _e, _f, custody, whitelistPda, whitelistMeta, params, inx, closeWsolATAIns, err_39;
|
|
6543
6853
|
if (useFeesPool === void 0) { useFeesPool = false; }
|
|
6544
6854
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6545
6855
|
if (unWrapSol === void 0) { unWrapSol = false; }
|
|
@@ -6750,9 +7060,9 @@ var PerpetualsClient = (function () {
|
|
|
6750
7060
|
}
|
|
6751
7061
|
return [3, 20];
|
|
6752
7062
|
case 19:
|
|
6753
|
-
|
|
6754
|
-
console.error("perpClient Swap error:: ",
|
|
6755
|
-
throw
|
|
7063
|
+
err_39 = _g.sent();
|
|
7064
|
+
console.error("perpClient Swap error:: ", err_39);
|
|
7065
|
+
throw err_39;
|
|
6756
7066
|
case 20: return [2, {
|
|
6757
7067
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6758
7068
|
additionalSigners: additionalSigners
|
|
@@ -6762,7 +7072,7 @@ var PerpetualsClient = (function () {
|
|
|
6762
7072
|
});
|
|
6763
7073
|
};
|
|
6764
7074
|
this.swapFeeInternal = function (rewardTokenSymbol, swapTokenSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6765
|
-
var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx,
|
|
7075
|
+
var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx, err_40;
|
|
6766
7076
|
return __generator(this, function (_b) {
|
|
6767
7077
|
switch (_b.label) {
|
|
6768
7078
|
case 0:
|
|
@@ -6816,9 +7126,9 @@ var PerpetualsClient = (function () {
|
|
|
6816
7126
|
instructions.push(inx);
|
|
6817
7127
|
return [3, 4];
|
|
6818
7128
|
case 3:
|
|
6819
|
-
|
|
6820
|
-
console.error("perpClient Swap error:: ",
|
|
6821
|
-
throw
|
|
7129
|
+
err_40 = _b.sent();
|
|
7130
|
+
console.error("perpClient Swap error:: ", err_40);
|
|
7131
|
+
throw err_40;
|
|
6822
7132
|
case 4: return [2, {
|
|
6823
7133
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6824
7134
|
additionalSigners: additionalSigners
|
|
@@ -6827,7 +7137,7 @@ var PerpetualsClient = (function () {
|
|
|
6827
7137
|
});
|
|
6828
7138
|
}); };
|
|
6829
7139
|
this.setLpTokenPrice = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6830
|
-
var instructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, setLpTokenPriceInstruction,
|
|
7140
|
+
var instructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, setLpTokenPriceInstruction, err_41;
|
|
6831
7141
|
return __generator(this, function (_d) {
|
|
6832
7142
|
switch (_d.label) {
|
|
6833
7143
|
case 0:
|
|
@@ -6875,9 +7185,9 @@ var PerpetualsClient = (function () {
|
|
|
6875
7185
|
instructions.push(setLpTokenPriceInstruction);
|
|
6876
7186
|
return [3, 4];
|
|
6877
7187
|
case 3:
|
|
6878
|
-
|
|
6879
|
-
console.log("perpClient setLpTokenPriceInstruction error:: ",
|
|
6880
|
-
throw
|
|
7188
|
+
err_41 = _d.sent();
|
|
7189
|
+
console.log("perpClient setLpTokenPriceInstruction error:: ", err_41);
|
|
7190
|
+
throw err_41;
|
|
6881
7191
|
case 4: return [2, {
|
|
6882
7192
|
instructions: __spreadArray([], instructions, true),
|
|
6883
7193
|
additionalSigners: additionalSigners
|
|
@@ -6925,7 +7235,7 @@ var PerpetualsClient = (function () {
|
|
|
6925
7235
|
});
|
|
6926
7236
|
}); };
|
|
6927
7237
|
this.setAdminSigners = function (admins, minSignatures) { return __awaiter(_this, void 0, void 0, function () {
|
|
6928
|
-
var adminMetas, _i, admins_2, admin,
|
|
7238
|
+
var adminMetas, _i, admins_2, admin, err_42;
|
|
6929
7239
|
return __generator(this, function (_a) {
|
|
6930
7240
|
switch (_a.label) {
|
|
6931
7241
|
case 0:
|
|
@@ -6955,17 +7265,17 @@ var PerpetualsClient = (function () {
|
|
|
6955
7265
|
_a.sent();
|
|
6956
7266
|
return [3, 4];
|
|
6957
7267
|
case 3:
|
|
6958
|
-
|
|
7268
|
+
err_42 = _a.sent();
|
|
6959
7269
|
if (this.printErrors) {
|
|
6960
|
-
console.error("setAdminSigners err:",
|
|
7270
|
+
console.error("setAdminSigners err:", err_42);
|
|
6961
7271
|
}
|
|
6962
|
-
throw
|
|
7272
|
+
throw err_42;
|
|
6963
7273
|
case 4: return [2];
|
|
6964
7274
|
}
|
|
6965
7275
|
});
|
|
6966
7276
|
}); };
|
|
6967
7277
|
this.addPool = function (name, oracleAuthority, maxAumUsd, permissions, metadataSymbol, metadataTitle, metadataUri, stakingFeeShareBps, vpVolumeFactor, stakingFeeBoostBps, minLpPriceUsd, maxLpPriceUsd, thresholdUsd) { return __awaiter(_this, void 0, void 0, function () {
|
|
6968
|
-
var preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, metadataAccount, addPoolInstruction,
|
|
7278
|
+
var preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, metadataAccount, addPoolInstruction, err_43;
|
|
6969
7279
|
return __generator(this, function (_a) {
|
|
6970
7280
|
switch (_a.label) {
|
|
6971
7281
|
case 0:
|
|
@@ -7013,9 +7323,9 @@ var PerpetualsClient = (function () {
|
|
|
7013
7323
|
instructions.push(addPoolInstruction);
|
|
7014
7324
|
return [3, 4];
|
|
7015
7325
|
case 3:
|
|
7016
|
-
|
|
7017
|
-
console.log("perpClient addPool error:: ",
|
|
7018
|
-
throw
|
|
7326
|
+
err_43 = _a.sent();
|
|
7327
|
+
console.log("perpClient addPool error:: ", err_43);
|
|
7328
|
+
throw err_43;
|
|
7019
7329
|
case 4: return [2, {
|
|
7020
7330
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7021
7331
|
additionalSigners: additionalSigners
|
|
@@ -7024,7 +7334,7 @@ var PerpetualsClient = (function () {
|
|
|
7024
7334
|
});
|
|
7025
7335
|
}); };
|
|
7026
7336
|
this.removePool = function (name) { return __awaiter(_this, void 0, void 0, function () {
|
|
7027
|
-
var preInstructions, instructions, postInstructions, additionalSigners, removePoolInstruction,
|
|
7337
|
+
var preInstructions, instructions, postInstructions, additionalSigners, removePoolInstruction, err_44;
|
|
7028
7338
|
return __generator(this, function (_a) {
|
|
7029
7339
|
switch (_a.label) {
|
|
7030
7340
|
case 0:
|
|
@@ -7051,9 +7361,9 @@ var PerpetualsClient = (function () {
|
|
|
7051
7361
|
instructions.push(removePoolInstruction);
|
|
7052
7362
|
return [3, 4];
|
|
7053
7363
|
case 3:
|
|
7054
|
-
|
|
7055
|
-
console.log("perpClient removePool error:: ",
|
|
7056
|
-
throw
|
|
7364
|
+
err_44 = _a.sent();
|
|
7365
|
+
console.log("perpClient removePool error:: ", err_44);
|
|
7366
|
+
throw err_44;
|
|
7057
7367
|
case 4: return [2, {
|
|
7058
7368
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7059
7369
|
additionalSigners: additionalSigners
|
|
@@ -7062,7 +7372,7 @@ var PerpetualsClient = (function () {
|
|
|
7062
7372
|
});
|
|
7063
7373
|
}); };
|
|
7064
7374
|
this.addCustody = function (poolName, tokenMint, isToken22, isStable, isVirtual, oracle, pricing, permissions, fees, borrowRate, ratios, depegAdjustment, rewardThreshold, minReserveUsd, limitPriceBufferBps, inversePrice) { return __awaiter(_this, void 0, void 0, function () {
|
|
7065
|
-
var preInstructions, instructions, postInstructions, additionalSigners, addCustodyInstruction,
|
|
7375
|
+
var preInstructions, instructions, postInstructions, additionalSigners, addCustodyInstruction, err_45;
|
|
7066
7376
|
return __generator(this, function (_a) {
|
|
7067
7377
|
switch (_a.label) {
|
|
7068
7378
|
case 0:
|
|
@@ -7109,9 +7419,9 @@ var PerpetualsClient = (function () {
|
|
|
7109
7419
|
instructions.push(addCustodyInstruction);
|
|
7110
7420
|
return [3, 4];
|
|
7111
7421
|
case 3:
|
|
7112
|
-
|
|
7113
|
-
console.log("perpClient addCustody error:: ",
|
|
7114
|
-
throw
|
|
7422
|
+
err_45 = _a.sent();
|
|
7423
|
+
console.log("perpClient addCustody error:: ", err_45);
|
|
7424
|
+
throw err_45;
|
|
7115
7425
|
case 4: return [2, {
|
|
7116
7426
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7117
7427
|
additionalSigners: additionalSigners
|
|
@@ -7120,7 +7430,7 @@ var PerpetualsClient = (function () {
|
|
|
7120
7430
|
});
|
|
7121
7431
|
}); };
|
|
7122
7432
|
this.editCustody = function (poolName, tokenMint, isStable, oracle, pricing, permissions, fees, borrowRate, ratios) { return __awaiter(_this, void 0, void 0, function () {
|
|
7123
|
-
var preInstructions, instructions, postInstructions, additionalSigners, editCustodyInstruction,
|
|
7433
|
+
var preInstructions, instructions, postInstructions, additionalSigners, editCustodyInstruction, err_46;
|
|
7124
7434
|
return __generator(this, function (_a) {
|
|
7125
7435
|
switch (_a.label) {
|
|
7126
7436
|
case 0:
|
|
@@ -7160,9 +7470,9 @@ var PerpetualsClient = (function () {
|
|
|
7160
7470
|
instructions.push(editCustodyInstruction);
|
|
7161
7471
|
return [3, 4];
|
|
7162
7472
|
case 3:
|
|
7163
|
-
|
|
7164
|
-
console.log("perpClient editCustody error:: ",
|
|
7165
|
-
throw
|
|
7473
|
+
err_46 = _a.sent();
|
|
7474
|
+
console.log("perpClient editCustody error:: ", err_46);
|
|
7475
|
+
throw err_46;
|
|
7166
7476
|
case 4: return [2, {
|
|
7167
7477
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7168
7478
|
additionalSigners: additionalSigners
|
|
@@ -7171,7 +7481,7 @@ var PerpetualsClient = (function () {
|
|
|
7171
7481
|
});
|
|
7172
7482
|
}); };
|
|
7173
7483
|
this.removeCustody = function (poolName, tokenMint, ratios, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7174
|
-
var custodyConfig, token, tokenProgramId, preInstructions, instructions, postInstructions, additionalSigners, userReceivingTokenAccount, removeCustodyInstruction,
|
|
7484
|
+
var custodyConfig, token, tokenProgramId, preInstructions, instructions, postInstructions, additionalSigners, userReceivingTokenAccount, removeCustodyInstruction, err_47;
|
|
7175
7485
|
return __generator(this, function (_a) {
|
|
7176
7486
|
switch (_a.label) {
|
|
7177
7487
|
case 0:
|
|
@@ -7217,9 +7527,9 @@ var PerpetualsClient = (function () {
|
|
|
7217
7527
|
instructions.push(removeCustodyInstruction);
|
|
7218
7528
|
return [3, 5];
|
|
7219
7529
|
case 4:
|
|
7220
|
-
|
|
7221
|
-
console.log("perpClient removeCustody error:: ",
|
|
7222
|
-
throw
|
|
7530
|
+
err_47 = _a.sent();
|
|
7531
|
+
console.log("perpClient removeCustody error:: ", err_47);
|
|
7532
|
+
throw err_47;
|
|
7223
7533
|
case 5: return [2, {
|
|
7224
7534
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7225
7535
|
additionalSigners: additionalSigners
|
|
@@ -7228,7 +7538,7 @@ var PerpetualsClient = (function () {
|
|
|
7228
7538
|
});
|
|
7229
7539
|
}); };
|
|
7230
7540
|
this.protocolWithdrawFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7231
|
-
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx,
|
|
7541
|
+
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_48;
|
|
7232
7542
|
return __generator(this, function (_a) {
|
|
7233
7543
|
switch (_a.label) {
|
|
7234
7544
|
case 0:
|
|
@@ -7261,9 +7571,9 @@ var PerpetualsClient = (function () {
|
|
|
7261
7571
|
instructions.push(withdrawFeesIx);
|
|
7262
7572
|
return [3, 5];
|
|
7263
7573
|
case 4:
|
|
7264
|
-
|
|
7265
|
-
console.log("perpClient setPool error:: ",
|
|
7266
|
-
throw
|
|
7574
|
+
err_48 = _a.sent();
|
|
7575
|
+
console.log("perpClient setPool error:: ", err_48);
|
|
7576
|
+
throw err_48;
|
|
7267
7577
|
case 5: return [2, {
|
|
7268
7578
|
instructions: __spreadArray([], instructions, true),
|
|
7269
7579
|
additionalSigners: additionalSigners
|
|
@@ -7272,7 +7582,7 @@ var PerpetualsClient = (function () {
|
|
|
7272
7582
|
});
|
|
7273
7583
|
}); };
|
|
7274
7584
|
this.moveProtocolFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7275
|
-
var publicKey, rewardCustodyConfig, instructions, additionalSigners, moveProtocolFeesIx,
|
|
7585
|
+
var publicKey, rewardCustodyConfig, instructions, additionalSigners, moveProtocolFeesIx, err_49;
|
|
7276
7586
|
return __generator(this, function (_a) {
|
|
7277
7587
|
switch (_a.label) {
|
|
7278
7588
|
case 0:
|
|
@@ -7305,9 +7615,9 @@ var PerpetualsClient = (function () {
|
|
|
7305
7615
|
instructions.push(moveProtocolFeesIx);
|
|
7306
7616
|
return [3, 4];
|
|
7307
7617
|
case 3:
|
|
7308
|
-
|
|
7309
|
-
console.log("perpClient setPool error:: ",
|
|
7310
|
-
throw
|
|
7618
|
+
err_49 = _a.sent();
|
|
7619
|
+
console.log("perpClient setPool error:: ", err_49);
|
|
7620
|
+
throw err_49;
|
|
7311
7621
|
case 4: return [2, {
|
|
7312
7622
|
instructions: __spreadArray([], instructions, true),
|
|
7313
7623
|
additionalSigners: additionalSigners
|
|
@@ -7316,7 +7626,7 @@ var PerpetualsClient = (function () {
|
|
|
7316
7626
|
});
|
|
7317
7627
|
}); };
|
|
7318
7628
|
this.setProtocolFeeShareBps = function (feeShareBps, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7319
|
-
var publicKey, setProtocolFeeShareBpsIx,
|
|
7629
|
+
var publicKey, setProtocolFeeShareBpsIx, err_50;
|
|
7320
7630
|
return __generator(this, function (_a) {
|
|
7321
7631
|
switch (_a.label) {
|
|
7322
7632
|
case 0:
|
|
@@ -7336,15 +7646,15 @@ var PerpetualsClient = (function () {
|
|
|
7336
7646
|
setProtocolFeeShareBpsIx = _a.sent();
|
|
7337
7647
|
return [2, setProtocolFeeShareBpsIx];
|
|
7338
7648
|
case 2:
|
|
7339
|
-
|
|
7340
|
-
console.log("perpClient setProtocolFeeShareBpsIx error:: ",
|
|
7341
|
-
throw
|
|
7649
|
+
err_50 = _a.sent();
|
|
7650
|
+
console.log("perpClient setProtocolFeeShareBpsIx error:: ", err_50);
|
|
7651
|
+
throw err_50;
|
|
7342
7652
|
case 3: return [2];
|
|
7343
7653
|
}
|
|
7344
7654
|
});
|
|
7345
7655
|
}); };
|
|
7346
7656
|
this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
|
|
7347
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction,
|
|
7657
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_51;
|
|
7348
7658
|
return __generator(this, function (_a) {
|
|
7349
7659
|
switch (_a.label) {
|
|
7350
7660
|
case 0:
|
|
@@ -7371,9 +7681,9 @@ var PerpetualsClient = (function () {
|
|
|
7371
7681
|
instructions.push(setPermissionsInstruction);
|
|
7372
7682
|
return [3, 4];
|
|
7373
7683
|
case 3:
|
|
7374
|
-
|
|
7375
|
-
console.log("perpClient setPool error:: ",
|
|
7376
|
-
throw
|
|
7684
|
+
err_51 = _a.sent();
|
|
7685
|
+
console.log("perpClient setPool error:: ", err_51);
|
|
7686
|
+
throw err_51;
|
|
7377
7687
|
case 4: return [2, {
|
|
7378
7688
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7379
7689
|
additionalSigners: additionalSigners
|
|
@@ -7382,7 +7692,7 @@ var PerpetualsClient = (function () {
|
|
|
7382
7692
|
});
|
|
7383
7693
|
}); };
|
|
7384
7694
|
this.reimburse = function (tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7385
|
-
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e,
|
|
7695
|
+
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_52;
|
|
7386
7696
|
var _f;
|
|
7387
7697
|
return __generator(this, function (_g) {
|
|
7388
7698
|
switch (_g.label) {
|
|
@@ -7443,9 +7753,9 @@ var PerpetualsClient = (function () {
|
|
|
7443
7753
|
instructions.push(reimburse);
|
|
7444
7754
|
return [3, 5];
|
|
7445
7755
|
case 4:
|
|
7446
|
-
|
|
7447
|
-
console.log("perpClient setPool error:: ",
|
|
7448
|
-
throw
|
|
7756
|
+
err_52 = _g.sent();
|
|
7757
|
+
console.log("perpClient setPool error:: ", err_52);
|
|
7758
|
+
throw err_52;
|
|
7449
7759
|
case 5: return [2, {
|
|
7450
7760
|
instructions: __spreadArray([], instructions, true),
|
|
7451
7761
|
additionalSigners: additionalSigners
|
|
@@ -7454,7 +7764,7 @@ var PerpetualsClient = (function () {
|
|
|
7454
7764
|
});
|
|
7455
7765
|
}); };
|
|
7456
7766
|
this.setInternalOraclePriceBatch = function (useCurrentTime, tokenMintList, tokenInternalPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
|
7457
|
-
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice,
|
|
7767
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_53;
|
|
7458
7768
|
return __generator(this, function (_a) {
|
|
7459
7769
|
switch (_a.label) {
|
|
7460
7770
|
case 0:
|
|
@@ -7495,9 +7805,9 @@ var PerpetualsClient = (function () {
|
|
|
7495
7805
|
instructions.push(setInternalOraclePrice);
|
|
7496
7806
|
return [3, 4];
|
|
7497
7807
|
case 3:
|
|
7498
|
-
|
|
7499
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
|
7500
|
-
throw
|
|
7808
|
+
err_53 = _a.sent();
|
|
7809
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_53);
|
|
7810
|
+
throw err_53;
|
|
7501
7811
|
case 4: return [2, {
|
|
7502
7812
|
instructions: __spreadArray([], instructions, true),
|
|
7503
7813
|
additionalSigners: additionalSigners
|
|
@@ -7506,7 +7816,7 @@ var PerpetualsClient = (function () {
|
|
|
7506
7816
|
});
|
|
7507
7817
|
}); };
|
|
7508
7818
|
this.setInternalLazerPriceBatch = function (messageData, tokenMintList, pythStorage, pythTreasury, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
|
7509
|
-
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalLazerPrice,
|
|
7819
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalLazerPrice, err_54;
|
|
7510
7820
|
return __generator(this, function (_a) {
|
|
7511
7821
|
switch (_a.label) {
|
|
7512
7822
|
case 0:
|
|
@@ -7547,9 +7857,9 @@ var PerpetualsClient = (function () {
|
|
|
7547
7857
|
instructions.push(setInternalLazerPrice);
|
|
7548
7858
|
return [3, 4];
|
|
7549
7859
|
case 3:
|
|
7550
|
-
|
|
7551
|
-
console.log("perpClient setInternalLazerPriceBatch error:: ",
|
|
7552
|
-
throw
|
|
7860
|
+
err_54 = _a.sent();
|
|
7861
|
+
console.log("perpClient setInternalLazerPriceBatch error:: ", err_54);
|
|
7862
|
+
throw err_54;
|
|
7553
7863
|
case 4: return [2, {
|
|
7554
7864
|
instructions: __spreadArray([], instructions, true),
|
|
7555
7865
|
additionalSigners: additionalSigners
|
|
@@ -7558,7 +7868,7 @@ var PerpetualsClient = (function () {
|
|
|
7558
7868
|
});
|
|
7559
7869
|
}); };
|
|
7560
7870
|
this.setInternalOracleEmaPriceBatch = function (tokenMintList, tokenInternalEmaPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
|
7561
|
-
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_3, _i, tokenMintList_3, tokenMint, instructions, additionalSigners, setInternalOraclePrice,
|
|
7871
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_3, _i, tokenMintList_3, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_55;
|
|
7562
7872
|
return __generator(this, function (_a) {
|
|
7563
7873
|
switch (_a.label) {
|
|
7564
7874
|
case 0:
|
|
@@ -7598,9 +7908,9 @@ var PerpetualsClient = (function () {
|
|
|
7598
7908
|
instructions.push(setInternalOraclePrice);
|
|
7599
7909
|
return [3, 4];
|
|
7600
7910
|
case 3:
|
|
7601
|
-
|
|
7602
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
|
7603
|
-
throw
|
|
7911
|
+
err_55 = _a.sent();
|
|
7912
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_55);
|
|
7913
|
+
throw err_55;
|
|
7604
7914
|
case 4: return [2, {
|
|
7605
7915
|
instructions: __spreadArray([], instructions, true),
|
|
7606
7916
|
additionalSigners: additionalSigners
|
|
@@ -7609,7 +7919,7 @@ var PerpetualsClient = (function () {
|
|
|
7609
7919
|
});
|
|
7610
7920
|
}); };
|
|
7611
7921
|
this.setPositionPriceImpact = function (positionPubkey, priceImpactUsd, penaltyAuthority) { return __awaiter(_this, void 0, void 0, function () {
|
|
7612
|
-
var instructions, additionalSigners, setPositionPriceImpactIx,
|
|
7922
|
+
var instructions, additionalSigners, setPositionPriceImpactIx, err_56;
|
|
7613
7923
|
return __generator(this, function (_a) {
|
|
7614
7924
|
switch (_a.label) {
|
|
7615
7925
|
case 0:
|
|
@@ -7633,9 +7943,9 @@ var PerpetualsClient = (function () {
|
|
|
7633
7943
|
instructions.push(setPositionPriceImpactIx);
|
|
7634
7944
|
return [3, 4];
|
|
7635
7945
|
case 3:
|
|
7636
|
-
|
|
7637
|
-
console.log("perpClient setPositionPriceImpact error:: ",
|
|
7638
|
-
throw
|
|
7946
|
+
err_56 = _a.sent();
|
|
7947
|
+
console.log("perpClient setPositionPriceImpact error:: ", err_56);
|
|
7948
|
+
throw err_56;
|
|
7639
7949
|
case 4: return [2, {
|
|
7640
7950
|
instructions: __spreadArray([], instructions, true),
|
|
7641
7951
|
additionalSigners: additionalSigners
|
|
@@ -7644,7 +7954,7 @@ var PerpetualsClient = (function () {
|
|
|
7644
7954
|
});
|
|
7645
7955
|
}); };
|
|
7646
7956
|
this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7647
|
-
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp,
|
|
7957
|
+
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_57;
|
|
7648
7958
|
return __generator(this, function (_a) {
|
|
7649
7959
|
switch (_a.label) {
|
|
7650
7960
|
case 0:
|
|
@@ -7682,8 +7992,8 @@ var PerpetualsClient = (function () {
|
|
|
7682
7992
|
instructions.push(renameFlp);
|
|
7683
7993
|
return [3, 4];
|
|
7684
7994
|
case 3:
|
|
7685
|
-
|
|
7686
|
-
console.log("perpClient renameFlp error:: ",
|
|
7995
|
+
err_57 = _a.sent();
|
|
7996
|
+
console.log("perpClient renameFlp error:: ", err_57);
|
|
7687
7997
|
return [3, 4];
|
|
7688
7998
|
case 4: return [2, {
|
|
7689
7999
|
instructions: __spreadArray([], instructions, true),
|
|
@@ -7693,7 +8003,7 @@ var PerpetualsClient = (function () {
|
|
|
7693
8003
|
});
|
|
7694
8004
|
}); };
|
|
7695
8005
|
this.initStake = function (stakingFeeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7696
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction,
|
|
8006
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_58;
|
|
7697
8007
|
return __generator(this, function (_a) {
|
|
7698
8008
|
switch (_a.label) {
|
|
7699
8009
|
case 0:
|
|
@@ -7731,9 +8041,9 @@ var PerpetualsClient = (function () {
|
|
|
7731
8041
|
instructions.push(initStakeInstruction);
|
|
7732
8042
|
return [3, 4];
|
|
7733
8043
|
case 3:
|
|
7734
|
-
|
|
7735
|
-
console.log("perpClient InitStaking error:: ",
|
|
7736
|
-
throw
|
|
8044
|
+
err_58 = _a.sent();
|
|
8045
|
+
console.log("perpClient InitStaking error:: ", err_58);
|
|
8046
|
+
throw err_58;
|
|
7737
8047
|
case 4: return [2, {
|
|
7738
8048
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7739
8049
|
additionalSigners: additionalSigners
|
|
@@ -7742,7 +8052,7 @@ var PerpetualsClient = (function () {
|
|
|
7742
8052
|
});
|
|
7743
8053
|
}); };
|
|
7744
8054
|
this.initCompounding = function (feeShareBps, metadataTitle, metadataSymbol, metadataUri, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7745
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction,
|
|
8055
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_59;
|
|
7746
8056
|
return __generator(this, function (_a) {
|
|
7747
8057
|
switch (_a.label) {
|
|
7748
8058
|
case 0:
|
|
@@ -7786,9 +8096,9 @@ var PerpetualsClient = (function () {
|
|
|
7786
8096
|
instructions.push(initCompoundingInstruction);
|
|
7787
8097
|
return [3, 4];
|
|
7788
8098
|
case 3:
|
|
7789
|
-
|
|
7790
|
-
console.log("perpClient initCompounding error:: ",
|
|
7791
|
-
throw
|
|
8099
|
+
err_59 = _a.sent();
|
|
8100
|
+
console.log("perpClient initCompounding error:: ", err_59);
|
|
8101
|
+
throw err_59;
|
|
7792
8102
|
case 4: return [2, {
|
|
7793
8103
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7794
8104
|
additionalSigners: additionalSigners
|
|
@@ -7797,7 +8107,7 @@ var PerpetualsClient = (function () {
|
|
|
7797
8107
|
});
|
|
7798
8108
|
}); };
|
|
7799
8109
|
this.initTokenVault = function (token_permissions, tokens_to_distribute, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7800
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction,
|
|
8110
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_60;
|
|
7801
8111
|
return __generator(this, function (_a) {
|
|
7802
8112
|
switch (_a.label) {
|
|
7803
8113
|
case 0:
|
|
@@ -7838,9 +8148,9 @@ var PerpetualsClient = (function () {
|
|
|
7838
8148
|
instructions.push(initTokenVaultInstruction);
|
|
7839
8149
|
return [3, 4];
|
|
7840
8150
|
case 3:
|
|
7841
|
-
|
|
7842
|
-
console.log("perpClient InitTokenVaultInstruction error:: ",
|
|
7843
|
-
throw
|
|
8151
|
+
err_60 = _a.sent();
|
|
8152
|
+
console.log("perpClient InitTokenVaultInstruction error:: ", err_60);
|
|
8153
|
+
throw err_60;
|
|
7844
8154
|
case 4: return [2, {
|
|
7845
8155
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7846
8156
|
additionalSigners: additionalSigners
|
|
@@ -7849,7 +8159,7 @@ var PerpetualsClient = (function () {
|
|
|
7849
8159
|
});
|
|
7850
8160
|
}); };
|
|
7851
8161
|
this.setTokenVaultConfig = function (token_permissions, withdrawTimeLimit, withdrawInstantFee, stakeLevel, unlockPeriod, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7852
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction,
|
|
8162
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_61;
|
|
7853
8163
|
return __generator(this, function (_a) {
|
|
7854
8164
|
switch (_a.label) {
|
|
7855
8165
|
case 0:
|
|
@@ -7881,9 +8191,9 @@ var PerpetualsClient = (function () {
|
|
|
7881
8191
|
instructions.push(setTokenVaultConfigInstruction);
|
|
7882
8192
|
return [3, 4];
|
|
7883
8193
|
case 3:
|
|
7884
|
-
|
|
7885
|
-
console.log("perpClient setTokenVaultConfigInstruction error:: ",
|
|
7886
|
-
throw
|
|
8194
|
+
err_61 = _a.sent();
|
|
8195
|
+
console.log("perpClient setTokenVaultConfigInstruction error:: ", err_61);
|
|
8196
|
+
throw err_61;
|
|
7887
8197
|
case 4: return [2, {
|
|
7888
8198
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7889
8199
|
additionalSigners: additionalSigners
|
|
@@ -7892,7 +8202,7 @@ var PerpetualsClient = (function () {
|
|
|
7892
8202
|
});
|
|
7893
8203
|
}); };
|
|
7894
8204
|
this.withdrawInstantFee = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7895
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction,
|
|
8205
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_62;
|
|
7896
8206
|
return __generator(this, function (_a) {
|
|
7897
8207
|
switch (_a.label) {
|
|
7898
8208
|
case 0:
|
|
@@ -7931,9 +8241,9 @@ var PerpetualsClient = (function () {
|
|
|
7931
8241
|
instructions.push(withdrawInstantFeeInstruction);
|
|
7932
8242
|
return [3, 6];
|
|
7933
8243
|
case 5:
|
|
7934
|
-
|
|
7935
|
-
console.log("perpClient withdrawInstantFeeInstruction error:: ",
|
|
7936
|
-
throw
|
|
8244
|
+
err_62 = _a.sent();
|
|
8245
|
+
console.log("perpClient withdrawInstantFeeInstruction error:: ", err_62);
|
|
8246
|
+
throw err_62;
|
|
7937
8247
|
case 6: return [2, {
|
|
7938
8248
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7939
8249
|
additionalSigners: additionalSigners
|
|
@@ -7942,7 +8252,7 @@ var PerpetualsClient = (function () {
|
|
|
7942
8252
|
});
|
|
7943
8253
|
}); };
|
|
7944
8254
|
this.withdrawUnclaimedTokens = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7945
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction,
|
|
8255
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction, err_63;
|
|
7946
8256
|
return __generator(this, function (_a) {
|
|
7947
8257
|
switch (_a.label) {
|
|
7948
8258
|
case 0:
|
|
@@ -7981,9 +8291,9 @@ var PerpetualsClient = (function () {
|
|
|
7981
8291
|
instructions.push(withdrawUnclaimedTokensInstruction);
|
|
7982
8292
|
return [3, 6];
|
|
7983
8293
|
case 5:
|
|
7984
|
-
|
|
7985
|
-
console.log("perpClient withdrawUnclaimedTokensInstruction error:: ",
|
|
7986
|
-
throw
|
|
8294
|
+
err_63 = _a.sent();
|
|
8295
|
+
console.log("perpClient withdrawUnclaimedTokensInstruction error:: ", err_63);
|
|
8296
|
+
throw err_63;
|
|
7987
8297
|
case 6: return [2, {
|
|
7988
8298
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7989
8299
|
additionalSigners: additionalSigners
|
|
@@ -7992,7 +8302,7 @@ var PerpetualsClient = (function () {
|
|
|
7992
8302
|
});
|
|
7993
8303
|
}); };
|
|
7994
8304
|
this.initRevenueTokenAccount = function (feeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7995
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction,
|
|
8305
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_64;
|
|
7996
8306
|
return __generator(this, function (_a) {
|
|
7997
8307
|
switch (_a.label) {
|
|
7998
8308
|
case 0:
|
|
@@ -8029,9 +8339,9 @@ var PerpetualsClient = (function () {
|
|
|
8029
8339
|
instructions.push(initRevenueTokenAccountInstruction);
|
|
8030
8340
|
return [3, 4];
|
|
8031
8341
|
case 3:
|
|
8032
|
-
|
|
8033
|
-
console.log("perpClient initRevenueTokenAccountInstruction error:: ",
|
|
8034
|
-
throw
|
|
8342
|
+
err_64 = _a.sent();
|
|
8343
|
+
console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_64);
|
|
8344
|
+
throw err_64;
|
|
8035
8345
|
case 4: return [2, {
|
|
8036
8346
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8037
8347
|
additionalSigners: additionalSigners
|
|
@@ -8040,7 +8350,7 @@ var PerpetualsClient = (function () {
|
|
|
8040
8350
|
});
|
|
8041
8351
|
}); };
|
|
8042
8352
|
this.initRebateVault = function (allowRebatePayout, rebateSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8043
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateCustodyMint, initRebateVaultInstruction,
|
|
8353
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateCustodyMint, initRebateVaultInstruction, err_65;
|
|
8044
8354
|
return __generator(this, function (_a) {
|
|
8045
8355
|
switch (_a.label) {
|
|
8046
8356
|
case 0:
|
|
@@ -8075,9 +8385,9 @@ var PerpetualsClient = (function () {
|
|
|
8075
8385
|
instructions.push(initRebateVaultInstruction);
|
|
8076
8386
|
return [3, 4];
|
|
8077
8387
|
case 3:
|
|
8078
|
-
|
|
8079
|
-
console.log("perpClient initRebateVaultInstruction error:: ",
|
|
8080
|
-
throw
|
|
8388
|
+
err_65 = _a.sent();
|
|
8389
|
+
console.log("perpClient initRebateVaultInstruction error:: ", err_65);
|
|
8390
|
+
throw err_65;
|
|
8081
8391
|
case 4: return [2, {
|
|
8082
8392
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8083
8393
|
additionalSigners: additionalSigners
|
|
@@ -8086,7 +8396,7 @@ var PerpetualsClient = (function () {
|
|
|
8086
8396
|
});
|
|
8087
8397
|
}); };
|
|
8088
8398
|
this.distributeTokenReward = function (amount, epochCount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8089
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction,
|
|
8399
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_66;
|
|
8090
8400
|
return __generator(this, function (_a) {
|
|
8091
8401
|
switch (_a.label) {
|
|
8092
8402
|
case 0:
|
|
@@ -8123,9 +8433,9 @@ var PerpetualsClient = (function () {
|
|
|
8123
8433
|
instructions.push(distributeTokenRewardInstruction);
|
|
8124
8434
|
return [3, 4];
|
|
8125
8435
|
case 3:
|
|
8126
|
-
|
|
8127
|
-
console.log("perpClient distributeTokenRewardInstruction error:: ",
|
|
8128
|
-
throw
|
|
8436
|
+
err_66 = _a.sent();
|
|
8437
|
+
console.log("perpClient distributeTokenRewardInstruction error:: ", err_66);
|
|
8438
|
+
throw err_66;
|
|
8129
8439
|
case 4: return [2, {
|
|
8130
8440
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8131
8441
|
additionalSigners: additionalSigners
|
|
@@ -8134,7 +8444,7 @@ var PerpetualsClient = (function () {
|
|
|
8134
8444
|
});
|
|
8135
8445
|
}); };
|
|
8136
8446
|
this.setTokenStakeLevel = function (owner, stakeLevel, isInitialized) { return __awaiter(_this, void 0, void 0, function () {
|
|
8137
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction,
|
|
8447
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_67;
|
|
8138
8448
|
return __generator(this, function (_a) {
|
|
8139
8449
|
switch (_a.label) {
|
|
8140
8450
|
case 0:
|
|
@@ -8163,9 +8473,9 @@ var PerpetualsClient = (function () {
|
|
|
8163
8473
|
instructions.push(setTokenStakeLevelInstruction);
|
|
8164
8474
|
return [3, 4];
|
|
8165
8475
|
case 3:
|
|
8166
|
-
|
|
8167
|
-
console.log("perpClient setTokenStakeLevelInstruction error:: ",
|
|
8168
|
-
throw
|
|
8476
|
+
err_67 = _a.sent();
|
|
8477
|
+
console.log("perpClient setTokenStakeLevelInstruction error:: ", err_67);
|
|
8478
|
+
throw err_67;
|
|
8169
8479
|
case 4: return [2, {
|
|
8170
8480
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8171
8481
|
additionalSigners: additionalSigners
|
|
@@ -8174,7 +8484,7 @@ var PerpetualsClient = (function () {
|
|
|
8174
8484
|
});
|
|
8175
8485
|
}); };
|
|
8176
8486
|
this.setTokenReward = function (owner, amount, epochCount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8177
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction,
|
|
8487
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_68;
|
|
8178
8488
|
return __generator(this, function (_a) {
|
|
8179
8489
|
switch (_a.label) {
|
|
8180
8490
|
case 0:
|
|
@@ -8205,9 +8515,9 @@ var PerpetualsClient = (function () {
|
|
|
8205
8515
|
instructions.push(setTokenRewardInstruction);
|
|
8206
8516
|
return [3, 4];
|
|
8207
8517
|
case 3:
|
|
8208
|
-
|
|
8209
|
-
console.log("perpClient setTokenRewardInstruction error:: ",
|
|
8210
|
-
throw
|
|
8518
|
+
err_68 = _a.sent();
|
|
8519
|
+
console.log("perpClient setTokenRewardInstruction error:: ", err_68);
|
|
8520
|
+
throw err_68;
|
|
8211
8521
|
case 4: return [2, {
|
|
8212
8522
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8213
8523
|
additionalSigners: additionalSigners
|
|
@@ -8216,7 +8526,7 @@ var PerpetualsClient = (function () {
|
|
|
8216
8526
|
});
|
|
8217
8527
|
}); };
|
|
8218
8528
|
this.resizeInternalOracle = function (lazerFeedId, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
|
|
8219
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction,
|
|
8529
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction, err_69;
|
|
8220
8530
|
return __generator(this, function (_a) {
|
|
8221
8531
|
switch (_a.label) {
|
|
8222
8532
|
case 0:
|
|
@@ -8245,9 +8555,9 @@ var PerpetualsClient = (function () {
|
|
|
8245
8555
|
instructions.push(resizeInternalOracleInstruction);
|
|
8246
8556
|
return [3, 4];
|
|
8247
8557
|
case 3:
|
|
8248
|
-
|
|
8249
|
-
console.log("perpClient resizeInternalOracleInstruction error:: ",
|
|
8250
|
-
throw
|
|
8558
|
+
err_69 = _a.sent();
|
|
8559
|
+
console.log("perpClient resizeInternalOracleInstruction error:: ", err_69);
|
|
8560
|
+
throw err_69;
|
|
8251
8561
|
case 4: return [2, {
|
|
8252
8562
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8253
8563
|
additionalSigners: additionalSigners
|
|
@@ -8256,7 +8566,7 @@ var PerpetualsClient = (function () {
|
|
|
8256
8566
|
});
|
|
8257
8567
|
}); };
|
|
8258
8568
|
this.createWhitelist = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
|
|
8259
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction,
|
|
8569
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction, err_70;
|
|
8260
8570
|
return __generator(this, function (_a) {
|
|
8261
8571
|
switch (_a.label) {
|
|
8262
8572
|
case 0:
|
|
@@ -8289,9 +8599,9 @@ var PerpetualsClient = (function () {
|
|
|
8289
8599
|
instructions.push(createWhitelistInstruction);
|
|
8290
8600
|
return [3, 4];
|
|
8291
8601
|
case 3:
|
|
8292
|
-
|
|
8293
|
-
console.log("perpClient createWhitelistInstruction error:: ",
|
|
8294
|
-
throw
|
|
8602
|
+
err_70 = _a.sent();
|
|
8603
|
+
console.log("perpClient createWhitelistInstruction error:: ", err_70);
|
|
8604
|
+
throw err_70;
|
|
8295
8605
|
case 4: return [2, {
|
|
8296
8606
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8297
8607
|
additionalSigners: additionalSigners
|
|
@@ -8300,7 +8610,7 @@ var PerpetualsClient = (function () {
|
|
|
8300
8610
|
});
|
|
8301
8611
|
}); };
|
|
8302
8612
|
this.setWhitelistConfig = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
|
|
8303
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction,
|
|
8613
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction, err_71;
|
|
8304
8614
|
return __generator(this, function (_a) {
|
|
8305
8615
|
switch (_a.label) {
|
|
8306
8616
|
case 0:
|
|
@@ -8333,9 +8643,9 @@ var PerpetualsClient = (function () {
|
|
|
8333
8643
|
instructions.push(setWhitelistConfigInstruction);
|
|
8334
8644
|
return [3, 4];
|
|
8335
8645
|
case 3:
|
|
8336
|
-
|
|
8337
|
-
console.log("perpClient setWhitelistConfigInstruction error:: ",
|
|
8338
|
-
throw
|
|
8646
|
+
err_71 = _a.sent();
|
|
8647
|
+
console.log("perpClient setWhitelistConfigInstruction error:: ", err_71);
|
|
8648
|
+
throw err_71;
|
|
8339
8649
|
case 4: return [2, {
|
|
8340
8650
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8341
8651
|
additionalSigners: additionalSigners
|
|
@@ -8344,7 +8654,7 @@ var PerpetualsClient = (function () {
|
|
|
8344
8654
|
});
|
|
8345
8655
|
}); };
|
|
8346
8656
|
this.setPerpetualsConfig = function (allowUngatedTrading, voltageMultiplier, tradingDiscount, referralRebate, defaultRebate, tradeLimit, triggerOrderLimit, rebateLimitUsd) { return __awaiter(_this, void 0, void 0, function () {
|
|
8347
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPerpetualsConfigInstruction,
|
|
8657
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPerpetualsConfigInstruction, err_72;
|
|
8348
8658
|
return __generator(this, function (_a) {
|
|
8349
8659
|
switch (_a.label) {
|
|
8350
8660
|
case 0:
|
|
@@ -8378,9 +8688,9 @@ var PerpetualsClient = (function () {
|
|
|
8378
8688
|
instructions.push(setPerpetualsConfigInstruction);
|
|
8379
8689
|
return [3, 4];
|
|
8380
8690
|
case 3:
|
|
8381
|
-
|
|
8382
|
-
console.log("perpClient setPerpetualsConfigInstruction error:: ",
|
|
8383
|
-
throw
|
|
8691
|
+
err_72 = _a.sent();
|
|
8692
|
+
console.log("perpClient setPerpetualsConfigInstruction error:: ", err_72);
|
|
8693
|
+
throw err_72;
|
|
8384
8694
|
case 4: return [2, {
|
|
8385
8695
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8386
8696
|
additionalSigners: additionalSigners
|
|
@@ -8389,7 +8699,7 @@ var PerpetualsClient = (function () {
|
|
|
8389
8699
|
});
|
|
8390
8700
|
}); };
|
|
8391
8701
|
this.setPoolConfig = function (name, permissions, maxAumUsd, oracleAuthority, stakingFeeShareBps, vpVolumeFactor, stakingFeeBoostBps, minLpPriceUsd, maxLpPriceUsd, thresholdUsd) { return __awaiter(_this, void 0, void 0, function () {
|
|
8392
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPoolConfigInstruction,
|
|
8702
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPoolConfigInstruction, err_73;
|
|
8393
8703
|
return __generator(this, function (_a) {
|
|
8394
8704
|
switch (_a.label) {
|
|
8395
8705
|
case 0:
|
|
@@ -8417,9 +8727,9 @@ var PerpetualsClient = (function () {
|
|
|
8417
8727
|
instructions.push(setPoolConfigInstruction);
|
|
8418
8728
|
return [3, 4];
|
|
8419
8729
|
case 3:
|
|
8420
|
-
|
|
8421
|
-
console.log("perpClient setPoolConfigInstruction error:: ",
|
|
8422
|
-
throw
|
|
8730
|
+
err_73 = _a.sent();
|
|
8731
|
+
console.log("perpClient setPoolConfigInstruction error:: ", err_73);
|
|
8732
|
+
throw err_73;
|
|
8423
8733
|
case 4: return [2, {
|
|
8424
8734
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8425
8735
|
additionalSigners: additionalSigners
|
|
@@ -8428,7 +8738,7 @@ var PerpetualsClient = (function () {
|
|
|
8428
8738
|
});
|
|
8429
8739
|
}); };
|
|
8430
8740
|
this.addCustodyToken22 = function (poolName, tokenMint, tokenAccountSpace, token22) { return __awaiter(_this, void 0, void 0, function () {
|
|
8431
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, addCustodyToken22Instruction,
|
|
8741
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, addCustodyToken22Instruction, err_74;
|
|
8432
8742
|
return __generator(this, function (_a) {
|
|
8433
8743
|
switch (_a.label) {
|
|
8434
8744
|
case 0:
|
|
@@ -8462,9 +8772,9 @@ var PerpetualsClient = (function () {
|
|
|
8462
8772
|
instructions.push(addCustodyToken22Instruction);
|
|
8463
8773
|
return [3, 4];
|
|
8464
8774
|
case 3:
|
|
8465
|
-
|
|
8466
|
-
console.log("perpClient addCustodyToken22Instruction error:: ",
|
|
8467
|
-
throw
|
|
8775
|
+
err_74 = _a.sent();
|
|
8776
|
+
console.log("perpClient addCustodyToken22Instruction error:: ", err_74);
|
|
8777
|
+
throw err_74;
|
|
8468
8778
|
case 4: return [2, {
|
|
8469
8779
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8470
8780
|
additionalSigners: additionalSigners
|
|
@@ -8473,7 +8783,7 @@ var PerpetualsClient = (function () {
|
|
|
8473
8783
|
});
|
|
8474
8784
|
}); };
|
|
8475
8785
|
this.addMarket = function (poolName, targetCustody, collateralCustody, side, correlation, maxPayoffBps, permissions) { return __awaiter(_this, void 0, void 0, function () {
|
|
8476
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, market, addMarketInstruction,
|
|
8786
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, market, addMarketInstruction, err_75;
|
|
8477
8787
|
return __generator(this, function (_a) {
|
|
8478
8788
|
switch (_a.label) {
|
|
8479
8789
|
case 0:
|
|
@@ -8516,9 +8826,9 @@ var PerpetualsClient = (function () {
|
|
|
8516
8826
|
instructions.push(addMarketInstruction);
|
|
8517
8827
|
return [3, 4];
|
|
8518
8828
|
case 3:
|
|
8519
|
-
|
|
8520
|
-
console.log("perpClient addMarketInstruction error:: ",
|
|
8521
|
-
throw
|
|
8829
|
+
err_75 = _a.sent();
|
|
8830
|
+
console.log("perpClient addMarketInstruction error:: ", err_75);
|
|
8831
|
+
throw err_75;
|
|
8522
8832
|
case 4: return [2, {
|
|
8523
8833
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8524
8834
|
additionalSigners: additionalSigners
|
|
@@ -8527,7 +8837,7 @@ var PerpetualsClient = (function () {
|
|
|
8527
8837
|
});
|
|
8528
8838
|
}); };
|
|
8529
8839
|
this.setCustody = function (poolName, tokenMint, isVirtual, depegAdjustment, inversePrice, oracle, pricingConfig, permissions, fees, borrowRate, ratios, rewardThreshold, minReserveUsd, limitPriceBufferBps, token22) { return __awaiter(_this, void 0, void 0, function () {
|
|
8530
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setCustodyConfigInstruction,
|
|
8840
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setCustodyConfigInstruction, err_76;
|
|
8531
8841
|
return __generator(this, function (_a) {
|
|
8532
8842
|
switch (_a.label) {
|
|
8533
8843
|
case 0:
|
|
@@ -8570,9 +8880,9 @@ var PerpetualsClient = (function () {
|
|
|
8570
8880
|
instructions.push(setCustodyConfigInstruction);
|
|
8571
8881
|
return [3, 4];
|
|
8572
8882
|
case 3:
|
|
8573
|
-
|
|
8574
|
-
console.log("perpClient setCustodyConfigInstruction error:: ",
|
|
8575
|
-
throw
|
|
8883
|
+
err_76 = _a.sent();
|
|
8884
|
+
console.log("perpClient setCustodyConfigInstruction error:: ", err_76);
|
|
8885
|
+
throw err_76;
|
|
8576
8886
|
case 4: return [2, {
|
|
8577
8887
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8578
8888
|
additionalSigners: additionalSigners
|
|
@@ -8581,7 +8891,7 @@ var PerpetualsClient = (function () {
|
|
|
8581
8891
|
});
|
|
8582
8892
|
}); };
|
|
8583
8893
|
this.addInternalOracle = function (exponent, lazerFeedId, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
|
|
8584
|
-
var preInstructions, instructions, postInstructions, additionalSigners, addInternalOracleInstruction,
|
|
8894
|
+
var preInstructions, instructions, postInstructions, additionalSigners, addInternalOracleInstruction, err_77;
|
|
8585
8895
|
return __generator(this, function (_a) {
|
|
8586
8896
|
switch (_a.label) {
|
|
8587
8897
|
case 0:
|
|
@@ -8611,9 +8921,9 @@ var PerpetualsClient = (function () {
|
|
|
8611
8921
|
instructions.push(addInternalOracleInstruction);
|
|
8612
8922
|
return [3, 4];
|
|
8613
8923
|
case 3:
|
|
8614
|
-
|
|
8615
|
-
console.log("perpClient setCustodyConfigInstruction error:: ",
|
|
8616
|
-
throw
|
|
8924
|
+
err_77 = _a.sent();
|
|
8925
|
+
console.log("perpClient setCustodyConfigInstruction error:: ", err_77);
|
|
8926
|
+
throw err_77;
|
|
8617
8927
|
case 4: return [2, {
|
|
8618
8928
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8619
8929
|
additionalSigners: additionalSigners
|
|
@@ -8622,7 +8932,7 @@ var PerpetualsClient = (function () {
|
|
|
8622
8932
|
});
|
|
8623
8933
|
}); };
|
|
8624
8934
|
this.setMarket = function (poolName, targetCustody, collateralCustody, marketAccount, maxPayoffBps, permissions, correlation) { return __awaiter(_this, void 0, void 0, function () {
|
|
8625
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setMarketConfigInstruction,
|
|
8935
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setMarketConfigInstruction, err_78;
|
|
8626
8936
|
return __generator(this, function (_a) {
|
|
8627
8937
|
switch (_a.label) {
|
|
8628
8938
|
case 0:
|
|
@@ -8653,9 +8963,9 @@ var PerpetualsClient = (function () {
|
|
|
8653
8963
|
instructions.push(setMarketConfigInstruction);
|
|
8654
8964
|
return [3, 4];
|
|
8655
8965
|
case 3:
|
|
8656
|
-
|
|
8657
|
-
console.log("perpClient setCustodyConfigInstruction error:: ",
|
|
8658
|
-
throw
|
|
8966
|
+
err_78 = _a.sent();
|
|
8967
|
+
console.log("perpClient setCustodyConfigInstruction error:: ", err_78);
|
|
8968
|
+
throw err_78;
|
|
8659
8969
|
case 4: return [2, {
|
|
8660
8970
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8661
8971
|
additionalSigners: additionalSigners
|
|
@@ -8664,7 +8974,7 @@ var PerpetualsClient = (function () {
|
|
|
8664
8974
|
});
|
|
8665
8975
|
}); };
|
|
8666
8976
|
this.removeMarket = function (poolName, market, targetMint, collateralMint) { return __awaiter(_this, void 0, void 0, function () {
|
|
8667
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, removeMarketInstruction,
|
|
8977
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, removeMarketInstruction, err_79;
|
|
8668
8978
|
return __generator(this, function (_a) {
|
|
8669
8979
|
switch (_a.label) {
|
|
8670
8980
|
case 0:
|
|
@@ -8696,9 +9006,9 @@ var PerpetualsClient = (function () {
|
|
|
8696
9006
|
instructions.push(removeMarketInstruction);
|
|
8697
9007
|
return [3, 4];
|
|
8698
9008
|
case 3:
|
|
8699
|
-
|
|
8700
|
-
console.log("perpClient setCustodyConfigInstruction error:: ",
|
|
8701
|
-
throw
|
|
9009
|
+
err_79 = _a.sent();
|
|
9010
|
+
console.log("perpClient setCustodyConfigInstruction error:: ", err_79);
|
|
9011
|
+
throw err_79;
|
|
8702
9012
|
case 4: return [2, {
|
|
8703
9013
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8704
9014
|
additionalSigners: additionalSigners
|
|
@@ -8707,7 +9017,7 @@ var PerpetualsClient = (function () {
|
|
|
8707
9017
|
});
|
|
8708
9018
|
}); };
|
|
8709
9019
|
this.refreshPositionsStatus = function (positionAccounts) { return __awaiter(_this, void 0, void 0, function () {
|
|
8710
|
-
var instructions, additionalSigners, remainingAccounts, refreshInstruction,
|
|
9020
|
+
var instructions, additionalSigners, remainingAccounts, refreshInstruction, err_80;
|
|
8711
9021
|
return __generator(this, function (_a) {
|
|
8712
9022
|
switch (_a.label) {
|
|
8713
9023
|
case 0:
|
|
@@ -8734,9 +9044,9 @@ var PerpetualsClient = (function () {
|
|
|
8734
9044
|
instructions.push(refreshInstruction);
|
|
8735
9045
|
return [3, 4];
|
|
8736
9046
|
case 3:
|
|
8737
|
-
|
|
8738
|
-
console.log("perpClient refreshPositionsStatus error:: ",
|
|
8739
|
-
throw
|
|
9047
|
+
err_80 = _a.sent();
|
|
9048
|
+
console.log("perpClient refreshPositionsStatus error:: ", err_80);
|
|
9049
|
+
throw err_80;
|
|
8740
9050
|
case 4: return [2, {
|
|
8741
9051
|
instructions: __spreadArray([], instructions, true),
|
|
8742
9052
|
additionalSigners: additionalSigners
|
|
@@ -8745,7 +9055,7 @@ var PerpetualsClient = (function () {
|
|
|
8745
9055
|
});
|
|
8746
9056
|
}); };
|
|
8747
9057
|
this.refreshOrdersStatus = function (orderAccounts) { return __awaiter(_this, void 0, void 0, function () {
|
|
8748
|
-
var instructions, additionalSigners, remainingAccounts, refreshInstruction,
|
|
9058
|
+
var instructions, additionalSigners, remainingAccounts, refreshInstruction, err_81;
|
|
8749
9059
|
return __generator(this, function (_a) {
|
|
8750
9060
|
switch (_a.label) {
|
|
8751
9061
|
case 0:
|
|
@@ -8772,9 +9082,9 @@ var PerpetualsClient = (function () {
|
|
|
8772
9082
|
instructions.push(refreshInstruction);
|
|
8773
9083
|
return [3, 4];
|
|
8774
9084
|
case 3:
|
|
8775
|
-
|
|
8776
|
-
console.log("perpClient refreshOrdersStatus error:: ",
|
|
8777
|
-
throw
|
|
9085
|
+
err_81 = _a.sent();
|
|
9086
|
+
console.log("perpClient refreshOrdersStatus error:: ", err_81);
|
|
9087
|
+
throw err_81;
|
|
8778
9088
|
case 4: return [2, {
|
|
8779
9089
|
instructions: __spreadArray([], instructions, true),
|
|
8780
9090
|
additionalSigners: additionalSigners
|
|
@@ -8783,7 +9093,7 @@ var PerpetualsClient = (function () {
|
|
|
8783
9093
|
});
|
|
8784
9094
|
}); };
|
|
8785
9095
|
this.migrateMarketPosition = function (poolName, oldMarket, newMarket, oldCollateralCustody, newCollateralCustody, owner) { return __awaiter(_this, void 0, void 0, function () {
|
|
8786
|
-
var preInstructions, instructions, postInstructions, additionalSigners, oldPosition, newPosition, oldCollateralCustodyAccount, newCollateralCustodyAccount, migrateMarketPositionInstruction,
|
|
9096
|
+
var preInstructions, instructions, postInstructions, additionalSigners, oldPosition, newPosition, oldCollateralCustodyAccount, newCollateralCustodyAccount, migrateMarketPositionInstruction, err_82;
|
|
8787
9097
|
return __generator(this, function (_a) {
|
|
8788
9098
|
switch (_a.label) {
|
|
8789
9099
|
case 0:
|
|
@@ -8834,9 +9144,9 @@ var PerpetualsClient = (function () {
|
|
|
8834
9144
|
instructions.push(migrateMarketPositionInstruction);
|
|
8835
9145
|
return [3, 6];
|
|
8836
9146
|
case 5:
|
|
8837
|
-
|
|
8838
|
-
console.log("perpClient migrateMarketPosition error:: ",
|
|
8839
|
-
throw
|
|
9147
|
+
err_82 = _a.sent();
|
|
9148
|
+
console.log("perpClient migrateMarketPosition error:: ", err_82);
|
|
9149
|
+
throw err_82;
|
|
8840
9150
|
case 6: return [2, {
|
|
8841
9151
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8842
9152
|
additionalSigners: additionalSigners
|
|
@@ -8850,7 +9160,7 @@ var PerpetualsClient = (function () {
|
|
|
8850
9160
|
args_1[_i - 5] = arguments[_i];
|
|
8851
9161
|
}
|
|
8852
9162
|
return __awaiter(_this, __spreadArray([poolName_1, oldMarket_1, newMarket_1, oldCollateralCustody_1, newCollateralCustody_1], args_1, true), void 0, function (poolName, oldMarket, newMarket, oldCollateralCustody, newCollateralCustody, owner) {
|
|
8853
|
-
var preInstructions, instructions, postInstructions, additionalSigners, oldOrder, newOrder, migrateMarketOrderInstruction,
|
|
9163
|
+
var preInstructions, instructions, postInstructions, additionalSigners, oldOrder, newOrder, migrateMarketOrderInstruction, err_83;
|
|
8854
9164
|
if (owner === void 0) { owner = this.provider.wallet.publicKey; }
|
|
8855
9165
|
return __generator(this, function (_a) {
|
|
8856
9166
|
switch (_a.label) {
|
|
@@ -8892,9 +9202,9 @@ var PerpetualsClient = (function () {
|
|
|
8892
9202
|
instructions.push(migrateMarketOrderInstruction);
|
|
8893
9203
|
return [3, 4];
|
|
8894
9204
|
case 3:
|
|
8895
|
-
|
|
8896
|
-
console.log("perpClient migrateMarketOrder error:: ",
|
|
8897
|
-
throw
|
|
9205
|
+
err_83 = _a.sent();
|
|
9206
|
+
console.log("perpClient migrateMarketOrder error:: ", err_83);
|
|
9207
|
+
throw err_83;
|
|
8898
9208
|
case 4: return [2, {
|
|
8899
9209
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8900
9210
|
additionalSigners: additionalSigners
|
|
@@ -8904,7 +9214,7 @@ var PerpetualsClient = (function () {
|
|
|
8904
9214
|
});
|
|
8905
9215
|
};
|
|
8906
9216
|
this.forceSettlePosition = function (market, owner, receivingAccount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8907
|
-
var instructions, additionalSigners, marketAccount, targetCustody_1, collateralCustody_1, targetCustodyConfig, collateralCustodyConfig, positionAccount, orderAccount, remainingAccounts, orderAccountInfo, forceSettlePositionIx,
|
|
9217
|
+
var instructions, additionalSigners, marketAccount, targetCustody_1, collateralCustody_1, targetCustodyConfig, collateralCustodyConfig, positionAccount, orderAccount, remainingAccounts, orderAccountInfo, forceSettlePositionIx, err_84;
|
|
8908
9218
|
return __generator(this, function (_a) {
|
|
8909
9219
|
switch (_a.label) {
|
|
8910
9220
|
case 0:
|
|
@@ -8968,9 +9278,9 @@ var PerpetualsClient = (function () {
|
|
|
8968
9278
|
instructions.push(forceSettlePositionIx);
|
|
8969
9279
|
return [3, 6];
|
|
8970
9280
|
case 5:
|
|
8971
|
-
|
|
8972
|
-
console.log("perpClient forceSettlePosition error:: ",
|
|
8973
|
-
throw
|
|
9281
|
+
err_84 = _a.sent();
|
|
9282
|
+
console.log("perpClient forceSettlePosition error:: ", err_84);
|
|
9283
|
+
throw err_84;
|
|
8974
9284
|
case 6: return [2, {
|
|
8975
9285
|
instructions: __spreadArray([], instructions, true),
|
|
8976
9286
|
additionalSigners: additionalSigners
|
|
@@ -8979,7 +9289,7 @@ var PerpetualsClient = (function () {
|
|
|
8979
9289
|
});
|
|
8980
9290
|
}); };
|
|
8981
9291
|
this.forceSettleOrder = function (market, owner, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8982
|
-
var instructions, additionalSigners, marketAccount, targetCustody, orderKey, orderAccount, uidToCustodyConfig, _i, _a, custodyConfig, custody, _b, activeLimitOrders, uniqueUids, _c, uniqueUids_1, uid, reserveCustodyConfig, isToken2022, receivingAccount, forceSettleOrderIx, reserveCustodyConfig, isToken2022, receivingAccount, forceSettleOrderIx,
|
|
9292
|
+
var instructions, additionalSigners, marketAccount, targetCustody, orderKey, orderAccount, uidToCustodyConfig, _i, _a, custodyConfig, custody, _b, activeLimitOrders, uniqueUids, _c, uniqueUids_1, uid, reserveCustodyConfig, isToken2022, receivingAccount, forceSettleOrderIx, reserveCustodyConfig, isToken2022, receivingAccount, forceSettleOrderIx, err_85;
|
|
8983
9293
|
return __generator(this, function (_d) {
|
|
8984
9294
|
switch (_d.label) {
|
|
8985
9295
|
case 0:
|
|
@@ -9092,9 +9402,9 @@ var PerpetualsClient = (function () {
|
|
|
9092
9402
|
_d.label = 15;
|
|
9093
9403
|
case 15: return [3, 17];
|
|
9094
9404
|
case 16:
|
|
9095
|
-
|
|
9096
|
-
console.log("perpClient forceSettleOrder error:: ",
|
|
9097
|
-
throw
|
|
9405
|
+
err_85 = _d.sent();
|
|
9406
|
+
console.log("perpClient forceSettleOrder error:: ", err_85);
|
|
9407
|
+
throw err_85;
|
|
9098
9408
|
case 17: return [2, {
|
|
9099
9409
|
instructions: __spreadArray([], instructions, true),
|
|
9100
9410
|
additionalSigners: additionalSigners
|