flash-sdk 10.6.0 → 10.6.2
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 +6 -16
- package/dist/PerpetualsClient.js +273 -472
- 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 +1 -0
- package/dist/TokenVaultAccount.d.ts +1 -0
- package/dist/TradingAccount.d.ts +1 -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 +72 -505
- package/dist/idl/perpetuals.js +72 -505
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +1 -2
- 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.d.ts +1 -0
- 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.");
|
|
@@ -4096,119 +4096,8 @@ var PerpetualsClient = (function () {
|
|
|
4096
4096
|
}
|
|
4097
4097
|
});
|
|
4098
4098
|
}); };
|
|
4099
|
-
this.updateNftAccount = function (nftMint, updateReferer, updateBooster, flpStakeAccounts) { return __awaiter(_this, void 0, void 0, function () {
|
|
4100
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, nftTradingAccount, nftReferralAccount, nftTokenAccount, flpStakeAccountMetas, _i, flpStakeAccounts_1, flpStakeAccountPk, updateNftTradingAccountInstruction, err_8;
|
|
4101
|
-
return __generator(this, function (_a) {
|
|
4102
|
-
switch (_a.label) {
|
|
4103
|
-
case 0:
|
|
4104
|
-
publicKey = this.provider.wallet.publicKey;
|
|
4105
|
-
preInstructions = [];
|
|
4106
|
-
instructions = [];
|
|
4107
|
-
postInstructions = [];
|
|
4108
|
-
additionalSigners = [];
|
|
4109
|
-
_a.label = 1;
|
|
4110
|
-
case 1:
|
|
4111
|
-
_a.trys.push([1, 4, , 5]);
|
|
4112
|
-
nftTradingAccount = web3_js_1.PublicKey.findProgramAddressSync([
|
|
4113
|
-
Buffer.from("trading"),
|
|
4114
|
-
nftMint.toBuffer(),
|
|
4115
|
-
], this.programId)[0];
|
|
4116
|
-
nftReferralAccount = web3_js_1.PublicKey.findProgramAddressSync([
|
|
4117
|
-
Buffer.from("referral"),
|
|
4118
|
-
publicKey.toBuffer(),
|
|
4119
|
-
], this.programId)[0];
|
|
4120
|
-
return [4, (0, spl_token_1.getAssociatedTokenAddress)(nftMint, publicKey, true)];
|
|
4121
|
-
case 2:
|
|
4122
|
-
nftTokenAccount = _a.sent();
|
|
4123
|
-
flpStakeAccountMetas = [];
|
|
4124
|
-
for (_i = 0, flpStakeAccounts_1 = flpStakeAccounts; _i < flpStakeAccounts_1.length; _i++) {
|
|
4125
|
-
flpStakeAccountPk = flpStakeAccounts_1[_i];
|
|
4126
|
-
flpStakeAccountMetas.push({
|
|
4127
|
-
pubkey: flpStakeAccountPk,
|
|
4128
|
-
isSigner: false,
|
|
4129
|
-
isWritable: true,
|
|
4130
|
-
});
|
|
4131
|
-
}
|
|
4132
|
-
return [4, this.program.methods
|
|
4133
|
-
.updateTradingAccount({
|
|
4134
|
-
updateReferer: updateReferer,
|
|
4135
|
-
updateBooster: updateBooster
|
|
4136
|
-
})
|
|
4137
|
-
.accounts({
|
|
4138
|
-
owner: publicKey,
|
|
4139
|
-
feePayer: publicKey,
|
|
4140
|
-
nftTokenAccount: nftTokenAccount,
|
|
4141
|
-
referralAccount: nftReferralAccount,
|
|
4142
|
-
tradingAccount: nftTradingAccount
|
|
4143
|
-
})
|
|
4144
|
-
.instruction()];
|
|
4145
|
-
case 3:
|
|
4146
|
-
updateNftTradingAccountInstruction = _a.sent();
|
|
4147
|
-
instructions.push(updateNftTradingAccountInstruction);
|
|
4148
|
-
return [3, 5];
|
|
4149
|
-
case 4:
|
|
4150
|
-
err_8 = _a.sent();
|
|
4151
|
-
console.log("perpClient updateNftAccount error:: ", err_8);
|
|
4152
|
-
throw err_8;
|
|
4153
|
-
case 5: return [2, {
|
|
4154
|
-
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4155
|
-
additionalSigners: additionalSigners
|
|
4156
|
-
}];
|
|
4157
|
-
}
|
|
4158
|
-
});
|
|
4159
|
-
}); };
|
|
4160
|
-
this.levelUp = function (poolConfig, nftMint, authorizationRulesAccount) { return __awaiter(_this, void 0, void 0, function () {
|
|
4161
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, nftTradingAccount, metadataAccount, levelUpInstruction, err_9;
|
|
4162
|
-
return __generator(this, function (_a) {
|
|
4163
|
-
switch (_a.label) {
|
|
4164
|
-
case 0:
|
|
4165
|
-
publicKey = this.provider.wallet.publicKey;
|
|
4166
|
-
preInstructions = [];
|
|
4167
|
-
instructions = [];
|
|
4168
|
-
postInstructions = [];
|
|
4169
|
-
additionalSigners = [];
|
|
4170
|
-
_a.label = 1;
|
|
4171
|
-
case 1:
|
|
4172
|
-
_a.trys.push([1, 3, , 4]);
|
|
4173
|
-
nftTradingAccount = web3_js_1.PublicKey.findProgramAddressSync([
|
|
4174
|
-
Buffer.from("trading"),
|
|
4175
|
-
nftMint.toBuffer(),
|
|
4176
|
-
], this.programId)[0];
|
|
4177
|
-
metadataAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), nftMint.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
4178
|
-
return [4, this.program.methods
|
|
4179
|
-
.levelUp({})
|
|
4180
|
-
.accounts({
|
|
4181
|
-
owner: publicKey,
|
|
4182
|
-
perpetuals: this.perpetuals.publicKey,
|
|
4183
|
-
pool: poolConfig.poolAddress,
|
|
4184
|
-
metadataAccount: metadataAccount,
|
|
4185
|
-
nftMint: nftMint,
|
|
4186
|
-
metadataProgram: constants_1.METAPLEX_PROGRAM_ID,
|
|
4187
|
-
tradingAccount: nftTradingAccount,
|
|
4188
|
-
transferAuthority: this.authority.publicKey,
|
|
4189
|
-
authorizationRulesAccount: authorizationRulesAccount,
|
|
4190
|
-
authorizationRulesProgram: new web3_js_1.PublicKey('auth9SigNpDKz4sJJ1DfCTuZrZNSAgh9sFD3rboVmgg'),
|
|
4191
|
-
systemProgram: web3_js_1.SystemProgram.programId,
|
|
4192
|
-
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
|
4193
|
-
})
|
|
4194
|
-
.instruction()];
|
|
4195
|
-
case 2:
|
|
4196
|
-
levelUpInstruction = _a.sent();
|
|
4197
|
-
instructions.push(levelUpInstruction);
|
|
4198
|
-
return [3, 4];
|
|
4199
|
-
case 3:
|
|
4200
|
-
err_9 = _a.sent();
|
|
4201
|
-
console.log("perpClient levelUp error:: ", err_9);
|
|
4202
|
-
throw err_9;
|
|
4203
|
-
case 4: return [2, {
|
|
4204
|
-
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4205
|
-
additionalSigners: additionalSigners
|
|
4206
|
-
}];
|
|
4207
|
-
}
|
|
4208
|
-
});
|
|
4209
|
-
}); };
|
|
4210
4099
|
this.depositStake = function (owner, feePayer, depositAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
4211
|
-
var preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, depositStakeInstruction,
|
|
4100
|
+
var preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, depositStakeInstruction, err_8;
|
|
4212
4101
|
return __generator(this, function (_a) {
|
|
4213
4102
|
switch (_a.label) {
|
|
4214
4103
|
case 0:
|
|
@@ -4250,9 +4139,9 @@ var PerpetualsClient = (function () {
|
|
|
4250
4139
|
instructions.push(depositStakeInstruction);
|
|
4251
4140
|
return [3, 5];
|
|
4252
4141
|
case 4:
|
|
4253
|
-
|
|
4254
|
-
console.log("perpClient depositStaking error:: ",
|
|
4255
|
-
throw
|
|
4142
|
+
err_8 = _a.sent();
|
|
4143
|
+
console.log("perpClient depositStaking error:: ", err_8);
|
|
4144
|
+
throw err_8;
|
|
4256
4145
|
case 5: return [2, {
|
|
4257
4146
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4258
4147
|
additionalSigners: additionalSigners
|
|
@@ -4261,7 +4150,7 @@ var PerpetualsClient = (function () {
|
|
|
4261
4150
|
});
|
|
4262
4151
|
}); };
|
|
4263
4152
|
this.refreshStakeWithAllFlpStakeAccounts = function (rewardSymbol, poolConfig, flpStakeAccountPks) { return __awaiter(_this, void 0, void 0, function () {
|
|
4264
|
-
var rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_1, flpStakeAccountPk, refreshStakeInstruction,
|
|
4153
|
+
var rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_1, flpStakeAccountPk, refreshStakeInstruction, err_9;
|
|
4265
4154
|
return __generator(this, function (_c) {
|
|
4266
4155
|
switch (_c.label) {
|
|
4267
4156
|
case 0:
|
|
@@ -4308,9 +4197,9 @@ var PerpetualsClient = (function () {
|
|
|
4308
4197
|
refreshStakeInstruction = _c.sent();
|
|
4309
4198
|
return [2, refreshStakeInstruction];
|
|
4310
4199
|
case 2:
|
|
4311
|
-
|
|
4312
|
-
console.log("perpClient refreshStaking error:: ",
|
|
4313
|
-
throw
|
|
4200
|
+
err_9 = _c.sent();
|
|
4201
|
+
console.log("perpClient refreshStaking error:: ", err_9);
|
|
4202
|
+
throw err_9;
|
|
4314
4203
|
case 3: return [2];
|
|
4315
4204
|
}
|
|
4316
4205
|
});
|
|
@@ -4321,7 +4210,7 @@ var PerpetualsClient = (function () {
|
|
|
4321
4210
|
args_1[_i - 3] = arguments[_i];
|
|
4322
4211
|
}
|
|
4323
4212
|
return __awaiter(_this, __spreadArray([rewardSymbol_1, poolConfig_1, flpStakeAccountPk_1], args_1, true), void 0, function (rewardSymbol, poolConfig, flpStakeAccountPk, userPublicKey) {
|
|
4324
|
-
var publicKey, rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _a, _b, custody, stakeAccountMetas, tokenStakeAccount, refreshStakeInstruction,
|
|
4213
|
+
var publicKey, rewardCustodyMint, rewardCustodyConfig, pool, feeDistributionTokenAccount, custodyAccountMetas, _a, _b, custody, stakeAccountMetas, tokenStakeAccount, refreshStakeInstruction, err_10;
|
|
4325
4214
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
4326
4215
|
return __generator(this, function (_c) {
|
|
4327
4216
|
switch (_c.label) {
|
|
@@ -4369,9 +4258,9 @@ var PerpetualsClient = (function () {
|
|
|
4369
4258
|
refreshStakeInstruction = _c.sent();
|
|
4370
4259
|
return [2, refreshStakeInstruction];
|
|
4371
4260
|
case 2:
|
|
4372
|
-
|
|
4373
|
-
console.log("perpClient refreshStaking error:: ",
|
|
4374
|
-
throw
|
|
4261
|
+
err_10 = _c.sent();
|
|
4262
|
+
console.log("perpClient refreshStaking error:: ", err_10);
|
|
4263
|
+
throw err_10;
|
|
4375
4264
|
case 3: return [2];
|
|
4376
4265
|
}
|
|
4377
4266
|
});
|
|
@@ -4383,7 +4272,7 @@ var PerpetualsClient = (function () {
|
|
|
4383
4272
|
args_1[_i - 3] = arguments[_i];
|
|
4384
4273
|
}
|
|
4385
4274
|
return __awaiter(_this, __spreadArray([rewardSymbol_1, unstakeAmount_1, poolConfig_1], args_1, true), void 0, function (rewardSymbol, unstakeAmount, poolConfig, userPublicKey) {
|
|
4386
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, pool, flpStakeAccount, tokenStakeAccount, tokenStakeAccounts, _a, unstakeInstantInstruction,
|
|
4275
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, pool, flpStakeAccount, tokenStakeAccount, tokenStakeAccounts, _a, unstakeInstantInstruction, err_11;
|
|
4387
4276
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
4388
4277
|
return __generator(this, function (_b) {
|
|
4389
4278
|
switch (_b.label) {
|
|
@@ -4435,9 +4324,9 @@ var PerpetualsClient = (function () {
|
|
|
4435
4324
|
instructions.push(unstakeInstantInstruction);
|
|
4436
4325
|
return [3, 6];
|
|
4437
4326
|
case 5:
|
|
4438
|
-
|
|
4439
|
-
console.log("perpClient unstakeInstant error:: ",
|
|
4440
|
-
throw
|
|
4327
|
+
err_11 = _b.sent();
|
|
4328
|
+
console.log("perpClient unstakeInstant error:: ", err_11);
|
|
4329
|
+
throw err_11;
|
|
4441
4330
|
case 6: return [2, {
|
|
4442
4331
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4443
4332
|
additionalSigners: additionalSigners
|
|
@@ -4447,7 +4336,7 @@ var PerpetualsClient = (function () {
|
|
|
4447
4336
|
});
|
|
4448
4337
|
};
|
|
4449
4338
|
this.setFeeShareBps = function (poolConfig, flpStakeAccountPks) { return __awaiter(_this, void 0, void 0, function () {
|
|
4450
|
-
var publicKey, pool, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_2, flpStakeAccountPk, refreshStakeInstruction,
|
|
4339
|
+
var publicKey, pool, custodyAccountMetas, _i, _a, custody, maxFlpStakeAccountPkLength, flpStakeAccountMetas, _b, flpStakeAccountPks_2, flpStakeAccountPk, refreshStakeInstruction, err_12;
|
|
4451
4340
|
return __generator(this, function (_c) {
|
|
4452
4341
|
switch (_c.label) {
|
|
4453
4342
|
case 0:
|
|
@@ -4491,15 +4380,15 @@ var PerpetualsClient = (function () {
|
|
|
4491
4380
|
refreshStakeInstruction = _c.sent();
|
|
4492
4381
|
return [2, refreshStakeInstruction];
|
|
4493
4382
|
case 2:
|
|
4494
|
-
|
|
4495
|
-
console.log("perpClient refreshStaking error:: ",
|
|
4496
|
-
throw
|
|
4383
|
+
err_12 = _c.sent();
|
|
4384
|
+
console.log("perpClient refreshStaking error:: ", err_12);
|
|
4385
|
+
throw err_12;
|
|
4497
4386
|
case 3: return [2];
|
|
4498
4387
|
}
|
|
4499
4388
|
});
|
|
4500
4389
|
}); };
|
|
4501
4390
|
this.unstakeRequest = function (unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
4502
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, unstakeRequestInstruction,
|
|
4391
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, unstakeRequestInstruction, err_13;
|
|
4503
4392
|
return __generator(this, function (_a) {
|
|
4504
4393
|
switch (_a.label) {
|
|
4505
4394
|
case 0:
|
|
@@ -4533,9 +4422,9 @@ var PerpetualsClient = (function () {
|
|
|
4533
4422
|
instructions.push(unstakeRequestInstruction);
|
|
4534
4423
|
return [3, 4];
|
|
4535
4424
|
case 3:
|
|
4536
|
-
|
|
4537
|
-
console.log("perpClient unstakeRequest error:: ",
|
|
4538
|
-
throw
|
|
4425
|
+
err_13 = _a.sent();
|
|
4426
|
+
console.log("perpClient unstakeRequest error:: ", err_13);
|
|
4427
|
+
throw err_13;
|
|
4539
4428
|
case 4: return [2, {
|
|
4540
4429
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4541
4430
|
additionalSigners: additionalSigners
|
|
@@ -4549,7 +4438,7 @@ var PerpetualsClient = (function () {
|
|
|
4549
4438
|
args_1[_i - 1] = arguments[_i];
|
|
4550
4439
|
}
|
|
4551
4440
|
return __awaiter(_this, __spreadArray([poolConfig_1], args_1, true), void 0, function (poolConfig, pendingActivation, deactivated, createUserLPTA, userPublicKey) {
|
|
4552
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, pool, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, _a, withdrawStakeInstruction,
|
|
4441
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, pool, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, _a, withdrawStakeInstruction, err_14;
|
|
4553
4442
|
if (pendingActivation === void 0) { pendingActivation = true; }
|
|
4554
4443
|
if (deactivated === void 0) { deactivated = true; }
|
|
4555
4444
|
if (createUserLPTA === void 0) { createUserLPTA = true; }
|
|
@@ -4605,9 +4494,9 @@ var PerpetualsClient = (function () {
|
|
|
4605
4494
|
instructions.push(withdrawStakeInstruction);
|
|
4606
4495
|
return [3, 6];
|
|
4607
4496
|
case 5:
|
|
4608
|
-
|
|
4609
|
-
console.log("perpClient withdrawStake error:: ",
|
|
4610
|
-
throw
|
|
4497
|
+
err_14 = _b.sent();
|
|
4498
|
+
console.log("perpClient withdrawStake error:: ", err_14);
|
|
4499
|
+
throw err_14;
|
|
4611
4500
|
case 6: return [2, {
|
|
4612
4501
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4613
4502
|
additionalSigners: additionalSigners
|
|
@@ -4622,7 +4511,7 @@ var PerpetualsClient = (function () {
|
|
|
4622
4511
|
args_1[_i - 3] = arguments[_i];
|
|
4623
4512
|
}
|
|
4624
4513
|
return __awaiter(_this, __spreadArray([rewardSymbol_1, poolConfig_1, tokenStakeAccount_1], args_1, true), void 0, function (rewardSymbol, poolConfig, tokenStakeAccount, createUserATA) {
|
|
4625
|
-
var publicKey, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tokenStakeAccounts, withdrawStakeInstruction,
|
|
4514
|
+
var publicKey, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tokenStakeAccounts, withdrawStakeInstruction, err_15;
|
|
4626
4515
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
4627
4516
|
return __generator(this, function (_b) {
|
|
4628
4517
|
switch (_b.label) {
|
|
@@ -4683,9 +4572,9 @@ var PerpetualsClient = (function () {
|
|
|
4683
4572
|
instructions.push(withdrawStakeInstruction);
|
|
4684
4573
|
return [3, 6];
|
|
4685
4574
|
case 5:
|
|
4686
|
-
|
|
4687
|
-
console.log("perpClient withdrawStake error:: ",
|
|
4688
|
-
throw
|
|
4575
|
+
err_15 = _b.sent();
|
|
4576
|
+
console.log("perpClient withdrawStake error:: ", err_15);
|
|
4577
|
+
throw err_15;
|
|
4689
4578
|
case 6: return [2, {
|
|
4690
4579
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
4691
4580
|
additionalSigners: additionalSigners
|
|
@@ -4700,7 +4589,7 @@ var PerpetualsClient = (function () {
|
|
|
4700
4589
|
args_1[_i - 5] = arguments[_i];
|
|
4701
4590
|
}
|
|
4702
4591
|
return __awaiter(_this, __spreadArray([amountIn_1, minCompoundingAmountOut_1, inTokenSymbol_1, rewardTokenMint_1, poolConfig_1], args_1, true), void 0, function (amountIn, minCompoundingAmountOut, inTokenSymbol, rewardTokenMint, poolConfig, skipBalanceChecks, ephemeralSignerPubkey, userPublicKey) {
|
|
4703
|
-
var publicKey, preInstructions, instructions, additionalSigners, postInstructions, rewardCustody, inCustodyConfig, lpTokenMint, compoundingTokenMint, wrappedSolAccount, lpTokenAccount, compoundingTokenAccount, fundingAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, lamports, unWrappedSolBalance, _e, addCompoundingLiquidity,
|
|
4592
|
+
var publicKey, preInstructions, instructions, additionalSigners, postInstructions, rewardCustody, inCustodyConfig, lpTokenMint, compoundingTokenMint, wrappedSolAccount, lpTokenAccount, compoundingTokenAccount, fundingAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, lamports, unWrappedSolBalance, _e, addCompoundingLiquidity, err_16;
|
|
4704
4593
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
|
4705
4594
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
4706
4595
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
@@ -4828,8 +4717,8 @@ var PerpetualsClient = (function () {
|
|
|
4828
4717
|
instructions.push(addCompoundingLiquidity);
|
|
4829
4718
|
return [3, 10];
|
|
4830
4719
|
case 9:
|
|
4831
|
-
|
|
4832
|
-
console.log("perpClient addCompoundingLiquidity error:: ",
|
|
4720
|
+
err_16 = _f.sent();
|
|
4721
|
+
console.log("perpClient addCompoundingLiquidity error:: ", err_16);
|
|
4833
4722
|
return [3, 10];
|
|
4834
4723
|
case 10: return [2, {
|
|
4835
4724
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -4845,7 +4734,7 @@ var PerpetualsClient = (function () {
|
|
|
4845
4734
|
args_1[_i - 5] = arguments[_i];
|
|
4846
4735
|
}
|
|
4847
4736
|
return __awaiter(_this, __spreadArray([compoundingAmountIn_1, minAmountOut_1, outTokenSymbol_1, rewardTokenMint_1, poolConfig_1], args_1, true), void 0, function (compoundingAmountIn, minAmountOut, outTokenSymbol, rewardTokenMint, poolConfig, createUserATA, ephemeralSignerPubkey, userPublicKey) {
|
|
4848
|
-
var publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, outCustodyConfig, lpTokenMint, compoundingTokenMint, lamports, _a, custodyAccountMetas, custodyOracleAccountMetas, markets, _b, _c, custody, _d, _e, market, compoundingTokenAccount, removeCompoundingLiquidity,
|
|
4737
|
+
var publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, outCustodyConfig, lpTokenMint, compoundingTokenMint, lamports, _a, custodyAccountMetas, custodyOracleAccountMetas, markets, _b, _c, custody, _d, _e, market, compoundingTokenAccount, removeCompoundingLiquidity, err_17;
|
|
4849
4738
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
4850
4739
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
4851
4740
|
if (userPublicKey === void 0) { userPublicKey = undefined; }
|
|
@@ -4957,8 +4846,8 @@ var PerpetualsClient = (function () {
|
|
|
4957
4846
|
instructions.push(removeCompoundingLiquidity);
|
|
4958
4847
|
return [3, 8];
|
|
4959
4848
|
case 7:
|
|
4960
|
-
|
|
4961
|
-
console.log("perpClient removeCompoundingLiquidity error:: ",
|
|
4849
|
+
err_17 = _f.sent();
|
|
4850
|
+
console.log("perpClient removeCompoundingLiquidity error:: ", err_17);
|
|
4962
4851
|
return [3, 8];
|
|
4963
4852
|
case 8: return [2, {
|
|
4964
4853
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -4974,7 +4863,7 @@ var PerpetualsClient = (function () {
|
|
|
4974
4863
|
args_1[_i - 3] = arguments[_i];
|
|
4975
4864
|
}
|
|
4976
4865
|
return __awaiter(_this, __spreadArray([amount_1, rewardTokenMint_1, poolConfig_1], args_1, true), void 0, function (amount, rewardTokenMint, poolConfig, createUserATA) {
|
|
4977
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, _a, flpStakeAccount, tokenStakeAccount, tokenStakeAccounts, _b, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _c, _d, custody, _e, _f, market, migrateStake,
|
|
4866
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, _a, flpStakeAccount, tokenStakeAccount, tokenStakeAccounts, _b, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _c, _d, custody, _e, _f, market, migrateStake, err_18;
|
|
4978
4867
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
4979
4868
|
return __generator(this, function (_g) {
|
|
4980
4869
|
switch (_g.label) {
|
|
@@ -5072,8 +4961,8 @@ var PerpetualsClient = (function () {
|
|
|
5072
4961
|
instructions.push(migrateStake);
|
|
5073
4962
|
return [3, 8];
|
|
5074
4963
|
case 7:
|
|
5075
|
-
|
|
5076
|
-
console.log("perpClient migrateStake error:: ",
|
|
4964
|
+
err_18 = _g.sent();
|
|
4965
|
+
console.log("perpClient migrateStake error:: ", err_18);
|
|
5077
4966
|
return [3, 8];
|
|
5078
4967
|
case 8: return [2, {
|
|
5079
4968
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -5084,7 +4973,7 @@ var PerpetualsClient = (function () {
|
|
|
5084
4973
|
});
|
|
5085
4974
|
};
|
|
5086
4975
|
this.migrateFlp = function (amount, rewardTokenMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5087
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp,
|
|
4976
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp, err_19;
|
|
5088
4977
|
return __generator(this, function (_d) {
|
|
5089
4978
|
switch (_d.label) {
|
|
5090
4979
|
case 0:
|
|
@@ -5156,8 +5045,8 @@ var PerpetualsClient = (function () {
|
|
|
5156
5045
|
instructions.push(migrateFlp);
|
|
5157
5046
|
return [3, 4];
|
|
5158
5047
|
case 3:
|
|
5159
|
-
|
|
5160
|
-
console.log("perpClient migrateFlp error:: ",
|
|
5048
|
+
err_19 = _d.sent();
|
|
5049
|
+
console.log("perpClient migrateFlp error:: ", err_19);
|
|
5161
5050
|
return [3, 4];
|
|
5162
5051
|
case 4: return [2, {
|
|
5163
5052
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
@@ -5172,7 +5061,7 @@ var PerpetualsClient = (function () {
|
|
|
5172
5061
|
args_1[_i - 1] = arguments[_i];
|
|
5173
5062
|
}
|
|
5174
5063
|
return __awaiter(_this, __spreadArray([poolConfig_1], args_1, true), void 0, function (poolConfig, rewardTokenSymbol) {
|
|
5175
|
-
var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, compoundingFee,
|
|
5064
|
+
var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, compoundingFee, err_20;
|
|
5176
5065
|
if (rewardTokenSymbol === void 0) { rewardTokenSymbol = 'USDC'; }
|
|
5177
5066
|
return __generator(this, function (_e) {
|
|
5178
5067
|
switch (_e.label) {
|
|
@@ -5230,8 +5119,8 @@ var PerpetualsClient = (function () {
|
|
|
5230
5119
|
instructions.push(compoundingFee);
|
|
5231
5120
|
return [3, 4];
|
|
5232
5121
|
case 3:
|
|
5233
|
-
|
|
5234
|
-
console.log("perpClient compoundingFee error:: ",
|
|
5122
|
+
err_20 = _e.sent();
|
|
5123
|
+
console.log("perpClient compoundingFee error:: ", err_20);
|
|
5235
5124
|
return [3, 4];
|
|
5236
5125
|
case 4: return [2, {
|
|
5237
5126
|
instructions: __spreadArray([], instructions, true),
|
|
@@ -5241,146 +5130,8 @@ var PerpetualsClient = (function () {
|
|
|
5241
5130
|
});
|
|
5242
5131
|
});
|
|
5243
5132
|
};
|
|
5244
|
-
this.burnAndClaim = function (owner, nftMint, poolConfig, createAta) { return __awaiter(_this, void 0, void 0, function () {
|
|
5245
|
-
var preInstructions, instructions, postInstructions, additionalSigners, userTokenAccount, _a, nftTokenAccount, nftTradingAccount, metadataAccount, collectionMetadata, edition, tokenRecord, burnAndClaimInstruction, err_23;
|
|
5246
|
-
return __generator(this, function (_b) {
|
|
5247
|
-
switch (_b.label) {
|
|
5248
|
-
case 0:
|
|
5249
|
-
preInstructions = [];
|
|
5250
|
-
instructions = [];
|
|
5251
|
-
postInstructions = [];
|
|
5252
|
-
additionalSigners = [];
|
|
5253
|
-
_b.label = 1;
|
|
5254
|
-
case 1:
|
|
5255
|
-
_b.trys.push([1, 7, , 8]);
|
|
5256
|
-
return [4, (0, spl_token_1.getAssociatedTokenAddress)(poolConfig.tokenMint, owner, true)];
|
|
5257
|
-
case 2:
|
|
5258
|
-
userTokenAccount = _b.sent();
|
|
5259
|
-
_a = createAta;
|
|
5260
|
-
if (!_a) return [3, 4];
|
|
5261
|
-
return [4, (0, utils_1.checkIfAccountExists)(userTokenAccount, this.provider.connection)];
|
|
5262
|
-
case 3:
|
|
5263
|
-
_a = !(_b.sent());
|
|
5264
|
-
_b.label = 4;
|
|
5265
|
-
case 4:
|
|
5266
|
-
if (_a) {
|
|
5267
|
-
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(owner, userTokenAccount, owner, poolConfig.tokenMint));
|
|
5268
|
-
}
|
|
5269
|
-
return [4, (0, spl_token_1.getAssociatedTokenAddress)(nftMint, owner, true)];
|
|
5270
|
-
case 5:
|
|
5271
|
-
nftTokenAccount = _b.sent();
|
|
5272
|
-
nftTradingAccount = web3_js_1.PublicKey.findProgramAddressSync([
|
|
5273
|
-
Buffer.from("trading"),
|
|
5274
|
-
nftMint.toBuffer(),
|
|
5275
|
-
], this.programId)[0];
|
|
5276
|
-
metadataAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), nftMint.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5277
|
-
collectionMetadata = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), poolConfig.nftCollectionAddress.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5278
|
-
edition = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), nftMint.toBuffer(), Buffer.from("edition")], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5279
|
-
tokenRecord = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), nftMint.toBuffer(), Buffer.from("token_record"), nftTokenAccount.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5280
|
-
return [4, this.program.methods
|
|
5281
|
-
.burnAndClaim({})
|
|
5282
|
-
.accounts({
|
|
5283
|
-
owner: owner,
|
|
5284
|
-
receivingTokenAccount: userTokenAccount,
|
|
5285
|
-
perpetuals: this.perpetuals.publicKey,
|
|
5286
|
-
tokenVault: poolConfig.tokenVault,
|
|
5287
|
-
tokenVaultTokenAccount: poolConfig.tokenVaultTokenAccount,
|
|
5288
|
-
metadataAccount: metadataAccount,
|
|
5289
|
-
collectionMetadata: collectionMetadata,
|
|
5290
|
-
edition: edition,
|
|
5291
|
-
tokenRecord: tokenRecord,
|
|
5292
|
-
tradingAccount: nftTradingAccount,
|
|
5293
|
-
transferAuthority: poolConfig.transferAuthority,
|
|
5294
|
-
metadataProgram: constants_1.METAPLEX_PROGRAM_ID,
|
|
5295
|
-
nftMint: nftMint,
|
|
5296
|
-
nftTokenAccount: nftTokenAccount,
|
|
5297
|
-
systemProgram: web3_js_1.SystemProgram.programId,
|
|
5298
|
-
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
5299
|
-
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
5300
|
-
eventAuthority: this.eventAuthority.publicKey,
|
|
5301
|
-
program: this.programId,
|
|
5302
|
-
receivingTokenMint: poolConfig.tokenMint,
|
|
5303
|
-
})
|
|
5304
|
-
.instruction()];
|
|
5305
|
-
case 6:
|
|
5306
|
-
burnAndClaimInstruction = _b.sent();
|
|
5307
|
-
instructions.push(burnAndClaimInstruction);
|
|
5308
|
-
return [3, 8];
|
|
5309
|
-
case 7:
|
|
5310
|
-
err_23 = _b.sent();
|
|
5311
|
-
console.log("perpClient burnAndClaimInstruction error:: ", err_23);
|
|
5312
|
-
throw err_23;
|
|
5313
|
-
case 8: return [2, {
|
|
5314
|
-
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5315
|
-
additionalSigners: additionalSigners
|
|
5316
|
-
}];
|
|
5317
|
-
}
|
|
5318
|
-
});
|
|
5319
|
-
}); };
|
|
5320
|
-
this.burnAndStake = function (owner, feePayer, nftMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5321
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, nftTokenAccount, nftTradingAccount, metadataAccount, collectionMetadata, edition, tokenRecord, burnAndStakeInstruction, err_24;
|
|
5322
|
-
return __generator(this, function (_a) {
|
|
5323
|
-
switch (_a.label) {
|
|
5324
|
-
case 0:
|
|
5325
|
-
preInstructions = [];
|
|
5326
|
-
instructions = [];
|
|
5327
|
-
postInstructions = [];
|
|
5328
|
-
additionalSigners = [];
|
|
5329
|
-
_a.label = 1;
|
|
5330
|
-
case 1:
|
|
5331
|
-
_a.trys.push([1, 3, , 4]);
|
|
5332
|
-
tokenStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("token_stake"), owner.toBuffer()], this.programId)[0];
|
|
5333
|
-
nftTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(nftMint, owner, true);
|
|
5334
|
-
nftTradingAccount = web3_js_1.PublicKey.findProgramAddressSync([
|
|
5335
|
-
Buffer.from("trading"),
|
|
5336
|
-
nftMint.toBuffer(),
|
|
5337
|
-
], this.programId)[0];
|
|
5338
|
-
metadataAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), nftMint.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5339
|
-
collectionMetadata = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), poolConfig.nftCollectionAddress.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5340
|
-
edition = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), nftMint.toBuffer(), Buffer.from("edition")], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5341
|
-
tokenRecord = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), nftMint.toBuffer(), Buffer.from("token_record"), nftTokenAccount.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
|
5342
|
-
return [4, this.program.methods
|
|
5343
|
-
.burnAndStake({})
|
|
5344
|
-
.accounts({
|
|
5345
|
-
owner: owner,
|
|
5346
|
-
feePayer: feePayer,
|
|
5347
|
-
perpetuals: this.perpetuals.publicKey,
|
|
5348
|
-
tokenVault: poolConfig.tokenVault,
|
|
5349
|
-
tokenVaultTokenAccount: poolConfig.tokenVaultTokenAccount,
|
|
5350
|
-
tokenStakeAccount: tokenStakeAccount,
|
|
5351
|
-
metadataAccount: metadataAccount,
|
|
5352
|
-
collectionMetadata: collectionMetadata,
|
|
5353
|
-
edition: edition,
|
|
5354
|
-
tokenRecord: tokenRecord,
|
|
5355
|
-
tradingAccount: nftTradingAccount,
|
|
5356
|
-
transferAuthority: poolConfig.transferAuthority,
|
|
5357
|
-
metadataProgram: constants_1.METAPLEX_PROGRAM_ID,
|
|
5358
|
-
nftMint: nftMint,
|
|
5359
|
-
nftTokenAccount: nftTokenAccount,
|
|
5360
|
-
systemProgram: web3_js_1.SystemProgram.programId,
|
|
5361
|
-
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
5362
|
-
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
5363
|
-
eventAuthority: this.eventAuthority.publicKey,
|
|
5364
|
-
program: this.programId
|
|
5365
|
-
})
|
|
5366
|
-
.instruction()];
|
|
5367
|
-
case 2:
|
|
5368
|
-
burnAndStakeInstruction = _a.sent();
|
|
5369
|
-
instructions.push(burnAndStakeInstruction);
|
|
5370
|
-
return [3, 4];
|
|
5371
|
-
case 3:
|
|
5372
|
-
err_24 = _a.sent();
|
|
5373
|
-
console.log("perpClient burnAndStakeInstruction error:: ", err_24);
|
|
5374
|
-
throw err_24;
|
|
5375
|
-
case 4: return [2, {
|
|
5376
|
-
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5377
|
-
additionalSigners: additionalSigners
|
|
5378
|
-
}];
|
|
5379
|
-
}
|
|
5380
|
-
});
|
|
5381
|
-
}); };
|
|
5382
5133
|
this.depositTokenStake = function (owner, feePayer, depositAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5383
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, depositTokenStakeInstruction,
|
|
5134
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, depositTokenStakeInstruction, err_21;
|
|
5384
5135
|
return __generator(this, function (_a) {
|
|
5385
5136
|
switch (_a.label) {
|
|
5386
5137
|
case 0:
|
|
@@ -5422,9 +5173,9 @@ var PerpetualsClient = (function () {
|
|
|
5422
5173
|
instructions.push(depositTokenStakeInstruction);
|
|
5423
5174
|
return [3, 5];
|
|
5424
5175
|
case 4:
|
|
5425
|
-
|
|
5426
|
-
console.log("perpClient depositStakingInstruction error:: ",
|
|
5427
|
-
throw
|
|
5176
|
+
err_21 = _a.sent();
|
|
5177
|
+
console.log("perpClient depositStakingInstruction error:: ", err_21);
|
|
5178
|
+
throw err_21;
|
|
5428
5179
|
case 5: return [2, {
|
|
5429
5180
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5430
5181
|
additionalSigners: additionalSigners
|
|
@@ -5433,7 +5184,7 @@ var PerpetualsClient = (function () {
|
|
|
5433
5184
|
});
|
|
5434
5185
|
}); };
|
|
5435
5186
|
this.unstakeTokenRequest = function (owner, unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5436
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, unstakeTokenRequestInstruction,
|
|
5187
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, unstakeTokenRequestInstruction, err_22;
|
|
5437
5188
|
return __generator(this, function (_a) {
|
|
5438
5189
|
switch (_a.label) {
|
|
5439
5190
|
case 0:
|
|
@@ -5462,9 +5213,9 @@ var PerpetualsClient = (function () {
|
|
|
5462
5213
|
instructions.push(unstakeTokenRequestInstruction);
|
|
5463
5214
|
return [3, 4];
|
|
5464
5215
|
case 3:
|
|
5465
|
-
|
|
5466
|
-
console.log("perpClient unstakeTokenRequestInstruction error:: ",
|
|
5467
|
-
throw
|
|
5216
|
+
err_22 = _a.sent();
|
|
5217
|
+
console.log("perpClient unstakeTokenRequestInstruction error:: ", err_22);
|
|
5218
|
+
throw err_22;
|
|
5468
5219
|
case 4: return [2, {
|
|
5469
5220
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5470
5221
|
additionalSigners: additionalSigners
|
|
@@ -5473,7 +5224,7 @@ var PerpetualsClient = (function () {
|
|
|
5473
5224
|
});
|
|
5474
5225
|
}); };
|
|
5475
5226
|
this.unstakeTokenInstant = function (owner, unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5476
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, unstakeTokenInstantInstruction,
|
|
5227
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, unstakeTokenInstantInstruction, err_23;
|
|
5477
5228
|
return __generator(this, function (_a) {
|
|
5478
5229
|
switch (_a.label) {
|
|
5479
5230
|
case 0:
|
|
@@ -5514,9 +5265,9 @@ var PerpetualsClient = (function () {
|
|
|
5514
5265
|
instructions.push(unstakeTokenInstantInstruction);
|
|
5515
5266
|
return [3, 5];
|
|
5516
5267
|
case 4:
|
|
5517
|
-
|
|
5518
|
-
console.log("perpClient unstakeTokenInstantInstruction error:: ",
|
|
5519
|
-
throw
|
|
5268
|
+
err_23 = _a.sent();
|
|
5269
|
+
console.log("perpClient unstakeTokenInstantInstruction error:: ", err_23);
|
|
5270
|
+
throw err_23;
|
|
5520
5271
|
case 5: return [2, {
|
|
5521
5272
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5522
5273
|
additionalSigners: additionalSigners
|
|
@@ -5525,7 +5276,7 @@ var PerpetualsClient = (function () {
|
|
|
5525
5276
|
});
|
|
5526
5277
|
}); };
|
|
5527
5278
|
this.withdrawToken = function (owner, withdrawRequestId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5528
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, withdrawTokenInstruction,
|
|
5279
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, withdrawTokenInstruction, err_24;
|
|
5529
5280
|
return __generator(this, function (_a) {
|
|
5530
5281
|
switch (_a.label) {
|
|
5531
5282
|
case 0:
|
|
@@ -5566,9 +5317,9 @@ var PerpetualsClient = (function () {
|
|
|
5566
5317
|
instructions.push(withdrawTokenInstruction);
|
|
5567
5318
|
return [3, 5];
|
|
5568
5319
|
case 4:
|
|
5569
|
-
|
|
5570
|
-
console.log("perpClient withdrawTokenInstruction error:: ",
|
|
5571
|
-
throw
|
|
5320
|
+
err_24 = _a.sent();
|
|
5321
|
+
console.log("perpClient withdrawTokenInstruction error:: ", err_24);
|
|
5322
|
+
throw err_24;
|
|
5572
5323
|
case 5: return [2, {
|
|
5573
5324
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5574
5325
|
additionalSigners: additionalSigners
|
|
@@ -5577,7 +5328,7 @@ var PerpetualsClient = (function () {
|
|
|
5577
5328
|
});
|
|
5578
5329
|
}); };
|
|
5579
5330
|
this.cancelUnstakeRequest = function (owner, withdrawRequestId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5580
|
-
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, cancelUnstakeRequestInstruction,
|
|
5331
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, cancelUnstakeRequestInstruction, err_25;
|
|
5581
5332
|
return __generator(this, function (_a) {
|
|
5582
5333
|
switch (_a.label) {
|
|
5583
5334
|
case 0:
|
|
@@ -5606,9 +5357,9 @@ var PerpetualsClient = (function () {
|
|
|
5606
5357
|
instructions.push(cancelUnstakeRequestInstruction);
|
|
5607
5358
|
return [3, 4];
|
|
5608
5359
|
case 3:
|
|
5609
|
-
|
|
5610
|
-
console.log("perpClient cancelUnstakeRequestInstruction error:: ",
|
|
5611
|
-
throw
|
|
5360
|
+
err_25 = _a.sent();
|
|
5361
|
+
console.log("perpClient cancelUnstakeRequestInstruction error:: ", err_25);
|
|
5362
|
+
throw err_25;
|
|
5612
5363
|
case 4: return [2, {
|
|
5613
5364
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5614
5365
|
additionalSigners: additionalSigners
|
|
@@ -5622,7 +5373,7 @@ var PerpetualsClient = (function () {
|
|
|
5622
5373
|
args_1[_i - 2] = arguments[_i];
|
|
5623
5374
|
}
|
|
5624
5375
|
return __awaiter(_this, __spreadArray([owner_1, poolConfig_1], args_1, true), void 0, function (owner, poolConfig, createUserATA) {
|
|
5625
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, _a, collectTokenRewardInstruction,
|
|
5376
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, _a, collectTokenRewardInstruction, err_26;
|
|
5626
5377
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5627
5378
|
return __generator(this, function (_b) {
|
|
5628
5379
|
switch (_b.label) {
|
|
@@ -5668,9 +5419,9 @@ var PerpetualsClient = (function () {
|
|
|
5668
5419
|
instructions.push(collectTokenRewardInstruction);
|
|
5669
5420
|
return [3, 6];
|
|
5670
5421
|
case 5:
|
|
5671
|
-
|
|
5672
|
-
console.log("perpClient collectTokenRewardInstruction error:: ",
|
|
5673
|
-
throw
|
|
5422
|
+
err_26 = _b.sent();
|
|
5423
|
+
console.log("perpClient collectTokenRewardInstruction error:: ", err_26);
|
|
5424
|
+
throw err_26;
|
|
5674
5425
|
case 6: return [2, {
|
|
5675
5426
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5676
5427
|
additionalSigners: additionalSigners
|
|
@@ -5685,7 +5436,7 @@ var PerpetualsClient = (function () {
|
|
|
5685
5436
|
args_1[_i - 3] = arguments[_i];
|
|
5686
5437
|
}
|
|
5687
5438
|
return __awaiter(_this, __spreadArray([owner_1, rewardSymbol_1, poolConfig_1], args_1, true), void 0, function (owner, rewardSymbol, poolConfig, createUserATA) {
|
|
5688
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, tokenStakeAccount, userTokenAccount, _a, collectRevenueInstruction,
|
|
5439
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, tokenStakeAccount, userTokenAccount, _a, collectRevenueInstruction, err_27;
|
|
5689
5440
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5690
5441
|
return __generator(this, function (_b) {
|
|
5691
5442
|
switch (_b.label) {
|
|
@@ -5732,9 +5483,9 @@ var PerpetualsClient = (function () {
|
|
|
5732
5483
|
instructions.push(collectRevenueInstruction);
|
|
5733
5484
|
return [3, 6];
|
|
5734
5485
|
case 5:
|
|
5735
|
-
|
|
5736
|
-
console.log("perpClient collectRevenueInstruction error:: ",
|
|
5737
|
-
throw
|
|
5486
|
+
err_27 = _b.sent();
|
|
5487
|
+
console.log("perpClient collectRevenueInstruction error:: ", err_27);
|
|
5488
|
+
throw err_27;
|
|
5738
5489
|
case 6: return [2, {
|
|
5739
5490
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5740
5491
|
additionalSigners: additionalSigners
|
|
@@ -5744,7 +5495,7 @@ var PerpetualsClient = (function () {
|
|
|
5744
5495
|
});
|
|
5745
5496
|
};
|
|
5746
5497
|
this.initRewardVault = function (nftCount, rewardSymbol, collectionMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5747
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, nftTransferAuthority, initRewardVault,
|
|
5498
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, nftTransferAuthority, initRewardVault, err_28;
|
|
5748
5499
|
return __generator(this, function (_a) {
|
|
5749
5500
|
switch (_a.label) {
|
|
5750
5501
|
case 0:
|
|
@@ -5781,9 +5532,9 @@ var PerpetualsClient = (function () {
|
|
|
5781
5532
|
instructions.push(initRewardVault);
|
|
5782
5533
|
return [3, 4];
|
|
5783
5534
|
case 3:
|
|
5784
|
-
|
|
5785
|
-
console.log("perpClient InitRewardVault error:: ",
|
|
5786
|
-
throw
|
|
5535
|
+
err_28 = _a.sent();
|
|
5536
|
+
console.log("perpClient InitRewardVault error:: ", err_28);
|
|
5537
|
+
throw err_28;
|
|
5787
5538
|
case 4: return [2, {
|
|
5788
5539
|
instructions: __spreadArray([], instructions, true),
|
|
5789
5540
|
additionalSigners: additionalSigners
|
|
@@ -5792,7 +5543,7 @@ var PerpetualsClient = (function () {
|
|
|
5792
5543
|
});
|
|
5793
5544
|
}); };
|
|
5794
5545
|
this.distributeReward = function (rewardAmount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
5795
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, distributeReward,
|
|
5546
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, distributeReward, err_29;
|
|
5796
5547
|
return __generator(this, function (_a) {
|
|
5797
5548
|
switch (_a.label) {
|
|
5798
5549
|
case 0:
|
|
@@ -5823,9 +5574,9 @@ var PerpetualsClient = (function () {
|
|
|
5823
5574
|
instructions.push(distributeReward);
|
|
5824
5575
|
return [3, 4];
|
|
5825
5576
|
case 3:
|
|
5826
|
-
|
|
5827
|
-
console.log("perpClient distributeReward error:: ",
|
|
5828
|
-
throw
|
|
5577
|
+
err_29 = _a.sent();
|
|
5578
|
+
console.log("perpClient distributeReward error:: ", err_29);
|
|
5579
|
+
throw err_29;
|
|
5829
5580
|
case 4: return [2, {
|
|
5830
5581
|
instructions: __spreadArray([], instructions, true),
|
|
5831
5582
|
additionalSigners: additionalSigners
|
|
@@ -5839,7 +5590,7 @@ var PerpetualsClient = (function () {
|
|
|
5839
5590
|
args_1[_i - 3] = arguments[_i];
|
|
5840
5591
|
}
|
|
5841
5592
|
return __awaiter(_this, __spreadArray([rewardSymbol_1, poolConfig_1, nftMint_1], args_1, true), void 0, function (rewardSymbol, poolConfig, nftMint, createUserATA) {
|
|
5842
|
-
var publicKey, rewardToken, rewardCustodyMint, instructions, additionalSigners, nftTokenAccount, metadataAccount, receivingTokenAccount, _a, rewardRecord, rewardVault, rewardTokenAccount, nftTransferAuthority, collectNftReward,
|
|
5593
|
+
var publicKey, rewardToken, rewardCustodyMint, instructions, additionalSigners, nftTokenAccount, metadataAccount, receivingTokenAccount, _a, rewardRecord, rewardVault, rewardTokenAccount, nftTransferAuthority, collectNftReward, err_30;
|
|
5843
5594
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5844
5595
|
return __generator(this, function (_b) {
|
|
5845
5596
|
switch (_b.label) {
|
|
@@ -5891,8 +5642,8 @@ var PerpetualsClient = (function () {
|
|
|
5891
5642
|
instructions.push(collectNftReward);
|
|
5892
5643
|
return [3, 6];
|
|
5893
5644
|
case 5:
|
|
5894
|
-
|
|
5895
|
-
throw
|
|
5645
|
+
err_30 = _b.sent();
|
|
5646
|
+
throw err_30;
|
|
5896
5647
|
case 6: return [2, {
|
|
5897
5648
|
instructions: __spreadArray([], instructions, true),
|
|
5898
5649
|
additionalSigners: additionalSigners
|
|
@@ -5907,7 +5658,7 @@ var PerpetualsClient = (function () {
|
|
|
5907
5658
|
args_1[_i - 2] = arguments[_i];
|
|
5908
5659
|
}
|
|
5909
5660
|
return __awaiter(_this, __spreadArray([rewardSymbol_1, poolConfig_1], args_1, true), void 0, function (rewardSymbol, poolConfig, createUserATA, nftTradingAccount) {
|
|
5910
|
-
var publicKey, rewardToken, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tradingAccount, rewardVault, rewardTokenAccount, withdrawStakeInstruction,
|
|
5661
|
+
var publicKey, rewardToken, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tradingAccount, rewardVault, rewardTokenAccount, withdrawStakeInstruction, err_31;
|
|
5911
5662
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
5912
5663
|
return __generator(this, function (_b) {
|
|
5913
5664
|
switch (_b.label) {
|
|
@@ -5973,9 +5724,9 @@ var PerpetualsClient = (function () {
|
|
|
5973
5724
|
instructions.push(withdrawStakeInstruction);
|
|
5974
5725
|
return [3, 6];
|
|
5975
5726
|
case 5:
|
|
5976
|
-
|
|
5977
|
-
console.log("perpClient withdrawStake error:: ",
|
|
5978
|
-
throw
|
|
5727
|
+
err_31 = _b.sent();
|
|
5728
|
+
console.log("perpClient withdrawStake error:: ", err_31);
|
|
5729
|
+
throw err_31;
|
|
5979
5730
|
case 6: return [2, {
|
|
5980
5731
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
5981
5732
|
additionalSigners: additionalSigners
|
|
@@ -5990,7 +5741,7 @@ var PerpetualsClient = (function () {
|
|
|
5990
5741
|
args_1[_i - 11] = arguments[_i];
|
|
5991
5742
|
}
|
|
5992
5743
|
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) {
|
|
5993
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder,
|
|
5744
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder, err_32;
|
|
5994
5745
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
|
5995
5746
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
5996
5747
|
return __generator(this, function (_c) {
|
|
@@ -6096,9 +5847,9 @@ var PerpetualsClient = (function () {
|
|
|
6096
5847
|
instructions.push(placeLimitOrder);
|
|
6097
5848
|
return [3, 10];
|
|
6098
5849
|
case 9:
|
|
6099
|
-
|
|
6100
|
-
console.log("perpClient placeLimitOrder error:: ",
|
|
6101
|
-
throw
|
|
5850
|
+
err_32 = _c.sent();
|
|
5851
|
+
console.log("perpClient placeLimitOrder error:: ", err_32);
|
|
5852
|
+
throw err_32;
|
|
6102
5853
|
case 10: return [2, {
|
|
6103
5854
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6104
5855
|
additionalSigners: additionalSigners
|
|
@@ -6113,7 +5864,7 @@ var PerpetualsClient = (function () {
|
|
|
6113
5864
|
args_1[_i - 11] = arguments[_i];
|
|
6114
5865
|
}
|
|
6115
5866
|
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) {
|
|
6116
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder,
|
|
5867
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, receiveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder, err_33;
|
|
6117
5868
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6118
5869
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
6119
5870
|
return __generator(this, function (_b) {
|
|
@@ -6204,9 +5955,9 @@ var PerpetualsClient = (function () {
|
|
|
6204
5955
|
instructions.push(editLimitOrder);
|
|
6205
5956
|
return [3, 8];
|
|
6206
5957
|
case 7:
|
|
6207
|
-
|
|
6208
|
-
console.log("perpClient editLimitOrder error:: ",
|
|
6209
|
-
throw
|
|
5958
|
+
err_33 = _b.sent();
|
|
5959
|
+
console.log("perpClient editLimitOrder error:: ", err_33);
|
|
5960
|
+
throw err_33;
|
|
6210
5961
|
case 8: return [2, {
|
|
6211
5962
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6212
5963
|
additionalSigners: additionalSigners
|
|
@@ -6221,7 +5972,7 @@ var PerpetualsClient = (function () {
|
|
|
6221
5972
|
args_1[_i - 7] = arguments[_i];
|
|
6222
5973
|
}
|
|
6223
5974
|
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, rebateTokenAccount) {
|
|
6224
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder,
|
|
5975
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder, err_34;
|
|
6225
5976
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
6226
5977
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
|
6227
5978
|
if (rebateTokenAccount === void 0) { rebateTokenAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6274,9 +6025,9 @@ var PerpetualsClient = (function () {
|
|
|
6274
6025
|
instructions.push(executeLimitOrder);
|
|
6275
6026
|
return [3, 4];
|
|
6276
6027
|
case 3:
|
|
6277
|
-
|
|
6278
|
-
console.log("perpClient executeLimitOrder error:: ",
|
|
6279
|
-
throw
|
|
6028
|
+
err_34 = _a.sent();
|
|
6029
|
+
console.log("perpClient executeLimitOrder error:: ", err_34);
|
|
6030
|
+
throw err_34;
|
|
6280
6031
|
case 4: return [2, {
|
|
6281
6032
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6282
6033
|
additionalSigners: additionalSigners
|
|
@@ -6291,7 +6042,7 @@ var PerpetualsClient = (function () {
|
|
|
6291
6042
|
args_1[_i - 8] = arguments[_i];
|
|
6292
6043
|
}
|
|
6293
6044
|
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, rebateTokenAccount) {
|
|
6294
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap,
|
|
6045
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap, err_35;
|
|
6295
6046
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
6296
6047
|
if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
|
|
6297
6048
|
if (rebateTokenAccount === void 0) { rebateTokenAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6347,9 +6098,9 @@ var PerpetualsClient = (function () {
|
|
|
6347
6098
|
instructions.push(executeLimitWithSwap);
|
|
6348
6099
|
return [3, 4];
|
|
6349
6100
|
case 3:
|
|
6350
|
-
|
|
6351
|
-
console.log("perpClient executeLimitWithSwap error:: ",
|
|
6352
|
-
throw
|
|
6101
|
+
err_35 = _a.sent();
|
|
6102
|
+
console.log("perpClient executeLimitWithSwap error:: ", err_35);
|
|
6103
|
+
throw err_35;
|
|
6353
6104
|
case 4: return [2, {
|
|
6354
6105
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6355
6106
|
additionalSigners: additionalSigners
|
|
@@ -6359,7 +6110,7 @@ var PerpetualsClient = (function () {
|
|
|
6359
6110
|
});
|
|
6360
6111
|
};
|
|
6361
6112
|
this.placeTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6362
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder,
|
|
6113
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder, err_36;
|
|
6363
6114
|
return __generator(this, function (_a) {
|
|
6364
6115
|
switch (_a.label) {
|
|
6365
6116
|
case 0:
|
|
@@ -6407,9 +6158,9 @@ var PerpetualsClient = (function () {
|
|
|
6407
6158
|
instructions.push(placeTriggerOrder);
|
|
6408
6159
|
return [3, 4];
|
|
6409
6160
|
case 3:
|
|
6410
|
-
|
|
6411
|
-
console.log("perpClient placeTriggerOrder error:: ",
|
|
6412
|
-
throw
|
|
6161
|
+
err_36 = _a.sent();
|
|
6162
|
+
console.log("perpClient placeTriggerOrder error:: ", err_36);
|
|
6163
|
+
throw err_36;
|
|
6413
6164
|
case 4: return [2, {
|
|
6414
6165
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6415
6166
|
additionalSigners: additionalSigners
|
|
@@ -6418,7 +6169,7 @@ var PerpetualsClient = (function () {
|
|
|
6418
6169
|
});
|
|
6419
6170
|
}); };
|
|
6420
6171
|
this.editTriggerOrder = function (targetSymbol, collateralSymbol, receiveSymbol, side, orderId, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6421
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder,
|
|
6172
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder, err_37;
|
|
6422
6173
|
return __generator(this, function (_a) {
|
|
6423
6174
|
switch (_a.label) {
|
|
6424
6175
|
case 0:
|
|
@@ -6465,9 +6216,9 @@ var PerpetualsClient = (function () {
|
|
|
6465
6216
|
instructions.push(editTriggerOrder);
|
|
6466
6217
|
return [3, 4];
|
|
6467
6218
|
case 3:
|
|
6468
|
-
|
|
6469
|
-
console.log("perpClient editTriggerOrder error:: ",
|
|
6470
|
-
throw
|
|
6219
|
+
err_37 = _a.sent();
|
|
6220
|
+
console.log("perpClient editTriggerOrder error:: ", err_37);
|
|
6221
|
+
throw err_37;
|
|
6471
6222
|
case 4: return [2, {
|
|
6472
6223
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6473
6224
|
additionalSigners: additionalSigners
|
|
@@ -6476,7 +6227,7 @@ var PerpetualsClient = (function () {
|
|
|
6476
6227
|
});
|
|
6477
6228
|
}); };
|
|
6478
6229
|
this.cancelTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6479
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder,
|
|
6230
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder, err_38;
|
|
6480
6231
|
return __generator(this, function (_a) {
|
|
6481
6232
|
switch (_a.label) {
|
|
6482
6233
|
case 0:
|
|
@@ -6509,9 +6260,9 @@ var PerpetualsClient = (function () {
|
|
|
6509
6260
|
instructions.push(cancelTriggerOrder);
|
|
6510
6261
|
return [3, 4];
|
|
6511
6262
|
case 3:
|
|
6512
|
-
|
|
6513
|
-
console.log("perpClient cancelTriggerOrder error:: ",
|
|
6514
|
-
throw
|
|
6263
|
+
err_38 = _a.sent();
|
|
6264
|
+
console.log("perpClient cancelTriggerOrder error:: ", err_38);
|
|
6265
|
+
throw err_38;
|
|
6515
6266
|
case 4: return [2, {
|
|
6516
6267
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6517
6268
|
additionalSigners: additionalSigners
|
|
@@ -6520,7 +6271,7 @@ var PerpetualsClient = (function () {
|
|
|
6520
6271
|
});
|
|
6521
6272
|
}); };
|
|
6522
6273
|
this.cancelAllTriggerOrders = function (targetSymbol, collateralSymbol, side, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
6523
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders,
|
|
6274
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, positionAccount, cancelAllTriggerOrders, err_39;
|
|
6524
6275
|
return __generator(this, function (_a) {
|
|
6525
6276
|
switch (_a.label) {
|
|
6526
6277
|
case 0:
|
|
@@ -6551,9 +6302,9 @@ var PerpetualsClient = (function () {
|
|
|
6551
6302
|
instructions.push(cancelAllTriggerOrders);
|
|
6552
6303
|
return [3, 4];
|
|
6553
6304
|
case 3:
|
|
6554
|
-
|
|
6555
|
-
console.log("perpClient cancelAllTriggerOrders error:: ",
|
|
6556
|
-
throw
|
|
6305
|
+
err_39 = _a.sent();
|
|
6306
|
+
console.log("perpClient cancelAllTriggerOrders error:: ", err_39);
|
|
6307
|
+
throw err_39;
|
|
6557
6308
|
case 4: return [2, {
|
|
6558
6309
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6559
6310
|
additionalSigners: additionalSigners
|
|
@@ -6567,7 +6318,7 @@ var PerpetualsClient = (function () {
|
|
|
6567
6318
|
args_1[_i - 9] = arguments[_i];
|
|
6568
6319
|
}
|
|
6569
6320
|
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, rebateTokenAccount) {
|
|
6570
|
-
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,
|
|
6321
|
+
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_40;
|
|
6571
6322
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6572
6323
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
6573
6324
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6674,9 +6425,9 @@ var PerpetualsClient = (function () {
|
|
|
6674
6425
|
instructions.push(executeTriggerWithSwap);
|
|
6675
6426
|
return [3, 10];
|
|
6676
6427
|
case 9:
|
|
6677
|
-
|
|
6678
|
-
console.log("perpClient executeTriggerWithSwap error:: ",
|
|
6679
|
-
throw
|
|
6428
|
+
err_40 = _e.sent();
|
|
6429
|
+
console.log("perpClient executeTriggerWithSwap error:: ", err_40);
|
|
6430
|
+
throw err_40;
|
|
6680
6431
|
case 10: return [2, {
|
|
6681
6432
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6682
6433
|
additionalSigners: additionalSigners
|
|
@@ -6691,7 +6442,7 @@ var PerpetualsClient = (function () {
|
|
|
6691
6442
|
args_1[_i - 8] = arguments[_i];
|
|
6692
6443
|
}
|
|
6693
6444
|
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, rebateTokenAccount) {
|
|
6694
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder,
|
|
6445
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder, err_41;
|
|
6695
6446
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6696
6447
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
|
6697
6448
|
if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
|
|
@@ -6763,9 +6514,9 @@ var PerpetualsClient = (function () {
|
|
|
6763
6514
|
instructions.push(executeTriggerOrder);
|
|
6764
6515
|
return [3, 8];
|
|
6765
6516
|
case 7:
|
|
6766
|
-
|
|
6767
|
-
console.log("perpClient executeTriggerOrder error:: ",
|
|
6768
|
-
throw
|
|
6517
|
+
err_41 = _b.sent();
|
|
6518
|
+
console.log("perpClient executeTriggerOrder error:: ", err_41);
|
|
6519
|
+
throw err_41;
|
|
6769
6520
|
case 8: return [2, {
|
|
6770
6521
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6771
6522
|
additionalSigners: additionalSigners
|
|
@@ -6780,7 +6531,7 @@ var PerpetualsClient = (function () {
|
|
|
6780
6531
|
args_1[_i - 5] = arguments[_i];
|
|
6781
6532
|
}
|
|
6782
6533
|
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) {
|
|
6783
|
-
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, params, inx, closeWsolATAIns,
|
|
6534
|
+
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, params, inx, closeWsolATAIns, err_42;
|
|
6784
6535
|
if (useFeesPool === void 0) { useFeesPool = false; }
|
|
6785
6536
|
if (createUserATA === void 0) { createUserATA = true; }
|
|
6786
6537
|
if (unWrapSol === void 0) { unWrapSol = false; }
|
|
@@ -6985,9 +6736,9 @@ var PerpetualsClient = (function () {
|
|
|
6985
6736
|
}
|
|
6986
6737
|
return [3, 20];
|
|
6987
6738
|
case 19:
|
|
6988
|
-
|
|
6989
|
-
console.error("perpClient Swap error:: ",
|
|
6990
|
-
throw
|
|
6739
|
+
err_42 = _g.sent();
|
|
6740
|
+
console.error("perpClient Swap error:: ", err_42);
|
|
6741
|
+
throw err_42;
|
|
6991
6742
|
case 20: return [2, {
|
|
6992
6743
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
6993
6744
|
additionalSigners: additionalSigners
|
|
@@ -6997,7 +6748,7 @@ var PerpetualsClient = (function () {
|
|
|
6997
6748
|
});
|
|
6998
6749
|
};
|
|
6999
6750
|
this.swapFeeInternal = function (rewardTokenSymbol, swapTokenSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7000
|
-
var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx,
|
|
6751
|
+
var rewardCustody, custody, publicKey, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody_1, params, inx, err_43;
|
|
7001
6752
|
return __generator(this, function (_b) {
|
|
7002
6753
|
switch (_b.label) {
|
|
7003
6754
|
case 0:
|
|
@@ -7057,9 +6808,9 @@ var PerpetualsClient = (function () {
|
|
|
7057
6808
|
instructions.push(inx);
|
|
7058
6809
|
return [3, 4];
|
|
7059
6810
|
case 3:
|
|
7060
|
-
|
|
7061
|
-
console.error("perpClient Swap error:: ",
|
|
7062
|
-
throw
|
|
6811
|
+
err_43 = _b.sent();
|
|
6812
|
+
console.error("perpClient Swap error:: ", err_43);
|
|
6813
|
+
throw err_43;
|
|
7063
6814
|
case 4: return [2, {
|
|
7064
6815
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7065
6816
|
additionalSigners: additionalSigners
|
|
@@ -7068,7 +6819,7 @@ var PerpetualsClient = (function () {
|
|
|
7068
6819
|
});
|
|
7069
6820
|
}); };
|
|
7070
6821
|
this.setLpTokenPrice = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7071
|
-
var instructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, setLpTokenPriceInstruction,
|
|
6822
|
+
var instructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, setLpTokenPriceInstruction, err_44;
|
|
7072
6823
|
return __generator(this, function (_d) {
|
|
7073
6824
|
switch (_d.label) {
|
|
7074
6825
|
case 0:
|
|
@@ -7116,9 +6867,9 @@ var PerpetualsClient = (function () {
|
|
|
7116
6867
|
instructions.push(setLpTokenPriceInstruction);
|
|
7117
6868
|
return [3, 4];
|
|
7118
6869
|
case 3:
|
|
7119
|
-
|
|
7120
|
-
console.log("perpClient setLpTokenPriceInstruction error:: ",
|
|
7121
|
-
throw
|
|
6870
|
+
err_44 = _d.sent();
|
|
6871
|
+
console.log("perpClient setLpTokenPriceInstruction error:: ", err_44);
|
|
6872
|
+
throw err_44;
|
|
7122
6873
|
case 4: return [2, {
|
|
7123
6874
|
instructions: __spreadArray([], instructions, true),
|
|
7124
6875
|
additionalSigners: additionalSigners
|
|
@@ -7166,7 +6917,7 @@ var PerpetualsClient = (function () {
|
|
|
7166
6917
|
});
|
|
7167
6918
|
}); };
|
|
7168
6919
|
this.setAdminSigners = function (admins, minSignatures) { return __awaiter(_this, void 0, void 0, function () {
|
|
7169
|
-
var adminMetas, _i, admins_2, admin,
|
|
6920
|
+
var adminMetas, _i, admins_2, admin, err_45;
|
|
7170
6921
|
return __generator(this, function (_a) {
|
|
7171
6922
|
switch (_a.label) {
|
|
7172
6923
|
case 0:
|
|
@@ -7196,11 +6947,11 @@ var PerpetualsClient = (function () {
|
|
|
7196
6947
|
_a.sent();
|
|
7197
6948
|
return [3, 4];
|
|
7198
6949
|
case 3:
|
|
7199
|
-
|
|
6950
|
+
err_45 = _a.sent();
|
|
7200
6951
|
if (this.printErrors) {
|
|
7201
|
-
console.error("setAdminSigners err:",
|
|
6952
|
+
console.error("setAdminSigners err:", err_45);
|
|
7202
6953
|
}
|
|
7203
|
-
throw
|
|
6954
|
+
throw err_45;
|
|
7204
6955
|
case 4: return [2];
|
|
7205
6956
|
}
|
|
7206
6957
|
});
|
|
@@ -7389,7 +7140,7 @@ var PerpetualsClient = (function () {
|
|
|
7389
7140
|
});
|
|
7390
7141
|
}); };
|
|
7391
7142
|
this.protocolWithdrawFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7392
|
-
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx,
|
|
7143
|
+
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_46;
|
|
7393
7144
|
return __generator(this, function (_a) {
|
|
7394
7145
|
switch (_a.label) {
|
|
7395
7146
|
case 0:
|
|
@@ -7422,9 +7173,9 @@ var PerpetualsClient = (function () {
|
|
|
7422
7173
|
instructions.push(withdrawFeesIx);
|
|
7423
7174
|
return [3, 5];
|
|
7424
7175
|
case 4:
|
|
7425
|
-
|
|
7426
|
-
console.log("perpClient setPool error:: ",
|
|
7427
|
-
throw
|
|
7176
|
+
err_46 = _a.sent();
|
|
7177
|
+
console.log("perpClient setPool error:: ", err_46);
|
|
7178
|
+
throw err_46;
|
|
7428
7179
|
case 5: return [2, {
|
|
7429
7180
|
instructions: __spreadArray([], instructions, true),
|
|
7430
7181
|
additionalSigners: additionalSigners
|
|
@@ -7433,7 +7184,7 @@ var PerpetualsClient = (function () {
|
|
|
7433
7184
|
});
|
|
7434
7185
|
}); };
|
|
7435
7186
|
this.moveProtocolFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7436
|
-
var publicKey, custodyConfig, instructions, additionalSigners, moveProtocolFeesIx,
|
|
7187
|
+
var publicKey, custodyConfig, instructions, additionalSigners, moveProtocolFeesIx, err_47;
|
|
7437
7188
|
return __generator(this, function (_a) {
|
|
7438
7189
|
switch (_a.label) {
|
|
7439
7190
|
case 0:
|
|
@@ -7467,9 +7218,9 @@ var PerpetualsClient = (function () {
|
|
|
7467
7218
|
instructions.push(moveProtocolFeesIx);
|
|
7468
7219
|
return [3, 4];
|
|
7469
7220
|
case 3:
|
|
7470
|
-
|
|
7471
|
-
console.log("perpClient setPool error:: ",
|
|
7472
|
-
throw
|
|
7221
|
+
err_47 = _a.sent();
|
|
7222
|
+
console.log("perpClient setPool error:: ", err_47);
|
|
7223
|
+
throw err_47;
|
|
7473
7224
|
case 4: return [2, {
|
|
7474
7225
|
instructions: __spreadArray([], instructions, true),
|
|
7475
7226
|
additionalSigners: additionalSigners
|
|
@@ -7478,7 +7229,7 @@ var PerpetualsClient = (function () {
|
|
|
7478
7229
|
});
|
|
7479
7230
|
}); };
|
|
7480
7231
|
this.setProtocolFeeShareBps = function (feeShareBps, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7481
|
-
var publicKey, setProtocolFeeShareBpsIx,
|
|
7232
|
+
var publicKey, setProtocolFeeShareBpsIx, err_48;
|
|
7482
7233
|
return __generator(this, function (_a) {
|
|
7483
7234
|
switch (_a.label) {
|
|
7484
7235
|
case 0:
|
|
@@ -7498,15 +7249,15 @@ var PerpetualsClient = (function () {
|
|
|
7498
7249
|
setProtocolFeeShareBpsIx = _a.sent();
|
|
7499
7250
|
return [2, setProtocolFeeShareBpsIx];
|
|
7500
7251
|
case 2:
|
|
7501
|
-
|
|
7502
|
-
console.log("perpClient setProtocolFeeShareBpsIx error:: ",
|
|
7503
|
-
throw
|
|
7252
|
+
err_48 = _a.sent();
|
|
7253
|
+
console.log("perpClient setProtocolFeeShareBpsIx error:: ", err_48);
|
|
7254
|
+
throw err_48;
|
|
7504
7255
|
case 3: return [2];
|
|
7505
7256
|
}
|
|
7506
7257
|
});
|
|
7507
7258
|
}); };
|
|
7508
7259
|
this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
|
|
7509
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction,
|
|
7260
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_49;
|
|
7510
7261
|
return __generator(this, function (_a) {
|
|
7511
7262
|
switch (_a.label) {
|
|
7512
7263
|
case 0:
|
|
@@ -7533,9 +7284,9 @@ var PerpetualsClient = (function () {
|
|
|
7533
7284
|
instructions.push(setPermissionsInstruction);
|
|
7534
7285
|
return [3, 4];
|
|
7535
7286
|
case 3:
|
|
7536
|
-
|
|
7537
|
-
console.log("perpClient setPool error:: ",
|
|
7538
|
-
throw
|
|
7287
|
+
err_49 = _a.sent();
|
|
7288
|
+
console.log("perpClient setPool error:: ", err_49);
|
|
7289
|
+
throw err_49;
|
|
7539
7290
|
case 4: return [2, {
|
|
7540
7291
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7541
7292
|
additionalSigners: additionalSigners
|
|
@@ -7544,7 +7295,7 @@ var PerpetualsClient = (function () {
|
|
|
7544
7295
|
});
|
|
7545
7296
|
}); };
|
|
7546
7297
|
this.reimburse = function (tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7547
|
-
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e,
|
|
7298
|
+
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_50;
|
|
7548
7299
|
var _f;
|
|
7549
7300
|
return __generator(this, function (_g) {
|
|
7550
7301
|
switch (_g.label) {
|
|
@@ -7605,9 +7356,9 @@ var PerpetualsClient = (function () {
|
|
|
7605
7356
|
instructions.push(reimburse);
|
|
7606
7357
|
return [3, 5];
|
|
7607
7358
|
case 4:
|
|
7608
|
-
|
|
7609
|
-
console.log("perpClient setPool error:: ",
|
|
7610
|
-
throw
|
|
7359
|
+
err_50 = _g.sent();
|
|
7360
|
+
console.log("perpClient setPool error:: ", err_50);
|
|
7361
|
+
throw err_50;
|
|
7611
7362
|
case 5: return [2, {
|
|
7612
7363
|
instructions: __spreadArray([], instructions, true),
|
|
7613
7364
|
additionalSigners: additionalSigners
|
|
@@ -7616,7 +7367,7 @@ var PerpetualsClient = (function () {
|
|
|
7616
7367
|
});
|
|
7617
7368
|
}); };
|
|
7618
7369
|
this.setInternalOraclePrice = function (tokenMint, useCurrentTime, price, expo, conf, ema, publishTime, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7619
|
-
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice,
|
|
7370
|
+
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_51;
|
|
7620
7371
|
return __generator(this, function (_a) {
|
|
7621
7372
|
switch (_a.label) {
|
|
7622
7373
|
case 0:
|
|
@@ -7650,9 +7401,9 @@ var PerpetualsClient = (function () {
|
|
|
7650
7401
|
instructions.push(setInternalOraclePrice);
|
|
7651
7402
|
return [3, 4];
|
|
7652
7403
|
case 3:
|
|
7653
|
-
|
|
7654
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
|
7655
|
-
throw
|
|
7404
|
+
err_51 = _a.sent();
|
|
7405
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_51);
|
|
7406
|
+
throw err_51;
|
|
7656
7407
|
case 4: return [2, {
|
|
7657
7408
|
instructions: __spreadArray([], instructions, true),
|
|
7658
7409
|
additionalSigners: additionalSigners
|
|
@@ -7661,7 +7412,7 @@ var PerpetualsClient = (function () {
|
|
|
7661
7412
|
});
|
|
7662
7413
|
}); };
|
|
7663
7414
|
this.setInternalOraclePriceBatch = function (useCurrentTime, tokenMintList, tokenInternalPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
|
7664
|
-
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice,
|
|
7415
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_52;
|
|
7665
7416
|
return __generator(this, function (_a) {
|
|
7666
7417
|
switch (_a.label) {
|
|
7667
7418
|
case 0:
|
|
@@ -7707,9 +7458,9 @@ var PerpetualsClient = (function () {
|
|
|
7707
7458
|
instructions.push(setInternalOraclePrice);
|
|
7708
7459
|
return [3, 4];
|
|
7709
7460
|
case 3:
|
|
7710
|
-
|
|
7711
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
|
7712
|
-
throw
|
|
7461
|
+
err_52 = _a.sent();
|
|
7462
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_52);
|
|
7463
|
+
throw err_52;
|
|
7713
7464
|
case 4: return [2, {
|
|
7714
7465
|
instructions: __spreadArray([], instructions, true),
|
|
7715
7466
|
additionalSigners: additionalSigners
|
|
@@ -7718,7 +7469,7 @@ var PerpetualsClient = (function () {
|
|
|
7718
7469
|
});
|
|
7719
7470
|
}); };
|
|
7720
7471
|
this.setInternalOracleEmaPriceBatch = function (tokenMintList, tokenInternalEmaPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
|
|
7721
|
-
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalOraclePrice,
|
|
7472
|
+
var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_53;
|
|
7722
7473
|
return __generator(this, function (_a) {
|
|
7723
7474
|
switch (_a.label) {
|
|
7724
7475
|
case 0:
|
|
@@ -7758,9 +7509,9 @@ var PerpetualsClient = (function () {
|
|
|
7758
7509
|
instructions.push(setInternalOraclePrice);
|
|
7759
7510
|
return [3, 4];
|
|
7760
7511
|
case 3:
|
|
7761
|
-
|
|
7762
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
|
7763
|
-
throw
|
|
7512
|
+
err_53 = _a.sent();
|
|
7513
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_53);
|
|
7514
|
+
throw err_53;
|
|
7764
7515
|
case 4: return [2, {
|
|
7765
7516
|
instructions: __spreadArray([], instructions, true),
|
|
7766
7517
|
additionalSigners: additionalSigners
|
|
@@ -7769,7 +7520,7 @@ var PerpetualsClient = (function () {
|
|
|
7769
7520
|
});
|
|
7770
7521
|
}); };
|
|
7771
7522
|
this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7772
|
-
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp,
|
|
7523
|
+
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_54;
|
|
7773
7524
|
return __generator(this, function (_a) {
|
|
7774
7525
|
switch (_a.label) {
|
|
7775
7526
|
case 0:
|
|
@@ -7807,8 +7558,8 @@ var PerpetualsClient = (function () {
|
|
|
7807
7558
|
instructions.push(renameFlp);
|
|
7808
7559
|
return [3, 4];
|
|
7809
7560
|
case 3:
|
|
7810
|
-
|
|
7811
|
-
console.log("perpClient renameFlp error:: ",
|
|
7561
|
+
err_54 = _a.sent();
|
|
7562
|
+
console.log("perpClient renameFlp error:: ", err_54);
|
|
7812
7563
|
return [3, 4];
|
|
7813
7564
|
case 4: return [2, {
|
|
7814
7565
|
instructions: __spreadArray([], instructions, true),
|
|
@@ -7818,7 +7569,7 @@ var PerpetualsClient = (function () {
|
|
|
7818
7569
|
});
|
|
7819
7570
|
}); };
|
|
7820
7571
|
this.initStake = function (stakingFeeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7821
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction,
|
|
7572
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_55;
|
|
7822
7573
|
return __generator(this, function (_a) {
|
|
7823
7574
|
switch (_a.label) {
|
|
7824
7575
|
case 0:
|
|
@@ -7856,9 +7607,9 @@ var PerpetualsClient = (function () {
|
|
|
7856
7607
|
instructions.push(initStakeInstruction);
|
|
7857
7608
|
return [3, 4];
|
|
7858
7609
|
case 3:
|
|
7859
|
-
|
|
7860
|
-
console.log("perpClient InitStaking error:: ",
|
|
7861
|
-
throw
|
|
7610
|
+
err_55 = _a.sent();
|
|
7611
|
+
console.log("perpClient InitStaking error:: ", err_55);
|
|
7612
|
+
throw err_55;
|
|
7862
7613
|
case 4: return [2, {
|
|
7863
7614
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7864
7615
|
additionalSigners: additionalSigners
|
|
@@ -7867,7 +7618,7 @@ var PerpetualsClient = (function () {
|
|
|
7867
7618
|
});
|
|
7868
7619
|
}); };
|
|
7869
7620
|
this.initCompounding = function (feeShareBps, metadataTitle, metadataSymbol, metadataUri, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7870
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction,
|
|
7621
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_56;
|
|
7871
7622
|
return __generator(this, function (_a) {
|
|
7872
7623
|
switch (_a.label) {
|
|
7873
7624
|
case 0:
|
|
@@ -7912,9 +7663,9 @@ var PerpetualsClient = (function () {
|
|
|
7912
7663
|
instructions.push(initCompoundingInstruction);
|
|
7913
7664
|
return [3, 4];
|
|
7914
7665
|
case 3:
|
|
7915
|
-
|
|
7916
|
-
console.log("perpClient initCompounding error:: ",
|
|
7917
|
-
throw
|
|
7666
|
+
err_56 = _a.sent();
|
|
7667
|
+
console.log("perpClient initCompounding error:: ", err_56);
|
|
7668
|
+
throw err_56;
|
|
7918
7669
|
case 4: return [2, {
|
|
7919
7670
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7920
7671
|
additionalSigners: additionalSigners
|
|
@@ -7923,7 +7674,7 @@ var PerpetualsClient = (function () {
|
|
|
7923
7674
|
});
|
|
7924
7675
|
}); };
|
|
7925
7676
|
this.initTokenVault = function (token_permissions, tokens_to_distribute, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7926
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction,
|
|
7677
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_57;
|
|
7927
7678
|
return __generator(this, function (_a) {
|
|
7928
7679
|
switch (_a.label) {
|
|
7929
7680
|
case 0:
|
|
@@ -7964,9 +7715,9 @@ var PerpetualsClient = (function () {
|
|
|
7964
7715
|
instructions.push(initTokenVaultInstruction);
|
|
7965
7716
|
return [3, 4];
|
|
7966
7717
|
case 3:
|
|
7967
|
-
|
|
7968
|
-
console.log("perpClient InitTokenVaultInstruction error:: ",
|
|
7969
|
-
throw
|
|
7718
|
+
err_57 = _a.sent();
|
|
7719
|
+
console.log("perpClient InitTokenVaultInstruction error:: ", err_57);
|
|
7720
|
+
throw err_57;
|
|
7970
7721
|
case 4: return [2, {
|
|
7971
7722
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7972
7723
|
additionalSigners: additionalSigners
|
|
@@ -7975,7 +7726,7 @@ var PerpetualsClient = (function () {
|
|
|
7975
7726
|
});
|
|
7976
7727
|
}); };
|
|
7977
7728
|
this.setTokenVaultConfig = function (token_permissions, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7978
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction,
|
|
7729
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_58;
|
|
7979
7730
|
return __generator(this, function (_a) {
|
|
7980
7731
|
switch (_a.label) {
|
|
7981
7732
|
case 0:
|
|
@@ -8006,9 +7757,9 @@ var PerpetualsClient = (function () {
|
|
|
8006
7757
|
instructions.push(setTokenVaultConfigInstruction);
|
|
8007
7758
|
return [3, 4];
|
|
8008
7759
|
case 3:
|
|
8009
|
-
|
|
8010
|
-
console.log("perpClient setTokenVaultConfigInstruction error:: ",
|
|
8011
|
-
throw
|
|
7760
|
+
err_58 = _a.sent();
|
|
7761
|
+
console.log("perpClient setTokenVaultConfigInstruction error:: ", err_58);
|
|
7762
|
+
throw err_58;
|
|
8012
7763
|
case 4: return [2, {
|
|
8013
7764
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8014
7765
|
additionalSigners: additionalSigners
|
|
@@ -8017,7 +7768,7 @@ var PerpetualsClient = (function () {
|
|
|
8017
7768
|
});
|
|
8018
7769
|
}); };
|
|
8019
7770
|
this.withdrawInstantFee = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8020
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction,
|
|
7771
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_59;
|
|
8021
7772
|
return __generator(this, function (_a) {
|
|
8022
7773
|
switch (_a.label) {
|
|
8023
7774
|
case 0:
|
|
@@ -8056,9 +7807,59 @@ var PerpetualsClient = (function () {
|
|
|
8056
7807
|
instructions.push(withdrawInstantFeeInstruction);
|
|
8057
7808
|
return [3, 6];
|
|
8058
7809
|
case 5:
|
|
8059
|
-
|
|
8060
|
-
console.log("perpClient withdrawInstantFeeInstruction error:: ",
|
|
8061
|
-
throw
|
|
7810
|
+
err_59 = _a.sent();
|
|
7811
|
+
console.log("perpClient withdrawInstantFeeInstruction error:: ", err_59);
|
|
7812
|
+
throw err_59;
|
|
7813
|
+
case 6: return [2, {
|
|
7814
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
7815
|
+
additionalSigners: additionalSigners
|
|
7816
|
+
}];
|
|
7817
|
+
}
|
|
7818
|
+
});
|
|
7819
|
+
}); };
|
|
7820
|
+
this.withdrawUnclaimedTokens = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
7821
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction, err_60;
|
|
7822
|
+
return __generator(this, function (_a) {
|
|
7823
|
+
switch (_a.label) {
|
|
7824
|
+
case 0:
|
|
7825
|
+
publicKey = this.provider.wallet.publicKey;
|
|
7826
|
+
preInstructions = [];
|
|
7827
|
+
instructions = [];
|
|
7828
|
+
postInstructions = [];
|
|
7829
|
+
additionalSigners = [];
|
|
7830
|
+
_a.label = 1;
|
|
7831
|
+
case 1:
|
|
7832
|
+
_a.trys.push([1, 5, , 6]);
|
|
7833
|
+
return [4, (0, spl_token_1.getAssociatedTokenAddress)(poolConfig.tokenMint, publicKey, true)];
|
|
7834
|
+
case 2:
|
|
7835
|
+
receivingTokenAccount = _a.sent();
|
|
7836
|
+
return [4, (0, utils_1.checkIfAccountExists)(receivingTokenAccount, this.provider.connection)];
|
|
7837
|
+
case 3:
|
|
7838
|
+
if (!(_a.sent())) {
|
|
7839
|
+
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, receivingTokenAccount, publicKey, poolConfig.tokenMint));
|
|
7840
|
+
}
|
|
7841
|
+
return [4, this.program.methods
|
|
7842
|
+
.withdrawUnclaimedTokens({})
|
|
7843
|
+
.accounts({
|
|
7844
|
+
admin: publicKey,
|
|
7845
|
+
multisig: this.multisig.publicKey,
|
|
7846
|
+
perpetuals: this.perpetuals.publicKey,
|
|
7847
|
+
transferAuthority: poolConfig.transferAuthority,
|
|
7848
|
+
tokenVault: poolConfig.tokenVault,
|
|
7849
|
+
tokenVaultTokenAccount: poolConfig.tokenVaultTokenAccount,
|
|
7850
|
+
receivingTokenAccount: receivingTokenAccount,
|
|
7851
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
7852
|
+
receivingTokenMint: poolConfig.tokenMint,
|
|
7853
|
+
})
|
|
7854
|
+
.instruction()];
|
|
7855
|
+
case 4:
|
|
7856
|
+
withdrawUnclaimedTokensInstruction = _a.sent();
|
|
7857
|
+
instructions.push(withdrawUnclaimedTokensInstruction);
|
|
7858
|
+
return [3, 6];
|
|
7859
|
+
case 5:
|
|
7860
|
+
err_60 = _a.sent();
|
|
7861
|
+
console.log("perpClient withdrawUnclaimedTokensInstruction error:: ", err_60);
|
|
7862
|
+
throw err_60;
|
|
8062
7863
|
case 6: return [2, {
|
|
8063
7864
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8064
7865
|
additionalSigners: additionalSigners
|
|
@@ -8067,7 +7868,7 @@ var PerpetualsClient = (function () {
|
|
|
8067
7868
|
});
|
|
8068
7869
|
}); };
|
|
8069
7870
|
this.initRevenueTokenAccount = function (feeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8070
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction,
|
|
7871
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_61;
|
|
8071
7872
|
return __generator(this, function (_a) {
|
|
8072
7873
|
switch (_a.label) {
|
|
8073
7874
|
case 0:
|
|
@@ -8104,9 +7905,9 @@ var PerpetualsClient = (function () {
|
|
|
8104
7905
|
instructions.push(initRevenueTokenAccountInstruction);
|
|
8105
7906
|
return [3, 4];
|
|
8106
7907
|
case 3:
|
|
8107
|
-
|
|
8108
|
-
console.log("perpClient initRevenueTokenAccountInstruction error:: ",
|
|
8109
|
-
throw
|
|
7908
|
+
err_61 = _a.sent();
|
|
7909
|
+
console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_61);
|
|
7910
|
+
throw err_61;
|
|
8110
7911
|
case 4: return [2, {
|
|
8111
7912
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8112
7913
|
additionalSigners: additionalSigners
|
|
@@ -8115,7 +7916,7 @@ var PerpetualsClient = (function () {
|
|
|
8115
7916
|
});
|
|
8116
7917
|
}); };
|
|
8117
7918
|
this.distributeTokenReward = function (amount, epochCount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8118
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction,
|
|
7919
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_62;
|
|
8119
7920
|
return __generator(this, function (_a) {
|
|
8120
7921
|
switch (_a.label) {
|
|
8121
7922
|
case 0:
|
|
@@ -8154,9 +7955,9 @@ var PerpetualsClient = (function () {
|
|
|
8154
7955
|
instructions.push(distributeTokenRewardInstruction);
|
|
8155
7956
|
return [3, 4];
|
|
8156
7957
|
case 3:
|
|
8157
|
-
|
|
8158
|
-
console.log("perpClient distributeTokenRewardInstruction error:: ",
|
|
8159
|
-
throw
|
|
7958
|
+
err_62 = _a.sent();
|
|
7959
|
+
console.log("perpClient distributeTokenRewardInstruction error:: ", err_62);
|
|
7960
|
+
throw err_62;
|
|
8160
7961
|
case 4: return [2, {
|
|
8161
7962
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8162
7963
|
additionalSigners: additionalSigners
|
|
@@ -8165,7 +7966,7 @@ var PerpetualsClient = (function () {
|
|
|
8165
7966
|
});
|
|
8166
7967
|
}); };
|
|
8167
7968
|
this.setTokenStakeLevel = function (owner, stakeLevel) { return __awaiter(_this, void 0, void 0, function () {
|
|
8168
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction,
|
|
7969
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_63;
|
|
8169
7970
|
return __generator(this, function (_a) {
|
|
8170
7971
|
switch (_a.label) {
|
|
8171
7972
|
case 0:
|
|
@@ -8193,9 +7994,9 @@ var PerpetualsClient = (function () {
|
|
|
8193
7994
|
instructions.push(setTokenStakeLevelInstruction);
|
|
8194
7995
|
return [3, 4];
|
|
8195
7996
|
case 3:
|
|
8196
|
-
|
|
8197
|
-
console.log("perpClient setTokenStakeLevelInstruction error:: ",
|
|
8198
|
-
throw
|
|
7997
|
+
err_63 = _a.sent();
|
|
7998
|
+
console.log("perpClient setTokenStakeLevelInstruction error:: ", err_63);
|
|
7999
|
+
throw err_63;
|
|
8199
8000
|
case 4: return [2, {
|
|
8200
8001
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8201
8002
|
additionalSigners: additionalSigners
|
|
@@ -8204,7 +8005,7 @@ var PerpetualsClient = (function () {
|
|
|
8204
8005
|
});
|
|
8205
8006
|
}); };
|
|
8206
8007
|
this.setTokenReward = function (owner, amount, epochCount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
8207
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction,
|
|
8008
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_64;
|
|
8208
8009
|
return __generator(this, function (_a) {
|
|
8209
8010
|
switch (_a.label) {
|
|
8210
8011
|
case 0:
|
|
@@ -8236,9 +8037,9 @@ var PerpetualsClient = (function () {
|
|
|
8236
8037
|
instructions.push(setTokenRewardInstruction);
|
|
8237
8038
|
return [3, 4];
|
|
8238
8039
|
case 3:
|
|
8239
|
-
|
|
8240
|
-
console.log("perpClient setTokenRewardInstruction error:: ",
|
|
8241
|
-
throw
|
|
8040
|
+
err_64 = _a.sent();
|
|
8041
|
+
console.log("perpClient setTokenRewardInstruction error:: ", err_64);
|
|
8042
|
+
throw err_64;
|
|
8242
8043
|
case 4: return [2, {
|
|
8243
8044
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8244
8045
|
additionalSigners: additionalSigners
|
|
@@ -8247,7 +8048,7 @@ var PerpetualsClient = (function () {
|
|
|
8247
8048
|
});
|
|
8248
8049
|
}); };
|
|
8249
8050
|
this.resizeInternalOracle = function (extOracle, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
|
|
8250
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction,
|
|
8051
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction, err_65;
|
|
8251
8052
|
return __generator(this, function (_a) {
|
|
8252
8053
|
switch (_a.label) {
|
|
8253
8054
|
case 0:
|
|
@@ -8276,9 +8077,9 @@ var PerpetualsClient = (function () {
|
|
|
8276
8077
|
instructions.push(resizeInternalOracleInstruction);
|
|
8277
8078
|
return [3, 4];
|
|
8278
8079
|
case 3:
|
|
8279
|
-
|
|
8280
|
-
console.log("perpClient resizeInternalOracleInstruction error:: ",
|
|
8281
|
-
throw
|
|
8080
|
+
err_65 = _a.sent();
|
|
8081
|
+
console.log("perpClient resizeInternalOracleInstruction error:: ", err_65);
|
|
8082
|
+
throw err_65;
|
|
8282
8083
|
case 4: return [2, {
|
|
8283
8084
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
|
8284
8085
|
additionalSigners: additionalSigners
|