flash-sdk 2.11.12 → 2.12.0

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.
@@ -3253,7 +3253,7 @@ var PerpetualsClient = (function () {
3253
3253
  this.addLiquidityAndStake = function (inputSymbol, amountIn, minLpAmountOut, poolConfig, skipBalanceChecks) {
3254
3254
  if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
3255
3255
  return __awaiter(_this, void 0, void 0, function () {
3256
- var publicKey, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userInputTokenAccount, lpTokenMint, inputCustodyConfig, lpTokenAccount, flpStakeAccount, poolStakedFlpVault, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _c, custody, _d, _e, market, instruction;
3256
+ var publicKey, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userInputTokenAccount, lpTokenMint, inputCustodyConfig, lpTokenAccount, flpStakeAccount, poolStakedLpVault, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _c, custody, _d, _e, market, instruction;
3257
3257
  return __generator(this, function (_f) {
3258
3258
  switch (_f.label) {
3259
3259
  case 0:
@@ -3268,7 +3268,7 @@ var PerpetualsClient = (function () {
3268
3268
  case 1:
3269
3269
  lpTokenAccount = _f.sent();
3270
3270
  flpStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("stake"), publicKey.toBuffer(), poolConfig.poolAddress.toBuffer()], this.programId)[0];
3271
- poolStakedFlpVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("staked_lp_token_account"), poolConfig.poolAddress.toBuffer(), lpTokenMint.toBuffer()], this.programId)[0];
3271
+ poolStakedLpVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("staked_lp_token_account"), poolConfig.poolAddress.toBuffer(), lpTokenMint.toBuffer()], this.programId)[0];
3272
3272
  if (!(inputSymbol == 'SOL')) return [3, 5];
3273
3273
  console.log("inputSymbol === SOL", inputSymbol);
3274
3274
  wrappedSolAccount = new web3_js_1.Keypair();
@@ -3361,7 +3361,7 @@ var PerpetualsClient = (function () {
3361
3361
  custodyTokenAccount: inputCustodyConfig.tokenAccount,
3362
3362
  lpTokenMint: lpTokenMint,
3363
3363
  flpStakeAccount: flpStakeAccount,
3364
- poolStakedFlpVault: poolStakedFlpVault,
3364
+ poolStakedLpVault: poolStakedLpVault,
3365
3365
  systemProgram: web3_js_1.SystemProgram.programId,
3366
3366
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
3367
3367
  eventAuthority: this.eventAuthority.publicKey,
@@ -3384,7 +3384,7 @@ var PerpetualsClient = (function () {
3384
3384
  this.addLiquidityAndStakeComposibility = function (inputSymbol, amountIn, minLpAmountOut, poolConfig, skipBalanceChecks) {
3385
3385
  if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
3386
3386
  return __awaiter(_this, void 0, void 0, function () {
3387
- var publicKey, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userInputTokenAccount, lpTokenMint, inputCustodyConfig, lpTokenAccount, flpStakeAccount, poolStakedFlpVault, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _c, custody, _d, _e, market, instruction;
3387
+ var publicKey, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userInputTokenAccount, lpTokenMint, inputCustodyConfig, lpTokenAccount, flpStakeAccount, poolStakedLpVault, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _c, custody, _d, _e, market, instruction;
3388
3388
  return __generator(this, function (_f) {
3389
3389
  switch (_f.label) {
3390
3390
  case 0:
@@ -3399,7 +3399,7 @@ var PerpetualsClient = (function () {
3399
3399
  case 1:
3400
3400
  lpTokenAccount = _f.sent();
3401
3401
  flpStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("stake"), publicKey.toBuffer(), poolConfig.poolAddress.toBuffer()], this.programId)[0];
3402
- poolStakedFlpVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("staked_lp_token_account"), poolConfig.poolAddress.toBuffer(), lpTokenMint.toBuffer()], this.programId)[0];
3402
+ poolStakedLpVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("staked_lp_token_account"), poolConfig.poolAddress.toBuffer(), lpTokenMint.toBuffer()], this.programId)[0];
3403
3403
  if (!(inputSymbol == 'SOL')) return [3, 5];
3404
3404
  console.log("inputSymbol === SOL", inputSymbol);
3405
3405
  wrappedSolAccount = new web3_js_1.Keypair();
@@ -3494,7 +3494,7 @@ var PerpetualsClient = (function () {
3494
3494
  custodyTokenAccount: inputCustodyConfig.tokenAccount,
3495
3495
  lpTokenMint: lpTokenMint,
3496
3496
  flpStakeAccount: flpStakeAccount,
3497
- poolStakedFlpVault: poolStakedFlpVault,
3497
+ poolStakedLpVault: poolStakedLpVault,
3498
3498
  systemProgram: web3_js_1.SystemProgram.programId,
3499
3499
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
3500
3500
  eventAuthority: this.eventAuthority.publicKey,
@@ -3951,7 +3951,7 @@ var PerpetualsClient = (function () {
3951
3951
  });
3952
3952
  }); };
3953
3953
  this.depositStake = function (owner, feePayer, depositAmount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
3954
- var preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, poolStakedFlpVault, flpStakeAccount, userLpTokenAccount, depositStakeInstruction, err_12;
3954
+ var preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, depositStakeInstruction, err_12;
3955
3955
  return __generator(this, function (_a) {
3956
3956
  switch (_a.label) {
3957
3957
  case 0:
@@ -3963,7 +3963,7 @@ var PerpetualsClient = (function () {
3963
3963
  case 1:
3964
3964
  _a.trys.push([1, 4, , 5]);
3965
3965
  lpTokenMint = poolConfig.lpTokenMint;
3966
- poolStakedFlpVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("staked_lp_token_account"), poolConfig.poolAddress.toBuffer(), lpTokenMint.toBuffer()], this.programId)[0];
3966
+ poolStakedLpVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("staked_lp_token_account"), poolConfig.poolAddress.toBuffer(), lpTokenMint.toBuffer()], this.programId)[0];
3967
3967
  flpStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("stake"), owner.toBuffer(), poolConfig.poolAddress.toBuffer()], this.programId)[0];
3968
3968
  return [4, (0, spl_token_1.getAssociatedTokenAddress)(poolConfig.lpTokenMint, owner)];
3969
3969
  case 2:
@@ -3975,12 +3975,12 @@ var PerpetualsClient = (function () {
3975
3975
  .accounts({
3976
3976
  owner: owner,
3977
3977
  feePayer: feePayer,
3978
- fundingFlpTokenAccount: userLpTokenAccount,
3978
+ fundingLpTokenAccount: userLpTokenAccount,
3979
3979
  transferAuthority: poolConfig.transferAuthority,
3980
3980
  perpetuals: this.perpetuals.publicKey,
3981
3981
  pool: poolConfig.poolAddress,
3982
3982
  flpStakeAccount: flpStakeAccount,
3983
- poolStakedFlpVault: poolStakedFlpVault,
3983
+ poolStakedLpVault: poolStakedLpVault,
3984
3984
  systemProgram: web3_js_1.SystemProgram.programId,
3985
3985
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
3986
3986
  eventAuthority: this.eventAuthority.publicKey,
@@ -4239,7 +4239,7 @@ var PerpetualsClient = (function () {
4239
4239
  if (deactivated === void 0) { deactivated = true; }
4240
4240
  if (createUserLPTA === void 0) { createUserLPTA = true; }
4241
4241
  return __awaiter(_this, void 0, void 0, function () {
4242
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, pool, poolStakedFlpVault, flpStakeAccount, userLpTokenAccount, _a, withdrawStakeInstruction, err_17;
4242
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, pool, poolStakedLpVault, flpStakeAccount, userLpTokenAccount, _a, withdrawStakeInstruction, err_17;
4243
4243
  return __generator(this, function (_b) {
4244
4244
  switch (_b.label) {
4245
4245
  case 0:
@@ -4253,7 +4253,7 @@ var PerpetualsClient = (function () {
4253
4253
  _b.trys.push([1, 6, , 7]);
4254
4254
  lpTokenMint = poolConfig.lpTokenMint;
4255
4255
  pool = poolConfig.poolAddress;
4256
- poolStakedFlpVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("staked_lp_token_account"), pool.toBuffer(), lpTokenMint.toBuffer()], this.program.programId)[0];
4256
+ poolStakedLpVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("staked_lp_token_account"), pool.toBuffer(), lpTokenMint.toBuffer()], this.program.programId)[0];
4257
4257
  flpStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("stake"), publicKey.toBuffer(), pool.toBuffer()], this.program.programId)[0];
4258
4258
  return [4, (0, spl_token_1.getAssociatedTokenAddress)(poolConfig.lpTokenMint, publicKey)];
4259
4259
  case 2:
@@ -4275,12 +4275,12 @@ var PerpetualsClient = (function () {
4275
4275
  })
4276
4276
  .accounts({
4277
4277
  owner: publicKey,
4278
- receivingFlpTokenAccount: userLpTokenAccount,
4278
+ receivingLpTokenAccount: userLpTokenAccount,
4279
4279
  transferAuthority: poolConfig.transferAuthority,
4280
4280
  perpetuals: this.perpetuals.publicKey,
4281
4281
  pool: pool,
4282
4282
  flpStakeAccount: flpStakeAccount,
4283
- poolStakedFlpVault: poolStakedFlpVault,
4283
+ poolStakedLpVault: poolStakedLpVault,
4284
4284
  systemProgram: web3_js_1.SystemProgram.programId,
4285
4285
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
4286
4286
  eventAuthority: this.eventAuthority.publicKey,
@@ -5004,8 +5004,8 @@ var PerpetualsClient = (function () {
5004
5004
  }
5005
5005
  });
5006
5006
  }); };
5007
- this.addCompoundingLiquidity = function (amountIn, minSflpAmountOut, inTokenSymbol, rewardTokenMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
5008
- var publicKey, preInstructions, instructions, additionalSigners, postInstructions, rewardCustody, inCustodyConfig, lpTokenMint, sFlpTokenMint, wrappedSolAccount, lpTokenAccount, sflpTokenAccount, fundingAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, accCreationLamports, lamports, unWrappedSolBalance, _d, compoundingVault, addCompoundingLiquidity, err_30;
5007
+ this.addCompoundingLiquidity = function (amountIn, minCompoundingAmountOut, inTokenSymbol, rewardTokenMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
5008
+ var publicKey, preInstructions, instructions, additionalSigners, postInstructions, rewardCustody, inCustodyConfig, lpTokenMint, compoundingTokenMint, wrappedSolAccount, lpTokenAccount, compoundingTokenAccount, fundingAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, accCreationLamports, lamports, unWrappedSolBalance, _d, compoundingLpVault, addCompoundingLiquidity, err_30;
5009
5009
  return __generator(this, function (_e) {
5010
5010
  switch (_e.label) {
5011
5011
  case 0:
@@ -5017,13 +5017,13 @@ var PerpetualsClient = (function () {
5017
5017
  rewardCustody = poolConfig.custodies.find(function (i) { return i.mintKey.equals(rewardTokenMint); });
5018
5018
  inCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(inTokenSymbol).mintKey); });
5019
5019
  lpTokenMint = poolConfig.lpTokenMint;
5020
- sFlpTokenMint = poolConfig.sFlpTokenMint;
5020
+ compoundingTokenMint = poolConfig.compoundingTokenMint;
5021
5021
  return [4, (0, spl_token_1.getAssociatedTokenAddress)(poolConfig.lpTokenMint, publicKey)];
5022
5022
  case 1:
5023
5023
  lpTokenAccount = _e.sent();
5024
- return [4, (0, spl_token_1.getAssociatedTokenAddress)(sFlpTokenMint, publicKey)];
5024
+ return [4, (0, spl_token_1.getAssociatedTokenAddress)(compoundingTokenMint, publicKey)];
5025
5025
  case 2:
5026
- sflpTokenAccount = _e.sent();
5026
+ compoundingTokenAccount = _e.sent();
5027
5027
  return [4, (0, spl_token_1.getAssociatedTokenAddress)(inCustodyConfig.mintKey, publicKey)];
5028
5028
  case 3:
5029
5029
  fundingAccount = _e.sent();
@@ -5056,10 +5056,10 @@ var PerpetualsClient = (function () {
5056
5056
  if (!(_e.sent())) {
5057
5057
  instructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, lpTokenAccount, publicKey, poolConfig.lpTokenMint));
5058
5058
  }
5059
- return [4, (0, utils_1.checkIfAccountExists)(sflpTokenAccount, this.provider.connection)];
5059
+ return [4, (0, utils_1.checkIfAccountExists)(compoundingTokenAccount, this.provider.connection)];
5060
5060
  case 5:
5061
5061
  if (!(_e.sent())) {
5062
- instructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, sflpTokenAccount, publicKey, poolConfig.sFlpTokenMint));
5062
+ instructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, compoundingTokenAccount, publicKey, poolConfig.compoundingTokenMint));
5063
5063
  }
5064
5064
  if (!(inTokenSymbol == 'SOL')) return [3, 8];
5065
5065
  console.log("inTokenSymbol === SOL", inTokenSymbol);
@@ -5098,20 +5098,20 @@ var PerpetualsClient = (function () {
5098
5098
  }
5099
5099
  _e.label = 10;
5100
5100
  case 10:
5101
- compoundingVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("compounding_lp_token_account"), poolConfig.poolAddress.toBuffer(), lpTokenMint.toBuffer()], this.programId)[0];
5101
+ compoundingLpVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("compounding_lp_token_account"), poolConfig.poolAddress.toBuffer(), lpTokenMint.toBuffer()], this.programId)[0];
5102
5102
  _e.label = 11;
5103
5103
  case 11:
5104
5104
  _e.trys.push([11, 13, , 14]);
5105
5105
  return [4, this.program.methods
5106
5106
  .addCompoundingLiquidity({
5107
5107
  amountIn: amountIn,
5108
- minSflpAmountOut: minSflpAmountOut
5108
+ minCompoundingAmountOut: minCompoundingAmountOut
5109
5109
  })
5110
5110
  .accounts({
5111
5111
  owner: publicKey,
5112
5112
  fundingAccount: fundingAccount,
5113
- sflpTokenAccount: sflpTokenAccount,
5114
- poolCompoundingFlpVault: compoundingVault,
5113
+ compoundingTokenAccount: compoundingTokenAccount,
5114
+ poolCompoundingLpVault: compoundingLpVault,
5115
5115
  transferAuthority: poolConfig.transferAuthority,
5116
5116
  perpetuals: poolConfig.perpetuals,
5117
5117
  pool: poolConfig.poolAddress,
@@ -5121,7 +5121,7 @@ var PerpetualsClient = (function () {
5121
5121
  rewardCustody: rewardCustody.custodyAccount,
5122
5122
  rewardCustodyOracleAccount: this.useExtOracleAccount ? rewardCustody.extOracleAccount : rewardCustody.intOracleAccount,
5123
5123
  lpTokenMint: lpTokenMint,
5124
- sflpTokenMint: sFlpTokenMint,
5124
+ compoundingTokenMint: compoundingTokenMint,
5125
5125
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
5126
5126
  eventAuthority: this.eventAuthority.publicKey,
5127
5127
  program: this.program.programId,
@@ -5144,10 +5144,10 @@ var PerpetualsClient = (function () {
5144
5144
  }
5145
5145
  });
5146
5146
  }); };
5147
- this.removeCompoundingLiquidity = function (sflpAmountIn, minAmountOut, outTokenSymbol, rewardTokenMint, poolConfig, createUserATA) {
5147
+ this.removeCompoundingLiquidity = function (compoundingAmountIn, minAmountOut, outTokenSymbol, rewardTokenMint, poolConfig, createUserATA) {
5148
5148
  if (createUserATA === void 0) { createUserATA = true; }
5149
5149
  return __awaiter(_this, void 0, void 0, function () {
5150
- var publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, outCustodyConfig, lpTokenMint, sFlpTokenMint, lamports, _a, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _b, custody, _c, _d, market, sflpTokenAccount, receivingAccount, compoundingVault, removeCompoundingLiquidity, err_31;
5150
+ var publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, outCustodyConfig, lpTokenMint, compoundingTokenMint, lamports, _a, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _b, custody, _c, _d, market, compoundingTokenAccount, receivingAccount, compoundingLpVault, removeCompoundingLiquidity, err_31;
5151
5151
  return __generator(this, function (_e) {
5152
5152
  switch (_e.label) {
5153
5153
  case 0:
@@ -5159,7 +5159,7 @@ var PerpetualsClient = (function () {
5159
5159
  rewardCustody = poolConfig.custodies.find(function (i) { return i.mintKey.equals(rewardTokenMint); });
5160
5160
  outCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(outTokenSymbol).mintKey); });
5161
5161
  lpTokenMint = poolConfig.lpTokenMint;
5162
- sFlpTokenMint = poolConfig.sFlpTokenMint;
5162
+ compoundingTokenMint = poolConfig.compoundingTokenMint;
5163
5163
  if (!(outCustodyConfig.symbol == 'SOL')) return [3, 2];
5164
5164
  wrappedSolAccount = new web3_js_1.Keypair();
5165
5165
  userReceivingTokenAccount = wrappedSolAccount.publicKey;
@@ -5220,26 +5220,26 @@ var PerpetualsClient = (function () {
5220
5220
  isWritable: false,
5221
5221
  });
5222
5222
  }
5223
- return [4, (0, spl_token_1.getAssociatedTokenAddress)(sFlpTokenMint, publicKey)];
5223
+ return [4, (0, spl_token_1.getAssociatedTokenAddress)(compoundingTokenMint, publicKey)];
5224
5224
  case 7:
5225
- sflpTokenAccount = _e.sent();
5225
+ compoundingTokenAccount = _e.sent();
5226
5226
  return [4, (0, spl_token_1.getAssociatedTokenAddress)(outCustodyConfig.mintKey, publicKey)];
5227
5227
  case 8:
5228
5228
  receivingAccount = _e.sent();
5229
- compoundingVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("compounding_lp_token_account"), poolConfig.poolAddress.toBuffer(), lpTokenMint.toBuffer()], this.programId)[0];
5229
+ compoundingLpVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("compounding_lp_token_account"), poolConfig.poolAddress.toBuffer(), lpTokenMint.toBuffer()], this.programId)[0];
5230
5230
  _e.label = 9;
5231
5231
  case 9:
5232
5232
  _e.trys.push([9, 11, , 12]);
5233
5233
  return [4, this.program.methods
5234
5234
  .removeCompoundingLiquidity({
5235
- sflpAmountIn: sflpAmountIn,
5235
+ compoundingAmountIn: compoundingAmountIn,
5236
5236
  minAmountOut: minAmountOut
5237
5237
  })
5238
5238
  .accounts({
5239
5239
  owner: publicKey,
5240
5240
  receivingAccount: outCustodyConfig.symbol == 'SOL' ? wrappedSolAccount.publicKey : userReceivingTokenAccount,
5241
- sflpTokenAccount: sflpTokenAccount,
5242
- poolCompoundingFlpVault: compoundingVault,
5241
+ compoundingTokenAccount: compoundingTokenAccount,
5242
+ poolCompoundingLpVault: compoundingLpVault,
5243
5243
  transferAuthority: poolConfig.transferAuthority,
5244
5244
  perpetuals: poolConfig.perpetuals,
5245
5245
  pool: poolConfig.poolAddress,
@@ -5249,7 +5249,7 @@ var PerpetualsClient = (function () {
5249
5249
  rewardCustody: rewardCustody.custodyAccount,
5250
5250
  rewardCustodyOracleAccount: this.useExtOracleAccount ? rewardCustody.extOracleAccount : rewardCustody.intOracleAccount,
5251
5251
  lpTokenMint: lpTokenMint,
5252
- sflpTokenMint: sFlpTokenMint,
5252
+ compoundingTokenMint: compoundingTokenMint,
5253
5253
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
5254
5254
  eventAuthority: this.eventAuthority.publicKey,
5255
5255
  program: this.program.programId,
@@ -5276,7 +5276,7 @@ var PerpetualsClient = (function () {
5276
5276
  this.migrateStake = function (amount, rewardTokenMint, poolConfig, createUserATA) {
5277
5277
  if (createUserATA === void 0) { createUserATA = true; }
5278
5278
  return __awaiter(_this, void 0, void 0, function () {
5279
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, sFlpTokenMint, sflpTokenAccount, _a, flpStakeAccount, compoundingVault, poolStakedFlpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _b, custody, _c, _d, market, migrateStake, err_32;
5279
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, _a, flpStakeAccount, compoundingLpVault, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _b, custody, _c, _d, market, migrateStake, err_32;
5280
5280
  return __generator(this, function (_e) {
5281
5281
  switch (_e.label) {
5282
5282
  case 0:
@@ -5287,23 +5287,23 @@ var PerpetualsClient = (function () {
5287
5287
  additionalSigners = [];
5288
5288
  rewardCustody = poolConfig.custodies.find(function (i) { return i.mintKey.equals(rewardTokenMint); });
5289
5289
  lpTokenMint = poolConfig.lpTokenMint;
5290
- sFlpTokenMint = poolConfig.sFlpTokenMint;
5291
- return [4, (0, spl_token_1.getAssociatedTokenAddress)(sFlpTokenMint, publicKey)];
5290
+ compoundingTokenMint = poolConfig.compoundingTokenMint;
5291
+ return [4, (0, spl_token_1.getAssociatedTokenAddress)(compoundingTokenMint, publicKey)];
5292
5292
  case 1:
5293
- sflpTokenAccount = _e.sent();
5293
+ compoudingTokenAccount = _e.sent();
5294
5294
  _a = createUserATA;
5295
5295
  if (!_a) return [3, 3];
5296
- return [4, (0, utils_1.checkIfAccountExists)(sflpTokenAccount, this.provider.connection)];
5296
+ return [4, (0, utils_1.checkIfAccountExists)(compoudingTokenAccount, this.provider.connection)];
5297
5297
  case 2:
5298
5298
  _a = !(_e.sent());
5299
5299
  _e.label = 3;
5300
5300
  case 3:
5301
5301
  if (_a) {
5302
- preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, sflpTokenAccount, publicKey, sFlpTokenMint));
5302
+ preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, compoudingTokenAccount, publicKey, compoundingTokenMint));
5303
5303
  }
5304
5304
  flpStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("stake"), publicKey.toBuffer(), poolConfig.poolAddress.toBuffer()], this.programId)[0];
5305
- compoundingVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("compounding_lp_token_account"), poolConfig.poolAddress.toBuffer(), poolConfig.lpTokenMint.toBuffer()], this.programId)[0];
5306
- poolStakedFlpVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("staked_lp_token_account"), poolConfig.poolAddress.toBuffer(), lpTokenMint.toBuffer()], this.programId)[0];
5305
+ compoundingLpVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("compounding_lp_token_account"), poolConfig.poolAddress.toBuffer(), poolConfig.lpTokenMint.toBuffer()], this.programId)[0];
5306
+ poolStakedLpVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("staked_lp_token_account"), poolConfig.poolAddress.toBuffer(), lpTokenMint.toBuffer()], this.programId)[0];
5307
5307
  custodyAccountMetas = [];
5308
5308
  custodyOracleAccountMetas = [];
5309
5309
  markets = [];
@@ -5337,17 +5337,17 @@ var PerpetualsClient = (function () {
5337
5337
  })
5338
5338
  .accounts({
5339
5339
  owner: publicKey,
5340
- sflpTokenAccount: sflpTokenAccount,
5340
+ compoundingTokenAccount: compoudingTokenAccount,
5341
5341
  transferAuthority: poolConfig.transferAuthority,
5342
5342
  perpetuals: poolConfig.perpetuals,
5343
5343
  pool: poolConfig.poolAddress,
5344
5344
  flpStakeAccount: flpStakeAccount,
5345
5345
  rewardCustody: rewardCustody.custodyAccount,
5346
5346
  rewardCustodyOracleAccount: rewardCustody.intOracleAccount,
5347
- poolStakedFlpVault: poolStakedFlpVault,
5348
- poolCompoundingFlpVault: compoundingVault,
5347
+ poolStakedLpVault: poolStakedLpVault,
5348
+ poolCompoundingLpVault: compoundingLpVault,
5349
5349
  lpTokenMint: lpTokenMint,
5350
- sflpTokenMint: sFlpTokenMint,
5350
+ compoundingTokenMint: compoundingTokenMint,
5351
5351
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
5352
5352
  eventAuthority: this.eventAuthority.publicKey,
5353
5353
  program: this.program.programId,
@@ -5371,77 +5371,79 @@ var PerpetualsClient = (function () {
5371
5371
  });
5372
5372
  });
5373
5373
  };
5374
- this.compoundingFee = function (rewardTokenMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
5375
- var publicKey, instructions, additionalSigners, rewardCustody, lpTokenMint, sFlpTokenMint, compoundingVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, compoundingFee, err_33;
5376
- return __generator(this, function (_d) {
5377
- switch (_d.label) {
5378
- case 0:
5379
- publicKey = this.provider.wallet.publicKey;
5380
- instructions = [];
5381
- additionalSigners = [];
5382
- rewardCustody = poolConfig.custodies.find(function (i) { return i.mintKey.equals(rewardTokenMint); });
5383
- lpTokenMint = poolConfig.lpTokenMint;
5384
- sFlpTokenMint = poolConfig.sFlpTokenMint;
5385
- compoundingVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("compounding_lp_token_account"), poolConfig.poolAddress.toBuffer(), sFlpTokenMint.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
5386
- custodyAccountMetas = [];
5387
- custodyOracleAccountMetas = [];
5388
- markets = [];
5389
- for (_i = 0, _a = poolConfig.custodies; _i < _a.length; _i++) {
5390
- custody = _a[_i];
5391
- custodyAccountMetas.push({
5392
- pubkey: custody.custodyAccount,
5393
- isSigner: false,
5394
- isWritable: false,
5395
- });
5396
- custodyOracleAccountMetas.push({
5397
- pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
5398
- isSigner: false,
5399
- isWritable: false,
5400
- });
5401
- }
5402
- for (_b = 0, _c = poolConfig.markets; _b < _c.length; _b++) {
5403
- market = _c[_b];
5404
- markets.push({
5405
- pubkey: market.marketAccount,
5406
- isSigner: false,
5407
- isWritable: false,
5408
- });
5409
- }
5410
- _d.label = 1;
5411
- case 1:
5412
- _d.trys.push([1, 3, , 4]);
5413
- return [4, this.program.methods
5414
- .compoundFees({})
5415
- .accounts({
5416
- poolCompoundingFlpVault: compoundingVault,
5417
- transferAuthority: poolConfig.transferAuthority,
5418
- perpetuals: poolConfig.perpetuals,
5419
- pool: poolConfig.poolAddress,
5420
- rewardCustody: rewardCustody.custodyAccount,
5421
- rewardCustodyOracleAccount: this.useExtOracleAccount ? rewardCustody.extOracleAccount : rewardCustody.intOracleAccount,
5422
- lpTokenMint: lpTokenMint,
5423
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
5424
- eventAuthority: this.eventAuthority.publicKey,
5425
- program: this.program.programId,
5426
- ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
5427
- })
5428
- .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true), markets, true))
5429
- .instruction()];
5430
- case 2:
5431
- compoundingFee = _d.sent();
5432
- instructions.push(compoundingFee);
5433
- return [3, 4];
5434
- case 3:
5435
- err_33 = _d.sent();
5436
- console.log("perpClient compoundingFee error:: ", err_33);
5437
- return [3, 4];
5438
- case 4: return [2, {
5439
- instructions: __spreadArray([], instructions, true),
5440
- additionalSigners: additionalSigners
5441
- }];
5442
- }
5374
+ this.compoundingFee = function (poolConfig, rewardTokenSymbol) {
5375
+ if (rewardTokenSymbol === void 0) { rewardTokenSymbol = 'USDC'; }
5376
+ return __awaiter(_this, void 0, void 0, function () {
5377
+ var instructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoundingLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, compoundingFee, err_33;
5378
+ return __generator(this, function (_d) {
5379
+ switch (_d.label) {
5380
+ case 0:
5381
+ instructions = [];
5382
+ additionalSigners = [];
5383
+ rewardCustody = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(rewardTokenSymbol).mintKey); });
5384
+ lpTokenMint = poolConfig.lpTokenMint;
5385
+ compoundingTokenMint = poolConfig.compoundingTokenMint;
5386
+ compoundingLpVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("compounding_lp_token_account"), poolConfig.poolAddress.toBuffer(), compoundingTokenMint.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
5387
+ custodyAccountMetas = [];
5388
+ custodyOracleAccountMetas = [];
5389
+ markets = [];
5390
+ for (_i = 0, _a = poolConfig.custodies; _i < _a.length; _i++) {
5391
+ custody = _a[_i];
5392
+ custodyAccountMetas.push({
5393
+ pubkey: custody.custodyAccount,
5394
+ isSigner: false,
5395
+ isWritable: false,
5396
+ });
5397
+ custodyOracleAccountMetas.push({
5398
+ pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
5399
+ isSigner: false,
5400
+ isWritable: false,
5401
+ });
5402
+ }
5403
+ for (_b = 0, _c = poolConfig.markets; _b < _c.length; _b++) {
5404
+ market = _c[_b];
5405
+ markets.push({
5406
+ pubkey: market.marketAccount,
5407
+ isSigner: false,
5408
+ isWritable: false,
5409
+ });
5410
+ }
5411
+ _d.label = 1;
5412
+ case 1:
5413
+ _d.trys.push([1, 3, , 4]);
5414
+ return [4, this.program.methods
5415
+ .compoundFees({})
5416
+ .accounts({
5417
+ poolCompoundingLpVault: compoundingLpVault,
5418
+ transferAuthority: poolConfig.transferAuthority,
5419
+ perpetuals: poolConfig.perpetuals,
5420
+ pool: poolConfig.poolAddress,
5421
+ rewardCustody: rewardCustody.custodyAccount,
5422
+ rewardCustodyOracleAccount: this.useExtOracleAccount ? rewardCustody.extOracleAccount : rewardCustody.intOracleAccount,
5423
+ lpTokenMint: lpTokenMint,
5424
+ tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
5425
+ eventAuthority: this.eventAuthority.publicKey,
5426
+ program: this.program.programId,
5427
+ ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
5428
+ })
5429
+ .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true), markets, true))
5430
+ .instruction()];
5431
+ case 2:
5432
+ compoundingFee = _d.sent();
5433
+ instructions.push(compoundingFee);
5434
+ return [3, 4];
5435
+ case 3:
5436
+ err_33 = _d.sent();
5437
+ console.log("perpClient compoundingFee error:: ", err_33);
5438
+ return [3, 4];
5439
+ case 4: return [2, {
5440
+ instructions: __spreadArray([], instructions, true),
5441
+ additionalSigners: additionalSigners
5442
+ }];
5443
+ }
5444
+ });
5443
5445
  });
5444
- }); };
5446
+ };
5445
5447
  this.initRewardDistribution = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
5446
5448
  var publicKey, rewardMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, transferAuthority, initRewardVault, err_34;
5447
5449
  return __generator(this, function (_a) {
@@ -5487,7 +5489,7 @@ var PerpetualsClient = (function () {
5487
5489
  }
5488
5490
  });
5489
5491
  }); };
5490
- this.updateCounter = function () { return __awaiter(_this, void 0, void 0, function () {
5492
+ this.updateCounterReward = function () { return __awaiter(_this, void 0, void 0, function () {
5491
5493
  var publicKey, instructions, additionalSigners, rewardVault, updateCounter, err_35;
5492
5494
  return __generator(this, function (_a) {
5493
5495
  switch (_a.label) {
@@ -7,9 +7,9 @@ export declare class PoolAccount implements Pool {
7
7
  name: string;
8
8
  permissions: Permissions;
9
9
  inceptionTime: BN;
10
- flpMint: PublicKey;
10
+ lpMint: PublicKey;
11
11
  oracleAuthority: PublicKey;
12
- stakedFlpVault: PublicKey;
12
+ stakedLpVault: PublicKey;
13
13
  rewardCustody: PublicKey;
14
14
  custodies: PublicKey[];
15
15
  ratios: TokenRatios[];
@@ -19,16 +19,16 @@ export declare class PoolAccount implements Pool {
19
19
  totalStaked: StakeStats;
20
20
  stakingFeeShareBps: BN;
21
21
  bump: number;
22
- flpMintBump: number;
23
- stakedFlpVaultBump: number;
22
+ lpMintBump: number;
23
+ stakedLpVaultBump: number;
24
24
  vpVolumeFactor: number;
25
25
  padding: number[];
26
26
  stakingFeeBoostBps: BN[];
27
- sflpMint: PublicKey;
28
- compoundingFlpVault: PublicKey;
27
+ compoundingMint: PublicKey;
28
+ compoundingLpVault: PublicKey;
29
29
  compoundingStats: CompoundingStats;
30
- sflpMintBump: number;
31
- compoundingFlpVaultBump: number;
30
+ compoundingMintBump: number;
31
+ compoundingLpVaultBump: number;
32
32
  constructor(publicKey: PublicKey, parseData: Pool);
33
33
  static from(publicKey: PublicKey, parseData: Pool): PoolAccount;
34
34
  updatePoolData(parseData: Pool): void;
@@ -50,11 +50,11 @@ export declare class PoolConfig {
50
50
  poolName: string;
51
51
  poolAddress: PublicKey;
52
52
  lpTokenMint: PublicKey;
53
- sFlpTokenMint: PublicKey;
54
- flpTokenAccount: PublicKey;
53
+ compoundingTokenMint: PublicKey;
54
+ stakedLpVault: PublicKey;
55
55
  lpDecimals: number;
56
+ compoundingLpTokenSymbol: string;
56
57
  lpTokenSymbol: string;
57
- stakedLpTokenSymbol: string;
58
58
  perpetuals: PublicKey;
59
59
  transferAuthority: PublicKey;
60
60
  multisig: PublicKey;
@@ -71,7 +71,7 @@ export declare class PoolConfig {
71
71
  tokens: Token[];
72
72
  custodies: CustodyConfig[];
73
73
  markets: MarketConfig[];
74
- constructor(programId: PublicKey, perpComposibilityProgramId: PublicKey, fbNftRewardProgramId: PublicKey, cluster: Cluster, poolName: string, poolAddress: PublicKey, lpTokenMint: PublicKey, sFlpTokenMint: PublicKey, flpTokenAccount: PublicKey, lpDecimals: number, lpTokenSymbol: string, stakedLpTokenSymbol: string, perpetuals: PublicKey, transferAuthority: PublicKey, multisig: PublicKey, addressLookupTableAddresses: PublicKey[], backupOracle: PublicKey, nftCollectionAddress: PublicKey, rewardDistributionProgram: {
74
+ constructor(programId: PublicKey, perpComposibilityProgramId: PublicKey, fbNftRewardProgramId: PublicKey, cluster: Cluster, poolName: string, poolAddress: PublicKey, lpTokenMint: PublicKey, compoundingTokenMint: PublicKey, stakedLpVault: PublicKey, lpDecimals: number, compoundingLpTokenSymbol: string, lpTokenSymbol: string, perpetuals: PublicKey, transferAuthority: PublicKey, multisig: PublicKey, addressLookupTableAddresses: PublicKey[], backupOracle: PublicKey, nftCollectionAddress: PublicKey, rewardDistributionProgram: {
75
75
  programId: PublicKey;
76
76
  transferAuthority: PublicKey;
77
77
  rewardVault: PublicKey;
@@ -19,7 +19,7 @@ var web3_js_1 = require("@solana/web3.js");
19
19
  var PoolConfig_json_1 = __importDefault(require("./PoolConfig.json"));
20
20
  var types_1 = require("./types");
21
21
  var PoolConfig = (function () {
22
- function PoolConfig(programId, perpComposibilityProgramId, fbNftRewardProgramId, cluster, poolName, poolAddress, lpTokenMint, sFlpTokenMint, flpTokenAccount, lpDecimals, lpTokenSymbol, stakedLpTokenSymbol, perpetuals, transferAuthority, multisig, addressLookupTableAddresses, backupOracle, nftCollectionAddress, rewardDistributionProgram, tokens, custodies, markets) {
22
+ function PoolConfig(programId, perpComposibilityProgramId, fbNftRewardProgramId, cluster, poolName, poolAddress, lpTokenMint, compoundingTokenMint, stakedLpVault, lpDecimals, compoundingLpTokenSymbol, lpTokenSymbol, perpetuals, transferAuthority, multisig, addressLookupTableAddresses, backupOracle, nftCollectionAddress, rewardDistributionProgram, tokens, custodies, markets) {
23
23
  var _this = this;
24
24
  this.programId = programId;
25
25
  this.perpComposibilityProgramId = perpComposibilityProgramId;
@@ -28,11 +28,11 @@ var PoolConfig = (function () {
28
28
  this.poolName = poolName;
29
29
  this.poolAddress = poolAddress;
30
30
  this.lpTokenMint = lpTokenMint;
31
- this.sFlpTokenMint = sFlpTokenMint;
32
- this.flpTokenAccount = flpTokenAccount;
31
+ this.compoundingTokenMint = compoundingTokenMint;
32
+ this.stakedLpVault = stakedLpVault;
33
33
  this.lpDecimals = lpDecimals;
34
+ this.compoundingLpTokenSymbol = compoundingLpTokenSymbol;
34
35
  this.lpTokenSymbol = lpTokenSymbol;
35
- this.stakedLpTokenSymbol = stakedLpTokenSymbol;
36
36
  this.perpetuals = perpetuals;
37
37
  this.transferAuthority = transferAuthority;
38
38
  this.multisig = multisig;
@@ -165,7 +165,7 @@ var PoolConfig = (function () {
165
165
  catch (error) {
166
166
  console.log("ERROR: buildPoolconfigFromJson unable to load markets ");
167
167
  }
168
- return new PoolConfig(new web3_js_1.PublicKey(poolConfig.programId), new web3_js_1.PublicKey(poolConfig.perpComposibilityProgramId), new web3_js_1.PublicKey(poolConfig.fbNftRewardProgramId), poolConfig.cluster, poolConfig.poolName, new web3_js_1.PublicKey(poolConfig.poolAddress), new web3_js_1.PublicKey(poolConfig.lpTokenMint), new web3_js_1.PublicKey(poolConfig.sFlpTokenMint), new web3_js_1.PublicKey(poolConfig.flpTokenAccount), poolConfig.lpDecimals, poolConfig.lpTokenSymbol, poolConfig.stakedLpTokenSymbol, new web3_js_1.PublicKey(poolConfig.perpetuals), new web3_js_1.PublicKey(poolConfig.transferAuthority), new web3_js_1.PublicKey(poolConfig.multisig), addressLookupTableAddresses, new web3_js_1.PublicKey(poolConfig.backupOracle), new web3_js_1.PublicKey(poolConfig.nftCollectionAddress), {
168
+ return new PoolConfig(new web3_js_1.PublicKey(poolConfig.programId), new web3_js_1.PublicKey(poolConfig.perpComposibilityProgramId), new web3_js_1.PublicKey(poolConfig.fbNftRewardProgramId), poolConfig.cluster, poolConfig.poolName, new web3_js_1.PublicKey(poolConfig.poolAddress), new web3_js_1.PublicKey(poolConfig.lpTokenMint), new web3_js_1.PublicKey(poolConfig.compoundingTokenMint), new web3_js_1.PublicKey(poolConfig.stakedLpVault), poolConfig.lpDecimals, poolConfig.compoundingLpTokenSymbol, poolConfig.lpTokenSymbol, new web3_js_1.PublicKey(poolConfig.perpetuals), new web3_js_1.PublicKey(poolConfig.transferAuthority), new web3_js_1.PublicKey(poolConfig.multisig), addressLookupTableAddresses, new web3_js_1.PublicKey(poolConfig.backupOracle), new web3_js_1.PublicKey(poolConfig.nftCollectionAddress), {
169
169
  programId: new web3_js_1.PublicKey(poolConfig.rewardDistributionProgram.programId),
170
170
  rewardMint: new web3_js_1.PublicKey(poolConfig.rewardDistributionProgram.rewardMint),
171
171
  rewardTokenAccount: new web3_js_1.PublicKey(poolConfig.rewardDistributionProgram.rewardTokenAccount),