@meteora-ag/cp-amm-sdk 1.0.1-rc.0 → 1.0.1-rc.3

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/index.js CHANGED
@@ -21,6 +21,10 @@
21
21
 
22
22
  // src/CpAmm.ts
23
23
  var _anchor = require('@coral-xyz/anchor');
24
+
25
+
26
+
27
+
24
28
  var _spltoken = require('@solana/spl-token');
25
29
  var _invariant = require('invariant'); var _invariant2 = _interopRequireDefault(_invariant);
26
30
  var _decimaljs = require('decimal.js'); var _decimaljs2 = _interopRequireDefault(_decimaljs);
@@ -6170,9 +6174,14 @@ var cp_amm_default = {
6170
6174
  ]
6171
6175
  };
6172
6176
 
6173
- // src/constants.ts
6177
+ // src/CpAmm.ts
6178
+
6174
6179
 
6175
6180
  var _web3js = require('@solana/web3.js');
6181
+
6182
+ // src/constants.ts
6183
+
6184
+
6176
6185
  var CP_AMM_PROGRAM_ID = new (0, _web3js.PublicKey)(
6177
6186
  "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG"
6178
6187
  );
@@ -6272,6 +6281,12 @@ function derivePositionNftAccount(positionNftMint, programId) {
6272
6281
  programId
6273
6282
  )[0];
6274
6283
  }
6284
+ function deriveEventAuthority(programId) {
6285
+ return _web3js.PublicKey.findProgramAddressSync(
6286
+ [Buffer.from("__event_authority")],
6287
+ programId
6288
+ );
6289
+ }
6275
6290
 
6276
6291
  // src/math/index.ts
6277
6292
 
@@ -6985,12 +7000,21 @@ var CpAmm = class {
6985
7000
  tokenBDecimal
6986
7001
  }
6987
7002
  );
7003
+ const poolAuthority = derivePoolAuthority(this._program.programId);
6988
7004
  const pool = derivePoolAddress(
6989
7005
  config,
6990
7006
  tokenAMint,
6991
7007
  tokenBMint,
6992
7008
  this._program.programId
6993
7009
  );
7010
+ const position = derivePositionAddress(
7011
+ positionNft,
7012
+ this._program.programId
7013
+ );
7014
+ const positionNftAccount = derivePositionNftAccount(
7015
+ positionNft,
7016
+ this._program.programId
7017
+ );
6994
7018
  const tokenAProgram = (_b = (_a = yield this._program.provider.connection.getParsedAccountInfo(tokenAMint)) == null ? void 0 : _a.value) == null ? void 0 : _b.owner;
6995
7019
  const tokenBProgram = (_d = (_c = yield this._program.provider.connection.getParsedAccountInfo(tokenBMint)) == null ? void 0 : _c.value) == null ? void 0 : _d.owner;
6996
7020
  const payerTokenA = _spltoken.getAssociatedTokenAddressSync.call(void 0,
@@ -7005,22 +7029,41 @@ var CpAmm = class {
7005
7029
  true,
7006
7030
  tokenBProgram
7007
7031
  );
7032
+ const tokenAVault = deriveTokenVaultAddress(
7033
+ tokenAMint,
7034
+ pool,
7035
+ this._program.programId
7036
+ );
7037
+ const tokenBVault = deriveTokenVaultAddress(
7038
+ tokenBMint,
7039
+ pool,
7040
+ this._program.programId
7041
+ );
7008
7042
  const tx = yield this._program.methods.initializePool({
7009
7043
  liquidity: liquidityQ64,
7010
7044
  sqrtPrice: sqrtPriceQ64,
7011
7045
  activationPoint
7012
- }).accounts({
7046
+ }).accountsStrict({
7013
7047
  creator,
7048
+ positionNftAccount,
7014
7049
  positionNftMint: positionNft,
7015
7050
  payer,
7016
7051
  config,
7052
+ poolAuthority,
7017
7053
  pool,
7054
+ position,
7018
7055
  tokenAMint,
7019
7056
  tokenBMint,
7057
+ tokenAVault,
7058
+ tokenBVault,
7020
7059
  payerTokenA,
7021
7060
  payerTokenB,
7061
+ token2022Program: _spltoken.TOKEN_2022_PROGRAM_ID,
7022
7062
  tokenAProgram,
7023
- tokenBProgram
7063
+ tokenBProgram,
7064
+ systemProgram: _web3js.SystemProgram.programId,
7065
+ eventAuthority: deriveEventAuthority(this._program.programId)[0],
7066
+ program: this._program.programId
7024
7067
  }).transaction();
7025
7068
  return tx;
7026
7069
  });
@@ -7041,7 +7084,9 @@ var CpAmm = class {
7041
7084
  hasAlphaVault,
7042
7085
  collectFeeMode,
7043
7086
  activationPoint,
7044
- activationType
7087
+ activationType,
7088
+ tokenAProgram,
7089
+ tokenBProgram
7045
7090
  } = params;
7046
7091
  const { sqrtPriceQ64, liquidityQ64 } = yield this.preparePoolCreationParams(
7047
7092
  {
@@ -7051,6 +7096,7 @@ var CpAmm = class {
7051
7096
  tokenBDecimal
7052
7097
  }
7053
7098
  );
7099
+ const poolAuthority = derivePoolAuthority(this._program.programId);
7054
7100
  const pool = deriveCustomizablePoolAddress(
7055
7101
  tokenAMint,
7056
7102
  tokenBMint,
@@ -7060,8 +7106,20 @@ var CpAmm = class {
7060
7106
  positionNft,
7061
7107
  this._program.programId
7062
7108
  );
7063
- const tokenAProgram = (yield this._program.provider.connection.getAccountInfo(tokenAMint)).owner;
7064
- const tokenBProgram = (yield this._program.provider.connection.getAccountInfo(tokenBMint)).owner;
7109
+ const positionNftAccount = derivePositionNftAccount(
7110
+ positionNft,
7111
+ this._program.programId
7112
+ );
7113
+ const tokenAVault = deriveTokenVaultAddress(
7114
+ tokenAMint,
7115
+ pool,
7116
+ this._program.programId
7117
+ );
7118
+ const tokenBVault = deriveTokenVaultAddress(
7119
+ tokenBMint,
7120
+ pool,
7121
+ this._program.programId
7122
+ );
7065
7123
  const preInstructions = [];
7066
7124
  const [
7067
7125
  { ataPubkey: payerTokenA, ix: createTokenATokenAccountIx },
@@ -7112,17 +7170,26 @@ var CpAmm = class {
7112
7170
  activationType,
7113
7171
  collectFeeMode,
7114
7172
  activationPoint
7115
- }).accounts({
7173
+ }).accountsStrict({
7116
7174
  creator,
7175
+ positionNftAccount,
7117
7176
  positionNftMint: positionNft,
7118
7177
  payer,
7178
+ poolAuthority,
7119
7179
  pool,
7180
+ position,
7120
7181
  tokenAMint,
7121
7182
  tokenBMint,
7183
+ tokenAVault,
7184
+ tokenBVault,
7122
7185
  payerTokenA,
7123
7186
  payerTokenB,
7124
- tokenAProgram,
7125
- tokenBProgram
7187
+ token2022Program: _spltoken.TOKEN_2022_PROGRAM_ID,
7188
+ tokenAProgram: tokenAProgram != null ? tokenAProgram : (yield this._program.provider.connection.getAccountInfo(tokenAMint)).owner,
7189
+ tokenBProgram: tokenBProgram != null ? tokenBProgram : (yield this._program.provider.connection.getAccountInfo(tokenBMint)).owner,
7190
+ systemProgram: _web3js.SystemProgram.programId,
7191
+ eventAuthority: deriveEventAuthority(this._program.programId)[0],
7192
+ program: this._program.programId
7126
7193
  }).preInstructions(preInstructions).transaction();
7127
7194
  return { tx: transaction, pool, position };
7128
7195
  });
@@ -7130,11 +7197,27 @@ var CpAmm = class {
7130
7197
  createPosition(params) {
7131
7198
  return __async(this, null, function* () {
7132
7199
  const { owner, payer, pool, positionNft } = params;
7133
- return yield this._program.methods.createPosition().accounts({
7200
+ const poolAuthority = derivePoolAuthority(this._program.programId);
7201
+ const position = derivePositionAddress(
7202
+ positionNft,
7203
+ this._program.programId
7204
+ );
7205
+ const positionNftAccount = derivePositionNftAccount(
7206
+ positionNft,
7207
+ this._program.programId
7208
+ );
7209
+ return yield this._program.methods.createPosition().accountsStrict({
7134
7210
  owner,
7135
7211
  positionNftMint: positionNft,
7212
+ poolAuthority,
7213
+ positionNftAccount,
7136
7214
  payer,
7137
- pool
7215
+ pool,
7216
+ position,
7217
+ tokenProgram: _spltoken.TOKEN_2022_PROGRAM_ID,
7218
+ systemProgram: _web3js.SystemProgram.programId,
7219
+ eventAuthority: deriveEventAuthority(this._program.programId)[0],
7220
+ program: this._program.programId
7138
7221
  }).transaction();
7139
7222
  });
7140
7223
  }
@@ -7142,6 +7225,7 @@ var CpAmm = class {
7142
7225
  return __async(this, null, function* () {
7143
7226
  const {
7144
7227
  owner,
7228
+ pool,
7145
7229
  position,
7146
7230
  positionNftMint,
7147
7231
  liquidityDeltaQ64,
@@ -7151,6 +7235,8 @@ var CpAmm = class {
7151
7235
  tokenBAmountThreshold,
7152
7236
  tokenAMint,
7153
7237
  tokenBMint,
7238
+ tokenAVault,
7239
+ tokenBVault,
7154
7240
  tokenAProgram,
7155
7241
  tokenBProgram
7156
7242
  } = params;
@@ -7209,14 +7295,21 @@ var CpAmm = class {
7209
7295
  liquidityDelta: liquidityDeltaQ64,
7210
7296
  tokenAAmountThreshold,
7211
7297
  tokenBAmountThreshold
7212
- }).accounts({
7298
+ }).accountsStrict({
7299
+ pool,
7213
7300
  position,
7214
7301
  positionNftAccount,
7215
7302
  owner,
7216
7303
  tokenAAccount,
7217
7304
  tokenBAccount,
7305
+ tokenAMint,
7306
+ tokenBMint,
7307
+ tokenAVault,
7308
+ tokenBVault,
7218
7309
  tokenAProgram,
7219
- tokenBProgram
7310
+ tokenBProgram,
7311
+ eventAuthority: deriveEventAuthority(this._program.programId)[0],
7312
+ program: this._program.programId
7220
7313
  }).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
7221
7314
  });
7222
7315
  }
@@ -7224,6 +7317,7 @@ var CpAmm = class {
7224
7317
  return __async(this, null, function* () {
7225
7318
  const {
7226
7319
  owner,
7320
+ pool,
7227
7321
  position,
7228
7322
  positionNftMint,
7229
7323
  liquidityDeltaQ64,
@@ -7231,6 +7325,8 @@ var CpAmm = class {
7231
7325
  tokenBAmountThreshold,
7232
7326
  tokenAMint,
7233
7327
  tokenBMint,
7328
+ tokenAVault,
7329
+ tokenBVault,
7234
7330
  tokenAProgram,
7235
7331
  tokenBProgram
7236
7332
  } = params;
@@ -7238,6 +7334,7 @@ var CpAmm = class {
7238
7334
  positionNftMint,
7239
7335
  this._program.programId
7240
7336
  );
7337
+ const poolAuthority = derivePoolAuthority(this._program.programId);
7241
7338
  const preInstructions = [];
7242
7339
  const [
7243
7340
  { ataPubkey: tokenAAccount, ix: createTokenAAccountIx },
@@ -7273,14 +7370,22 @@ var CpAmm = class {
7273
7370
  liquidityDelta: liquidityDeltaQ64,
7274
7371
  tokenAAmountThreshold,
7275
7372
  tokenBAmountThreshold
7276
- }).accounts({
7373
+ }).accountsStrict({
7374
+ poolAuthority,
7375
+ pool,
7277
7376
  position,
7278
7377
  positionNftAccount,
7279
7378
  owner,
7280
7379
  tokenAAccount,
7281
7380
  tokenBAccount,
7381
+ tokenAMint,
7382
+ tokenBMint,
7383
+ tokenAVault,
7384
+ tokenBVault,
7282
7385
  tokenAProgram,
7283
- tokenBProgram
7386
+ tokenBProgram,
7387
+ eventAuthority: deriveEventAuthority(this._program.programId)[0],
7388
+ program: this._program.programId
7284
7389
  }).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
7285
7390
  });
7286
7391
  }
@@ -7293,12 +7398,15 @@ var CpAmm = class {
7293
7398
  outputTokenMint,
7294
7399
  amountIn,
7295
7400
  minimumAmountOut,
7401
+ tokenAVault,
7402
+ tokenBVault,
7296
7403
  tokenAMint,
7297
7404
  tokenBMint,
7298
7405
  tokenAProgram,
7299
7406
  tokenBProgram,
7300
7407
  referralTokenAccount
7301
7408
  } = params;
7409
+ const poolAuthority = derivePoolAuthority(this._program.programId);
7302
7410
  const preInstructions = [];
7303
7411
  const [
7304
7412
  { ataPubkey: inputTokenAccount, ix: createInputTokenAccountIx },
@@ -7341,16 +7449,21 @@ var CpAmm = class {
7341
7449
  return yield this._program.methods.swap({
7342
7450
  amountIn,
7343
7451
  minimumAmountOut
7344
- }).accounts({
7452
+ }).accountsStrict({
7453
+ poolAuthority,
7345
7454
  pool,
7346
7455
  payer,
7347
7456
  inputTokenAccount,
7348
7457
  outputTokenAccount,
7458
+ tokenAVault,
7459
+ tokenBVault,
7349
7460
  tokenAMint,
7350
7461
  tokenBMint,
7351
7462
  tokenAProgram,
7352
7463
  tokenBProgram,
7353
- referralTokenAccount
7464
+ referralTokenAccount,
7465
+ eventAuthority: deriveEventAuthority(this._program.programId)[0],
7466
+ program: this._program.programId
7354
7467
  }).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
7355
7468
  });
7356
7469
  }
@@ -7358,6 +7471,7 @@ var CpAmm = class {
7358
7471
  return __async(this, null, function* () {
7359
7472
  const {
7360
7473
  owner,
7474
+ pool,
7361
7475
  payer,
7362
7476
  vestingAccount,
7363
7477
  position,
@@ -7381,12 +7495,16 @@ var CpAmm = class {
7381
7495
  numberOfPeriod,
7382
7496
  index: vestings.length
7383
7497
  };
7384
- return yield this._program.methods.lockPosition(lockPositionParams).accounts({
7498
+ return yield this._program.methods.lockPosition(lockPositionParams).accountsStrict({
7385
7499
  position,
7386
7500
  positionNftAccount,
7387
7501
  vesting: vestingAccount,
7502
+ pool,
7388
7503
  owner,
7389
- payer
7504
+ payer,
7505
+ systemProgram: _web3js.SystemProgram.programId,
7506
+ eventAuthority: deriveEventAuthority(this._program.programId)[0],
7507
+ program: this._program.programId
7390
7508
  }).transaction();
7391
7509
  });
7392
7510
  }
@@ -7397,10 +7515,13 @@ var CpAmm = class {
7397
7515
  positionNftMint,
7398
7516
  this._program.programId
7399
7517
  );
7400
- return yield this._program.methods.permanentLockPosition(unlockedLiquidity).accounts({
7518
+ return yield this._program.methods.permanentLockPosition(unlockedLiquidity).accountsStrict({
7401
7519
  position,
7402
7520
  positionNftAccount,
7403
- owner
7521
+ pool,
7522
+ owner,
7523
+ eventAuthority: deriveEventAuthority(this._program.programId)[0],
7524
+ program: this._program.programId
7404
7525
  }).transaction();
7405
7526
  });
7406
7527
  }
@@ -7411,9 +7532,10 @@ var CpAmm = class {
7411
7532
  positionNftMint,
7412
7533
  this._program.programId
7413
7534
  );
7414
- return yield this._program.methods.refreshVesting().accounts({
7535
+ return yield this._program.methods.refreshVesting().accountsStrict({
7415
7536
  position,
7416
7537
  positionNftAccount,
7538
+ pool,
7417
7539
  owner
7418
7540
  }).remainingAccounts(
7419
7541
  vestings.map((pubkey) => {
@@ -7430,8 +7552,11 @@ var CpAmm = class {
7430
7552
  return __async(this, null, function* () {
7431
7553
  const {
7432
7554
  owner,
7555
+ pool,
7433
7556
  position,
7434
7557
  nftPositionMint,
7558
+ tokenAVault,
7559
+ tokenBVault,
7435
7560
  tokenAMint,
7436
7561
  tokenBMint,
7437
7562
  tokenAProgram,
@@ -7441,6 +7566,7 @@ var CpAmm = class {
7441
7566
  nftPositionMint,
7442
7567
  this._program.programId
7443
7568
  );
7569
+ const poolAuthority = derivePoolAuthority(this._program.programId);
7444
7570
  const preInstructions = [];
7445
7571
  const [
7446
7572
  { ataPubkey: tokenAAccount, ix: createTokenAAccountIx },
@@ -7472,32 +7598,44 @@ var CpAmm = class {
7472
7598
  const closeWrappedSOLIx = yield unwrapSOLInstruction(owner);
7473
7599
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
7474
7600
  }
7475
- return yield this._program.methods.claimPositionFee().accounts({
7601
+ return yield this._program.methods.claimPositionFee().accountsStrict({
7602
+ poolAuthority,
7476
7603
  owner,
7604
+ pool,
7477
7605
  position,
7478
7606
  positionNftAccount,
7479
7607
  tokenAAccount,
7480
7608
  tokenBAccount,
7609
+ tokenAVault,
7610
+ tokenBVault,
7611
+ tokenAMint,
7612
+ tokenBMint,
7481
7613
  tokenAProgram,
7482
- tokenBProgram
7614
+ tokenBProgram,
7615
+ eventAuthority: deriveEventAuthority(this._program.programId)[0],
7616
+ program: this._program.programId
7483
7617
  }).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
7484
7618
  });
7485
7619
  }
7486
7620
  updateRewardDuration(params) {
7487
7621
  return __async(this, null, function* () {
7488
7622
  const { pool, admin, rewardIndex, newDuration } = params;
7489
- return yield this._program.methods.updateRewardDuration(rewardIndex, newDuration).accounts({
7623
+ return yield this._program.methods.updateRewardDuration(rewardIndex, newDuration).accountsStrict({
7490
7624
  pool,
7491
- admin
7625
+ admin,
7626
+ eventAuthority: deriveEventAuthority(this._program.programId)[0],
7627
+ program: this._program.programId
7492
7628
  }).transaction();
7493
7629
  });
7494
7630
  }
7495
7631
  updateRewardFunder(params) {
7496
7632
  return __async(this, null, function* () {
7497
7633
  const { pool, admin, rewardIndex, newFunder } = params;
7498
- return yield this._program.methods.updateRewardFunder(rewardIndex, newFunder).accounts({
7634
+ return yield this._program.methods.updateRewardFunder(rewardIndex, newFunder).accountsStrict({
7499
7635
  pool,
7500
- admin
7636
+ admin,
7637
+ eventAuthority: deriveEventAuthority(this._program.programId)[0],
7638
+ program: this._program.programId
7501
7639
  }).transaction();
7502
7640
  });
7503
7641
  }
@@ -7526,19 +7664,22 @@ var CpAmm = class {
7526
7664
  );
7527
7665
  preInstructions.push(...wrapSOLIx);
7528
7666
  }
7529
- return yield this._program.methods.fundReward(rewardIndex, amount, carryForward).accounts({
7667
+ return yield this._program.methods.fundReward(rewardIndex, amount, carryForward).accountsStrict({
7530
7668
  pool,
7531
7669
  rewardVault: vault,
7532
7670
  rewardMint: mint,
7533
7671
  funderTokenAccount,
7534
7672
  funder,
7535
- tokenProgram
7673
+ tokenProgram,
7674
+ eventAuthority: deriveEventAuthority(this._program.programId)[0],
7675
+ program: this._program.programId
7536
7676
  }).transaction();
7537
7677
  });
7538
7678
  }
7539
7679
  withdrawIneligibleReward(params) {
7540
7680
  return __async(this, null, function* () {
7541
7681
  const { rewardIndex, pool, funder } = params;
7682
+ const poolAuthority = derivePoolAuthority(this._program.programId);
7542
7683
  const poolState = yield this.fetchPoolState(pool);
7543
7684
  const rewardInfo = poolState.rewardInfos[rewardIndex];
7544
7685
  const { mint, vault, rewardTokenFlag } = rewardInfo;
@@ -7558,13 +7699,16 @@ var CpAmm = class {
7558
7699
  const closeWrappedSOLIx = yield unwrapSOLInstruction(funder);
7559
7700
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
7560
7701
  }
7561
- return yield this._program.methods.withdrawIneligibleReward(rewardIndex).accounts({
7702
+ return yield this._program.methods.withdrawIneligibleReward(rewardIndex).accountsStrict({
7562
7703
  pool,
7563
7704
  rewardVault: vault,
7564
7705
  rewardMint: mint,
7706
+ poolAuthority,
7565
7707
  funderTokenAccount,
7566
7708
  funder,
7567
- tokenProgram
7709
+ tokenProgram,
7710
+ eventAuthority: deriveEventAuthority(this._program.programId)[0],
7711
+ program: this._program.programId
7568
7712
  }).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
7569
7713
  });
7570
7714
  }
@@ -7572,7 +7716,15 @@ var CpAmm = class {
7572
7716
  return __async(this, null, function* () {
7573
7717
  const { partner, pool, maxAmountA, maxAmountB } = params;
7574
7718
  const poolState = yield this.fetchPoolState(pool);
7575
- const { tokenAFlag, tokenBFlag } = poolState;
7719
+ const {
7720
+ tokenAVault,
7721
+ tokenBVault,
7722
+ tokenAMint,
7723
+ tokenBMint,
7724
+ tokenAFlag,
7725
+ tokenBFlag
7726
+ } = poolState;
7727
+ const poolAuthority = derivePoolAuthority(this._program.programId);
7576
7728
  const tokenAProgram = getTokenProgram(tokenAFlag);
7577
7729
  const tokenBProgram = getTokenProgram(tokenBFlag);
7578
7730
  const preInstructions = [];
@@ -7607,18 +7759,27 @@ var CpAmm = class {
7607
7759
  const closeWrappedSOLIx = yield unwrapSOLInstruction(partner);
7608
7760
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
7609
7761
  }
7610
- return yield this._program.methods.claimPartnerFee(maxAmountA, maxAmountB).accounts({
7762
+ return yield this._program.methods.claimPartnerFee(maxAmountA, maxAmountB).accountsStrict({
7763
+ poolAuthority,
7611
7764
  pool,
7612
7765
  tokenAAccount,
7613
7766
  tokenBAccount,
7767
+ tokenAVault,
7768
+ tokenBVault,
7769
+ tokenAMint,
7770
+ tokenBMint,
7771
+ partner,
7614
7772
  tokenAProgram,
7615
- tokenBProgram
7773
+ tokenBProgram,
7774
+ eventAuthority: deriveEventAuthority(this._program.programId)[0],
7775
+ program: this._program.programId
7616
7776
  }).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
7617
7777
  });
7618
7778
  }
7619
7779
  claimReward(params) {
7620
7780
  return __async(this, null, function* () {
7621
7781
  const { user, position, rewardIndex } = params;
7782
+ const poolAuthority = derivePoolAuthority(this._program.programId);
7622
7783
  const positionState = yield this.fetchPositionState(position);
7623
7784
  const poolState = yield this.fetchPoolState(positionState.pool);
7624
7785
  const positionNftAccount = derivePositionNftAccount(
@@ -7642,19 +7803,28 @@ var CpAmm = class {
7642
7803
  const closeWrappedSOLIx = yield unwrapSOLInstruction(user);
7643
7804
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
7644
7805
  }
7645
- return yield this._program.methods.claimReward(rewardIndex).accounts({
7806
+ return yield this._program.methods.claimReward(rewardIndex).accountsStrict({
7807
+ pool: positionState.pool,
7646
7808
  positionNftAccount,
7647
7809
  rewardVault: rewardInfo.vault,
7648
7810
  rewardMint: rewardInfo.mint,
7811
+ poolAuthority,
7649
7812
  position,
7650
7813
  userTokenAccount,
7651
7814
  owner: user,
7652
- tokenProgram
7815
+ tokenProgram,
7816
+ eventAuthority: deriveEventAuthority(this._program.programId)[0],
7817
+ program: this._program.programId
7653
7818
  }).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
7654
7819
  });
7655
7820
  }
7656
7821
  };
7657
7822
 
7823
+ // src/index.ts
7824
+ var index_default = cp_amm_default;
7825
+
7826
+
7827
+
7658
7828
 
7659
7829
 
7660
7830
 
@@ -7700,5 +7870,5 @@ var CpAmm = class {
7700
7870
 
7701
7871
 
7702
7872
 
7703
- exports.ActivationPoint = ActivationPoint; exports.ActivationType = ActivationType; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.CP_AMM_PROGRAM_ID = CP_AMM_PROGRAM_ID; exports.CollectFeeMode = CollectFeeMode; exports.CpAmm = CpAmm; exports.FEE_DENOMINATOR = FEE_DENOMINATOR; exports.FeeSchedulerMode = FeeSchedulerMode; exports.MAX_CU_BUFFER = MAX_CU_BUFFER; exports.MAX_FEE_NUMERATOR = MAX_FEE_NUMERATOR; exports.MAX_SQRT_PRICE = MAX_SQRT_PRICE; exports.MIN_CU_BUFFER = MIN_CU_BUFFER; exports.MIN_SQRT_PRICE = MIN_SQRT_PRICE; exports.Rounding = Rounding; exports.SCALE_OFFSET = SCALE_OFFSET; exports.TradeDirection = TradeDirection; exports.calculateSwap = calculateSwap; exports.deriveClaimFeeOperatorAddress = deriveClaimFeeOperatorAddress; exports.deriveConfigAddress = deriveConfigAddress; exports.deriveCustomizablePoolAddress = deriveCustomizablePoolAddress; exports.derivePoolAddress = derivePoolAddress; exports.derivePoolAuthority = derivePoolAuthority; exports.derivePositionAddress = derivePositionAddress; exports.derivePositionNftAccount = derivePositionNftAccount; exports.deriveRewardVaultAddress = deriveRewardVaultAddress; exports.deriveTokenBadgeAddress = deriveTokenBadgeAddress; exports.deriveTokenVaultAddress = deriveTokenVaultAddress; exports.getBaseFeeNumerator = getBaseFeeNumerator; exports.getDeltaAmountA = getDeltaAmountA; exports.getDeltaAmountB = getDeltaAmountB; exports.getDynamicFeeNumerator = getDynamicFeeNumerator; exports.getEstimatedComputeUnitIxWithBuffer = getEstimatedComputeUnitIxWithBuffer; exports.getEstimatedComputeUnitUsageWithBuffer = getEstimatedComputeUnitUsageWithBuffer; exports.getFeeNumerator = getFeeNumerator; exports.getFirstKey = getFirstKey; exports.getLiquidityDeltaFromAmountA = getLiquidityDeltaFromAmountA; exports.getLiquidityDeltaFromAmountB = getLiquidityDeltaFromAmountB; exports.getNextSqrtPrice = getNextSqrtPrice; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getSecondKey = getSecondKey; exports.getSimulationComputeUnits = getSimulationComputeUnits; exports.getTokenDecimals = getTokenDecimals; exports.getTokenProgram = getTokenProgram; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.wrapSOLInstruction = wrapSOLInstruction;
7873
+ exports.ActivationPoint = ActivationPoint; exports.ActivationType = ActivationType; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.CP_AMM_PROGRAM_ID = CP_AMM_PROGRAM_ID; exports.CollectFeeMode = CollectFeeMode; exports.CpAmm = CpAmm; exports.FEE_DENOMINATOR = FEE_DENOMINATOR; exports.FeeSchedulerMode = FeeSchedulerMode; exports.MAX_CU_BUFFER = MAX_CU_BUFFER; exports.MAX_FEE_NUMERATOR = MAX_FEE_NUMERATOR; exports.MAX_SQRT_PRICE = MAX_SQRT_PRICE; exports.MIN_CU_BUFFER = MIN_CU_BUFFER; exports.MIN_SQRT_PRICE = MIN_SQRT_PRICE; exports.Rounding = Rounding; exports.SCALE_OFFSET = SCALE_OFFSET; exports.TradeDirection = TradeDirection; exports.calculateSwap = calculateSwap; exports.default = index_default; exports.deriveClaimFeeOperatorAddress = deriveClaimFeeOperatorAddress; exports.deriveConfigAddress = deriveConfigAddress; exports.deriveCustomizablePoolAddress = deriveCustomizablePoolAddress; exports.deriveEventAuthority = deriveEventAuthority; exports.derivePoolAddress = derivePoolAddress; exports.derivePoolAuthority = derivePoolAuthority; exports.derivePositionAddress = derivePositionAddress; exports.derivePositionNftAccount = derivePositionNftAccount; exports.deriveRewardVaultAddress = deriveRewardVaultAddress; exports.deriveTokenBadgeAddress = deriveTokenBadgeAddress; exports.deriveTokenVaultAddress = deriveTokenVaultAddress; exports.getBaseFeeNumerator = getBaseFeeNumerator; exports.getDeltaAmountA = getDeltaAmountA; exports.getDeltaAmountB = getDeltaAmountB; exports.getDynamicFeeNumerator = getDynamicFeeNumerator; exports.getEstimatedComputeUnitIxWithBuffer = getEstimatedComputeUnitIxWithBuffer; exports.getEstimatedComputeUnitUsageWithBuffer = getEstimatedComputeUnitUsageWithBuffer; exports.getFeeNumerator = getFeeNumerator; exports.getFirstKey = getFirstKey; exports.getLiquidityDeltaFromAmountA = getLiquidityDeltaFromAmountA; exports.getLiquidityDeltaFromAmountB = getLiquidityDeltaFromAmountB; exports.getNextSqrtPrice = getNextSqrtPrice; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getSecondKey = getSecondKey; exports.getSimulationComputeUnits = getSimulationComputeUnits; exports.getTokenDecimals = getTokenDecimals; exports.getTokenProgram = getTokenProgram; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.wrapSOLInstruction = wrapSOLInstruction;
7704
7874
  //# sourceMappingURL=index.js.map