@pump-fun/pump-sdk 1.9.0 → 1.9.1-devnet.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -4588,23 +4588,34 @@ var PumpSdk = class {
4588
4588
  )
4589
4589
  ];
4590
4590
  }
4591
- async claimTokenIncentives(user, payer, mint = PUMP_TOKEN_MINT, tokenProgram = TOKEN_2022_PROGRAM_ID) {
4592
- return await this.offlinePumpProgram.methods.claimTokenIncentives().accountsPartial({
4593
- user,
4594
- payer,
4591
+ async claimTokenIncentives(user, payer) {
4592
+ const { mint } = await this.fetchGlobalVolumeAccumulator();
4593
+ if (mint.equals(PublicKey2.default)) {
4594
+ return [];
4595
+ }
4596
+ const [mintAccountInfo, userAccumulatorAccountInfo] = await this.connection.getMultipleAccountsInfo([
4595
4597
  mint,
4596
- tokenProgram
4597
- }).instruction();
4598
- }
4599
- async claimTokenIncentivesBothPrograms(user, payer, mint = PUMP_TOKEN_MINT, tokenProgram = TOKEN_2022_PROGRAM_ID) {
4598
+ userVolumeAccumulatorPda(user)[0]
4599
+ ]);
4600
+ if (!mintAccountInfo) {
4601
+ return [];
4602
+ }
4603
+ if (!userAccumulatorAccountInfo) {
4604
+ return [];
4605
+ }
4600
4606
  return [
4601
- await this.claimTokenIncentives(user, payer, mint, tokenProgram),
4602
- await this.pumpAmmSdk.claimTokenIncentives(
4607
+ await this.offlinePumpProgram.methods.claimTokenIncentives().accountsPartial({
4603
4608
  user,
4604
4609
  payer,
4605
4610
  mint,
4606
- tokenProgram
4607
- )
4611
+ tokenProgram: mintAccountInfo.owner
4612
+ }).instruction()
4613
+ ];
4614
+ }
4615
+ async claimTokenIncentivesBothPrograms(user, payer) {
4616
+ return [
4617
+ ...await this.claimTokenIncentives(user, payer),
4618
+ ...await this.pumpAmmSdk.claimTokenIncentives(user, payer)
4608
4619
  ];
4609
4620
  }
4610
4621
  async getTotalUnclaimedTokens(user) {
package/dist/index.d.mts CHANGED
@@ -8235,8 +8235,8 @@ declare class PumpSdk {
8235
8235
  getCreatorVaultBalance(creator: PublicKey): Promise<BN>;
8236
8236
  adminUpdateTokenIncentives(startTime: BN, endTime: BN, dayNumber: BN, tokenSupplyPerDay: BN, secondsInADay?: BN, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction>;
8237
8237
  adminUpdateTokenIncentivesBothPrograms(startTime: BN, endTime: BN, dayNumber: BN, tokenSupplyPerDay: BN, secondsInADay?: BN, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction[]>;
8238
- claimTokenIncentives(user: PublicKey, payer: PublicKey, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction>;
8239
- claimTokenIncentivesBothPrograms(user: PublicKey, payer: PublicKey, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction[]>;
8238
+ claimTokenIncentives(user: PublicKey, payer: PublicKey): Promise<TransactionInstruction[]>;
8239
+ claimTokenIncentivesBothPrograms(user: PublicKey, payer: PublicKey): Promise<TransactionInstruction[]>;
8240
8240
  getTotalUnclaimedTokens(user: PublicKey): Promise<BN>;
8241
8241
  getTotalUnclaimedTokensBothPrograms(user: PublicKey): Promise<BN>;
8242
8242
  getCurrentDayTokens(user: PublicKey): Promise<BN>;
package/dist/index.d.ts CHANGED
@@ -8235,8 +8235,8 @@ declare class PumpSdk {
8235
8235
  getCreatorVaultBalance(creator: PublicKey): Promise<BN>;
8236
8236
  adminUpdateTokenIncentives(startTime: BN, endTime: BN, dayNumber: BN, tokenSupplyPerDay: BN, secondsInADay?: BN, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction>;
8237
8237
  adminUpdateTokenIncentivesBothPrograms(startTime: BN, endTime: BN, dayNumber: BN, tokenSupplyPerDay: BN, secondsInADay?: BN, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction[]>;
8238
- claimTokenIncentives(user: PublicKey, payer: PublicKey, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction>;
8239
- claimTokenIncentivesBothPrograms(user: PublicKey, payer: PublicKey, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction[]>;
8238
+ claimTokenIncentives(user: PublicKey, payer: PublicKey): Promise<TransactionInstruction[]>;
8239
+ claimTokenIncentivesBothPrograms(user: PublicKey, payer: PublicKey): Promise<TransactionInstruction[]>;
8240
8240
  getTotalUnclaimedTokens(user: PublicKey): Promise<BN>;
8241
8241
  getTotalUnclaimedTokensBothPrograms(user: PublicKey): Promise<BN>;
8242
8242
  getCurrentDayTokens(user: PublicKey): Promise<BN>;
package/dist/index.js CHANGED
@@ -4635,23 +4635,34 @@ var PumpSdk = class {
4635
4635
  )
4636
4636
  ];
4637
4637
  }
4638
- async claimTokenIncentives(user, payer, mint = PUMP_TOKEN_MINT, tokenProgram = import_spl_token.TOKEN_2022_PROGRAM_ID) {
4639
- return await this.offlinePumpProgram.methods.claimTokenIncentives().accountsPartial({
4640
- user,
4641
- payer,
4638
+ async claimTokenIncentives(user, payer) {
4639
+ const { mint } = await this.fetchGlobalVolumeAccumulator();
4640
+ if (mint.equals(import_web32.PublicKey.default)) {
4641
+ return [];
4642
+ }
4643
+ const [mintAccountInfo, userAccumulatorAccountInfo] = await this.connection.getMultipleAccountsInfo([
4642
4644
  mint,
4643
- tokenProgram
4644
- }).instruction();
4645
- }
4646
- async claimTokenIncentivesBothPrograms(user, payer, mint = PUMP_TOKEN_MINT, tokenProgram = import_spl_token.TOKEN_2022_PROGRAM_ID) {
4645
+ userVolumeAccumulatorPda(user)[0]
4646
+ ]);
4647
+ if (!mintAccountInfo) {
4648
+ return [];
4649
+ }
4650
+ if (!userAccumulatorAccountInfo) {
4651
+ return [];
4652
+ }
4647
4653
  return [
4648
- await this.claimTokenIncentives(user, payer, mint, tokenProgram),
4649
- await this.pumpAmmSdk.claimTokenIncentives(
4654
+ await this.offlinePumpProgram.methods.claimTokenIncentives().accountsPartial({
4650
4655
  user,
4651
4656
  payer,
4652
4657
  mint,
4653
- tokenProgram
4654
- )
4658
+ tokenProgram: mintAccountInfo.owner
4659
+ }).instruction()
4660
+ ];
4661
+ }
4662
+ async claimTokenIncentivesBothPrograms(user, payer) {
4663
+ return [
4664
+ ...await this.claimTokenIncentives(user, payer),
4665
+ ...await this.pumpAmmSdk.claimTokenIncentives(user, payer)
4655
4666
  ];
4656
4667
  }
4657
4668
  async getTotalUnclaimedTokens(user) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pump-fun/pump-sdk",
3
- "version": "1.9.0",
3
+ "version": "1.9.1-devnet.1",
4
4
  "description": "Pump Bonding Curve SDK",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/pump-fun/pump-sdk#readme",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@coral-xyz/anchor": "^0.31.1",
42
- "@pump-fun/pump-swap-sdk": "^0.0.1-beta.87",
42
+ "@pump-fun/pump-swap-sdk": "^0.0.1-beta.88",
43
43
  "@solana/spl-token": "^0.4.13",
44
44
  "@solana/web3.js": "^1.98.2",
45
45
  "bn.js": "^5.2.2",
package/src/sdk.ts CHANGED
@@ -622,34 +622,47 @@ export class PumpSdk {
622
622
  async claimTokenIncentives(
623
623
  user: PublicKey,
624
624
  payer: PublicKey,
625
- mint: PublicKey = PUMP_TOKEN_MINT,
626
- tokenProgram: PublicKey = TOKEN_2022_PROGRAM_ID,
627
- ): Promise<TransactionInstruction> {
628
- return await this.offlinePumpProgram.methods
629
- .claimTokenIncentives()
630
- .accountsPartial({
631
- user,
632
- payer,
625
+ ): Promise<TransactionInstruction[]> {
626
+ const { mint } = await this.fetchGlobalVolumeAccumulator();
627
+
628
+ if (mint.equals(PublicKey.default)) {
629
+ return [];
630
+ }
631
+
632
+ const [mintAccountInfo, userAccumulatorAccountInfo] =
633
+ await this.connection.getMultipleAccountsInfo([
633
634
  mint,
634
- tokenProgram,
635
- })
636
- .instruction();
635
+ userVolumeAccumulatorPda(user)[0],
636
+ ]);
637
+
638
+ if (!mintAccountInfo) {
639
+ return [];
640
+ }
641
+
642
+ if (!userAccumulatorAccountInfo) {
643
+ return [];
644
+ }
645
+
646
+ return [
647
+ await this.offlinePumpProgram.methods
648
+ .claimTokenIncentives()
649
+ .accountsPartial({
650
+ user,
651
+ payer,
652
+ mint,
653
+ tokenProgram: mintAccountInfo.owner,
654
+ })
655
+ .instruction(),
656
+ ];
637
657
  }
638
658
 
639
659
  async claimTokenIncentivesBothPrograms(
640
660
  user: PublicKey,
641
661
  payer: PublicKey,
642
- mint: PublicKey = PUMP_TOKEN_MINT,
643
- tokenProgram: PublicKey = TOKEN_2022_PROGRAM_ID,
644
662
  ): Promise<TransactionInstruction[]> {
645
663
  return [
646
- await this.claimTokenIncentives(user, payer, mint, tokenProgram),
647
- await this.pumpAmmSdk.claimTokenIncentives(
648
- user,
649
- payer,
650
- mint,
651
- tokenProgram,
652
- ),
664
+ ...(await this.claimTokenIncentives(user, payer)),
665
+ ...(await this.pumpAmmSdk.claimTokenIncentives(user, payer)),
653
666
  ];
654
667
  }
655
668
 
@@ -718,7 +731,7 @@ export class PumpSdk {
718
731
  }
719
732
 
720
733
  async syncUserVolumeAccumulator(
721
- user: PublicKey
734
+ user: PublicKey,
722
735
  ): Promise<TransactionInstruction> {
723
736
  return await this.offlinePumpProgram.methods
724
737
  .syncUserVolumeAccumulator()
@@ -727,7 +740,7 @@ export class PumpSdk {
727
740
  }
728
741
 
729
742
  async syncUserVolumeAccumulatorBothPrograms(
730
- user: PublicKey,
743
+ user: PublicKey,
731
744
  ): Promise<TransactionInstruction[]> {
732
745
  return [
733
746
  await this.syncUserVolumeAccumulator(user),