flash-sdk 13.0.2 → 14.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/OraclePrice.d.ts +1 -0
- package/dist/OrderAccount.d.ts +1 -0
- package/dist/PerpetualsClient.d.ts +52 -233
- package/dist/PerpetualsClient.js +309 -321
- package/dist/PoolAccount.d.ts +1 -0
- package/dist/PoolDataClient.d.ts +1 -0
- package/dist/PositionAccount.d.ts +1 -0
- package/dist/TokenStakeAccount.d.ts +17 -3
- package/dist/TokenStakeAccount.js +36 -0
- package/dist/TokenVaultAccount.d.ts +2 -0
- package/dist/ViewHelper.js +2 -2
- package/dist/backupOracle.js +4 -4
- package/dist/constants/index.d.ts +1 -0
- package/dist/idl/perpetuals.d.ts +300 -479
- package/dist/idl/perpetuals.json +300 -479
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/generated.d.ts +24 -15
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +3 -3
- package/dist/utils/IdlCoder.js +7 -17
- package/dist/utils/alt.js +6 -5
- package/dist/utils/anchorCpiEvents.js +4 -4
- package/dist/utils/index.js +6 -6
- package/dist/utils/rpc.js +9 -9
- package/package.json +1 -1
package/dist/PerpetualsClient.js
CHANGED
|
@@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g
|
|
24
|
-
return g
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -1913,7 +1913,7 @@ var PerpetualsClient = (function () {
|
|
|
1913
1913
|
args_1[_i - 2] = arguments[_i];
|
|
1914
1914
|
}
|
|
1915
1915
|
return __awaiter(_this, __spreadArray([POOL_CONFIG_1, userPublicKey_1], args_1, true), void 0, function (POOL_CONFIG, userPublicKey, enableDebuglogs) {
|
|
1916
|
-
var fafTokenVaultPk, fafTokenVaultAccountInfo, fafTokenVaultAccount, fafTokenVault, tokenStakeAccount, accountInfo, fafStakeData, tokenStakeFafAccount,
|
|
1916
|
+
var fafTokenVaultPk, fafTokenVaultAccountInfo, fafTokenVaultAccount, fafTokenVault, tokenStakeAccount, accountInfo, fafStakeData, tokenStakeFafAccount, eligibleAmount, revenuePerFafStaked, revenueWatermark, revenueSnapshot, unclaimedRevenue, revenueAmount;
|
|
1917
1917
|
var _a, _b, _c, _d;
|
|
1918
1918
|
if (enableDebuglogs === void 0) { enableDebuglogs = false; }
|
|
1919
1919
|
return __generator(this, function (_e) {
|
|
@@ -1942,9 +1942,9 @@ var PerpetualsClient = (function () {
|
|
|
1942
1942
|
if (accountInfo) {
|
|
1943
1943
|
fafStakeData = this.program.coder.accounts.decode('tokenStake', accountInfo.data);
|
|
1944
1944
|
tokenStakeFafAccount = TokenStakeAccount_1.TokenStakeAccount.from(fafStakeData);
|
|
1945
|
-
|
|
1945
|
+
eligibleAmount = (_a = tokenStakeFafAccount === null || tokenStakeFafAccount === void 0 ? void 0 : tokenStakeFafAccount.getRevenueEligibleAmount()) !== null && _a !== void 0 ? _a : constants_1.BN_ZERO;
|
|
1946
1946
|
revenuePerFafStaked = (_b = fafTokenVaultAccount === null || fafTokenVaultAccount === void 0 ? void 0 : fafTokenVaultAccount.revenuePerFafStaked) !== null && _b !== void 0 ? _b : constants_1.BN_ZERO;
|
|
1947
|
-
revenueWatermark =
|
|
1947
|
+
revenueWatermark = eligibleAmount
|
|
1948
1948
|
.mul(revenuePerFafStaked)
|
|
1949
1949
|
.div(new anchor_1.BN(10).pow(new anchor_1.BN(constants_1.FAF_DECIMALS)));
|
|
1950
1950
|
revenueSnapshot = (_c = tokenStakeFafAccount === null || tokenStakeFafAccount === void 0 ? void 0 : tokenStakeFafAccount.revenueSnapshot) !== null && _c !== void 0 ? _c : constants_1.BN_ZERO;
|
|
@@ -1963,6 +1963,43 @@ var PerpetualsClient = (function () {
|
|
|
1963
1963
|
});
|
|
1964
1964
|
});
|
|
1965
1965
|
};
|
|
1966
|
+
this.getTokenStakeAccount = function (poolConfig, userPublicKey) { return __awaiter(_this, void 0, void 0, function () {
|
|
1967
|
+
var tokenStakePk, accountInfo, decoded;
|
|
1968
|
+
return __generator(this, function (_a) {
|
|
1969
|
+
switch (_a.label) {
|
|
1970
|
+
case 0:
|
|
1971
|
+
tokenStakePk = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('token_stake'), userPublicKey.toBuffer()], poolConfig.programId)[0];
|
|
1972
|
+
return [4, this.provider.connection.getAccountInfo(tokenStakePk)];
|
|
1973
|
+
case 1:
|
|
1974
|
+
accountInfo = _a.sent();
|
|
1975
|
+
if (!accountInfo) {
|
|
1976
|
+
return [2, null];
|
|
1977
|
+
}
|
|
1978
|
+
decoded = this.program.coder.accounts.decode('tokenStake', accountInfo.data);
|
|
1979
|
+
return [2, TokenStakeAccount_1.TokenStakeAccount.from(decoded)];
|
|
1980
|
+
}
|
|
1981
|
+
});
|
|
1982
|
+
}); };
|
|
1983
|
+
this.getUserUnstakingStatus = function (poolConfig, userPublicKey) { return __awaiter(_this, void 0, void 0, function () {
|
|
1984
|
+
var tokenStakeAccount;
|
|
1985
|
+
return __generator(this, function (_a) {
|
|
1986
|
+
switch (_a.label) {
|
|
1987
|
+
case 0: return [4, this.getTokenStakeAccount(poolConfig, userPublicKey)];
|
|
1988
|
+
case 1:
|
|
1989
|
+
tokenStakeAccount = _a.sent();
|
|
1990
|
+
if (!tokenStakeAccount) {
|
|
1991
|
+
return [2, null];
|
|
1992
|
+
}
|
|
1993
|
+
return [2, {
|
|
1994
|
+
activeStakeAmount: tokenStakeAccount.activeStakeAmount,
|
|
1995
|
+
totalLocked: tokenStakeAccount.getLockedAmount(),
|
|
1996
|
+
totalWithdrawable: tokenStakeAccount.getWithdrawableAmount(),
|
|
1997
|
+
revenueEligibleAmount: tokenStakeAccount.getRevenueEligibleAmount(),
|
|
1998
|
+
requests: tokenStakeAccount.getLockStatus(),
|
|
1999
|
+
}];
|
|
2000
|
+
}
|
|
2001
|
+
});
|
|
2002
|
+
}); };
|
|
1966
2003
|
this.getLpTokenPriceView = function (poolConfig_1) {
|
|
1967
2004
|
var args_1 = [];
|
|
1968
2005
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
@@ -5126,48 +5163,8 @@ var PerpetualsClient = (function () {
|
|
|
5126
5163
|
});
|
|
5127
5164
|
});
|
|
5128
5165
|
};
|
|
5129
|
-
this.migrateTokenStake = function (tokenStakeAccounts) { return __awaiter(_this, void 0, void 0, function () {
|
|
5130
|
-
var publicKey, instructions, additionalSigners, remainingAccounts, migrateTokenStakeIx, err_19;
|
|
5131
|
-
return __generator(this, function (_a) {
|
|
5132
|
-
switch (_a.label) {
|
|
5133
|
-
case 0:
|
|
5134
|
-
publicKey = this.provider.wallet.publicKey;
|
|
5135
|
-
instructions = [];
|
|
5136
|
-
additionalSigners = [];
|
|
5137
|
-
remainingAccounts = tokenStakeAccounts.map(function (pubkey) { return ({
|
|
5138
|
-
pubkey: pubkey,
|
|
5139
|
-
isSigner: false,
|
|
5140
|
-
isWritable: true,
|
|
5141
|
-
}); });
|
|
5142
|
-
_a.label = 1;
|
|
5143
|
-
case 1:
|
|
5144
|
-
_a.trys.push([1, 3, , 4]);
|
|
5145
|
-
return [4, this.program.methods
|
|
5146
|
-
.migrateTokenStake({})
|
|
5147
|
-
.accountsPartial({
|
|
5148
|
-
admin: publicKey,
|
|
5149
|
-
multisig: this.multisig.publicKey,
|
|
5150
|
-
program: this.program.programId,
|
|
5151
|
-
})
|
|
5152
|
-
.remainingAccounts(remainingAccounts)
|
|
5153
|
-
.instruction()];
|
|
5154
|
-
case 2:
|
|
5155
|
-
migrateTokenStakeIx = _a.sent();
|
|
5156
|
-
instructions.push(migrateTokenStakeIx);
|
|
5157
|
-
return [3, 4];
|
|
5158
|
-
case 3:
|
|
5159
|
-
err_19 = _a.sent();
|
|
5160
|
-
console.log("perpClient migrateTokenStake error:: ", err_19);
|
|
5161
|
-
return [3, 4];
|
|
5162
|
-
case 4: return [2, {
|
|
5163
|
-
instructions: instructions,
|
|
5164
|
-
additionalSigners: additionalSigners,
|
|
5165
|
-
}];
|
|
5166
|
-
}
|
|
5167
|
-
});
|
|
5168
|
-
}); };
|
|
5169
5166
|
this.migrateFlp = function (amount, rewardTokenMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5170
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp,
|
|
5167
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp, err_19;
|
|
5171
5168
|
return __generator(this, function (_d) {
|
|
5172
5169
|
switch (_d.label) {
|
|
5173
5170
|
case 0:
|
|
@@ -5238,8 +5235,8 @@ var PerpetualsClient = (function () {
|
|
|
5238
5235
|
instructions.push(migrateFlp);
|
|
5239
5236
|
return [3, 4];
|
|
5240
5237
|
case 3:
|
|
5241
|
-
|
|
5242
|
-
console.log("perpClient migrateFlp error:: ",
|
|
5238
|
+
err_19 = _d.sent();
|
|
5239
|
+
console.log("perpClient migrateFlp error:: ", err_19);
|
|
5243
5240
|
return [3, 4];
|
|
5244
5241
|
case 4: return [2, {
|
|
5245
5242
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -5254,7 +5251,7 @@ var PerpetualsClient = (function () {
|
|
|
5254
5251
|
args_1[_i - 1] = arguments[_i];
|
|
5255
5252
|
}
|
|
5256
5253
|
return __awaiter(_this, __spreadArray([poolConfig_1], args_1, true), void 0, function (poolConfig, rewardTokenSymbol) {
|
|
5257
|
-
var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, compoundingFee,
|
|
5254
|
+
var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, compoundingFee, err_20;
|
|
5258
5255
|
if (rewardTokenSymbol === void 0) { rewardTokenSymbol = 'USDC'; }
|
|
5259
5256
|
return __generator(this, function (_e) {
|
|
5260
5257
|
switch (_e.label) {
|
|
@@ -5311,8 +5308,8 @@ var PerpetualsClient = (function () {
|
|
|
5311
5308
|
instructions.push(compoundingFee);
|
|
5312
5309
|
return [3, 4];
|
|
5313
5310
|
case 3:
|
|
5314
|
-
|
|
5315
|
-
console.log("perpClient compoundingFee error:: ",
|
|
5311
|
+
err_20 = _e.sent();
|
|
5312
|
+
console.log("perpClient compoundingFee error:: ", err_20);
|
|
5316
5313
|
return [3, 4];
|
|
5317
5314
|
case 4: return [2, {
|
|
5318
5315
|
instructions: __spreadArray([], instructions, true),
|
|
@@ -5323,7 +5320,7 @@ var PerpetualsClient = (function () {
|
|
|
5323
5320
|
});
|
|
5324
5321
|
};
|
|
5325
5322
|
this.depositTokenStake = function (owner, feePayer, depositAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5326
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, depositTokenStakeInstruction,
|
|
5323
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, depositTokenStakeInstruction, err_21;
|
|
5327
5324
|
return __generator(this, function (_a) {
|
|
5328
5325
|
switch (_a.label) {
|
|
5329
5326
|
case 0:
|
|
@@ -5363,9 +5360,9 @@ var PerpetualsClient = (function () {
|
|
|
5363
5360
|
instructions.push(depositTokenStakeInstruction);
|
|
5364
5361
|
return [3, 5];
|
|
5365
5362
|
case 4:
|
|
5366
|
-
|
|
5367
|
-
console.log("perpClient depositStakingInstruction error:: ",
|
|
5368
|
-
throw
|
|
5363
|
+
err_21 = _a.sent();
|
|
5364
|
+
console.log("perpClient depositStakingInstruction error:: ", err_21);
|
|
5365
|
+
throw err_21;
|
|
5369
5366
|
case 5: return [2, {
|
|
5370
5367
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5371
5368
|
additionalSigners: additionalSigners
|
|
@@ -5374,7 +5371,7 @@ var PerpetualsClient = (function () {
|
|
|
5374
5371
|
});
|
|
5375
5372
|
}); };
|
|
5376
5373
|
this.unstakeTokenRequest = function (owner, unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5377
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, unstakeTokenRequestInstruction,
|
|
5374
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, unstakeTokenRequestInstruction, err_22;
|
|
5378
5375
|
return __generator(this, function (_a) {
|
|
5379
5376
|
switch (_a.label) {
|
|
5380
5377
|
case 0:
|
|
@@ -5402,9 +5399,9 @@ var PerpetualsClient = (function () {
|
|
|
5402
5399
|
instructions.push(unstakeTokenRequestInstruction);
|
|
5403
5400
|
return [3, 4];
|
|
5404
5401
|
case 3:
|
|
5405
|
-
|
|
5406
|
-
console.log("perpClient unstakeTokenRequestInstruction error:: ",
|
|
5407
|
-
throw
|
|
5402
|
+
err_22 = _a.sent();
|
|
5403
|
+
console.log("perpClient unstakeTokenRequestInstruction error:: ", err_22);
|
|
5404
|
+
throw err_22;
|
|
5408
5405
|
case 4: return [2, {
|
|
5409
5406
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5410
5407
|
additionalSigners: additionalSigners
|
|
@@ -5412,58 +5409,8 @@ var PerpetualsClient = (function () {
|
|
|
5412
5409
|
}
|
|
5413
5410
|
});
|
|
5414
5411
|
}); };
|
|
5415
|
-
this.unstakeTokenInstant = function (owner, unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5416
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, unstakeTokenInstantInstruction, err_24;
|
|
5417
|
-
return __generator(this, function (_a) {
|
|
5418
|
-
switch (_a.label) {
|
|
5419
|
-
case 0:
|
|
5420
|
-
preInstructions = [];
|
|
5421
|
-
instructions = [];
|
|
5422
|
-
postInstructions = [];
|
|
5423
|
-
additionalSigners = [];
|
|
5424
|
-
_a.label = 1;
|
|
5425
|
-
case 1:
|
|
5426
|
-
_a.trys.push([1, 4, , 5]);
|
|
5427
|
-
tokenStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("token_stake"), owner.toBuffer()], this.programId)[0];
|
|
5428
|
-
userTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(poolConfig.tokenMint, owner, true);
|
|
5429
|
-
return [4, (0, utils_1.checkIfAccountExists)(userTokenAccount, this.provider.connection)];
|
|
5430
|
-
case 2:
|
|
5431
|
-
if (!(_a.sent())) {
|
|
5432
|
-
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(this.provider.wallet.publicKey, userTokenAccount, owner, poolConfig.tokenMint));
|
|
5433
|
-
}
|
|
5434
|
-
return [4, this.program.methods
|
|
5435
|
-
.unstakeTokenInstant({
|
|
5436
|
-
unstakeAmount: unstakeAmount
|
|
5437
|
-
})
|
|
5438
|
-
.accountsPartial({
|
|
5439
|
-
owner: owner,
|
|
5440
|
-
receivingTokenAccount: userTokenAccount,
|
|
5441
|
-
perpetuals: poolConfig.perpetuals,
|
|
5442
|
-
transferAuthority: poolConfig.transferAuthority,
|
|
5443
|
-
tokenVault: poolConfig.tokenVault,
|
|
5444
|
-
tokenVaultTokenAccount: poolConfig.tokenVaultTokenAccount,
|
|
5445
|
-
tokenStakeAccount: tokenStakeAccount,
|
|
5446
|
-
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
5447
|
-
tokenMint: poolConfig.tokenMint,
|
|
5448
|
-
})
|
|
5449
|
-
.instruction()];
|
|
5450
|
-
case 3:
|
|
5451
|
-
unstakeTokenInstantInstruction = _a.sent();
|
|
5452
|
-
instructions.push(unstakeTokenInstantInstruction);
|
|
5453
|
-
return [3, 5];
|
|
5454
|
-
case 4:
|
|
5455
|
-
err_24 = _a.sent();
|
|
5456
|
-
console.log("perpClient unstakeTokenInstantInstruction error:: ", err_24);
|
|
5457
|
-
throw err_24;
|
|
5458
|
-
case 5: return [2, {
|
|
5459
|
-
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5460
|
-
additionalSigners: additionalSigners
|
|
5461
|
-
}];
|
|
5462
|
-
}
|
|
5463
|
-
});
|
|
5464
|
-
}); };
|
|
5465
5412
|
this.withdrawToken = function (owner, withdrawRequestId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5466
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, withdrawTokenInstruction,
|
|
5413
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, withdrawTokenInstruction, err_23;
|
|
5467
5414
|
return __generator(this, function (_a) {
|
|
5468
5415
|
switch (_a.label) {
|
|
5469
5416
|
case 0:
|
|
@@ -5483,7 +5430,7 @@ var PerpetualsClient = (function () {
|
|
|
5483
5430
|
}
|
|
5484
5431
|
return [4, this.program.methods
|
|
5485
5432
|
.withdrawToken({
|
|
5486
|
-
withdrawRequestId: withdrawRequestId
|
|
5433
|
+
withdrawRequestId: withdrawRequestId,
|
|
5487
5434
|
})
|
|
5488
5435
|
.accountsPartial({
|
|
5489
5436
|
owner: owner,
|
|
@@ -5502,9 +5449,9 @@ var PerpetualsClient = (function () {
|
|
|
5502
5449
|
instructions.push(withdrawTokenInstruction);
|
|
5503
5450
|
return [3, 5];
|
|
5504
5451
|
case 4:
|
|
5505
|
-
|
|
5506
|
-
console.log("perpClient withdrawTokenInstruction error:: ",
|
|
5507
|
-
throw
|
|
5452
|
+
err_23 = _a.sent();
|
|
5453
|
+
console.log("perpClient withdrawTokenInstruction error:: ", err_23);
|
|
5454
|
+
throw err_23;
|
|
5508
5455
|
case 5: return [2, {
|
|
5509
5456
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5510
5457
|
additionalSigners: additionalSigners
|
|
@@ -5512,8 +5459,8 @@ var PerpetualsClient = (function () {
|
|
|
5512
5459
|
}
|
|
5513
5460
|
});
|
|
5514
5461
|
}); };
|
|
5515
|
-
this.
|
|
5516
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount,
|
|
5462
|
+
this.cancelUnstakeTokenRequest = function (owner, withdrawRequestId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5463
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, cancelUnstakeTokenRequestInstruction, err_24;
|
|
5517
5464
|
return __generator(this, function (_a) {
|
|
5518
5465
|
switch (_a.label) {
|
|
5519
5466
|
case 0:
|
|
@@ -5537,13 +5484,13 @@ var PerpetualsClient = (function () {
|
|
|
5537
5484
|
})
|
|
5538
5485
|
.instruction()];
|
|
5539
5486
|
case 2:
|
|
5540
|
-
|
|
5541
|
-
instructions.push(
|
|
5487
|
+
cancelUnstakeTokenRequestInstruction = _a.sent();
|
|
5488
|
+
instructions.push(cancelUnstakeTokenRequestInstruction);
|
|
5542
5489
|
return [3, 4];
|
|
5543
5490
|
case 3:
|
|
5544
|
-
|
|
5545
|
-
console.log("perpClient
|
|
5546
|
-
throw
|
|
5491
|
+
err_24 = _a.sent();
|
|
5492
|
+
console.log("perpClient cancelUnstakeTokenRequestInstruction error:: ", err_24);
|
|
5493
|
+
throw err_24;
|
|
5547
5494
|
case 4: return [2, {
|
|
5548
5495
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5549
5496
|
additionalSigners: additionalSigners
|
|
@@ -5557,7 +5504,7 @@ var PerpetualsClient = (function () {
|
|
|
5557
5504
|
args_1[_i - 2] = arguments[_i];
|
|
5558
5505
|
}
|
|
5559
5506
|
return __awaiter(_this, __spreadArray([owner_1, poolConfig_1], args_1, true), void 0, function (owner, poolConfig, createUserATA) {
|
|
5560
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, _a, collectTokenRewardInstruction,
|
|
5507
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, _a, collectTokenRewardInstruction, err_25;
|
|
5561
5508
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5562
5509
|
return __generator(this, function (_b) {
|
|
5563
5510
|
switch (_b.label) {
|
|
@@ -5601,9 +5548,9 @@ var PerpetualsClient = (function () {
|
|
|
5601
5548
|
instructions.push(collectTokenRewardInstruction);
|
|
5602
5549
|
return [3, 6];
|
|
5603
5550
|
case 5:
|
|
5604
|
-
|
|
5605
|
-
console.log("perpClient collectTokenRewardInstruction error:: ",
|
|
5606
|
-
throw
|
|
5551
|
+
err_25 = _b.sent();
|
|
5552
|
+
console.log("perpClient collectTokenRewardInstruction error:: ", err_25);
|
|
5553
|
+
throw err_25;
|
|
5607
5554
|
case 6: return [2, {
|
|
5608
5555
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5609
5556
|
additionalSigners: additionalSigners
|
|
@@ -5618,7 +5565,7 @@ var PerpetualsClient = (function () {
|
|
|
5618
5565
|
args_1[_i - 3] = arguments[_i];
|
|
5619
5566
|
}
|
|
5620
5567
|
return __awaiter(_this, __spreadArray([owner_1, rewardSymbol_1, poolConfig_1], args_1, true), void 0, function (owner, rewardSymbol, poolConfig, createUserATA) {
|
|
5621
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, tokenStakeAccount, userTokenAccount, _a, collectRevenueInstruction,
|
|
5568
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, tokenStakeAccount, userTokenAccount, _a, collectRevenueInstruction, err_26;
|
|
5622
5569
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5623
5570
|
return __generator(this, function (_b) {
|
|
5624
5571
|
switch (_b.label) {
|
|
@@ -5663,9 +5610,9 @@ var PerpetualsClient = (function () {
|
|
|
5663
5610
|
instructions.push(collectRevenueInstruction);
|
|
5664
5611
|
return [3, 6];
|
|
5665
5612
|
case 5:
|
|
5666
|
-
|
|
5667
|
-
console.log("perpClient collectRevenueInstruction error:: ",
|
|
5668
|
-
throw
|
|
5613
|
+
err_26 = _b.sent();
|
|
5614
|
+
console.log("perpClient collectRevenueInstruction error:: ", err_26);
|
|
5615
|
+
throw err_26;
|
|
5669
5616
|
case 6: return [2, {
|
|
5670
5617
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5671
5618
|
additionalSigners: additionalSigners
|
|
@@ -5674,13 +5621,52 @@ var PerpetualsClient = (function () {
|
|
|
5674
5621
|
});
|
|
5675
5622
|
});
|
|
5676
5623
|
};
|
|
5624
|
+
this.refreshTokenStake = function (tokenStakeAccounts, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5625
|
+
var instructions, additionalSigners, remainingAccounts, refreshTokenStakeInstruction, err_27;
|
|
5626
|
+
return __generator(this, function (_a) {
|
|
5627
|
+
switch (_a.label) {
|
|
5628
|
+
case 0:
|
|
5629
|
+
instructions = [];
|
|
5630
|
+
additionalSigners = [];
|
|
5631
|
+
_a.label = 1;
|
|
5632
|
+
case 1:
|
|
5633
|
+
_a.trys.push([1, 3, , 4]);
|
|
5634
|
+
remainingAccounts = tokenStakeAccounts.map(function (pubkey) { return ({
|
|
5635
|
+
pubkey: pubkey,
|
|
5636
|
+
isSigner: false,
|
|
5637
|
+
isWritable: true,
|
|
5638
|
+
}); });
|
|
5639
|
+
return [4, this.program.methods
|
|
5640
|
+
.refreshTokenStake({})
|
|
5641
|
+
.accountsPartial({
|
|
5642
|
+
perpetuals: this.perpetuals.publicKey,
|
|
5643
|
+
tokenVault: poolConfig.tokenVault,
|
|
5644
|
+
program: this.programId,
|
|
5645
|
+
})
|
|
5646
|
+
.remainingAccounts(remainingAccounts)
|
|
5647
|
+
.instruction()];
|
|
5648
|
+
case 2:
|
|
5649
|
+
refreshTokenStakeInstruction = _a.sent();
|
|
5650
|
+
instructions.push(refreshTokenStakeInstruction);
|
|
5651
|
+
return [3, 4];
|
|
5652
|
+
case 3:
|
|
5653
|
+
err_27 = _a.sent();
|
|
5654
|
+
console.log("perpClient refreshTokenStakeInstruction error:: ", err_27);
|
|
5655
|
+
throw err_27;
|
|
5656
|
+
case 4: return [2, {
|
|
5657
|
+
instructions: instructions,
|
|
5658
|
+
additionalSigners: additionalSigners
|
|
5659
|
+
}];
|
|
5660
|
+
}
|
|
5661
|
+
});
|
|
5662
|
+
}); };
|
|
5677
5663
|
this.collectRebate = function (owner_1, rebateSymbol_1, poolConfig_1) {
|
|
5678
5664
|
var args_1 = [];
|
|
5679
5665
|
for (var _i = 3; _i < arguments.length; _i++) {
|
|
5680
5666
|
args_1[_i - 3] = arguments[_i];
|
|
5681
5667
|
}
|
|
5682
5668
|
return __awaiter(_this, __spreadArray([owner_1, rebateSymbol_1, poolConfig_1], args_1, true), void 0, function (owner, rebateSymbol, poolConfig, createUserATA) {
|
|
5683
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateMint, tokenStakeAccount, userTokenAccount, _a, collectRebateInstruction,
|
|
5669
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateMint, tokenStakeAccount, userTokenAccount, _a, collectRebateInstruction, err_28;
|
|
5684
5670
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5685
5671
|
return __generator(this, function (_b) {
|
|
5686
5672
|
switch (_b.label) {
|
|
@@ -5725,9 +5711,9 @@ var PerpetualsClient = (function () {
|
|
|
5725
5711
|
instructions.push(collectRebateInstruction);
|
|
5726
5712
|
return [3, 6];
|
|
5727
5713
|
case 5:
|
|
5728
|
-
|
|
5729
|
-
console.log("perpClient collectRebateInstruction error:: ",
|
|
5730
|
-
throw
|
|
5714
|
+
err_28 = _b.sent();
|
|
5715
|
+
console.log("perpClient collectRebateInstruction error:: ", err_28);
|
|
5716
|
+
throw err_28;
|
|
5731
5717
|
case 6: return [2, {
|
|
5732
5718
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5733
5719
|
additionalSigners: additionalSigners
|
|
@@ -5737,7 +5723,7 @@ var PerpetualsClient = (function () {
|
|
|
5737
5723
|
});
|
|
5738
5724
|
};
|
|
5739
5725
|
this.settleRebates = function (rebateSymbol, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5740
|
-
var preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, rebateMint, settleRebatesInstruction,
|
|
5726
|
+
var preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, rebateMint, settleRebatesInstruction, err_29;
|
|
5741
5727
|
return __generator(this, function (_a) {
|
|
5742
5728
|
switch (_a.label) {
|
|
5743
5729
|
case 0:
|
|
@@ -5771,9 +5757,9 @@ var PerpetualsClient = (function () {
|
|
|
5771
5757
|
instructions.push(settleRebatesInstruction);
|
|
5772
5758
|
return [3, 4];
|
|
5773
5759
|
case 3:
|
|
5774
|
-
|
|
5775
|
-
console.log("perpClient settleRebatesInstruction error:: ",
|
|
5776
|
-
throw
|
|
5760
|
+
err_29 = _a.sent();
|
|
5761
|
+
console.log("perpClient settleRebatesInstruction error:: ", err_29);
|
|
5762
|
+
throw err_29;
|
|
5777
5763
|
case 4: return [2, {
|
|
5778
5764
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5779
5765
|
additionalSigners: additionalSigners
|
|
@@ -5787,7 +5773,7 @@ var PerpetualsClient = (function () {
|
|
|
5787
5773
|
args_1[_i - 11] = arguments[_i];
|
|
5788
5774
|
}
|
|
5789
5775
|
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) {
|
|
5790
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder,
|
|
5776
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder, err_30;
|
|
5791
5777
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
|
5792
5778
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
5793
5779
|
return __generator(this, function (_c) {
|
|
@@ -5891,9 +5877,9 @@ var PerpetualsClient = (function () {
|
|
|
5891
5877
|
instructions.push(placeLimitOrder);
|
|
5892
5878
|
return [3, 10];
|
|
5893
5879
|
case 9:
|
|
5894
|
-
|
|
5895
|
-
console.log("perpClient placeLimitOrder error:: ",
|
|
5896
|
-
throw
|
|
5880
|
+
err_30 = _c.sent();
|
|
5881
|
+
console.log("perpClient placeLimitOrder error:: ", err_30);
|
|
5882
|
+
throw err_30;
|
|
5897
5883
|
case 10: return [2, {
|
|
5898
5884
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5899
5885
|
additionalSigners: additionalSigners
|
|
@@ -5908,7 +5894,7 @@ var PerpetualsClient = (function () {
|
|
|
5908
5894
|
args_1[_i - 11] = arguments[_i];
|
|
5909
5895
|
}
|
|
5910
5896
|
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) {
|
|
5911
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder,
|
|
5897
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder, err_31;
|
|
5912
5898
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5913
5899
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
5914
5900
|
return __generator(this, function (_b) {
|
|
@@ -5997,9 +5983,9 @@ var PerpetualsClient = (function () {
|
|
|
5997
5983
|
instructions.push(editLimitOrder);
|
|
5998
5984
|
return [3, 8];
|
|
5999
5985
|
case 7:
|
|
6000
|
-
|
|
6001
|
-
console.log("perpClient editLimitOrder error:: ",
|
|
6002
|
-
throw
|
|
5986
|
+
err_31 = _b.sent();
|
|
5987
|
+
console.log("perpClient editLimitOrder error:: ", err_31);
|
|
5988
|
+
throw err_31;
|
|
6003
5989
|
case 8: return [2, {
|
|
6004
5990
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6005
5991
|
additionalSigners: additionalSigners
|
|
@@ -6014,7 +6000,7 @@ var PerpetualsClient = (function () {
|
|
|
6014
6000
|
args_1[_i - 7] = arguments[_i];
|
|
6015
6001
|
}
|
|
6016
6002
|
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) {
|
|
6017
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder,
|
|
6003
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder, err_32;
|
|
6018
6004
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
6019
6005
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
|
6020
6006
|
return __generator(this, function (_a) {
|
|
@@ -6064,9 +6050,9 @@ var PerpetualsClient = (function () {
|
|
|
6064
6050
|
instructions.push(executeLimitOrder);
|
|
6065
6051
|
return [3, 4];
|
|
6066
6052
|
case 3:
|
|
6067
|
-
|
|
6068
|
-
console.log("perpClient executeLimitOrder error:: ",
|
|
6069
|
-
throw
|
|
6053
|
+
err_32 = _a.sent();
|
|
6054
|
+
console.log("perpClient executeLimitOrder error:: ", err_32);
|
|
6055
|
+
throw err_32;
|
|
6070
6056
|
case 4: return [2, {
|
|
6071
6057
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6072
6058
|
additionalSigners: additionalSigners
|
|
@@ -6081,7 +6067,7 @@ var PerpetualsClient = (function () {
|
|
|
6081
6067
|
args_1[_i - 8] = arguments[_i];
|
|
6082
6068
|
}
|
|
6083
6069
|
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) {
|
|
6084
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap,
|
|
6070
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap, err_33;
|
|
6085
6071
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
6086
6072
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
|
6087
6073
|
return __generator(this, function (_a) {
|
|
@@ -6134,9 +6120,9 @@ var PerpetualsClient = (function () {
|
|
|
6134
6120
|
instructions.push(executeLimitWithSwap);
|
|
6135
6121
|
return [3, 4];
|
|
6136
6122
|
case 3:
|
|
6137
|
-
|
|
6138
|
-
console.log("perpClient executeLimitWithSwap error:: ",
|
|
6139
|
-
throw
|
|
6123
|
+
err_33 = _a.sent();
|
|
6124
|
+
console.log("perpClient executeLimitWithSwap error:: ", err_33);
|
|
6125
|
+
throw err_33;
|
|
6140
6126
|
case 4: return [2, {
|
|
6141
6127
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6142
6128
|
additionalSigners: additionalSigners
|
|
@@ -6146,7 +6132,7 @@ var PerpetualsClient = (function () {
|
|
|
6146
6132
|
});
|
|
6147
6133
|
};
|
|
6148
6134
|
this.placeTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6149
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder,
|
|
6135
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder, err_34;
|
|
6150
6136
|
return __generator(this, function (_a) {
|
|
6151
6137
|
switch (_a.label) {
|
|
6152
6138
|
case 0:
|
|
@@ -6192,9 +6178,9 @@ var PerpetualsClient = (function () {
|
|
|
6192
6178
|
instructions.push(placeTriggerOrder);
|
|
6193
6179
|
return [3, 4];
|
|
6194
6180
|
case 3:
|
|
6195
|
-
|
|
6196
|
-
console.log("perpClient placeTriggerOrder error:: ",
|
|
6197
|
-
throw
|
|
6181
|
+
err_34 = _a.sent();
|
|
6182
|
+
console.log("perpClient placeTriggerOrder error:: ", err_34);
|
|
6183
|
+
throw err_34;
|
|
6198
6184
|
case 4: return [2, {
|
|
6199
6185
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6200
6186
|
additionalSigners: additionalSigners
|
|
@@ -6203,7 +6189,7 @@ var PerpetualsClient = (function () {
|
|
|
6203
6189
|
});
|
|
6204
6190
|
}); };
|
|
6205
6191
|
this.editTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, orderId, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6206
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder,
|
|
6192
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder, err_35;
|
|
6207
6193
|
return __generator(this, function (_a) {
|
|
6208
6194
|
switch (_a.label) {
|
|
6209
6195
|
case 0:
|
|
@@ -6248,9 +6234,9 @@ var PerpetualsClient = (function () {
|
|
|
6248
6234
|
instructions.push(editTriggerOrder);
|
|
6249
6235
|
return [3, 4];
|
|
6250
6236
|
case 3:
|
|
6251
|
-
|
|
6252
|
-
console.log("perpClient editTriggerOrder error:: ",
|
|
6253
|
-
throw
|
|
6237
|
+
err_35 = _a.sent();
|
|
6238
|
+
console.log("perpClient editTriggerOrder error:: ", err_35);
|
|
6239
|
+
throw err_35;
|
|
6254
6240
|
case 4: return [2, {
|
|
6255
6241
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6256
6242
|
additionalSigners: additionalSigners
|
|
@@ -6259,7 +6245,7 @@ var PerpetualsClient = (function () {
|
|
|
6259
6245
|
});
|
|
6260
6246
|
}); };
|
|
6261
6247
|
this.cancelTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6262
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder,
|
|
6248
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder, err_36;
|
|
6263
6249
|
return __generator(this, function (_a) {
|
|
6264
6250
|
switch (_a.label) {
|
|
6265
6251
|
case 0:
|
|
@@ -6290,9 +6276,9 @@ var PerpetualsClient = (function () {
|
|
|
6290
6276
|
instructions.push(cancelTriggerOrder);
|
|
6291
6277
|
return [3, 4];
|
|
6292
6278
|
case 3:
|
|
6293
|
-
|
|
6294
|
-
console.log("perpClient cancelTriggerOrder error:: ",
|
|
6295
|
-
throw
|
|
6279
|
+
err_36 = _a.sent();
|
|
6280
|
+
console.log("perpClient cancelTriggerOrder error:: ", err_36);
|
|
6281
|
+
throw err_36;
|
|
6296
6282
|
case 4: return [2, {
|
|
6297
6283
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6298
6284
|
additionalSigners: additionalSigners
|
|
@@ -6301,7 +6287,7 @@ var PerpetualsClient = (function () {
|
|
|
6301
6287
|
});
|
|
6302
6288
|
}); };
|
|
6303
6289
|
this.cancelAllTriggerOrders = function (targetSymbol, collateralSymbol, side, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6304
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders,
|
|
6290
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders, err_37;
|
|
6305
6291
|
return __generator(this, function (_a) {
|
|
6306
6292
|
switch (_a.label) {
|
|
6307
6293
|
case 0:
|
|
@@ -6330,9 +6316,9 @@ var PerpetualsClient = (function () {
|
|
|
6330
6316
|
instructions.push(cancelAllTriggerOrders);
|
|
6331
6317
|
return [3, 4];
|
|
6332
6318
|
case 3:
|
|
6333
|
-
|
|
6334
|
-
console.log("perpClient cancelAllTriggerOrders error:: ",
|
|
6335
|
-
throw
|
|
6319
|
+
err_37 = _a.sent();
|
|
6320
|
+
console.log("perpClient cancelAllTriggerOrders error:: ", err_37);
|
|
6321
|
+
throw err_37;
|
|
6336
6322
|
case 4: return [2, {
|
|
6337
6323
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6338
6324
|
additionalSigners: additionalSigners
|
|
@@ -6346,7 +6332,7 @@ var PerpetualsClient = (function () {
|
|
|
6346
6332
|
args_1[_i - 9] = arguments[_i];
|
|
6347
6333
|
}
|
|
6348
6334
|
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) {
|
|
6349
|
-
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,
|
|
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, err_38;
|
|
6350
6336
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6351
6337
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
6352
6338
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6450,9 +6436,9 @@ var PerpetualsClient = (function () {
|
|
|
6450
6436
|
instructions.push(executeTriggerWithSwap);
|
|
6451
6437
|
return [3, 10];
|
|
6452
6438
|
case 9:
|
|
6453
|
-
|
|
6454
|
-
console.log("perpClient executeTriggerWithSwap error:: ",
|
|
6455
|
-
throw
|
|
6439
|
+
err_38 = _e.sent();
|
|
6440
|
+
console.log("perpClient executeTriggerWithSwap error:: ", err_38);
|
|
6441
|
+
throw err_38;
|
|
6456
6442
|
case 10: return [2, {
|
|
6457
6443
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6458
6444
|
additionalSigners: additionalSigners
|
|
@@ -6467,7 +6453,7 @@ var PerpetualsClient = (function () {
|
|
|
6467
6453
|
args_1[_i - 8] = arguments[_i];
|
|
6468
6454
|
}
|
|
6469
6455
|
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) {
|
|
6470
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder,
|
|
6456
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder, err_39;
|
|
6471
6457
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6472
6458
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
6473
6459
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6536,9 +6522,9 @@ var PerpetualsClient = (function () {
|
|
|
6536
6522
|
instructions.push(executeTriggerOrder);
|
|
6537
6523
|
return [3, 8];
|
|
6538
6524
|
case 7:
|
|
6539
|
-
|
|
6540
|
-
console.log("perpClient executeTriggerOrder error:: ",
|
|
6541
|
-
throw
|
|
6525
|
+
err_39 = _b.sent();
|
|
6526
|
+
console.log("perpClient executeTriggerOrder error:: ", err_39);
|
|
6527
|
+
throw err_39;
|
|
6542
6528
|
case 8: return [2, {
|
|
6543
6529
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6544
6530
|
additionalSigners: additionalSigners
|
|
@@ -6553,7 +6539,7 @@ var PerpetualsClient = (function () {
|
|
|
6553
6539
|
args_1[_i - 5] = arguments[_i];
|
|
6554
6540
|
}
|
|
6555
6541
|
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) {
|
|
6556
|
-
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,
|
|
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, err_40;
|
|
6557
6543
|
if (useFeesPool === void 0) { useFeesPool = false; }
|
|
6558
6544
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6559
6545
|
if (unWrapSol === void 0) { unWrapSol = false; }
|
|
@@ -6764,9 +6750,9 @@ var PerpetualsClient = (function () {
|
|
|
6764
6750
|
}
|
|
6765
6751
|
return [3, 20];
|
|
6766
6752
|
case 19:
|
|
6767
|
-
|
|
6768
|
-
console.error("perpClient Swap error:: ",
|
|
6769
|
-
throw
|
|
6753
|
+
err_40 = _g.sent();
|
|
6754
|
+
console.error("perpClient Swap error:: ", err_40);
|
|
6755
|
+
throw err_40;
|
|
6770
6756
|
case 20: return [2, {
|
|
6771
6757
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6772
6758
|
additionalSigners: additionalSigners
|
|
@@ -6776,7 +6762,7 @@ var PerpetualsClient = (function () {
|
|
|
6776
6762
|
});
|
|
6777
6763
|
};
|
|
6778
6764
|
this.swapFeeInternal = function (rewardTokenSymbol, swapTokenSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6779
|
-
var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx,
|
|
6765
|
+
var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx, err_41;
|
|
6780
6766
|
return __generator(this, function (_b) {
|
|
6781
6767
|
switch (_b.label) {
|
|
6782
6768
|
case 0:
|
|
@@ -6830,9 +6816,9 @@ var PerpetualsClient = (function () {
|
|
|
6830
6816
|
instructions.push(inx);
|
|
6831
6817
|
return [3, 4];
|
|
6832
6818
|
case 3:
|
|
6833
|
-
|
|
6834
|
-
console.error("perpClient Swap error:: ",
|
|
6835
|
-
throw
|
|
6819
|
+
err_41 = _b.sent();
|
|
6820
|
+
console.error("perpClient Swap error:: ", err_41);
|
|
6821
|
+
throw err_41;
|
|
6836
6822
|
case 4: return [2, {
|
|
6837
6823
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6838
6824
|
additionalSigners: additionalSigners
|
|
@@ -6841,7 +6827,7 @@ var PerpetualsClient = (function () {
|
|
|
6841
6827
|
});
|
|
6842
6828
|
}); };
|
|
6843
6829
|
this.setLpTokenPrice = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6844
|
-
var instructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, setLpTokenPriceInstruction,
|
|
6830
|
+
var instructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, setLpTokenPriceInstruction, err_42;
|
|
6845
6831
|
return __generator(this, function (_d) {
|
|
6846
6832
|
switch (_d.label) {
|
|
6847
6833
|
case 0:
|
|
@@ -6889,9 +6875,9 @@ var PerpetualsClient = (function () {
|
|
|
6889
6875
|
instructions.push(setLpTokenPriceInstruction);
|
|
6890
6876
|
return [3, 4];
|
|
6891
6877
|
case 3:
|
|
6892
|
-
|
|
6893
|
-
console.log("perpClient setLpTokenPriceInstruction error:: ",
|
|
6894
|
-
throw
|
|
6878
|
+
err_42 = _d.sent();
|
|
6879
|
+
console.log("perpClient setLpTokenPriceInstruction error:: ", err_42);
|
|
6880
|
+
throw err_42;
|
|
6895
6881
|
case 4: return [2, {
|
|
6896
6882
|
instructions: __spreadArray([], instructions, true),
|
|
6897
6883
|
additionalSigners: additionalSigners
|
|
@@ -6939,7 +6925,7 @@ var PerpetualsClient = (function () {
|
|
|
6939
6925
|
});
|
|
6940
6926
|
}); };
|
|
6941
6927
|
this.setAdminSigners = function (admins, minSignatures) { return __awaiter(_this, void 0, void 0, function () {
|
|
6942
|
-
var adminMetas, _i, admins_2, admin,
|
|
6928
|
+
var adminMetas, _i, admins_2, admin, err_43;
|
|
6943
6929
|
return __generator(this, function (_a) {
|
|
6944
6930
|
switch (_a.label) {
|
|
6945
6931
|
case 0:
|
|
@@ -6969,11 +6955,11 @@ var PerpetualsClient = (function () {
|
|
|
6969
6955
|
_a.sent();
|
|
6970
6956
|
return [3, 4];
|
|
6971
6957
|
case 3:
|
|
6972
|
-
|
|
6958
|
+
err_43 = _a.sent();
|
|
6973
6959
|
if (this.printErrors) {
|
|
6974
|
-
console.error("setAdminSigners err:",
|
|
6960
|
+
console.error("setAdminSigners err:", err_43);
|
|
6975
6961
|
}
|
|
6976
|
-
throw
|
|
6962
|
+
throw err_43;
|
|
6977
6963
|
case 4: return [2];
|
|
6978
6964
|
}
|
|
6979
6965
|
});
|
|
@@ -7170,7 +7156,7 @@ var PerpetualsClient = (function () {
|
|
|
7170
7156
|
});
|
|
7171
7157
|
}); };
|
|
7172
7158
|
this.protocolWithdrawFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7173
|
-
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx,
|
|
7159
|
+
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_44;
|
|
7174
7160
|
return __generator(this, function (_a) {
|
|
7175
7161
|
switch (_a.label) {
|
|
7176
7162
|
case 0:
|
|
@@ -7203,9 +7189,9 @@ var PerpetualsClient = (function () {
|
|
|
7203
7189
|
instructions.push(withdrawFeesIx);
|
|
7204
7190
|
return [3, 5];
|
|
7205
7191
|
case 4:
|
|
7206
|
-
|
|
7207
|
-
console.log("perpClient setPool error:: ",
|
|
7208
|
-
throw
|
|
7192
|
+
err_44 = _a.sent();
|
|
7193
|
+
console.log("perpClient setPool error:: ", err_44);
|
|
7194
|
+
throw err_44;
|
|
7209
7195
|
case 5: return [2, {
|
|
7210
7196
|
instructions: __spreadArray([], instructions, true),
|
|
7211
7197
|
additionalSigners: additionalSigners
|
|
@@ -7214,7 +7200,7 @@ var PerpetualsClient = (function () {
|
|
|
7214
7200
|
});
|
|
7215
7201
|
}); };
|
|
7216
7202
|
this.moveProtocolFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7217
|
-
var publicKey, rewardCustodyConfig, instructions, additionalSigners, moveProtocolFeesIx,
|
|
7203
|
+
var publicKey, rewardCustodyConfig, instructions, additionalSigners, moveProtocolFeesIx, err_45;
|
|
7218
7204
|
return __generator(this, function (_a) {
|
|
7219
7205
|
switch (_a.label) {
|
|
7220
7206
|
case 0:
|
|
@@ -7247,9 +7233,9 @@ var PerpetualsClient = (function () {
|
|
|
7247
7233
|
instructions.push(moveProtocolFeesIx);
|
|
7248
7234
|
return [3, 4];
|
|
7249
7235
|
case 3:
|
|
7250
|
-
|
|
7251
|
-
console.log("perpClient setPool error:: ",
|
|
7252
|
-
throw
|
|
7236
|
+
err_45 = _a.sent();
|
|
7237
|
+
console.log("perpClient setPool error:: ", err_45);
|
|
7238
|
+
throw err_45;
|
|
7253
7239
|
case 4: return [2, {
|
|
7254
7240
|
instructions: __spreadArray([], instructions, true),
|
|
7255
7241
|
additionalSigners: additionalSigners
|
|
@@ -7258,7 +7244,7 @@ var PerpetualsClient = (function () {
|
|
|
7258
7244
|
});
|
|
7259
7245
|
}); };
|
|
7260
7246
|
this.setProtocolFeeShareBps = function (feeShareBps, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7261
|
-
var publicKey, setProtocolFeeShareBpsIx,
|
|
7247
|
+
var publicKey, setProtocolFeeShareBpsIx, err_46;
|
|
7262
7248
|
return __generator(this, function (_a) {
|
|
7263
7249
|
switch (_a.label) {
|
|
7264
7250
|
case 0:
|
|
@@ -7278,15 +7264,15 @@ var PerpetualsClient = (function () {
|
|
|
7278
7264
|
setProtocolFeeShareBpsIx = _a.sent();
|
|
7279
7265
|
return [2, setProtocolFeeShareBpsIx];
|
|
7280
7266
|
case 2:
|
|
7281
|
-
|
|
7282
|
-
console.log("perpClient setProtocolFeeShareBpsIx error:: ",
|
|
7283
|
-
throw
|
|
7267
|
+
err_46 = _a.sent();
|
|
7268
|
+
console.log("perpClient setProtocolFeeShareBpsIx error:: ", err_46);
|
|
7269
|
+
throw err_46;
|
|
7284
7270
|
case 3: return [2];
|
|
7285
7271
|
}
|
|
7286
7272
|
});
|
|
7287
7273
|
}); };
|
|
7288
7274
|
this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
|
|
7289
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction,
|
|
7275
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_47;
|
|
7290
7276
|
return __generator(this, function (_a) {
|
|
7291
7277
|
switch (_a.label) {
|
|
7292
7278
|
case 0:
|
|
@@ -7313,9 +7299,9 @@ var PerpetualsClient = (function () {
|
|
|
7313
7299
|
instructions.push(setPermissionsInstruction);
|
|
7314
7300
|
return [3, 4];
|
|
7315
7301
|
case 3:
|
|
7316
|
-
|
|
7317
|
-
console.log("perpClient setPool error:: ",
|
|
7318
|
-
throw
|
|
7302
|
+
err_47 = _a.sent();
|
|
7303
|
+
console.log("perpClient setPool error:: ", err_47);
|
|
7304
|
+
throw err_47;
|
|
7319
7305
|
case 4: return [2, {
|
|
7320
7306
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7321
7307
|
additionalSigners: additionalSigners
|
|
@@ -7324,7 +7310,7 @@ var PerpetualsClient = (function () {
|
|
|
7324
7310
|
});
|
|
7325
7311
|
}); };
|
|
7326
7312
|
this.reimburse = function (tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7327
|
-
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e,
|
|
7313
|
+
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_48;
|
|
7328
7314
|
var _f;
|
|
7329
7315
|
return __generator(this, function (_g) {
|
|
7330
7316
|
switch (_g.label) {
|
|
@@ -7385,9 +7371,9 @@ var PerpetualsClient = (function () {
|
|
|
7385
7371
|
instructions.push(reimburse);
|
|
7386
7372
|
return [3, 5];
|
|
7387
7373
|
case 4:
|
|
7388
|
-
|
|
7389
|
-
console.log("perpClient setPool error:: ",
|
|
7390
|
-
throw
|
|
7374
|
+
err_48 = _g.sent();
|
|
7375
|
+
console.log("perpClient setPool error:: ", err_48);
|
|
7376
|
+
throw err_48;
|
|
7391
7377
|
case 5: return [2, {
|
|
7392
7378
|
instructions: __spreadArray([], instructions, true),
|
|
7393
7379
|
additionalSigners: additionalSigners
|
|
@@ -7396,7 +7382,7 @@ var PerpetualsClient = (function () {
|
|
|
7396
7382
|
});
|
|
7397
7383
|
}); };
|
|
7398
7384
|
this.setInternalOraclePriceBatch = function (useCurrentTime, tokenMintList, tokenInternalPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
|
7399
|
-
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice,
|
|
7385
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_49;
|
|
7400
7386
|
return __generator(this, function (_a) {
|
|
7401
7387
|
switch (_a.label) {
|
|
7402
7388
|
case 0:
|
|
@@ -7437,9 +7423,9 @@ var PerpetualsClient = (function () {
|
|
|
7437
7423
|
instructions.push(setInternalOraclePrice);
|
|
7438
7424
|
return [3, 4];
|
|
7439
7425
|
case 3:
|
|
7440
|
-
|
|
7441
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
|
7442
|
-
throw
|
|
7426
|
+
err_49 = _a.sent();
|
|
7427
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_49);
|
|
7428
|
+
throw err_49;
|
|
7443
7429
|
case 4: return [2, {
|
|
7444
7430
|
instructions: __spreadArray([], instructions, true),
|
|
7445
7431
|
additionalSigners: additionalSigners
|
|
@@ -7448,7 +7434,7 @@ var PerpetualsClient = (function () {
|
|
|
7448
7434
|
});
|
|
7449
7435
|
}); };
|
|
7450
7436
|
this.setInternalLazerPriceBatch = function (messageData, tokenMintList, pythStorage, pythTreasury, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
|
7451
|
-
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalLazerPrice,
|
|
7437
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalLazerPrice, err_50;
|
|
7452
7438
|
return __generator(this, function (_a) {
|
|
7453
7439
|
switch (_a.label) {
|
|
7454
7440
|
case 0:
|
|
@@ -7489,9 +7475,9 @@ var PerpetualsClient = (function () {
|
|
|
7489
7475
|
instructions.push(setInternalLazerPrice);
|
|
7490
7476
|
return [3, 4];
|
|
7491
7477
|
case 3:
|
|
7492
|
-
|
|
7493
|
-
console.log("perpClient setInternalLazerPriceBatch error:: ",
|
|
7494
|
-
throw
|
|
7478
|
+
err_50 = _a.sent();
|
|
7479
|
+
console.log("perpClient setInternalLazerPriceBatch error:: ", err_50);
|
|
7480
|
+
throw err_50;
|
|
7495
7481
|
case 4: return [2, {
|
|
7496
7482
|
instructions: __spreadArray([], instructions, true),
|
|
7497
7483
|
additionalSigners: additionalSigners
|
|
@@ -7500,7 +7486,7 @@ var PerpetualsClient = (function () {
|
|
|
7500
7486
|
});
|
|
7501
7487
|
}); };
|
|
7502
7488
|
this.setInternalOracleEmaPriceBatch = function (tokenMintList, tokenInternalEmaPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
|
7503
|
-
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_3, _i, tokenMintList_3, tokenMint, instructions, additionalSigners, setInternalOraclePrice,
|
|
7489
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_3, _i, tokenMintList_3, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_51;
|
|
7504
7490
|
return __generator(this, function (_a) {
|
|
7505
7491
|
switch (_a.label) {
|
|
7506
7492
|
case 0:
|
|
@@ -7540,9 +7526,9 @@ var PerpetualsClient = (function () {
|
|
|
7540
7526
|
instructions.push(setInternalOraclePrice);
|
|
7541
7527
|
return [3, 4];
|
|
7542
7528
|
case 3:
|
|
7543
|
-
|
|
7544
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
|
7545
|
-
throw
|
|
7529
|
+
err_51 = _a.sent();
|
|
7530
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_51);
|
|
7531
|
+
throw err_51;
|
|
7546
7532
|
case 4: return [2, {
|
|
7547
7533
|
instructions: __spreadArray([], instructions, true),
|
|
7548
7534
|
additionalSigners: additionalSigners
|
|
@@ -7551,7 +7537,7 @@ var PerpetualsClient = (function () {
|
|
|
7551
7537
|
});
|
|
7552
7538
|
}); };
|
|
7553
7539
|
this.setPositionPriceImpact = function (positionPubkey, priceImpactUsd, penaltyAuthority) { return __awaiter(_this, void 0, void 0, function () {
|
|
7554
|
-
var instructions, additionalSigners, setPositionPriceImpactIx,
|
|
7540
|
+
var instructions, additionalSigners, setPositionPriceImpactIx, err_52;
|
|
7555
7541
|
return __generator(this, function (_a) {
|
|
7556
7542
|
switch (_a.label) {
|
|
7557
7543
|
case 0:
|
|
@@ -7575,9 +7561,9 @@ var PerpetualsClient = (function () {
|
|
|
7575
7561
|
instructions.push(setPositionPriceImpactIx);
|
|
7576
7562
|
return [3, 4];
|
|
7577
7563
|
case 3:
|
|
7578
|
-
|
|
7579
|
-
console.log("perpClient setPositionPriceImpact error:: ",
|
|
7580
|
-
throw
|
|
7564
|
+
err_52 = _a.sent();
|
|
7565
|
+
console.log("perpClient setPositionPriceImpact error:: ", err_52);
|
|
7566
|
+
throw err_52;
|
|
7581
7567
|
case 4: return [2, {
|
|
7582
7568
|
instructions: __spreadArray([], instructions, true),
|
|
7583
7569
|
additionalSigners: additionalSigners
|
|
@@ -7586,7 +7572,7 @@ var PerpetualsClient = (function () {
|
|
|
7586
7572
|
});
|
|
7587
7573
|
}); };
|
|
7588
7574
|
this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7589
|
-
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp,
|
|
7575
|
+
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_53;
|
|
7590
7576
|
return __generator(this, function (_a) {
|
|
7591
7577
|
switch (_a.label) {
|
|
7592
7578
|
case 0:
|
|
@@ -7624,8 +7610,8 @@ var PerpetualsClient = (function () {
|
|
|
7624
7610
|
instructions.push(renameFlp);
|
|
7625
7611
|
return [3, 4];
|
|
7626
7612
|
case 3:
|
|
7627
|
-
|
|
7628
|
-
console.log("perpClient renameFlp error:: ",
|
|
7613
|
+
err_53 = _a.sent();
|
|
7614
|
+
console.log("perpClient renameFlp error:: ", err_53);
|
|
7629
7615
|
return [3, 4];
|
|
7630
7616
|
case 4: return [2, {
|
|
7631
7617
|
instructions: __spreadArray([], instructions, true),
|
|
@@ -7635,7 +7621,7 @@ var PerpetualsClient = (function () {
|
|
|
7635
7621
|
});
|
|
7636
7622
|
}); };
|
|
7637
7623
|
this.initStake = function (stakingFeeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7638
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction,
|
|
7624
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_54;
|
|
7639
7625
|
return __generator(this, function (_a) {
|
|
7640
7626
|
switch (_a.label) {
|
|
7641
7627
|
case 0:
|
|
@@ -7673,9 +7659,9 @@ var PerpetualsClient = (function () {
|
|
|
7673
7659
|
instructions.push(initStakeInstruction);
|
|
7674
7660
|
return [3, 4];
|
|
7675
7661
|
case 3:
|
|
7676
|
-
|
|
7677
|
-
console.log("perpClient InitStaking error:: ",
|
|
7678
|
-
throw
|
|
7662
|
+
err_54 = _a.sent();
|
|
7663
|
+
console.log("perpClient InitStaking error:: ", err_54);
|
|
7664
|
+
throw err_54;
|
|
7679
7665
|
case 4: return [2, {
|
|
7680
7666
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7681
7667
|
additionalSigners: additionalSigners
|
|
@@ -7684,7 +7670,7 @@ var PerpetualsClient = (function () {
|
|
|
7684
7670
|
});
|
|
7685
7671
|
}); };
|
|
7686
7672
|
this.initCompounding = function (feeShareBps, metadataTitle, metadataSymbol, metadataUri, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7687
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction,
|
|
7673
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_55;
|
|
7688
7674
|
return __generator(this, function (_a) {
|
|
7689
7675
|
switch (_a.label) {
|
|
7690
7676
|
case 0:
|
|
@@ -7728,9 +7714,9 @@ var PerpetualsClient = (function () {
|
|
|
7728
7714
|
instructions.push(initCompoundingInstruction);
|
|
7729
7715
|
return [3, 4];
|
|
7730
7716
|
case 3:
|
|
7731
|
-
|
|
7732
|
-
console.log("perpClient initCompounding error:: ",
|
|
7733
|
-
throw
|
|
7717
|
+
err_55 = _a.sent();
|
|
7718
|
+
console.log("perpClient initCompounding error:: ", err_55);
|
|
7719
|
+
throw err_55;
|
|
7734
7720
|
case 4: return [2, {
|
|
7735
7721
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7736
7722
|
additionalSigners: additionalSigners
|
|
@@ -7739,7 +7725,7 @@ var PerpetualsClient = (function () {
|
|
|
7739
7725
|
});
|
|
7740
7726
|
}); };
|
|
7741
7727
|
this.initTokenVault = function (token_permissions, tokens_to_distribute, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7742
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction,
|
|
7728
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_56;
|
|
7743
7729
|
return __generator(this, function (_a) {
|
|
7744
7730
|
switch (_a.label) {
|
|
7745
7731
|
case 0:
|
|
@@ -7780,9 +7766,9 @@ var PerpetualsClient = (function () {
|
|
|
7780
7766
|
instructions.push(initTokenVaultInstruction);
|
|
7781
7767
|
return [3, 4];
|
|
7782
7768
|
case 3:
|
|
7783
|
-
|
|
7784
|
-
console.log("perpClient InitTokenVaultInstruction error:: ",
|
|
7785
|
-
throw
|
|
7769
|
+
err_56 = _a.sent();
|
|
7770
|
+
console.log("perpClient InitTokenVaultInstruction error:: ", err_56);
|
|
7771
|
+
throw err_56;
|
|
7786
7772
|
case 4: return [2, {
|
|
7787
7773
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7788
7774
|
additionalSigners: additionalSigners
|
|
@@ -7790,8 +7776,8 @@ var PerpetualsClient = (function () {
|
|
|
7790
7776
|
}
|
|
7791
7777
|
});
|
|
7792
7778
|
}); };
|
|
7793
|
-
this.setTokenVaultConfig = function (token_permissions, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7794
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction,
|
|
7779
|
+
this.setTokenVaultConfig = function (token_permissions, withdrawTimeLimit, withdrawInstantFee, stakeLevel, unlockPeriod, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7780
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_57;
|
|
7795
7781
|
return __generator(this, function (_a) {
|
|
7796
7782
|
switch (_a.label) {
|
|
7797
7783
|
case 0:
|
|
@@ -7809,6 +7795,7 @@ var PerpetualsClient = (function () {
|
|
|
7809
7795
|
withdrawTimeLimit: withdrawTimeLimit,
|
|
7810
7796
|
withdrawInstantFee: withdrawInstantFee,
|
|
7811
7797
|
stakeLevel: stakeLevel,
|
|
7798
|
+
unlockPeriod: unlockPeriod,
|
|
7812
7799
|
})
|
|
7813
7800
|
.accountsPartial({
|
|
7814
7801
|
admin: publicKey,
|
|
@@ -7822,9 +7809,9 @@ var PerpetualsClient = (function () {
|
|
|
7822
7809
|
instructions.push(setTokenVaultConfigInstruction);
|
|
7823
7810
|
return [3, 4];
|
|
7824
7811
|
case 3:
|
|
7825
|
-
|
|
7826
|
-
console.log("perpClient setTokenVaultConfigInstruction error:: ",
|
|
7827
|
-
throw
|
|
7812
|
+
err_57 = _a.sent();
|
|
7813
|
+
console.log("perpClient setTokenVaultConfigInstruction error:: ", err_57);
|
|
7814
|
+
throw err_57;
|
|
7828
7815
|
case 4: return [2, {
|
|
7829
7816
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7830
7817
|
additionalSigners: additionalSigners
|
|
@@ -7833,7 +7820,7 @@ var PerpetualsClient = (function () {
|
|
|
7833
7820
|
});
|
|
7834
7821
|
}); };
|
|
7835
7822
|
this.withdrawInstantFee = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7836
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction,
|
|
7823
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_58;
|
|
7837
7824
|
return __generator(this, function (_a) {
|
|
7838
7825
|
switch (_a.label) {
|
|
7839
7826
|
case 0:
|
|
@@ -7872,9 +7859,9 @@ var PerpetualsClient = (function () {
|
|
|
7872
7859
|
instructions.push(withdrawInstantFeeInstruction);
|
|
7873
7860
|
return [3, 6];
|
|
7874
7861
|
case 5:
|
|
7875
|
-
|
|
7876
|
-
console.log("perpClient withdrawInstantFeeInstruction error:: ",
|
|
7877
|
-
throw
|
|
7862
|
+
err_58 = _a.sent();
|
|
7863
|
+
console.log("perpClient withdrawInstantFeeInstruction error:: ", err_58);
|
|
7864
|
+
throw err_58;
|
|
7878
7865
|
case 6: return [2, {
|
|
7879
7866
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7880
7867
|
additionalSigners: additionalSigners
|
|
@@ -7883,7 +7870,7 @@ var PerpetualsClient = (function () {
|
|
|
7883
7870
|
});
|
|
7884
7871
|
}); };
|
|
7885
7872
|
this.withdrawUnclaimedTokens = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7886
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction,
|
|
7873
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction, err_59;
|
|
7887
7874
|
return __generator(this, function (_a) {
|
|
7888
7875
|
switch (_a.label) {
|
|
7889
7876
|
case 0:
|
|
@@ -7922,9 +7909,9 @@ var PerpetualsClient = (function () {
|
|
|
7922
7909
|
instructions.push(withdrawUnclaimedTokensInstruction);
|
|
7923
7910
|
return [3, 6];
|
|
7924
7911
|
case 5:
|
|
7925
|
-
|
|
7926
|
-
console.log("perpClient withdrawUnclaimedTokensInstruction error:: ",
|
|
7927
|
-
throw
|
|
7912
|
+
err_59 = _a.sent();
|
|
7913
|
+
console.log("perpClient withdrawUnclaimedTokensInstruction error:: ", err_59);
|
|
7914
|
+
throw err_59;
|
|
7928
7915
|
case 6: return [2, {
|
|
7929
7916
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7930
7917
|
additionalSigners: additionalSigners
|
|
@@ -7933,7 +7920,7 @@ var PerpetualsClient = (function () {
|
|
|
7933
7920
|
});
|
|
7934
7921
|
}); };
|
|
7935
7922
|
this.initRevenueTokenAccount = function (feeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7936
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction,
|
|
7923
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_60;
|
|
7937
7924
|
return __generator(this, function (_a) {
|
|
7938
7925
|
switch (_a.label) {
|
|
7939
7926
|
case 0:
|
|
@@ -7970,9 +7957,9 @@ var PerpetualsClient = (function () {
|
|
|
7970
7957
|
instructions.push(initRevenueTokenAccountInstruction);
|
|
7971
7958
|
return [3, 4];
|
|
7972
7959
|
case 3:
|
|
7973
|
-
|
|
7974
|
-
console.log("perpClient initRevenueTokenAccountInstruction error:: ",
|
|
7975
|
-
throw
|
|
7960
|
+
err_60 = _a.sent();
|
|
7961
|
+
console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_60);
|
|
7962
|
+
throw err_60;
|
|
7976
7963
|
case 4: return [2, {
|
|
7977
7964
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7978
7965
|
additionalSigners: additionalSigners
|
|
@@ -7981,7 +7968,7 @@ var PerpetualsClient = (function () {
|
|
|
7981
7968
|
});
|
|
7982
7969
|
}); };
|
|
7983
7970
|
this.initRebateVault = function (allowRebatePayout, rebateSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7984
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateCustodyMint, initRebateVaultInstruction,
|
|
7971
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateCustodyMint, initRebateVaultInstruction, err_61;
|
|
7985
7972
|
return __generator(this, function (_a) {
|
|
7986
7973
|
switch (_a.label) {
|
|
7987
7974
|
case 0:
|
|
@@ -8016,9 +8003,9 @@ var PerpetualsClient = (function () {
|
|
|
8016
8003
|
instructions.push(initRebateVaultInstruction);
|
|
8017
8004
|
return [3, 4];
|
|
8018
8005
|
case 3:
|
|
8019
|
-
|
|
8020
|
-
console.log("perpClient initRebateVaultInstruction error:: ",
|
|
8021
|
-
throw
|
|
8006
|
+
err_61 = _a.sent();
|
|
8007
|
+
console.log("perpClient initRebateVaultInstruction error:: ", err_61);
|
|
8008
|
+
throw err_61;
|
|
8022
8009
|
case 4: return [2, {
|
|
8023
8010
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8024
8011
|
additionalSigners: additionalSigners
|
|
@@ -8027,7 +8014,7 @@ var PerpetualsClient = (function () {
|
|
|
8027
8014
|
});
|
|
8028
8015
|
}); };
|
|
8029
8016
|
this.distributeTokenReward = function (amount, epochCount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8030
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction,
|
|
8017
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_62;
|
|
8031
8018
|
return __generator(this, function (_a) {
|
|
8032
8019
|
switch (_a.label) {
|
|
8033
8020
|
case 0:
|
|
@@ -8064,9 +8051,9 @@ var PerpetualsClient = (function () {
|
|
|
8064
8051
|
instructions.push(distributeTokenRewardInstruction);
|
|
8065
8052
|
return [3, 4];
|
|
8066
8053
|
case 3:
|
|
8067
|
-
|
|
8068
|
-
console.log("perpClient distributeTokenRewardInstruction error:: ",
|
|
8069
|
-
throw
|
|
8054
|
+
err_62 = _a.sent();
|
|
8055
|
+
console.log("perpClient distributeTokenRewardInstruction error:: ", err_62);
|
|
8056
|
+
throw err_62;
|
|
8070
8057
|
case 4: return [2, {
|
|
8071
8058
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8072
8059
|
additionalSigners: additionalSigners
|
|
@@ -8075,7 +8062,7 @@ var PerpetualsClient = (function () {
|
|
|
8075
8062
|
});
|
|
8076
8063
|
}); };
|
|
8077
8064
|
this.setTokenStakeLevel = function (owner, stakeLevel, isInitialized) { return __awaiter(_this, void 0, void 0, function () {
|
|
8078
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction,
|
|
8065
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_63;
|
|
8079
8066
|
return __generator(this, function (_a) {
|
|
8080
8067
|
switch (_a.label) {
|
|
8081
8068
|
case 0:
|
|
@@ -8104,9 +8091,9 @@ var PerpetualsClient = (function () {
|
|
|
8104
8091
|
instructions.push(setTokenStakeLevelInstruction);
|
|
8105
8092
|
return [3, 4];
|
|
8106
8093
|
case 3:
|
|
8107
|
-
|
|
8108
|
-
console.log("perpClient setTokenStakeLevelInstruction error:: ",
|
|
8109
|
-
throw
|
|
8094
|
+
err_63 = _a.sent();
|
|
8095
|
+
console.log("perpClient setTokenStakeLevelInstruction error:: ", err_63);
|
|
8096
|
+
throw err_63;
|
|
8110
8097
|
case 4: return [2, {
|
|
8111
8098
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8112
8099
|
additionalSigners: additionalSigners
|
|
@@ -8115,7 +8102,7 @@ var PerpetualsClient = (function () {
|
|
|
8115
8102
|
});
|
|
8116
8103
|
}); };
|
|
8117
8104
|
this.setTokenReward = function (owner, amount, epochCount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8118
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction,
|
|
8105
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_64;
|
|
8119
8106
|
return __generator(this, function (_a) {
|
|
8120
8107
|
switch (_a.label) {
|
|
8121
8108
|
case 0:
|
|
@@ -8146,9 +8133,9 @@ var PerpetualsClient = (function () {
|
|
|
8146
8133
|
instructions.push(setTokenRewardInstruction);
|
|
8147
8134
|
return [3, 4];
|
|
8148
8135
|
case 3:
|
|
8149
|
-
|
|
8150
|
-
console.log("perpClient setTokenRewardInstruction error:: ",
|
|
8151
|
-
throw
|
|
8136
|
+
err_64 = _a.sent();
|
|
8137
|
+
console.log("perpClient setTokenRewardInstruction error:: ", err_64);
|
|
8138
|
+
throw err_64;
|
|
8152
8139
|
case 4: return [2, {
|
|
8153
8140
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8154
8141
|
additionalSigners: additionalSigners
|
|
@@ -8157,7 +8144,7 @@ var PerpetualsClient = (function () {
|
|
|
8157
8144
|
});
|
|
8158
8145
|
}); };
|
|
8159
8146
|
this.resizeInternalOracle = function (lazerFeedId, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
|
|
8160
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction,
|
|
8147
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction, err_65;
|
|
8161
8148
|
return __generator(this, function (_a) {
|
|
8162
8149
|
switch (_a.label) {
|
|
8163
8150
|
case 0:
|
|
@@ -8186,9 +8173,9 @@ var PerpetualsClient = (function () {
|
|
|
8186
8173
|
instructions.push(resizeInternalOracleInstruction);
|
|
8187
8174
|
return [3, 4];
|
|
8188
8175
|
case 3:
|
|
8189
|
-
|
|
8190
|
-
console.log("perpClient resizeInternalOracleInstruction error:: ",
|
|
8191
|
-
throw
|
|
8176
|
+
err_65 = _a.sent();
|
|
8177
|
+
console.log("perpClient resizeInternalOracleInstruction error:: ", err_65);
|
|
8178
|
+
throw err_65;
|
|
8192
8179
|
case 4: return [2, {
|
|
8193
8180
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8194
8181
|
additionalSigners: additionalSigners
|
|
@@ -8197,7 +8184,7 @@ var PerpetualsClient = (function () {
|
|
|
8197
8184
|
});
|
|
8198
8185
|
}); };
|
|
8199
8186
|
this.createWhitelist = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
|
|
8200
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction,
|
|
8187
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction, err_66;
|
|
8201
8188
|
return __generator(this, function (_a) {
|
|
8202
8189
|
switch (_a.label) {
|
|
8203
8190
|
case 0:
|
|
@@ -8230,9 +8217,9 @@ var PerpetualsClient = (function () {
|
|
|
8230
8217
|
instructions.push(createWhitelistInstruction);
|
|
8231
8218
|
return [3, 4];
|
|
8232
8219
|
case 3:
|
|
8233
|
-
|
|
8234
|
-
console.log("perpClient createWhitelistInstruction error:: ",
|
|
8235
|
-
throw
|
|
8220
|
+
err_66 = _a.sent();
|
|
8221
|
+
console.log("perpClient createWhitelistInstruction error:: ", err_66);
|
|
8222
|
+
throw err_66;
|
|
8236
8223
|
case 4: return [2, {
|
|
8237
8224
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8238
8225
|
additionalSigners: additionalSigners
|
|
@@ -8241,7 +8228,7 @@ var PerpetualsClient = (function () {
|
|
|
8241
8228
|
});
|
|
8242
8229
|
}); };
|
|
8243
8230
|
this.setWhitelistConfig = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
|
|
8244
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction,
|
|
8231
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction, err_67;
|
|
8245
8232
|
return __generator(this, function (_a) {
|
|
8246
8233
|
switch (_a.label) {
|
|
8247
8234
|
case 0:
|
|
@@ -8274,9 +8261,9 @@ var PerpetualsClient = (function () {
|
|
|
8274
8261
|
instructions.push(setWhitelistConfigInstruction);
|
|
8275
8262
|
return [3, 4];
|
|
8276
8263
|
case 3:
|
|
8277
|
-
|
|
8278
|
-
console.log("perpClient setWhitelistConfigInstruction error:: ",
|
|
8279
|
-
throw
|
|
8264
|
+
err_67 = _a.sent();
|
|
8265
|
+
console.log("perpClient setWhitelistConfigInstruction error:: ", err_67);
|
|
8266
|
+
throw err_67;
|
|
8280
8267
|
case 4: return [2, {
|
|
8281
8268
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8282
8269
|
additionalSigners: additionalSigners
|
|
@@ -8285,7 +8272,7 @@ var PerpetualsClient = (function () {
|
|
|
8285
8272
|
});
|
|
8286
8273
|
}); };
|
|
8287
8274
|
this.setPerpetualsConfig = function (allowUngatedTrading, voltageMultiplier, tradingDiscount, referralRebate, defaultRebate, tradeLimit, triggerOrderLimit, rebateLimitUsd) { return __awaiter(_this, void 0, void 0, function () {
|
|
8288
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPerpetualsConfigInstruction,
|
|
8275
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPerpetualsConfigInstruction, err_68;
|
|
8289
8276
|
return __generator(this, function (_a) {
|
|
8290
8277
|
switch (_a.label) {
|
|
8291
8278
|
case 0:
|
|
@@ -8319,9 +8306,9 @@ var PerpetualsClient = (function () {
|
|
|
8319
8306
|
instructions.push(setPerpetualsConfigInstruction);
|
|
8320
8307
|
return [3, 4];
|
|
8321
8308
|
case 3:
|
|
8322
|
-
|
|
8323
|
-
console.log("perpClient setPerpetualsConfigInstruction error:: ",
|
|
8324
|
-
throw
|
|
8309
|
+
err_68 = _a.sent();
|
|
8310
|
+
console.log("perpClient setPerpetualsConfigInstruction error:: ", err_68);
|
|
8311
|
+
throw err_68;
|
|
8325
8312
|
case 4: return [2, {
|
|
8326
8313
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8327
8314
|
additionalSigners: additionalSigners
|
|
@@ -8330,7 +8317,7 @@ var PerpetualsClient = (function () {
|
|
|
8330
8317
|
});
|
|
8331
8318
|
}); };
|
|
8332
8319
|
this.setPoolConfig = function (name, permissions, maxAumUsd, oracleAuthority, stakingFeeShareBps, vpVolumeFactor, stakingFeeBoostBps, minLpPriceUsd, maxLpPriceUsd, thresholdUsd) { return __awaiter(_this, void 0, void 0, function () {
|
|
8333
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPoolConfigInstruction,
|
|
8320
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPoolConfigInstruction, err_69;
|
|
8334
8321
|
return __generator(this, function (_a) {
|
|
8335
8322
|
switch (_a.label) {
|
|
8336
8323
|
case 0:
|
|
@@ -8358,9 +8345,9 @@ var PerpetualsClient = (function () {
|
|
|
8358
8345
|
instructions.push(setPoolConfigInstruction);
|
|
8359
8346
|
return [3, 4];
|
|
8360
8347
|
case 3:
|
|
8361
|
-
|
|
8362
|
-
console.log("perpClient setPoolConfigInstruction error:: ",
|
|
8363
|
-
throw
|
|
8348
|
+
err_69 = _a.sent();
|
|
8349
|
+
console.log("perpClient setPoolConfigInstruction error:: ", err_69);
|
|
8350
|
+
throw err_69;
|
|
8364
8351
|
case 4: return [2, {
|
|
8365
8352
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8366
8353
|
additionalSigners: additionalSigners
|
|
@@ -8369,7 +8356,7 @@ var PerpetualsClient = (function () {
|
|
|
8369
8356
|
});
|
|
8370
8357
|
}); };
|
|
8371
8358
|
this.addCustodyToken22 = function (poolName, tokenMint, tokenAccountSpace, token22) { return __awaiter(_this, void 0, void 0, function () {
|
|
8372
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, addCustodyToken22Instruction,
|
|
8359
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, addCustodyToken22Instruction, err_70;
|
|
8373
8360
|
return __generator(this, function (_a) {
|
|
8374
8361
|
switch (_a.label) {
|
|
8375
8362
|
case 0:
|
|
@@ -8403,9 +8390,9 @@ var PerpetualsClient = (function () {
|
|
|
8403
8390
|
instructions.push(addCustodyToken22Instruction);
|
|
8404
8391
|
return [3, 4];
|
|
8405
8392
|
case 3:
|
|
8406
|
-
|
|
8407
|
-
console.log("perpClient addCustodyToken22Instruction error:: ",
|
|
8408
|
-
throw
|
|
8393
|
+
err_70 = _a.sent();
|
|
8394
|
+
console.log("perpClient addCustodyToken22Instruction error:: ", err_70);
|
|
8395
|
+
throw err_70;
|
|
8409
8396
|
case 4: return [2, {
|
|
8410
8397
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8411
8398
|
additionalSigners: additionalSigners
|
|
@@ -8414,7 +8401,7 @@ var PerpetualsClient = (function () {
|
|
|
8414
8401
|
});
|
|
8415
8402
|
}); };
|
|
8416
8403
|
this.addMarket = function (poolName, targetCustody, collateralCustody, side, correlation, maxPayoffBps, permissions) { return __awaiter(_this, void 0, void 0, function () {
|
|
8417
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, market, addMarketInstruction,
|
|
8404
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, market, addMarketInstruction, err_71;
|
|
8418
8405
|
return __generator(this, function (_a) {
|
|
8419
8406
|
switch (_a.label) {
|
|
8420
8407
|
case 0:
|
|
@@ -8457,9 +8444,9 @@ var PerpetualsClient = (function () {
|
|
|
8457
8444
|
instructions.push(addMarketInstruction);
|
|
8458
8445
|
return [3, 4];
|
|
8459
8446
|
case 3:
|
|
8460
|
-
|
|
8461
|
-
console.log("perpClient addMarketInstruction error:: ",
|
|
8462
|
-
throw
|
|
8447
|
+
err_71 = _a.sent();
|
|
8448
|
+
console.log("perpClient addMarketInstruction error:: ", err_71);
|
|
8449
|
+
throw err_71;
|
|
8463
8450
|
case 4: return [2, {
|
|
8464
8451
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8465
8452
|
additionalSigners: additionalSigners
|
|
@@ -8468,7 +8455,7 @@ var PerpetualsClient = (function () {
|
|
|
8468
8455
|
});
|
|
8469
8456
|
}); };
|
|
8470
8457
|
this.setCustody = function (poolName, tokenMint, depegAdjustment, inversePrice, oracle, pricingConfig, permissions, fees, borrowRate, ratios, rewardThreshold, minReserveUsd, limitPriceBufferBps, token22) { return __awaiter(_this, void 0, void 0, function () {
|
|
8471
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setCustodyConfigInstruction,
|
|
8458
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setCustodyConfigInstruction, err_72;
|
|
8472
8459
|
return __generator(this, function (_a) {
|
|
8473
8460
|
switch (_a.label) {
|
|
8474
8461
|
case 0:
|
|
@@ -8507,9 +8494,9 @@ var PerpetualsClient = (function () {
|
|
|
8507
8494
|
instructions.push(setCustodyConfigInstruction);
|
|
8508
8495
|
return [3, 4];
|
|
8509
8496
|
case 3:
|
|
8510
|
-
|
|
8511
|
-
console.log("perpClient setCustodyConfigInstruction error:: ",
|
|
8512
|
-
throw
|
|
8497
|
+
err_72 = _a.sent();
|
|
8498
|
+
console.log("perpClient setCustodyConfigInstruction error:: ", err_72);
|
|
8499
|
+
throw err_72;
|
|
8513
8500
|
case 4: return [2, {
|
|
8514
8501
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8515
8502
|
additionalSigners: additionalSigners
|
|
@@ -8518,7 +8505,7 @@ var PerpetualsClient = (function () {
|
|
|
8518
8505
|
});
|
|
8519
8506
|
}); };
|
|
8520
8507
|
this.addInternalOracle = function (exponent, lazerFeedId, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
|
|
8521
|
-
var preInstructions, instructions, postInstructions, additionalSigners, addInternalOracleInstruction,
|
|
8508
|
+
var preInstructions, instructions, postInstructions, additionalSigners, addInternalOracleInstruction, err_73;
|
|
8522
8509
|
return __generator(this, function (_a) {
|
|
8523
8510
|
switch (_a.label) {
|
|
8524
8511
|
case 0:
|
|
@@ -8548,9 +8535,9 @@ var PerpetualsClient = (function () {
|
|
|
8548
8535
|
instructions.push(addInternalOracleInstruction);
|
|
8549
8536
|
return [3, 4];
|
|
8550
8537
|
case 3:
|
|
8551
|
-
|
|
8552
|
-
console.log("perpClient setCustodyConfigInstruction error:: ",
|
|
8553
|
-
throw
|
|
8538
|
+
err_73 = _a.sent();
|
|
8539
|
+
console.log("perpClient setCustodyConfigInstruction error:: ", err_73);
|
|
8540
|
+
throw err_73;
|
|
8554
8541
|
case 4: return [2, {
|
|
8555
8542
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8556
8543
|
additionalSigners: additionalSigners
|
|
@@ -8559,7 +8546,7 @@ var PerpetualsClient = (function () {
|
|
|
8559
8546
|
});
|
|
8560
8547
|
}); };
|
|
8561
8548
|
this.setMarket = function (poolName, targetCustody, collateralCustody, marketAccount, maxPayoffBps, permissions, correlation) { return __awaiter(_this, void 0, void 0, function () {
|
|
8562
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setMarketConfigInstruction,
|
|
8549
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setMarketConfigInstruction, err_74;
|
|
8563
8550
|
return __generator(this, function (_a) {
|
|
8564
8551
|
switch (_a.label) {
|
|
8565
8552
|
case 0:
|
|
@@ -8590,9 +8577,9 @@ var PerpetualsClient = (function () {
|
|
|
8590
8577
|
instructions.push(setMarketConfigInstruction);
|
|
8591
8578
|
return [3, 4];
|
|
8592
8579
|
case 3:
|
|
8593
|
-
|
|
8594
|
-
console.log("perpClient setCustodyConfigInstruction error:: ",
|
|
8595
|
-
throw
|
|
8580
|
+
err_74 = _a.sent();
|
|
8581
|
+
console.log("perpClient setCustodyConfigInstruction error:: ", err_74);
|
|
8582
|
+
throw err_74;
|
|
8596
8583
|
case 4: return [2, {
|
|
8597
8584
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8598
8585
|
additionalSigners: additionalSigners
|
|
@@ -8601,7 +8588,7 @@ var PerpetualsClient = (function () {
|
|
|
8601
8588
|
});
|
|
8602
8589
|
}); };
|
|
8603
8590
|
this.removeMarket = function (poolName, market, targetMint, collateralMint) { return __awaiter(_this, void 0, void 0, function () {
|
|
8604
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, removeMarketInstruction,
|
|
8591
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, removeMarketInstruction, err_75;
|
|
8605
8592
|
return __generator(this, function (_a) {
|
|
8606
8593
|
switch (_a.label) {
|
|
8607
8594
|
case 0:
|
|
@@ -8633,9 +8620,9 @@ var PerpetualsClient = (function () {
|
|
|
8633
8620
|
instructions.push(removeMarketInstruction);
|
|
8634
8621
|
return [3, 4];
|
|
8635
8622
|
case 3:
|
|
8636
|
-
|
|
8637
|
-
console.log("perpClient setCustodyConfigInstruction error:: ",
|
|
8638
|
-
throw
|
|
8623
|
+
err_75 = _a.sent();
|
|
8624
|
+
console.log("perpClient setCustodyConfigInstruction error:: ", err_75);
|
|
8625
|
+
throw err_75;
|
|
8639
8626
|
case 4: return [2, {
|
|
8640
8627
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8641
8628
|
additionalSigners: additionalSigners
|
|
@@ -8765,3 +8752,4 @@ var PerpetualsClient = (function () {
|
|
|
8765
8752
|
return PerpetualsClient;
|
|
8766
8753
|
}());
|
|
8767
8754
|
exports.PerpetualsClient = PerpetualsClient;
|
|
8755
|
+
;
|