flash-sdk 2.34.0 → 2.40.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/PerpetualsClient.d.ts +432 -29
- package/dist/PerpetualsClient.js +607 -142
- 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 -1
- package/dist/utils/alt.d.ts +0 -1
- package/package.json +1 -1
package/dist/PerpetualsClient.js
CHANGED
@@ -2567,45 +2567,6 @@ var PerpetualsClient = (function () {
|
|
2567
2567
|
}
|
2568
2568
|
});
|
2569
2569
|
}); };
|
2570
|
-
this.getPositionQuoteView = function (targetSymbol, collateralSymbol, receivingSymbol, side, poolConfig, amountIn, leverage, discountIndex, privilege) { return __awaiter(_this, void 0, void 0, function () {
|
2571
|
-
var targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, params;
|
2572
|
-
return __generator(this, function (_a) {
|
2573
|
-
switch (_a.label) {
|
2574
|
-
case 0:
|
2575
|
-
targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(targetSymbol).mintKey); });
|
2576
|
-
collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey); });
|
2577
|
-
receivingCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(receivingSymbol).mintKey); });
|
2578
|
-
marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
|
2579
|
-
params = {
|
2580
|
-
amountIn: amountIn,
|
2581
|
-
leverage: leverage,
|
2582
|
-
privilege: privilege,
|
2583
|
-
discountIndex: discountIndex,
|
2584
|
-
};
|
2585
|
-
return [4, this.program.methods
|
2586
|
-
.getPositionQuote(params)
|
2587
|
-
.accounts({
|
2588
|
-
perpetuals: this.perpetuals.publicKey,
|
2589
|
-
pool: poolConfig.poolAddress,
|
2590
|
-
market: marketAccount,
|
2591
|
-
targetCustody: targetCustodyConfig.custodyAccount,
|
2592
|
-
targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
|
2593
|
-
collateralCustody: collateralCustodyConfig.custodyAccount,
|
2594
|
-
collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
|
2595
|
-
receivingCustody: receivingCustodyConfig.custodyAccount,
|
2596
|
-
receivingCustodyOracleAccount: this.useExtOracleAccount ? receivingCustodyConfig.extOracleAccount : receivingCustodyConfig.intOracleAccount,
|
2597
|
-
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
2598
|
-
})
|
2599
|
-
.remainingAccounts([])
|
2600
|
-
.view()
|
2601
|
-
.catch(function (err) {
|
2602
|
-
console.error(err);
|
2603
|
-
throw err;
|
2604
|
-
})];
|
2605
|
-
case 1: return [2, _a.sent()];
|
2606
|
-
}
|
2607
|
-
});
|
2608
|
-
}); };
|
2609
2570
|
this.openPosition = function (targetSymbol, collateralSymbol, priceWithSlippage, collateralWithfee, size, side, poolConfig, privilege, nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, skipBalanceChecks, ephemeralSignerPubkey) {
|
2610
2571
|
if (nftTradingAccount === void 0) { nftTradingAccount = web3_js_1.PublicKey.default; }
|
2611
2572
|
if (nftReferralAccount === void 0) { nftReferralAccount = web3_js_1.PublicKey.default; }
|
@@ -4295,7 +4256,7 @@ var PerpetualsClient = (function () {
|
|
4295
4256
|
});
|
4296
4257
|
});
|
4297
4258
|
};
|
4298
|
-
this.addReferral = function (
|
4259
|
+
this.addReferral = function (tokenStakeAccount, nftReferralAccount) { return __awaiter(_this, void 0, void 0, function () {
|
4299
4260
|
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, addReferralInstruction, err_8;
|
4300
4261
|
return __generator(this, function (_a) {
|
4301
4262
|
switch (_a.label) {
|
@@ -4314,7 +4275,7 @@ var PerpetualsClient = (function () {
|
|
4314
4275
|
owner: publicKey,
|
4315
4276
|
feePayer: publicKey,
|
4316
4277
|
referralAccount: nftReferralAccount,
|
4317
|
-
|
4278
|
+
tokenStakeAccount: tokenStakeAccount,
|
4318
4279
|
systemProgram: web3_js_1.SystemProgram.programId,
|
4319
4280
|
})
|
4320
4281
|
.instruction()];
|
@@ -5029,8 +4990,512 @@ var PerpetualsClient = (function () {
|
|
5029
4990
|
});
|
5030
4991
|
});
|
5031
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
|
+
}); };
|
5032
5497
|
this.initRewardVault = function (nftCount, rewardSymbol, collectionMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5033
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, nftTransferAuthority, initRewardVault,
|
5498
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, nftTransferAuthority, initRewardVault, err_31;
|
5034
5499
|
return __generator(this, function (_a) {
|
5035
5500
|
switch (_a.label) {
|
5036
5501
|
case 0:
|
@@ -5067,9 +5532,9 @@ var PerpetualsClient = (function () {
|
|
5067
5532
|
instructions.push(initRewardVault);
|
5068
5533
|
return [3, 4];
|
5069
5534
|
case 3:
|
5070
|
-
|
5071
|
-
console.log("perpClient InitRewardVault error:: ",
|
5072
|
-
throw
|
5535
|
+
err_31 = _a.sent();
|
5536
|
+
console.log("perpClient InitRewardVault error:: ", err_31);
|
5537
|
+
throw err_31;
|
5073
5538
|
case 4: return [2, {
|
5074
5539
|
instructions: __spreadArray([], instructions, true),
|
5075
5540
|
additionalSigners: additionalSigners
|
@@ -5078,7 +5543,7 @@ var PerpetualsClient = (function () {
|
|
5078
5543
|
});
|
5079
5544
|
}); };
|
5080
5545
|
this.distributeReward = function (rewardAmount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5081
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, distributeReward,
|
5546
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, distributeReward, err_32;
|
5082
5547
|
return __generator(this, function (_a) {
|
5083
5548
|
switch (_a.label) {
|
5084
5549
|
case 0:
|
@@ -5109,9 +5574,9 @@ var PerpetualsClient = (function () {
|
|
5109
5574
|
instructions.push(distributeReward);
|
5110
5575
|
return [3, 4];
|
5111
5576
|
case 3:
|
5112
|
-
|
5113
|
-
console.log("perpClient distributeReward error:: ",
|
5114
|
-
throw
|
5577
|
+
err_32 = _a.sent();
|
5578
|
+
console.log("perpClient distributeReward error:: ", err_32);
|
5579
|
+
throw err_32;
|
5115
5580
|
case 4: return [2, {
|
5116
5581
|
instructions: __spreadArray([], instructions, true),
|
5117
5582
|
additionalSigners: additionalSigners
|
@@ -5122,7 +5587,7 @@ var PerpetualsClient = (function () {
|
|
5122
5587
|
this.collectNftReward = function (rewardSymbol, poolConfig, nftMint, createUserATA) {
|
5123
5588
|
if (createUserATA === void 0) { createUserATA = true; }
|
5124
5589
|
return __awaiter(_this, void 0, void 0, function () {
|
5125
|
-
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;
|
5126
5591
|
return __generator(this, function (_b) {
|
5127
5592
|
switch (_b.label) {
|
5128
5593
|
case 0:
|
@@ -5172,8 +5637,8 @@ var PerpetualsClient = (function () {
|
|
5172
5637
|
instructions.push(collectNftReward);
|
5173
5638
|
return [3, 6];
|
5174
5639
|
case 5:
|
5175
|
-
|
5176
|
-
throw
|
5640
|
+
err_33 = _b.sent();
|
5641
|
+
throw err_33;
|
5177
5642
|
case 6: return [2, {
|
5178
5643
|
instructions: __spreadArray([], instructions, true),
|
5179
5644
|
additionalSigners: additionalSigners
|
@@ -5185,7 +5650,7 @@ var PerpetualsClient = (function () {
|
|
5185
5650
|
this.collectAndDistributeFee = function (rewardSymbol, poolConfig, createUserATA, nftTradingAccount) {
|
5186
5651
|
if (createUserATA === void 0) { createUserATA = true; }
|
5187
5652
|
return __awaiter(_this, void 0, void 0, function () {
|
5188
|
-
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;
|
5189
5654
|
return __generator(this, function (_b) {
|
5190
5655
|
switch (_b.label) {
|
5191
5656
|
case 0:
|
@@ -5249,9 +5714,9 @@ var PerpetualsClient = (function () {
|
|
5249
5714
|
instructions.push(withdrawStakeInstruction);
|
5250
5715
|
return [3, 6];
|
5251
5716
|
case 5:
|
5252
|
-
|
5253
|
-
console.log("perpClient withdrawStake error:: ",
|
5254
|
-
throw
|
5717
|
+
err_34 = _b.sent();
|
5718
|
+
console.log("perpClient withdrawStake error:: ", err_34);
|
5719
|
+
throw err_34;
|
5255
5720
|
case 6: return [2, {
|
5256
5721
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5257
5722
|
additionalSigners: additionalSigners
|
@@ -5261,7 +5726,7 @@ var PerpetualsClient = (function () {
|
|
5261
5726
|
});
|
5262
5727
|
};
|
5263
5728
|
this.setTriggerPrice = function (targetSymbol, collateralSymbol, side, triggerPrice, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5264
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, positionAccount, instructions, additionalSigners, setTriggerPrice,
|
5729
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, positionAccount, instructions, additionalSigners, setTriggerPrice, err_35;
|
5265
5730
|
return __generator(this, function (_a) {
|
5266
5731
|
switch (_a.label) {
|
5267
5732
|
case 0:
|
@@ -5300,9 +5765,9 @@ var PerpetualsClient = (function () {
|
|
5300
5765
|
instructions.push(setTriggerPrice);
|
5301
5766
|
return [3, 4];
|
5302
5767
|
case 3:
|
5303
|
-
|
5304
|
-
console.log("perpClient setTriggerPrice error:: ",
|
5305
|
-
throw
|
5768
|
+
err_35 = _a.sent();
|
5769
|
+
console.log("perpClient setTriggerPrice error:: ", err_35);
|
5770
|
+
throw err_35;
|
5306
5771
|
case 4: return [2, {
|
5307
5772
|
instructions: __spreadArray([], instructions, true),
|
5308
5773
|
additionalSigners: additionalSigners
|
@@ -5315,7 +5780,7 @@ var PerpetualsClient = (function () {
|
|
5315
5780
|
if (closeUsersWSOLATA === void 0) { closeUsersWSOLATA = false; }
|
5316
5781
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5317
5782
|
return __awaiter(_this, void 0, void 0, function () {
|
5318
|
-
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;
|
5319
5784
|
return __generator(this, function (_b) {
|
5320
5785
|
switch (_b.label) {
|
5321
5786
|
case 0:
|
@@ -5376,9 +5841,9 @@ var PerpetualsClient = (function () {
|
|
5376
5841
|
}
|
5377
5842
|
return [3, 7];
|
5378
5843
|
case 6:
|
5379
|
-
|
5380
|
-
console.log("perpClient forceClosePosition error:: ",
|
5381
|
-
throw
|
5844
|
+
err_36 = _b.sent();
|
5845
|
+
console.log("perpClient forceClosePosition error:: ", err_36);
|
5846
|
+
throw err_36;
|
5382
5847
|
case 7: return [2, {
|
5383
5848
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5384
5849
|
additionalSigners: additionalSigners
|
@@ -5391,7 +5856,7 @@ var PerpetualsClient = (function () {
|
|
5391
5856
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
5392
5857
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5393
5858
|
return __awaiter(_this, void 0, void 0, function () {
|
5394
|
-
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;
|
5395
5860
|
return __generator(this, function (_c) {
|
5396
5861
|
switch (_c.label) {
|
5397
5862
|
case 0:
|
@@ -5495,9 +5960,9 @@ var PerpetualsClient = (function () {
|
|
5495
5960
|
instructions.push(placeLimitOrder);
|
5496
5961
|
return [3, 11];
|
5497
5962
|
case 10:
|
5498
|
-
|
5499
|
-
console.log("perpClient placeLimitOrder error:: ",
|
5500
|
-
throw
|
5963
|
+
err_37 = _c.sent();
|
5964
|
+
console.log("perpClient placeLimitOrder error:: ", err_37);
|
5965
|
+
throw err_37;
|
5501
5966
|
case 11: return [2, {
|
5502
5967
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5503
5968
|
additionalSigners: additionalSigners
|
@@ -5510,7 +5975,7 @@ var PerpetualsClient = (function () {
|
|
5510
5975
|
if (createUserATA === void 0) { createUserATA = true; }
|
5511
5976
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5512
5977
|
return __awaiter(_this, void 0, void 0, function () {
|
5513
|
-
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;
|
5514
5979
|
return __generator(this, function (_b) {
|
5515
5980
|
switch (_b.label) {
|
5516
5981
|
case 0:
|
@@ -5597,9 +6062,9 @@ var PerpetualsClient = (function () {
|
|
5597
6062
|
instructions.push(editLimitOrder);
|
5598
6063
|
return [3, 8];
|
5599
6064
|
case 7:
|
5600
|
-
|
5601
|
-
console.log("perpClient editLimitOrder error:: ",
|
5602
|
-
throw
|
6065
|
+
err_38 = _b.sent();
|
6066
|
+
console.log("perpClient editLimitOrder error:: ", err_38);
|
6067
|
+
throw err_38;
|
5603
6068
|
case 8: return [2, {
|
5604
6069
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5605
6070
|
additionalSigners: additionalSigners
|
@@ -5613,7 +6078,7 @@ var PerpetualsClient = (function () {
|
|
5613
6078
|
if (nftReferralAccount === void 0) { nftReferralAccount = web3_js_1.PublicKey.default; }
|
5614
6079
|
if (nftRebateTokenAccount === void 0) { nftRebateTokenAccount = web3_js_1.PublicKey.default; }
|
5615
6080
|
return __awaiter(_this, void 0, void 0, function () {
|
5616
|
-
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;
|
5617
6082
|
return __generator(this, function (_a) {
|
5618
6083
|
switch (_a.label) {
|
5619
6084
|
case 0:
|
@@ -5659,9 +6124,9 @@ var PerpetualsClient = (function () {
|
|
5659
6124
|
instructions.push(executeLimitOrder);
|
5660
6125
|
return [3, 4];
|
5661
6126
|
case 3:
|
5662
|
-
|
5663
|
-
console.log("perpClient executeLimitOrder error:: ",
|
5664
|
-
throw
|
6127
|
+
err_39 = _a.sent();
|
6128
|
+
console.log("perpClient executeLimitOrder error:: ", err_39);
|
6129
|
+
throw err_39;
|
5665
6130
|
case 4: return [2, {
|
5666
6131
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5667
6132
|
additionalSigners: additionalSigners
|
@@ -5675,7 +6140,7 @@ var PerpetualsClient = (function () {
|
|
5675
6140
|
if (nftReferralAccount === void 0) { nftReferralAccount = web3_js_1.PublicKey.default; }
|
5676
6141
|
if (nftRebateTokenAccount === void 0) { nftRebateTokenAccount = web3_js_1.PublicKey.default; }
|
5677
6142
|
return __awaiter(_this, void 0, void 0, function () {
|
5678
|
-
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;
|
5679
6144
|
return __generator(this, function (_b) {
|
5680
6145
|
switch (_b.label) {
|
5681
6146
|
case 0:
|
@@ -5739,9 +6204,9 @@ var PerpetualsClient = (function () {
|
|
5739
6204
|
instructions.push(executeLimitWithSwap);
|
5740
6205
|
return [3, 4];
|
5741
6206
|
case 3:
|
5742
|
-
|
5743
|
-
console.log("perpClient executeLimitWithSwap error:: ",
|
5744
|
-
throw
|
6207
|
+
err_40 = _b.sent();
|
6208
|
+
console.log("perpClient executeLimitWithSwap error:: ", err_40);
|
6209
|
+
throw err_40;
|
5745
6210
|
case 4: return [2, {
|
5746
6211
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5747
6212
|
additionalSigners: additionalSigners
|
@@ -5751,7 +6216,7 @@ var PerpetualsClient = (function () {
|
|
5751
6216
|
});
|
5752
6217
|
};
|
5753
6218
|
this.placeTriggerOrder = function (targetSymbol, collateralSymbol, side, triggerPrice, deltaSizeAmount, isStopLoss, receiveCustodyId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5754
|
-
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;
|
5755
6220
|
return __generator(this, function (_a) {
|
5756
6221
|
switch (_a.label) {
|
5757
6222
|
case 0:
|
@@ -5798,9 +6263,9 @@ var PerpetualsClient = (function () {
|
|
5798
6263
|
instructions.push(placeTriggerOrder);
|
5799
6264
|
return [3, 4];
|
5800
6265
|
case 3:
|
5801
|
-
|
5802
|
-
console.log("perpClient placeTriggerOrder error:: ",
|
5803
|
-
throw
|
6266
|
+
err_41 = _a.sent();
|
6267
|
+
console.log("perpClient placeTriggerOrder error:: ", err_41);
|
6268
|
+
throw err_41;
|
5804
6269
|
case 4: return [2, {
|
5805
6270
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5806
6271
|
additionalSigners: additionalSigners
|
@@ -5809,7 +6274,7 @@ var PerpetualsClient = (function () {
|
|
5809
6274
|
});
|
5810
6275
|
}); };
|
5811
6276
|
this.editTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5812
|
-
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;
|
5813
6278
|
return __generator(this, function (_a) {
|
5814
6279
|
switch (_a.label) {
|
5815
6280
|
case 0:
|
@@ -5854,9 +6319,9 @@ var PerpetualsClient = (function () {
|
|
5854
6319
|
instructions.push(editTriggerOrder);
|
5855
6320
|
return [3, 4];
|
5856
6321
|
case 3:
|
5857
|
-
|
5858
|
-
console.log("perpClient editTriggerOrder error:: ",
|
5859
|
-
throw
|
6322
|
+
err_42 = _a.sent();
|
6323
|
+
console.log("perpClient editTriggerOrder error:: ", err_42);
|
6324
|
+
throw err_42;
|
5860
6325
|
case 4: return [2, {
|
5861
6326
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5862
6327
|
additionalSigners: additionalSigners
|
@@ -5865,7 +6330,7 @@ var PerpetualsClient = (function () {
|
|
5865
6330
|
});
|
5866
6331
|
}); };
|
5867
6332
|
this.cancelTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5868
|
-
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;
|
5869
6334
|
return __generator(this, function (_a) {
|
5870
6335
|
switch (_a.label) {
|
5871
6336
|
case 0:
|
@@ -5898,9 +6363,9 @@ var PerpetualsClient = (function () {
|
|
5898
6363
|
instructions.push(cancelTriggerOrder);
|
5899
6364
|
return [3, 4];
|
5900
6365
|
case 3:
|
5901
|
-
|
5902
|
-
console.log("perpClient cancelTriggerOrder error:: ",
|
5903
|
-
throw
|
6366
|
+
err_43 = _a.sent();
|
6367
|
+
console.log("perpClient cancelTriggerOrder error:: ", err_43);
|
6368
|
+
throw err_43;
|
5904
6369
|
case 4: return [2, {
|
5905
6370
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5906
6371
|
additionalSigners: additionalSigners
|
@@ -5912,7 +6377,7 @@ var PerpetualsClient = (function () {
|
|
5912
6377
|
if (createUserATA === void 0) { createUserATA = true; }
|
5913
6378
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5914
6379
|
return __awaiter(_this, void 0, void 0, function () {
|
5915
|
-
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;
|
5916
6381
|
return __generator(this, function (_d) {
|
5917
6382
|
switch (_d.label) {
|
5918
6383
|
case 0:
|
@@ -6007,9 +6472,9 @@ var PerpetualsClient = (function () {
|
|
6007
6472
|
instructions.push(executeTriggerWithSwap);
|
6008
6473
|
return [3, 10];
|
6009
6474
|
case 9:
|
6010
|
-
|
6011
|
-
console.log("perpClient executeTriggerWithSwap error:: ",
|
6012
|
-
throw
|
6475
|
+
err_44 = _d.sent();
|
6476
|
+
console.log("perpClient executeTriggerWithSwap error:: ", err_44);
|
6477
|
+
throw err_44;
|
6013
6478
|
case 10: return [2, {
|
6014
6479
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6015
6480
|
additionalSigners: additionalSigners
|
@@ -6022,7 +6487,7 @@ var PerpetualsClient = (function () {
|
|
6022
6487
|
if (createUserATA === void 0) { createUserATA = true; }
|
6023
6488
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6024
6489
|
return __awaiter(_this, void 0, void 0, function () {
|
6025
|
-
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;
|
6026
6491
|
return __generator(this, function (_b) {
|
6027
6492
|
switch (_b.label) {
|
6028
6493
|
case 0:
|
@@ -6085,9 +6550,9 @@ var PerpetualsClient = (function () {
|
|
6085
6550
|
instructions.push(executeTriggerOrder);
|
6086
6551
|
return [3, 8];
|
6087
6552
|
case 7:
|
6088
|
-
|
6089
|
-
console.log("perpClient executeTriggerOrder error:: ",
|
6090
|
-
throw
|
6553
|
+
err_45 = _b.sent();
|
6554
|
+
console.log("perpClient executeTriggerOrder error:: ", err_45);
|
6555
|
+
throw err_45;
|
6091
6556
|
case 8: return [2, {
|
6092
6557
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6093
6558
|
additionalSigners: additionalSigners
|
@@ -6097,7 +6562,7 @@ var PerpetualsClient = (function () {
|
|
6097
6562
|
});
|
6098
6563
|
};
|
6099
6564
|
this.migrateTriggerOrder = function (owner, marketAccount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6100
|
-
var payerPubkey, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, migrateTriggerOrder,
|
6565
|
+
var payerPubkey, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, migrateTriggerOrder, err_46;
|
6101
6566
|
return __generator(this, function (_a) {
|
6102
6567
|
switch (_a.label) {
|
6103
6568
|
case 0:
|
@@ -6127,9 +6592,9 @@ var PerpetualsClient = (function () {
|
|
6127
6592
|
instructions.push(migrateTriggerOrder);
|
6128
6593
|
return [3, 4];
|
6129
6594
|
case 3:
|
6130
|
-
|
6131
|
-
console.log("perpClient migrateTriggerOrder error:: ",
|
6132
|
-
throw
|
6595
|
+
err_46 = _a.sent();
|
6596
|
+
console.log("perpClient migrateTriggerOrder error:: ", err_46);
|
6597
|
+
throw err_46;
|
6133
6598
|
case 4: return [2, {
|
6134
6599
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6135
6600
|
additionalSigners: additionalSigners
|
@@ -6138,7 +6603,7 @@ var PerpetualsClient = (function () {
|
|
6138
6603
|
});
|
6139
6604
|
}); };
|
6140
6605
|
this.getPositionData = function (position, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6141
|
-
var marketConfig, targetCustodyConfig, collateralCustodyConfig, getPositionData,
|
6606
|
+
var marketConfig, targetCustodyConfig, collateralCustodyConfig, getPositionData, err_47;
|
6142
6607
|
return __generator(this, function (_a) {
|
6143
6608
|
switch (_a.label) {
|
6144
6609
|
case 0:
|
@@ -6167,15 +6632,15 @@ var PerpetualsClient = (function () {
|
|
6167
6632
|
console.log(getPositionData);
|
6168
6633
|
return [2, getPositionData];
|
6169
6634
|
case 3:
|
6170
|
-
|
6171
|
-
console.log("perpClient setPool error:: ",
|
6172
|
-
throw
|
6635
|
+
err_47 = _a.sent();
|
6636
|
+
console.log("perpClient setPool error:: ", err_47);
|
6637
|
+
throw err_47;
|
6173
6638
|
case 4: return [2];
|
6174
6639
|
}
|
6175
6640
|
});
|
6176
6641
|
}); };
|
6177
6642
|
this.protocolWithdrawFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6178
|
-
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx,
|
6643
|
+
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_48;
|
6179
6644
|
return __generator(this, function (_a) {
|
6180
6645
|
switch (_a.label) {
|
6181
6646
|
case 0:
|
@@ -6208,9 +6673,9 @@ var PerpetualsClient = (function () {
|
|
6208
6673
|
instructions.push(withdrawFeesIx);
|
6209
6674
|
return [3, 5];
|
6210
6675
|
case 4:
|
6211
|
-
|
6212
|
-
console.log("perpClient setPool error:: ",
|
6213
|
-
throw
|
6676
|
+
err_48 = _a.sent();
|
6677
|
+
console.log("perpClient setPool error:: ", err_48);
|
6678
|
+
throw err_48;
|
6214
6679
|
case 5: return [2, {
|
6215
6680
|
instructions: __spreadArray([], instructions, true),
|
6216
6681
|
additionalSigners: additionalSigners
|
@@ -6219,7 +6684,7 @@ var PerpetualsClient = (function () {
|
|
6219
6684
|
});
|
6220
6685
|
}); };
|
6221
6686
|
this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
|
6222
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction,
|
6687
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_49;
|
6223
6688
|
return __generator(this, function (_a) {
|
6224
6689
|
switch (_a.label) {
|
6225
6690
|
case 0:
|
@@ -6246,9 +6711,9 @@ var PerpetualsClient = (function () {
|
|
6246
6711
|
instructions.push(setPermissionsInstruction);
|
6247
6712
|
return [3, 4];
|
6248
6713
|
case 3:
|
6249
|
-
|
6250
|
-
console.log("perpClient setPool error:: ",
|
6251
|
-
throw
|
6714
|
+
err_49 = _a.sent();
|
6715
|
+
console.log("perpClient setPool error:: ", err_49);
|
6716
|
+
throw err_49;
|
6252
6717
|
case 4: return [2, {
|
6253
6718
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
6254
6719
|
additionalSigners: additionalSigners
|
@@ -6257,7 +6722,7 @@ var PerpetualsClient = (function () {
|
|
6257
6722
|
});
|
6258
6723
|
}); };
|
6259
6724
|
this.reimburse = function (tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6260
|
-
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;
|
6261
6726
|
var _f;
|
6262
6727
|
return __generator(this, function (_g) {
|
6263
6728
|
switch (_g.label) {
|
@@ -6317,9 +6782,9 @@ var PerpetualsClient = (function () {
|
|
6317
6782
|
instructions.push(reimburse);
|
6318
6783
|
return [3, 5];
|
6319
6784
|
case 4:
|
6320
|
-
|
6321
|
-
console.log("perpClient setPool error:: ",
|
6322
|
-
throw
|
6785
|
+
err_50 = _g.sent();
|
6786
|
+
console.log("perpClient setPool error:: ", err_50);
|
6787
|
+
throw err_50;
|
6323
6788
|
case 5: return [2, {
|
6324
6789
|
instructions: __spreadArray([], instructions, true),
|
6325
6790
|
additionalSigners: additionalSigners
|
@@ -6328,7 +6793,7 @@ var PerpetualsClient = (function () {
|
|
6328
6793
|
});
|
6329
6794
|
}); };
|
6330
6795
|
this.setInternalOraclePrice = function (tokenMint, price, expo, conf, ema, publishTime, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6331
|
-
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice,
|
6796
|
+
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_51;
|
6332
6797
|
return __generator(this, function (_a) {
|
6333
6798
|
switch (_a.label) {
|
6334
6799
|
case 0:
|
@@ -6361,9 +6826,9 @@ var PerpetualsClient = (function () {
|
|
6361
6826
|
instructions.push(setInternalOraclePrice);
|
6362
6827
|
return [3, 4];
|
6363
6828
|
case 3:
|
6364
|
-
|
6365
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
6366
|
-
throw
|
6829
|
+
err_51 = _a.sent();
|
6830
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_51);
|
6831
|
+
throw err_51;
|
6367
6832
|
case 4: return [2, {
|
6368
6833
|
instructions: __spreadArray([], instructions, true),
|
6369
6834
|
additionalSigners: additionalSigners
|
@@ -6375,7 +6840,7 @@ var PerpetualsClient = (function () {
|
|
6375
6840
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
6376
6841
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6377
6842
|
return __awaiter(_this, void 0, void 0, function () {
|
6378
|
-
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;
|
6379
6844
|
return __generator(this, function (_e) {
|
6380
6845
|
switch (_e.label) {
|
6381
6846
|
case 0:
|
@@ -6498,8 +6963,8 @@ var PerpetualsClient = (function () {
|
|
6498
6963
|
instructions.push(addCompoundingLiquidity);
|
6499
6964
|
return [3, 10];
|
6500
6965
|
case 9:
|
6501
|
-
|
6502
|
-
console.log("perpClient addCompoundingLiquidity error:: ",
|
6966
|
+
err_52 = _e.sent();
|
6967
|
+
console.log("perpClient addCompoundingLiquidity error:: ", err_52);
|
6503
6968
|
return [3, 10];
|
6504
6969
|
case 10: return [2, {
|
6505
6970
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6513,7 +6978,7 @@ var PerpetualsClient = (function () {
|
|
6513
6978
|
if (createUserATA === void 0) { createUserATA = true; }
|
6514
6979
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6515
6980
|
return __awaiter(_this, void 0, void 0, function () {
|
6516
|
-
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;
|
6517
6982
|
return __generator(this, function (_e) {
|
6518
6983
|
switch (_e.label) {
|
6519
6984
|
case 0:
|
@@ -6620,8 +7085,8 @@ var PerpetualsClient = (function () {
|
|
6620
7085
|
instructions.push(removeCompoundingLiquidity);
|
6621
7086
|
return [3, 8];
|
6622
7087
|
case 7:
|
6623
|
-
|
6624
|
-
console.log("perpClient removeCompoundingLiquidity error:: ",
|
7088
|
+
err_53 = _e.sent();
|
7089
|
+
console.log("perpClient removeCompoundingLiquidity error:: ", err_53);
|
6625
7090
|
return [3, 8];
|
6626
7091
|
case 8: return [2, {
|
6627
7092
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6634,7 +7099,7 @@ var PerpetualsClient = (function () {
|
|
6634
7099
|
this.migrateStake = function (amount, rewardTokenMint, poolConfig, createUserATA) {
|
6635
7100
|
if (createUserATA === void 0) { createUserATA = true; }
|
6636
7101
|
return __awaiter(_this, void 0, void 0, function () {
|
6637
|
-
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;
|
6638
7103
|
return __generator(this, function (_e) {
|
6639
7104
|
switch (_e.label) {
|
6640
7105
|
case 0:
|
@@ -6715,8 +7180,8 @@ var PerpetualsClient = (function () {
|
|
6715
7180
|
instructions.push(migrateStake);
|
6716
7181
|
return [3, 6];
|
6717
7182
|
case 5:
|
6718
|
-
|
6719
|
-
console.log("perpClient migrateStake error:: ",
|
7183
|
+
err_54 = _e.sent();
|
7184
|
+
console.log("perpClient migrateStake error:: ", err_54);
|
6720
7185
|
return [3, 6];
|
6721
7186
|
case 6: return [2, {
|
6722
7187
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6727,7 +7192,7 @@ var PerpetualsClient = (function () {
|
|
6727
7192
|
});
|
6728
7193
|
};
|
6729
7194
|
this.migrateFlp = function (amount, rewardTokenMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6730
|
-
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;
|
6731
7196
|
return __generator(this, function (_d) {
|
6732
7197
|
switch (_d.label) {
|
6733
7198
|
case 0:
|
@@ -6799,8 +7264,8 @@ var PerpetualsClient = (function () {
|
|
6799
7264
|
instructions.push(migrateFlp);
|
6800
7265
|
return [3, 4];
|
6801
7266
|
case 3:
|
6802
|
-
|
6803
|
-
console.log("perpClient migrateFlp error:: ",
|
7267
|
+
err_55 = _d.sent();
|
7268
|
+
console.log("perpClient migrateFlp error:: ", err_55);
|
6804
7269
|
return [3, 4];
|
6805
7270
|
case 4: return [2, {
|
6806
7271
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6812,7 +7277,7 @@ var PerpetualsClient = (function () {
|
|
6812
7277
|
this.compoundingFee = function (poolConfig, rewardTokenSymbol) {
|
6813
7278
|
if (rewardTokenSymbol === void 0) { rewardTokenSymbol = 'USDC'; }
|
6814
7279
|
return __awaiter(_this, void 0, void 0, function () {
|
6815
|
-
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;
|
6816
7281
|
return __generator(this, function (_d) {
|
6817
7282
|
switch (_d.label) {
|
6818
7283
|
case 0:
|
@@ -6869,8 +7334,8 @@ var PerpetualsClient = (function () {
|
|
6869
7334
|
instructions.push(compoundingFee);
|
6870
7335
|
return [3, 4];
|
6871
7336
|
case 3:
|
6872
|
-
|
6873
|
-
console.log("perpClient compoundingFee error:: ",
|
7337
|
+
err_56 = _d.sent();
|
7338
|
+
console.log("perpClient compoundingFee error:: ", err_56);
|
6874
7339
|
return [3, 4];
|
6875
7340
|
case 4: return [2, {
|
6876
7341
|
instructions: __spreadArray([], instructions, true),
|
@@ -6881,7 +7346,7 @@ var PerpetualsClient = (function () {
|
|
6881
7346
|
});
|
6882
7347
|
};
|
6883
7348
|
this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6884
|
-
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp,
|
7349
|
+
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_57;
|
6885
7350
|
return __generator(this, function (_a) {
|
6886
7351
|
switch (_a.label) {
|
6887
7352
|
case 0:
|
@@ -6919,8 +7384,8 @@ var PerpetualsClient = (function () {
|
|
6919
7384
|
instructions.push(renameFlp);
|
6920
7385
|
return [3, 4];
|
6921
7386
|
case 3:
|
6922
|
-
|
6923
|
-
console.log("perpClient renameFlp error:: ",
|
7387
|
+
err_57 = _a.sent();
|
7388
|
+
console.log("perpClient renameFlp error:: ", err_57);
|
6924
7389
|
return [3, 4];
|
6925
7390
|
case 4: return [2, {
|
6926
7391
|
instructions: __spreadArray([], instructions, true),
|