flash-sdk 2.33.4 → 2.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PerpetualsClient.d.ts +432 -28
- package/dist/PerpetualsClient.js +607 -103
- package/dist/PoolConfig.d.ts +4 -1
- package/dist/PoolConfig.js +5 -2
- package/dist/PoolConfig.json +45 -0
- package/dist/idl/perpetuals.d.ts +1242 -52
- package/dist/idl/perpetuals.js +1240 -50
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +10 -0
- package/package.json +1 -1
package/dist/PerpetualsClient.js
CHANGED
@@ -4256,7 +4256,7 @@ var PerpetualsClient = (function () {
|
|
4256
4256
|
});
|
4257
4257
|
});
|
4258
4258
|
};
|
4259
|
-
this.addReferral = function (
|
4259
|
+
this.addReferral = function (tokenStakeAccount, nftReferralAccount) { return __awaiter(_this, void 0, void 0, function () {
|
4260
4260
|
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, addReferralInstruction, err_8;
|
4261
4261
|
return __generator(this, function (_a) {
|
4262
4262
|
switch (_a.label) {
|
@@ -4275,7 +4275,7 @@ var PerpetualsClient = (function () {
|
|
4275
4275
|
owner: publicKey,
|
4276
4276
|
feePayer: publicKey,
|
4277
4277
|
referralAccount: nftReferralAccount,
|
4278
|
-
|
4278
|
+
tokenStakeAccount: tokenStakeAccount,
|
4279
4279
|
systemProgram: web3_js_1.SystemProgram.programId,
|
4280
4280
|
})
|
4281
4281
|
.instruction()];
|
@@ -4990,8 +4990,512 @@ var PerpetualsClient = (function () {
|
|
4990
4990
|
});
|
4991
4991
|
});
|
4992
4992
|
};
|
4993
|
+
this.initTokenVault = function (token_permissions, tokens_to_distribute, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
4994
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_21;
|
4995
|
+
return __generator(this, function (_a) {
|
4996
|
+
switch (_a.label) {
|
4997
|
+
case 0:
|
4998
|
+
publicKey = this.provider.wallet.publicKey;
|
4999
|
+
preInstructions = [];
|
5000
|
+
instructions = [];
|
5001
|
+
postInstructions = [];
|
5002
|
+
additionalSigners = [];
|
5003
|
+
_a.label = 1;
|
5004
|
+
case 1:
|
5005
|
+
_a.trys.push([1, 3, , 4]);
|
5006
|
+
tokenMint = poolConfig.tokenMint;
|
5007
|
+
fundingTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(tokenMint, publicKey, true);
|
5008
|
+
return [4, this.program.methods
|
5009
|
+
.initTokenVault({
|
5010
|
+
tokenPermissions: token_permissions,
|
5011
|
+
amount: tokens_to_distribute,
|
5012
|
+
withdrawTimeLimit: withdrawTimeLimit,
|
5013
|
+
withdrawInstantFee: withdrawInstantFee,
|
5014
|
+
stakeLevel: stakeLevel,
|
5015
|
+
})
|
5016
|
+
.accounts({
|
5017
|
+
admin: publicKey,
|
5018
|
+
multisig: this.multisig.publicKey,
|
5019
|
+
perpetuals: this.perpetuals.publicKey,
|
5020
|
+
transferAuthority: poolConfig.transferAuthority,
|
5021
|
+
fundingTokenAccount: fundingTokenAccount,
|
5022
|
+
tokenMint: tokenMint,
|
5023
|
+
tokenVault: poolConfig.tokenVault,
|
5024
|
+
tokenVaultTokenAccount: poolConfig.tokenVaultTokenAccount,
|
5025
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
5026
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
5027
|
+
rent: web3_js_1.SYSVAR_RENT_PUBKEY
|
5028
|
+
})
|
5029
|
+
.instruction()];
|
5030
|
+
case 2:
|
5031
|
+
initTokenVaultInstruction = _a.sent();
|
5032
|
+
instructions.push(initTokenVaultInstruction);
|
5033
|
+
return [3, 4];
|
5034
|
+
case 3:
|
5035
|
+
err_21 = _a.sent();
|
5036
|
+
console.log("perpClient InitTokenVaultInstruction error:: ", err_21);
|
5037
|
+
throw err_21;
|
5038
|
+
case 4: return [2, {
|
5039
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5040
|
+
additionalSigners: additionalSigners
|
5041
|
+
}];
|
5042
|
+
}
|
5043
|
+
});
|
5044
|
+
}); };
|
5045
|
+
this.setTokenVaultConfig = function (token_permissions, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5046
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_22;
|
5047
|
+
return __generator(this, function (_a) {
|
5048
|
+
switch (_a.label) {
|
5049
|
+
case 0:
|
5050
|
+
publicKey = this.provider.wallet.publicKey;
|
5051
|
+
preInstructions = [];
|
5052
|
+
instructions = [];
|
5053
|
+
postInstructions = [];
|
5054
|
+
additionalSigners = [];
|
5055
|
+
_a.label = 1;
|
5056
|
+
case 1:
|
5057
|
+
_a.trys.push([1, 3, , 4]);
|
5058
|
+
return [4, this.program.methods
|
5059
|
+
.setTokenVaultConfig({
|
5060
|
+
tokenPermissions: token_permissions,
|
5061
|
+
withdrawTimeLimit: withdrawTimeLimit,
|
5062
|
+
withdrawInstantFee: withdrawInstantFee,
|
5063
|
+
stakeLevel: stakeLevel,
|
5064
|
+
})
|
5065
|
+
.accounts({
|
5066
|
+
admin: publicKey,
|
5067
|
+
multisig: this.multisig.publicKey,
|
5068
|
+
tokenVault: poolConfig.tokenVault,
|
5069
|
+
})
|
5070
|
+
.instruction()];
|
5071
|
+
case 2:
|
5072
|
+
setTokenVaultConfigInstruction = _a.sent();
|
5073
|
+
instructions.push(setTokenVaultConfigInstruction);
|
5074
|
+
return [3, 4];
|
5075
|
+
case 3:
|
5076
|
+
err_22 = _a.sent();
|
5077
|
+
console.log("perpClient setTokenVaultConfigInstruction error:: ", err_22);
|
5078
|
+
throw err_22;
|
5079
|
+
case 4: return [2, {
|
5080
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5081
|
+
additionalSigners: additionalSigners
|
5082
|
+
}];
|
5083
|
+
}
|
5084
|
+
});
|
5085
|
+
}); };
|
5086
|
+
this.withdrawInstantFee = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5087
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_23;
|
5088
|
+
return __generator(this, function (_a) {
|
5089
|
+
switch (_a.label) {
|
5090
|
+
case 0:
|
5091
|
+
publicKey = this.provider.wallet.publicKey;
|
5092
|
+
preInstructions = [];
|
5093
|
+
instructions = [];
|
5094
|
+
postInstructions = [];
|
5095
|
+
additionalSigners = [];
|
5096
|
+
_a.label = 1;
|
5097
|
+
case 1:
|
5098
|
+
_a.trys.push([1, 5, , 6]);
|
5099
|
+
return [4, (0, spl_token_1.getAssociatedTokenAddress)(poolConfig.tokenMint, publicKey, true)];
|
5100
|
+
case 2:
|
5101
|
+
receivingTokenAccount = _a.sent();
|
5102
|
+
return [4, (0, utils_1.checkIfAccountExists)(receivingTokenAccount, this.provider.connection)];
|
5103
|
+
case 3:
|
5104
|
+
if (!(_a.sent())) {
|
5105
|
+
throw "userTokenAccount doesn't exist : ".concat(receivingTokenAccount.toBase58());
|
5106
|
+
}
|
5107
|
+
return [4, this.program.methods
|
5108
|
+
.withdrawInstantFees({})
|
5109
|
+
.accounts({
|
5110
|
+
admin: publicKey,
|
5111
|
+
multisig: this.multisig.publicKey,
|
5112
|
+
perpetuals: this.perpetuals.publicKey,
|
5113
|
+
transferAuthority: poolConfig.transferAuthority,
|
5114
|
+
tokenVault: poolConfig.tokenVault,
|
5115
|
+
tokenVaultTokenAccount: poolConfig.tokenVaultTokenAccount,
|
5116
|
+
receivingTokenAccount: receivingTokenAccount,
|
5117
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
5118
|
+
})
|
5119
|
+
.instruction()];
|
5120
|
+
case 4:
|
5121
|
+
withdrawInstantFeeInstruction = _a.sent();
|
5122
|
+
instructions.push(withdrawInstantFeeInstruction);
|
5123
|
+
return [3, 6];
|
5124
|
+
case 5:
|
5125
|
+
err_23 = _a.sent();
|
5126
|
+
console.log("perpClient withdrawInstantFeeInstruction error:: ", err_23);
|
5127
|
+
throw err_23;
|
5128
|
+
case 6: return [2, {
|
5129
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5130
|
+
additionalSigners: additionalSigners
|
5131
|
+
}];
|
5132
|
+
}
|
5133
|
+
});
|
5134
|
+
}); };
|
5135
|
+
this.burnAndClaim = function (owner, nftMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5136
|
+
var preInstructions, instructions, postInstructions, additionalSigners, userTokenAccount, nftTokenAccount, nftTradingAccount, metadataAccount, burnAndClaimInstruction, err_24;
|
5137
|
+
return __generator(this, function (_a) {
|
5138
|
+
switch (_a.label) {
|
5139
|
+
case 0:
|
5140
|
+
preInstructions = [];
|
5141
|
+
instructions = [];
|
5142
|
+
postInstructions = [];
|
5143
|
+
additionalSigners = [];
|
5144
|
+
_a.label = 1;
|
5145
|
+
case 1:
|
5146
|
+
_a.trys.push([1, 6, , 7]);
|
5147
|
+
return [4, (0, spl_token_1.getAssociatedTokenAddress)(poolConfig.tokenMint, owner, true)];
|
5148
|
+
case 2:
|
5149
|
+
userTokenAccount = _a.sent();
|
5150
|
+
return [4, (0, utils_1.checkIfAccountExists)(userTokenAccount, this.provider.connection)];
|
5151
|
+
case 3:
|
5152
|
+
if (!(_a.sent())) {
|
5153
|
+
throw "userTokenAccount doesn't exist : ".concat(userTokenAccount.toBase58());
|
5154
|
+
}
|
5155
|
+
return [4, (0, spl_token_1.getAssociatedTokenAddress)(nftMint, owner, true)];
|
5156
|
+
case 4:
|
5157
|
+
nftTokenAccount = _a.sent();
|
5158
|
+
nftTradingAccount = web3_js_1.PublicKey.findProgramAddressSync([
|
5159
|
+
Buffer.from("trading"),
|
5160
|
+
nftMint.toBuffer(),
|
5161
|
+
], this.programId)[0];
|
5162
|
+
metadataAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), nftMint.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
5163
|
+
return [4, this.program.methods
|
5164
|
+
.burnAndClaim({})
|
5165
|
+
.accounts({
|
5166
|
+
owner: owner,
|
5167
|
+
receivingTokenAccount: userTokenAccount,
|
5168
|
+
perpetuals: this.perpetuals.publicKey,
|
5169
|
+
tokenVault: poolConfig.tokenVault,
|
5170
|
+
tokenVaultTokenAccount: poolConfig.tokenVaultTokenAccount,
|
5171
|
+
metadataAccount: metadataAccount,
|
5172
|
+
tradingAccount: nftTradingAccount,
|
5173
|
+
transferAuthority: poolConfig.transferAuthority,
|
5174
|
+
metadataProgram: constants_1.METAPLEX_PROGRAM_ID,
|
5175
|
+
nftMint: nftMint,
|
5176
|
+
nftTokenAccount: nftTokenAccount,
|
5177
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
5178
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
5179
|
+
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
5180
|
+
eventAuthority: this.eventAuthority.publicKey,
|
5181
|
+
program: this.programId
|
5182
|
+
})
|
5183
|
+
.instruction()];
|
5184
|
+
case 5:
|
5185
|
+
burnAndClaimInstruction = _a.sent();
|
5186
|
+
instructions.push(burnAndClaimInstruction);
|
5187
|
+
return [3, 7];
|
5188
|
+
case 6:
|
5189
|
+
err_24 = _a.sent();
|
5190
|
+
console.log("perpClient burnAndClaimInstruction error:: ", err_24);
|
5191
|
+
throw err_24;
|
5192
|
+
case 7: return [2, {
|
5193
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5194
|
+
additionalSigners: additionalSigners
|
5195
|
+
}];
|
5196
|
+
}
|
5197
|
+
});
|
5198
|
+
}); };
|
5199
|
+
this.burnAndStake = function (owner, feePayer, nftMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5200
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, nftTokenAccount, nftTradingAccount, metadataAccount, burnAndStakeInstruction, err_25;
|
5201
|
+
return __generator(this, function (_a) {
|
5202
|
+
switch (_a.label) {
|
5203
|
+
case 0:
|
5204
|
+
preInstructions = [];
|
5205
|
+
instructions = [];
|
5206
|
+
postInstructions = [];
|
5207
|
+
additionalSigners = [];
|
5208
|
+
_a.label = 1;
|
5209
|
+
case 1:
|
5210
|
+
_a.trys.push([1, 4, , 5]);
|
5211
|
+
tokenStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("token_stake"), owner.toBuffer()], this.programId)[0];
|
5212
|
+
return [4, (0, spl_token_1.getAssociatedTokenAddress)(nftMint, owner, true)];
|
5213
|
+
case 2:
|
5214
|
+
nftTokenAccount = _a.sent();
|
5215
|
+
nftTradingAccount = web3_js_1.PublicKey.findProgramAddressSync([
|
5216
|
+
Buffer.from("trading"),
|
5217
|
+
nftMint.toBuffer(),
|
5218
|
+
], this.programId)[0];
|
5219
|
+
metadataAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), nftMint.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
|
5220
|
+
return [4, this.program.methods
|
5221
|
+
.burnAndStake({})
|
5222
|
+
.accounts({
|
5223
|
+
owner: owner,
|
5224
|
+
feePayer: feePayer,
|
5225
|
+
perpetuals: this.perpetuals.publicKey,
|
5226
|
+
tokenVault: poolConfig.tokenVault,
|
5227
|
+
tokenVaultTokenAccount: poolConfig.tokenVaultTokenAccount,
|
5228
|
+
tokenStakeAccount: tokenStakeAccount,
|
5229
|
+
metadataAccount: metadataAccount,
|
5230
|
+
tradingAccount: nftTradingAccount,
|
5231
|
+
transferAuthority: poolConfig.transferAuthority,
|
5232
|
+
metadataProgram: constants_1.METAPLEX_PROGRAM_ID,
|
5233
|
+
nftMint: nftMint,
|
5234
|
+
nftTokenAccount: nftTokenAccount,
|
5235
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
5236
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
5237
|
+
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
5238
|
+
eventAuthority: this.eventAuthority.publicKey,
|
5239
|
+
program: this.programId
|
5240
|
+
})
|
5241
|
+
.instruction()];
|
5242
|
+
case 3:
|
5243
|
+
burnAndStakeInstruction = _a.sent();
|
5244
|
+
instructions.push(burnAndStakeInstruction);
|
5245
|
+
return [3, 5];
|
5246
|
+
case 4:
|
5247
|
+
err_25 = _a.sent();
|
5248
|
+
console.log("perpClient burnAndStakeInstruction error:: ", err_25);
|
5249
|
+
throw err_25;
|
5250
|
+
case 5: return [2, {
|
5251
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5252
|
+
additionalSigners: additionalSigners
|
5253
|
+
}];
|
5254
|
+
}
|
5255
|
+
});
|
5256
|
+
}); };
|
5257
|
+
this.depositTokenStake = function (owner, feePayer, depositAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5258
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, depositTokenStakeInstruction, err_26;
|
5259
|
+
return __generator(this, function (_a) {
|
5260
|
+
switch (_a.label) {
|
5261
|
+
case 0:
|
5262
|
+
preInstructions = [];
|
5263
|
+
instructions = [];
|
5264
|
+
postInstructions = [];
|
5265
|
+
additionalSigners = [];
|
5266
|
+
_a.label = 1;
|
5267
|
+
case 1:
|
5268
|
+
_a.trys.push([1, 5, , 6]);
|
5269
|
+
tokenStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("token_stake"), owner.toBuffer()], this.programId)[0];
|
5270
|
+
return [4, (0, spl_token_1.getAssociatedTokenAddress)(poolConfig.tokenMint, owner, true)];
|
5271
|
+
case 2:
|
5272
|
+
userTokenAccount = _a.sent();
|
5273
|
+
return [4, (0, utils_1.checkIfAccountExists)(userTokenAccount, this.provider.connection)];
|
5274
|
+
case 3:
|
5275
|
+
if (!(_a.sent())) {
|
5276
|
+
throw "userTokenAccount doesn't exist : ".concat(userTokenAccount.toBase58());
|
5277
|
+
}
|
5278
|
+
return [4, this.program.methods
|
5279
|
+
.depositTokenStake({
|
5280
|
+
depositAmount: depositAmount
|
5281
|
+
})
|
5282
|
+
.accounts({
|
5283
|
+
owner: owner,
|
5284
|
+
feePayer: feePayer,
|
5285
|
+
fundingTokenAccount: userTokenAccount,
|
5286
|
+
perpetuals: this.perpetuals.publicKey,
|
5287
|
+
tokenVault: poolConfig.tokenVault,
|
5288
|
+
tokenVaultTokenAccount: poolConfig.tokenVaultTokenAccount,
|
5289
|
+
tokenStakeAccount: tokenStakeAccount,
|
5290
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
5291
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
5292
|
+
eventAuthority: this.eventAuthority.publicKey,
|
5293
|
+
program: this.programId
|
5294
|
+
})
|
5295
|
+
.instruction()];
|
5296
|
+
case 4:
|
5297
|
+
depositTokenStakeInstruction = _a.sent();
|
5298
|
+
instructions.push(depositTokenStakeInstruction);
|
5299
|
+
return [3, 6];
|
5300
|
+
case 5:
|
5301
|
+
err_26 = _a.sent();
|
5302
|
+
console.log("perpClient depositStakingInstruction error:: ", err_26);
|
5303
|
+
throw err_26;
|
5304
|
+
case 6: return [2, {
|
5305
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5306
|
+
additionalSigners: additionalSigners
|
5307
|
+
}];
|
5308
|
+
}
|
5309
|
+
});
|
5310
|
+
}); };
|
5311
|
+
this.unstakeTokenRequest = function (owner, unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5312
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, unstakeTokenRequestInstruction, err_27;
|
5313
|
+
return __generator(this, function (_a) {
|
5314
|
+
switch (_a.label) {
|
5315
|
+
case 0:
|
5316
|
+
preInstructions = [];
|
5317
|
+
instructions = [];
|
5318
|
+
postInstructions = [];
|
5319
|
+
additionalSigners = [];
|
5320
|
+
_a.label = 1;
|
5321
|
+
case 1:
|
5322
|
+
_a.trys.push([1, 3, , 4]);
|
5323
|
+
tokenStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("token_stake"), owner.toBuffer()], this.programId)[0];
|
5324
|
+
return [4, this.program.methods
|
5325
|
+
.unstakeTokenRequest({
|
5326
|
+
unstakeAmount: unstakeAmount
|
5327
|
+
})
|
5328
|
+
.accounts({
|
5329
|
+
owner: owner,
|
5330
|
+
tokenVault: poolConfig.tokenVault,
|
5331
|
+
tokenStakeAccount: tokenStakeAccount,
|
5332
|
+
eventAuthority: this.eventAuthority.publicKey,
|
5333
|
+
program: this.programId
|
5334
|
+
})
|
5335
|
+
.instruction()];
|
5336
|
+
case 2:
|
5337
|
+
unstakeTokenRequestInstruction = _a.sent();
|
5338
|
+
instructions.push(unstakeTokenRequestInstruction);
|
5339
|
+
return [3, 4];
|
5340
|
+
case 3:
|
5341
|
+
err_27 = _a.sent();
|
5342
|
+
console.log("perpClient unstakeTokenRequestInstruction error:: ", err_27);
|
5343
|
+
throw err_27;
|
5344
|
+
case 4: return [2, {
|
5345
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5346
|
+
additionalSigners: additionalSigners
|
5347
|
+
}];
|
5348
|
+
}
|
5349
|
+
});
|
5350
|
+
}); };
|
5351
|
+
this.unstakeTokenInstant = function (owner, unstakeAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5352
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, unstakeTokenInstantInstruction, err_28;
|
5353
|
+
return __generator(this, function (_a) {
|
5354
|
+
switch (_a.label) {
|
5355
|
+
case 0:
|
5356
|
+
preInstructions = [];
|
5357
|
+
instructions = [];
|
5358
|
+
postInstructions = [];
|
5359
|
+
additionalSigners = [];
|
5360
|
+
_a.label = 1;
|
5361
|
+
case 1:
|
5362
|
+
_a.trys.push([1, 5, , 6]);
|
5363
|
+
tokenStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("token_stake"), owner.toBuffer()], this.programId)[0];
|
5364
|
+
return [4, (0, spl_token_1.getAssociatedTokenAddress)(poolConfig.tokenMint, owner, true)];
|
5365
|
+
case 2:
|
5366
|
+
userTokenAccount = _a.sent();
|
5367
|
+
return [4, (0, utils_1.checkIfAccountExists)(userTokenAccount, this.provider.connection)];
|
5368
|
+
case 3:
|
5369
|
+
if (!(_a.sent())) {
|
5370
|
+
throw "userTokenAccount doesn't exist : ".concat(userTokenAccount.toBase58());
|
5371
|
+
}
|
5372
|
+
return [4, this.program.methods
|
5373
|
+
.unstakeTokenInstant({
|
5374
|
+
unstakeAmount: unstakeAmount
|
5375
|
+
})
|
5376
|
+
.accounts({
|
5377
|
+
owner: owner,
|
5378
|
+
receivingTokenAccount: userTokenAccount,
|
5379
|
+
perpetuals: poolConfig.perpetuals,
|
5380
|
+
transferAuthority: poolConfig.transferAuthority,
|
5381
|
+
tokenVault: poolConfig.tokenVault,
|
5382
|
+
tokenVaultTokenAccount: poolConfig.tokenVaultTokenAccount,
|
5383
|
+
tokenStakeAccount: tokenStakeAccount,
|
5384
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
5385
|
+
eventAuthority: this.eventAuthority.publicKey,
|
5386
|
+
program: this.programId
|
5387
|
+
})
|
5388
|
+
.instruction()];
|
5389
|
+
case 4:
|
5390
|
+
unstakeTokenInstantInstruction = _a.sent();
|
5391
|
+
instructions.push(unstakeTokenInstantInstruction);
|
5392
|
+
return [3, 6];
|
5393
|
+
case 5:
|
5394
|
+
err_28 = _a.sent();
|
5395
|
+
console.log("perpClient unstakeTokenInstantInstruction error:: ", err_28);
|
5396
|
+
throw err_28;
|
5397
|
+
case 6: return [2, {
|
5398
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5399
|
+
additionalSigners: additionalSigners
|
5400
|
+
}];
|
5401
|
+
}
|
5402
|
+
});
|
5403
|
+
}); };
|
5404
|
+
this.withdrawToken = function (owner, withdrawStakeId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5405
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, withdrawTokenInstruction, err_29;
|
5406
|
+
return __generator(this, function (_a) {
|
5407
|
+
switch (_a.label) {
|
5408
|
+
case 0:
|
5409
|
+
preInstructions = [];
|
5410
|
+
instructions = [];
|
5411
|
+
postInstructions = [];
|
5412
|
+
additionalSigners = [];
|
5413
|
+
_a.label = 1;
|
5414
|
+
case 1:
|
5415
|
+
_a.trys.push([1, 5, , 6]);
|
5416
|
+
tokenStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("token_stake"), owner.toBuffer()], this.programId)[0];
|
5417
|
+
return [4, (0, spl_token_1.getAssociatedTokenAddress)(poolConfig.tokenMint, owner, true)];
|
5418
|
+
case 2:
|
5419
|
+
userTokenAccount = _a.sent();
|
5420
|
+
return [4, (0, utils_1.checkIfAccountExists)(userTokenAccount, this.provider.connection)];
|
5421
|
+
case 3:
|
5422
|
+
if (!(_a.sent())) {
|
5423
|
+
throw "userTokenAccount doesn't exist : ".concat(userTokenAccount.toBase58());
|
5424
|
+
}
|
5425
|
+
return [4, this.program.methods
|
5426
|
+
.withdrawToken({
|
5427
|
+
withdrawStakeId: withdrawStakeId
|
5428
|
+
})
|
5429
|
+
.accounts({
|
5430
|
+
owner: owner,
|
5431
|
+
receivingTokenAccount: userTokenAccount,
|
5432
|
+
perpetuals: this.perpetuals.publicKey,
|
5433
|
+
transferAuthority: poolConfig.transferAuthority,
|
5434
|
+
tokenVault: poolConfig.tokenVault,
|
5435
|
+
tokenVaultTokenAccount: poolConfig.tokenVaultTokenAccount,
|
5436
|
+
tokenStakeAccount: tokenStakeAccount,
|
5437
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
5438
|
+
eventAuthority: this.eventAuthority.publicKey,
|
5439
|
+
program: this.programId
|
5440
|
+
})
|
5441
|
+
.instruction()];
|
5442
|
+
case 4:
|
5443
|
+
withdrawTokenInstruction = _a.sent();
|
5444
|
+
instructions.push(withdrawTokenInstruction);
|
5445
|
+
return [3, 6];
|
5446
|
+
case 5:
|
5447
|
+
err_29 = _a.sent();
|
5448
|
+
console.log("perpClient withdrawTokenInstruction error:: ", err_29);
|
5449
|
+
throw err_29;
|
5450
|
+
case 6: return [2, {
|
5451
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5452
|
+
additionalSigners: additionalSigners
|
5453
|
+
}];
|
5454
|
+
}
|
5455
|
+
});
|
5456
|
+
}); };
|
5457
|
+
this.cancelUnstakeRequest = function (owner, withdrawStakeId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5458
|
+
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, cancelUnstakeRequestInstruction, err_30;
|
5459
|
+
return __generator(this, function (_a) {
|
5460
|
+
switch (_a.label) {
|
5461
|
+
case 0:
|
5462
|
+
preInstructions = [];
|
5463
|
+
instructions = [];
|
5464
|
+
postInstructions = [];
|
5465
|
+
additionalSigners = [];
|
5466
|
+
_a.label = 1;
|
5467
|
+
case 1:
|
5468
|
+
_a.trys.push([1, 3, , 4]);
|
5469
|
+
tokenStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("token_stake"), owner.toBuffer()], this.programId)[0];
|
5470
|
+
return [4, this.program.methods
|
5471
|
+
.cancelUnstakeTokenRequest({
|
5472
|
+
withdrawStakeId: withdrawStakeId
|
5473
|
+
})
|
5474
|
+
.accounts({
|
5475
|
+
owner: owner,
|
5476
|
+
tokenVault: poolConfig.tokenVault,
|
5477
|
+
tokenStakeAccount: tokenStakeAccount,
|
5478
|
+
eventAuthority: this.eventAuthority.publicKey,
|
5479
|
+
program: this.programId
|
5480
|
+
})
|
5481
|
+
.instruction()];
|
5482
|
+
case 2:
|
5483
|
+
cancelUnstakeRequestInstruction = _a.sent();
|
5484
|
+
instructions.push(cancelUnstakeRequestInstruction);
|
5485
|
+
return [3, 4];
|
5486
|
+
case 3:
|
5487
|
+
err_30 = _a.sent();
|
5488
|
+
console.log("perpClient cancelUnstakeRequestInstruction error:: ", err_30);
|
5489
|
+
throw err_30;
|
5490
|
+
case 4: return [2, {
|
5491
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5492
|
+
additionalSigners: additionalSigners
|
5493
|
+
}];
|
5494
|
+
}
|
5495
|
+
});
|
5496
|
+
}); };
|
4993
5497
|
this.initRewardVault = function (nftCount, rewardSymbol, collectionMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
4994
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, nftTransferAuthority, initRewardVault,
|
5498
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, nftTransferAuthority, initRewardVault, err_31;
|
4995
5499
|
return __generator(this, function (_a) {
|
4996
5500
|
switch (_a.label) {
|
4997
5501
|
case 0:
|
@@ -5028,9 +5532,9 @@ var PerpetualsClient = (function () {
|
|
5028
5532
|
instructions.push(initRewardVault);
|
5029
5533
|
return [3, 4];
|
5030
5534
|
case 3:
|
5031
|
-
|
5032
|
-
console.log("perpClient InitRewardVault error:: ",
|
5033
|
-
throw
|
5535
|
+
err_31 = _a.sent();
|
5536
|
+
console.log("perpClient InitRewardVault error:: ", err_31);
|
5537
|
+
throw err_31;
|
5034
5538
|
case 4: return [2, {
|
5035
5539
|
instructions: __spreadArray([], instructions, true),
|
5036
5540
|
additionalSigners: additionalSigners
|
@@ -5039,7 +5543,7 @@ var PerpetualsClient = (function () {
|
|
5039
5543
|
});
|
5040
5544
|
}); };
|
5041
5545
|
this.distributeReward = function (rewardAmount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5042
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, distributeReward,
|
5546
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, distributeReward, err_32;
|
5043
5547
|
return __generator(this, function (_a) {
|
5044
5548
|
switch (_a.label) {
|
5045
5549
|
case 0:
|
@@ -5070,9 +5574,9 @@ var PerpetualsClient = (function () {
|
|
5070
5574
|
instructions.push(distributeReward);
|
5071
5575
|
return [3, 4];
|
5072
5576
|
case 3:
|
5073
|
-
|
5074
|
-
console.log("perpClient distributeReward error:: ",
|
5075
|
-
throw
|
5577
|
+
err_32 = _a.sent();
|
5578
|
+
console.log("perpClient distributeReward error:: ", err_32);
|
5579
|
+
throw err_32;
|
5076
5580
|
case 4: return [2, {
|
5077
5581
|
instructions: __spreadArray([], instructions, true),
|
5078
5582
|
additionalSigners: additionalSigners
|
@@ -5083,7 +5587,7 @@ var PerpetualsClient = (function () {
|
|
5083
5587
|
this.collectNftReward = function (rewardSymbol, poolConfig, nftMint, createUserATA) {
|
5084
5588
|
if (createUserATA === void 0) { createUserATA = true; }
|
5085
5589
|
return __awaiter(_this, void 0, void 0, function () {
|
5086
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, nftTokenAccount, metadataAccount, receivingTokenAccount, _a, rewardRecord, rewardVault, rewardTokenAccount, nftTransferAuthority, collectNftReward,
|
5590
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, nftTokenAccount, metadataAccount, receivingTokenAccount, _a, rewardRecord, rewardVault, rewardTokenAccount, nftTransferAuthority, collectNftReward, err_33;
|
5087
5591
|
return __generator(this, function (_b) {
|
5088
5592
|
switch (_b.label) {
|
5089
5593
|
case 0:
|
@@ -5133,8 +5637,8 @@ var PerpetualsClient = (function () {
|
|
5133
5637
|
instructions.push(collectNftReward);
|
5134
5638
|
return [3, 6];
|
5135
5639
|
case 5:
|
5136
|
-
|
5137
|
-
throw
|
5640
|
+
err_33 = _b.sent();
|
5641
|
+
throw err_33;
|
5138
5642
|
case 6: return [2, {
|
5139
5643
|
instructions: __spreadArray([], instructions, true),
|
5140
5644
|
additionalSigners: additionalSigners
|
@@ -5146,7 +5650,7 @@ var PerpetualsClient = (function () {
|
|
5146
5650
|
this.collectAndDistributeFee = function (rewardSymbol, poolConfig, createUserATA, nftTradingAccount) {
|
5147
5651
|
if (createUserATA === void 0) { createUserATA = true; }
|
5148
5652
|
return __awaiter(_this, void 0, void 0, function () {
|
5149
|
-
var publicKey, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tradingAccount, rewardVault, rewardTokenAccount, withdrawStakeInstruction,
|
5653
|
+
var publicKey, rewardCustodyMint, rewardCustodyConfig, preInstructions, instructions, postInstructions, additionalSigners, pool, flpStakeAccount, receivingTokenAccount, _a, tradingAccount, rewardVault, rewardTokenAccount, withdrawStakeInstruction, err_34;
|
5150
5654
|
return __generator(this, function (_b) {
|
5151
5655
|
switch (_b.label) {
|
5152
5656
|
case 0:
|
@@ -5210,9 +5714,9 @@ var PerpetualsClient = (function () {
|
|
5210
5714
|
instructions.push(withdrawStakeInstruction);
|
5211
5715
|
return [3, 6];
|
5212
5716
|
case 5:
|
5213
|
-
|
5214
|
-
console.log("perpClient withdrawStake error:: ",
|
5215
|
-
throw
|
5717
|
+
err_34 = _b.sent();
|
5718
|
+
console.log("perpClient withdrawStake error:: ", err_34);
|
5719
|
+
throw err_34;
|
5216
5720
|
case 6: return [2, {
|
5217
5721
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5218
5722
|
additionalSigners: additionalSigners
|
@@ -5222,7 +5726,7 @@ var PerpetualsClient = (function () {
|
|
5222
5726
|
});
|
5223
5727
|
};
|
5224
5728
|
this.setTriggerPrice = function (targetSymbol, collateralSymbol, side, triggerPrice, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5225
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, positionAccount, instructions, additionalSigners, setTriggerPrice,
|
5729
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, positionAccount, instructions, additionalSigners, setTriggerPrice, err_35;
|
5226
5730
|
return __generator(this, function (_a) {
|
5227
5731
|
switch (_a.label) {
|
5228
5732
|
case 0:
|
@@ -5261,9 +5765,9 @@ var PerpetualsClient = (function () {
|
|
5261
5765
|
instructions.push(setTriggerPrice);
|
5262
5766
|
return [3, 4];
|
5263
5767
|
case 3:
|
5264
|
-
|
5265
|
-
console.log("perpClient setTriggerPrice error:: ",
|
5266
|
-
throw
|
5768
|
+
err_35 = _a.sent();
|
5769
|
+
console.log("perpClient setTriggerPrice error:: ", err_35);
|
5770
|
+
throw err_35;
|
5267
5771
|
case 4: return [2, {
|
5268
5772
|
instructions: __spreadArray([], instructions, true),
|
5269
5773
|
additionalSigners: additionalSigners
|
@@ -5276,7 +5780,7 @@ var PerpetualsClient = (function () {
|
|
5276
5780
|
if (closeUsersWSOLATA === void 0) { closeUsersWSOLATA = false; }
|
5277
5781
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5278
5782
|
return __awaiter(_this, void 0, void 0, function () {
|
5279
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, forceClosePosition, closeWsolATAIns,
|
5783
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, forceClosePosition, closeWsolATAIns, err_36;
|
5280
5784
|
return __generator(this, function (_b) {
|
5281
5785
|
switch (_b.label) {
|
5282
5786
|
case 0:
|
@@ -5337,9 +5841,9 @@ var PerpetualsClient = (function () {
|
|
5337
5841
|
}
|
5338
5842
|
return [3, 7];
|
5339
5843
|
case 6:
|
5340
|
-
|
5341
|
-
console.log("perpClient forceClosePosition error:: ",
|
5342
|
-
throw
|
5844
|
+
err_36 = _b.sent();
|
5845
|
+
console.log("perpClient forceClosePosition error:: ", err_36);
|
5846
|
+
throw err_36;
|
5343
5847
|
case 7: return [2, {
|
5344
5848
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5345
5849
|
additionalSigners: additionalSigners
|
@@ -5352,7 +5856,7 @@ var PerpetualsClient = (function () {
|
|
5352
5856
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
5353
5857
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5354
5858
|
return __awaiter(_this, void 0, void 0, function () {
|
5355
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder,
|
5859
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, marketAccount, userReserveTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, orderAccount, placeLimitOrder, err_37;
|
5356
5860
|
return __generator(this, function (_c) {
|
5357
5861
|
switch (_c.label) {
|
5358
5862
|
case 0:
|
@@ -5456,9 +5960,9 @@ var PerpetualsClient = (function () {
|
|
5456
5960
|
instructions.push(placeLimitOrder);
|
5457
5961
|
return [3, 11];
|
5458
5962
|
case 10:
|
5459
|
-
|
5460
|
-
console.log("perpClient placeLimitOrder error:: ",
|
5461
|
-
throw
|
5963
|
+
err_37 = _c.sent();
|
5964
|
+
console.log("perpClient placeLimitOrder error:: ", err_37);
|
5965
|
+
throw err_37;
|
5462
5966
|
case 11: return [2, {
|
5463
5967
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5464
5968
|
additionalSigners: additionalSigners
|
@@ -5471,7 +5975,7 @@ var PerpetualsClient = (function () {
|
|
5471
5975
|
if (createUserATA === void 0) { createUserATA = true; }
|
5472
5976
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5473
5977
|
return __awaiter(_this, void 0, void 0, function () {
|
5474
|
-
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder,
|
5978
|
+
var publicKey, targetCustodyConfig, reserveCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, wrappedSolAccount, userReceivingTokenAccount, lamports, _a, positionAccount, orderAccount, editLimitOrder, err_38;
|
5475
5979
|
return __generator(this, function (_b) {
|
5476
5980
|
switch (_b.label) {
|
5477
5981
|
case 0:
|
@@ -5558,9 +6062,9 @@ var PerpetualsClient = (function () {
|
|
5558
6062
|
instructions.push(editLimitOrder);
|
5559
6063
|
return [3, 8];
|
5560
6064
|
case 7:
|
5561
|
-
|
5562
|
-
console.log("perpClient editLimitOrder error:: ",
|
5563
|
-
throw
|
6065
|
+
err_38 = _b.sent();
|
6066
|
+
console.log("perpClient editLimitOrder error:: ", err_38);
|
6067
|
+
throw err_38;
|
5564
6068
|
case 8: return [2, {
|
5565
6069
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5566
6070
|
additionalSigners: additionalSigners
|
@@ -5574,7 +6078,7 @@ var PerpetualsClient = (function () {
|
|
5574
6078
|
if (nftReferralAccount === void 0) { nftReferralAccount = web3_js_1.PublicKey.default; }
|
5575
6079
|
if (nftRebateTokenAccount === void 0) { nftRebateTokenAccount = web3_js_1.PublicKey.default; }
|
5576
6080
|
return __awaiter(_this, void 0, void 0, function () {
|
5577
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder,
|
6081
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitOrder, err_39;
|
5578
6082
|
return __generator(this, function (_a) {
|
5579
6083
|
switch (_a.label) {
|
5580
6084
|
case 0:
|
@@ -5620,9 +6124,9 @@ var PerpetualsClient = (function () {
|
|
5620
6124
|
instructions.push(executeLimitOrder);
|
5621
6125
|
return [3, 4];
|
5622
6126
|
case 3:
|
5623
|
-
|
5624
|
-
console.log("perpClient executeLimitOrder error:: ",
|
5625
|
-
throw
|
6127
|
+
err_39 = _a.sent();
|
6128
|
+
console.log("perpClient executeLimitOrder error:: ", err_39);
|
6129
|
+
throw err_39;
|
5626
6130
|
case 4: return [2, {
|
5627
6131
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5628
6132
|
additionalSigners: additionalSigners
|
@@ -5636,7 +6140,7 @@ var PerpetualsClient = (function () {
|
|
5636
6140
|
if (nftReferralAccount === void 0) { nftReferralAccount = web3_js_1.PublicKey.default; }
|
5637
6141
|
if (nftRebateTokenAccount === void 0) { nftRebateTokenAccount = web3_js_1.PublicKey.default; }
|
5638
6142
|
return __awaiter(_this, void 0, void 0, function () {
|
5639
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody, positionAccount, orderAccount, executeLimitWithSwap,
|
6143
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody, positionAccount, orderAccount, executeLimitWithSwap, err_40;
|
5640
6144
|
return __generator(this, function (_b) {
|
5641
6145
|
switch (_b.label) {
|
5642
6146
|
case 0:
|
@@ -5700,9 +6204,9 @@ var PerpetualsClient = (function () {
|
|
5700
6204
|
instructions.push(executeLimitWithSwap);
|
5701
6205
|
return [3, 4];
|
5702
6206
|
case 3:
|
5703
|
-
|
5704
|
-
console.log("perpClient executeLimitWithSwap error:: ",
|
5705
|
-
throw
|
6207
|
+
err_40 = _b.sent();
|
6208
|
+
console.log("perpClient executeLimitWithSwap error:: ", err_40);
|
6209
|
+
throw err_40;
|
5706
6210
|
case 4: return [2, {
|
5707
6211
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5708
6212
|
additionalSigners: additionalSigners
|
@@ -5712,7 +6216,7 @@ var PerpetualsClient = (function () {
|
|
5712
6216
|
});
|
5713
6217
|
};
|
5714
6218
|
this.placeTriggerOrder = function (targetSymbol, collateralSymbol, side, triggerPrice, deltaSizeAmount, isStopLoss, receiveCustodyId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5715
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder,
|
6219
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder, err_41;
|
5716
6220
|
return __generator(this, function (_a) {
|
5717
6221
|
switch (_a.label) {
|
5718
6222
|
case 0:
|
@@ -5759,9 +6263,9 @@ var PerpetualsClient = (function () {
|
|
5759
6263
|
instructions.push(placeTriggerOrder);
|
5760
6264
|
return [3, 4];
|
5761
6265
|
case 3:
|
5762
|
-
|
5763
|
-
console.log("perpClient placeTriggerOrder error:: ",
|
5764
|
-
throw
|
6266
|
+
err_41 = _a.sent();
|
6267
|
+
console.log("perpClient placeTriggerOrder error:: ", err_41);
|
6268
|
+
throw err_41;
|
5765
6269
|
case 4: return [2, {
|
5766
6270
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5767
6271
|
additionalSigners: additionalSigners
|
@@ -5770,7 +6274,7 @@ var PerpetualsClient = (function () {
|
|
5770
6274
|
});
|
5771
6275
|
}); };
|
5772
6276
|
this.editTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5773
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder,
|
6277
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder, err_42;
|
5774
6278
|
return __generator(this, function (_a) {
|
5775
6279
|
switch (_a.label) {
|
5776
6280
|
case 0:
|
@@ -5815,9 +6319,9 @@ var PerpetualsClient = (function () {
|
|
5815
6319
|
instructions.push(editTriggerOrder);
|
5816
6320
|
return [3, 4];
|
5817
6321
|
case 3:
|
5818
|
-
|
5819
|
-
console.log("perpClient editTriggerOrder error:: ",
|
5820
|
-
throw
|
6322
|
+
err_42 = _a.sent();
|
6323
|
+
console.log("perpClient editTriggerOrder error:: ", err_42);
|
6324
|
+
throw err_42;
|
5821
6325
|
case 4: return [2, {
|
5822
6326
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5823
6327
|
additionalSigners: additionalSigners
|
@@ -5826,7 +6330,7 @@ var PerpetualsClient = (function () {
|
|
5826
6330
|
});
|
5827
6331
|
}); };
|
5828
6332
|
this.cancelTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5829
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder,
|
6333
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder, err_43;
|
5830
6334
|
return __generator(this, function (_a) {
|
5831
6335
|
switch (_a.label) {
|
5832
6336
|
case 0:
|
@@ -5859,9 +6363,9 @@ var PerpetualsClient = (function () {
|
|
5859
6363
|
instructions.push(cancelTriggerOrder);
|
5860
6364
|
return [3, 4];
|
5861
6365
|
case 3:
|
5862
|
-
|
5863
|
-
console.log("perpClient cancelTriggerOrder error:: ",
|
5864
|
-
throw
|
6366
|
+
err_43 = _a.sent();
|
6367
|
+
console.log("perpClient cancelTriggerOrder error:: ", err_43);
|
6368
|
+
throw err_43;
|
5865
6369
|
case 4: return [2, {
|
5866
6370
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5867
6371
|
additionalSigners: additionalSigners
|
@@ -5873,7 +6377,7 @@ var PerpetualsClient = (function () {
|
|
5873
6377
|
if (createUserATA === void 0) { createUserATA = true; }
|
5874
6378
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5875
6379
|
return __awaiter(_this, void 0, void 0, function () {
|
5876
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, userReceivingTokenAccount, userReceivingTokenAccountCollateral, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, _b, positionAccount, orderAccount, custodyAccountMetas, custodyOracleAccountMetas, _i, _c, custody, executeTriggerWithSwap,
|
6380
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, userReceivingTokenAccount, userReceivingTokenAccountCollateral, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, _b, positionAccount, orderAccount, custodyAccountMetas, custodyOracleAccountMetas, _i, _c, custody, executeTriggerWithSwap, err_44;
|
5877
6381
|
return __generator(this, function (_d) {
|
5878
6382
|
switch (_d.label) {
|
5879
6383
|
case 0:
|
@@ -5968,9 +6472,9 @@ var PerpetualsClient = (function () {
|
|
5968
6472
|
instructions.push(executeTriggerWithSwap);
|
5969
6473
|
return [3, 10];
|
5970
6474
|
case 9:
|
5971
|
-
|
5972
|
-
console.log("perpClient executeTriggerWithSwap error:: ",
|
5973
|
-
throw
|
6475
|
+
err_44 = _d.sent();
|
6476
|
+
console.log("perpClient executeTriggerWithSwap error:: ", err_44);
|
6477
|
+
throw err_44;
|
5974
6478
|
case 10: return [2, {
|
5975
6479
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5976
6480
|
additionalSigners: additionalSigners
|
@@ -5983,7 +6487,7 @@ var PerpetualsClient = (function () {
|
|
5983
6487
|
if (createUserATA === void 0) { createUserATA = true; }
|
5984
6488
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5985
6489
|
return __awaiter(_this, void 0, void 0, function () {
|
5986
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder,
|
6490
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder, err_45;
|
5987
6491
|
return __generator(this, function (_b) {
|
5988
6492
|
switch (_b.label) {
|
5989
6493
|
case 0:
|
@@ -6046,9 +6550,9 @@ var PerpetualsClient = (function () {
|
|
6046
6550
|
instructions.push(executeTriggerOrder);
|
6047
6551
|
return [3, 8];
|
6048
6552
|
case 7:
|
6049
|
-
|
6050
|
-
console.log("perpClient executeTriggerOrder error:: ",
|
6051
|
-
throw
|
6553
|
+
err_45 = _b.sent();
|
6554
|
+
console.log("perpClient executeTriggerOrder error:: ", err_45);
|
6555
|
+
throw err_45;
|
6052
6556
|
case 8: return [2, {
|
6053
6557
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6054
6558
|
additionalSigners: additionalSigners
|
@@ -6058,7 +6562,7 @@ var PerpetualsClient = (function () {
|
|
6058
6562
|
});
|
6059
6563
|
};
|
6060
6564
|
this.migrateTriggerOrder = function (owner, marketAccount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6061
|
-
var payerPubkey, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, migrateTriggerOrder,
|
6565
|
+
var payerPubkey, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, migrateTriggerOrder, err_46;
|
6062
6566
|
return __generator(this, function (_a) {
|
6063
6567
|
switch (_a.label) {
|
6064
6568
|
case 0:
|
@@ -6088,9 +6592,9 @@ var PerpetualsClient = (function () {
|
|
6088
6592
|
instructions.push(migrateTriggerOrder);
|
6089
6593
|
return [3, 4];
|
6090
6594
|
case 3:
|
6091
|
-
|
6092
|
-
console.log("perpClient migrateTriggerOrder error:: ",
|
6093
|
-
throw
|
6595
|
+
err_46 = _a.sent();
|
6596
|
+
console.log("perpClient migrateTriggerOrder error:: ", err_46);
|
6597
|
+
throw err_46;
|
6094
6598
|
case 4: return [2, {
|
6095
6599
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6096
6600
|
additionalSigners: additionalSigners
|
@@ -6099,7 +6603,7 @@ var PerpetualsClient = (function () {
|
|
6099
6603
|
});
|
6100
6604
|
}); };
|
6101
6605
|
this.getPositionData = function (position, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6102
|
-
var marketConfig, targetCustodyConfig, collateralCustodyConfig, getPositionData,
|
6606
|
+
var marketConfig, targetCustodyConfig, collateralCustodyConfig, getPositionData, err_47;
|
6103
6607
|
return __generator(this, function (_a) {
|
6104
6608
|
switch (_a.label) {
|
6105
6609
|
case 0:
|
@@ -6128,15 +6632,15 @@ var PerpetualsClient = (function () {
|
|
6128
6632
|
console.log(getPositionData);
|
6129
6633
|
return [2, getPositionData];
|
6130
6634
|
case 3:
|
6131
|
-
|
6132
|
-
console.log("perpClient setPool error:: ",
|
6133
|
-
throw
|
6635
|
+
err_47 = _a.sent();
|
6636
|
+
console.log("perpClient setPool error:: ", err_47);
|
6637
|
+
throw err_47;
|
6134
6638
|
case 4: return [2];
|
6135
6639
|
}
|
6136
6640
|
});
|
6137
6641
|
}); };
|
6138
6642
|
this.protocolWithdrawFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6139
|
-
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx,
|
6643
|
+
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_48;
|
6140
6644
|
return __generator(this, function (_a) {
|
6141
6645
|
switch (_a.label) {
|
6142
6646
|
case 0:
|
@@ -6169,9 +6673,9 @@ var PerpetualsClient = (function () {
|
|
6169
6673
|
instructions.push(withdrawFeesIx);
|
6170
6674
|
return [3, 5];
|
6171
6675
|
case 4:
|
6172
|
-
|
6173
|
-
console.log("perpClient setPool error:: ",
|
6174
|
-
throw
|
6676
|
+
err_48 = _a.sent();
|
6677
|
+
console.log("perpClient setPool error:: ", err_48);
|
6678
|
+
throw err_48;
|
6175
6679
|
case 5: return [2, {
|
6176
6680
|
instructions: __spreadArray([], instructions, true),
|
6177
6681
|
additionalSigners: additionalSigners
|
@@ -6180,7 +6684,7 @@ var PerpetualsClient = (function () {
|
|
6180
6684
|
});
|
6181
6685
|
}); };
|
6182
6686
|
this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
|
6183
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction,
|
6687
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_49;
|
6184
6688
|
return __generator(this, function (_a) {
|
6185
6689
|
switch (_a.label) {
|
6186
6690
|
case 0:
|
@@ -6207,9 +6711,9 @@ var PerpetualsClient = (function () {
|
|
6207
6711
|
instructions.push(setPermissionsInstruction);
|
6208
6712
|
return [3, 4];
|
6209
6713
|
case 3:
|
6210
|
-
|
6211
|
-
console.log("perpClient setPool error:: ",
|
6212
|
-
throw
|
6714
|
+
err_49 = _a.sent();
|
6715
|
+
console.log("perpClient setPool error:: ", err_49);
|
6716
|
+
throw err_49;
|
6213
6717
|
case 4: return [2, {
|
6214
6718
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6215
6719
|
additionalSigners: additionalSigners
|
@@ -6218,7 +6722,7 @@ var PerpetualsClient = (function () {
|
|
6218
6722
|
});
|
6219
6723
|
}); };
|
6220
6724
|
this.reimburse = function (tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6221
|
-
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e,
|
6725
|
+
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_50;
|
6222
6726
|
var _f;
|
6223
6727
|
return __generator(this, function (_g) {
|
6224
6728
|
switch (_g.label) {
|
@@ -6278,9 +6782,9 @@ var PerpetualsClient = (function () {
|
|
6278
6782
|
instructions.push(reimburse);
|
6279
6783
|
return [3, 5];
|
6280
6784
|
case 4:
|
6281
|
-
|
6282
|
-
console.log("perpClient setPool error:: ",
|
6283
|
-
throw
|
6785
|
+
err_50 = _g.sent();
|
6786
|
+
console.log("perpClient setPool error:: ", err_50);
|
6787
|
+
throw err_50;
|
6284
6788
|
case 5: return [2, {
|
6285
6789
|
instructions: __spreadArray([], instructions, true),
|
6286
6790
|
additionalSigners: additionalSigners
|
@@ -6289,7 +6793,7 @@ var PerpetualsClient = (function () {
|
|
6289
6793
|
});
|
6290
6794
|
}); };
|
6291
6795
|
this.setInternalOraclePrice = function (tokenMint, price, expo, conf, ema, publishTime, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6292
|
-
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice,
|
6796
|
+
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_51;
|
6293
6797
|
return __generator(this, function (_a) {
|
6294
6798
|
switch (_a.label) {
|
6295
6799
|
case 0:
|
@@ -6322,9 +6826,9 @@ var PerpetualsClient = (function () {
|
|
6322
6826
|
instructions.push(setInternalOraclePrice);
|
6323
6827
|
return [3, 4];
|
6324
6828
|
case 3:
|
6325
|
-
|
6326
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
6327
|
-
throw
|
6829
|
+
err_51 = _a.sent();
|
6830
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_51);
|
6831
|
+
throw err_51;
|
6328
6832
|
case 4: return [2, {
|
6329
6833
|
instructions: __spreadArray([], instructions, true),
|
6330
6834
|
additionalSigners: additionalSigners
|
@@ -6336,7 +6840,7 @@ var PerpetualsClient = (function () {
|
|
6336
6840
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
6337
6841
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6338
6842
|
return __awaiter(_this, void 0, void 0, function () {
|
6339
|
-
var publicKey, preInstructions, instructions, additionalSigners, postInstructions, rewardCustody, inCustodyConfig, lpTokenMint, compoundingTokenMint, wrappedSolAccount, lpTokenAccount, compoundingTokenAccount, fundingAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, lamports, unWrappedSolBalance, _d, addCompoundingLiquidity,
|
6843
|
+
var publicKey, preInstructions, instructions, additionalSigners, postInstructions, rewardCustody, inCustodyConfig, lpTokenMint, compoundingTokenMint, wrappedSolAccount, lpTokenAccount, compoundingTokenAccount, fundingAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, lamports, unWrappedSolBalance, _d, addCompoundingLiquidity, err_52;
|
6340
6844
|
return __generator(this, function (_e) {
|
6341
6845
|
switch (_e.label) {
|
6342
6846
|
case 0:
|
@@ -6459,8 +6963,8 @@ var PerpetualsClient = (function () {
|
|
6459
6963
|
instructions.push(addCompoundingLiquidity);
|
6460
6964
|
return [3, 10];
|
6461
6965
|
case 9:
|
6462
|
-
|
6463
|
-
console.log("perpClient addCompoundingLiquidity error:: ",
|
6966
|
+
err_52 = _e.sent();
|
6967
|
+
console.log("perpClient addCompoundingLiquidity error:: ", err_52);
|
6464
6968
|
return [3, 10];
|
6465
6969
|
case 10: return [2, {
|
6466
6970
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6474,7 +6978,7 @@ var PerpetualsClient = (function () {
|
|
6474
6978
|
if (createUserATA === void 0) { createUserATA = true; }
|
6475
6979
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6476
6980
|
return __awaiter(_this, void 0, void 0, function () {
|
6477
|
-
var publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, outCustodyConfig, lpTokenMint, compoundingTokenMint, lamports, _a, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _b, custody, _c, _d, market, compoundingTokenAccount, removeCompoundingLiquidity,
|
6981
|
+
var publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, outCustodyConfig, lpTokenMint, compoundingTokenMint, lamports, _a, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _b, custody, _c, _d, market, compoundingTokenAccount, removeCompoundingLiquidity, err_53;
|
6478
6982
|
return __generator(this, function (_e) {
|
6479
6983
|
switch (_e.label) {
|
6480
6984
|
case 0:
|
@@ -6581,8 +7085,8 @@ var PerpetualsClient = (function () {
|
|
6581
7085
|
instructions.push(removeCompoundingLiquidity);
|
6582
7086
|
return [3, 8];
|
6583
7087
|
case 7:
|
6584
|
-
|
6585
|
-
console.log("perpClient removeCompoundingLiquidity error:: ",
|
7088
|
+
err_53 = _e.sent();
|
7089
|
+
console.log("perpClient removeCompoundingLiquidity error:: ", err_53);
|
6586
7090
|
return [3, 8];
|
6587
7091
|
case 8: return [2, {
|
6588
7092
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6595,7 +7099,7 @@ var PerpetualsClient = (function () {
|
|
6595
7099
|
this.migrateStake = function (amount, rewardTokenMint, poolConfig, createUserATA) {
|
6596
7100
|
if (createUserATA === void 0) { createUserATA = true; }
|
6597
7101
|
return __awaiter(_this, void 0, void 0, function () {
|
6598
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, _a, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _b, custody, _c, _d, market, migrateStake,
|
7102
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, _a, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _b, custody, _c, _d, market, migrateStake, err_54;
|
6599
7103
|
return __generator(this, function (_e) {
|
6600
7104
|
switch (_e.label) {
|
6601
7105
|
case 0:
|
@@ -6676,8 +7180,8 @@ var PerpetualsClient = (function () {
|
|
6676
7180
|
instructions.push(migrateStake);
|
6677
7181
|
return [3, 6];
|
6678
7182
|
case 5:
|
6679
|
-
|
6680
|
-
console.log("perpClient migrateStake error:: ",
|
7183
|
+
err_54 = _e.sent();
|
7184
|
+
console.log("perpClient migrateStake error:: ", err_54);
|
6681
7185
|
return [3, 6];
|
6682
7186
|
case 6: return [2, {
|
6683
7187
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6688,7 +7192,7 @@ var PerpetualsClient = (function () {
|
|
6688
7192
|
});
|
6689
7193
|
};
|
6690
7194
|
this.migrateFlp = function (amount, rewardTokenMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6691
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp,
|
7195
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp, err_55;
|
6692
7196
|
return __generator(this, function (_d) {
|
6693
7197
|
switch (_d.label) {
|
6694
7198
|
case 0:
|
@@ -6760,8 +7264,8 @@ var PerpetualsClient = (function () {
|
|
6760
7264
|
instructions.push(migrateFlp);
|
6761
7265
|
return [3, 4];
|
6762
7266
|
case 3:
|
6763
|
-
|
6764
|
-
console.log("perpClient migrateFlp error:: ",
|
7267
|
+
err_55 = _d.sent();
|
7268
|
+
console.log("perpClient migrateFlp error:: ", err_55);
|
6765
7269
|
return [3, 4];
|
6766
7270
|
case 4: return [2, {
|
6767
7271
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6773,7 +7277,7 @@ var PerpetualsClient = (function () {
|
|
6773
7277
|
this.compoundingFee = function (poolConfig, rewardTokenSymbol) {
|
6774
7278
|
if (rewardTokenSymbol === void 0) { rewardTokenSymbol = 'USDC'; }
|
6775
7279
|
return __awaiter(_this, void 0, void 0, function () {
|
6776
|
-
var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, compoundingFee,
|
7280
|
+
var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, compoundingFee, err_56;
|
6777
7281
|
return __generator(this, function (_d) {
|
6778
7282
|
switch (_d.label) {
|
6779
7283
|
case 0:
|
@@ -6830,8 +7334,8 @@ var PerpetualsClient = (function () {
|
|
6830
7334
|
instructions.push(compoundingFee);
|
6831
7335
|
return [3, 4];
|
6832
7336
|
case 3:
|
6833
|
-
|
6834
|
-
console.log("perpClient compoundingFee error:: ",
|
7337
|
+
err_56 = _d.sent();
|
7338
|
+
console.log("perpClient compoundingFee error:: ", err_56);
|
6835
7339
|
return [3, 4];
|
6836
7340
|
case 4: return [2, {
|
6837
7341
|
instructions: __spreadArray([], instructions, true),
|
@@ -6842,7 +7346,7 @@ var PerpetualsClient = (function () {
|
|
6842
7346
|
});
|
6843
7347
|
};
|
6844
7348
|
this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6845
|
-
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp,
|
7349
|
+
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_57;
|
6846
7350
|
return __generator(this, function (_a) {
|
6847
7351
|
switch (_a.label) {
|
6848
7352
|
case 0:
|
@@ -6880,8 +7384,8 @@ var PerpetualsClient = (function () {
|
|
6880
7384
|
instructions.push(renameFlp);
|
6881
7385
|
return [3, 4];
|
6882
7386
|
case 3:
|
6883
|
-
|
6884
|
-
console.log("perpClient renameFlp error:: ",
|
7387
|
+
err_57 = _a.sent();
|
7388
|
+
console.log("perpClient renameFlp error:: ", err_57);
|
6885
7389
|
return [3, 4];
|
6886
7390
|
case 4: return [2, {
|
6887
7391
|
instructions: __spreadArray([], instructions, true),
|