@pump-fun/pump-sdk 1.8.0 → 1.8.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
@@ -4388,19 +4388,30 @@ var PumpSdk = class {
4388
4388
  }
4389
4389
  async adminUpdateTokenIncentives(startTime, endTime, dayNumber, tokenSupplyPerDay, secondsInADay = new BN3(86400), mint = PUMP_TOKEN_MINT, tokenProgram = TOKEN_2022_PROGRAM_ID) {
4390
4390
  const { authority } = await this.fetchGlobal();
4391
+ return await this.offlinePumpProgram.methods.adminUpdateTokenIncentives(
4392
+ startTime,
4393
+ endTime,
4394
+ secondsInADay,
4395
+ dayNumber,
4396
+ tokenSupplyPerDay
4397
+ ).accountsPartial({
4398
+ global: this.globalPda(),
4399
+ authority,
4400
+ mint,
4401
+ tokenProgram
4402
+ }).instruction();
4403
+ }
4404
+ async adminUpdateTokenIncentivesBothPrograms(startTime, endTime, dayNumber, tokenSupplyPerDay, secondsInADay = new BN3(86400), mint = PUMP_TOKEN_MINT, tokenProgram = TOKEN_2022_PROGRAM_ID) {
4391
4405
  return [
4392
- await this.offlinePumpProgram.methods.adminUpdateTokenIncentives(
4406
+ await this.adminUpdateTokenIncentives(
4393
4407
  startTime,
4394
4408
  endTime,
4395
- secondsInADay,
4396
4409
  dayNumber,
4397
- tokenSupplyPerDay
4398
- ).accountsPartial({
4399
- global: this.globalPda(),
4400
- authority,
4410
+ tokenSupplyPerDay,
4411
+ secondsInADay,
4401
4412
  mint,
4402
4413
  tokenProgram
4403
- }).instruction(),
4414
+ ),
4404
4415
  await this.pumpAmmAdminSdk.adminUpdateTokenIncentives(
4405
4416
  startTime,
4406
4417
  endTime,
@@ -4413,14 +4424,17 @@ var PumpSdk = class {
4413
4424
  ];
4414
4425
  }
4415
4426
  async claimTokenIncentives(user, payer, mint = PUMP_TOKEN_MINT, tokenProgram = TOKEN_2022_PROGRAM_ID) {
4427
+ return await this.offlinePumpProgram.methods.claimTokenIncentives().accountsPartial({
4428
+ user,
4429
+ payer,
4430
+ mint,
4431
+ tokenProgram
4432
+ }).instruction();
4433
+ }
4434
+ async claimTokenIncentivesBothPrograms(user, payer, mint = PUMP_TOKEN_MINT, tokenProgram = TOKEN_2022_PROGRAM_ID) {
4416
4435
  return [
4417
- await this.offlinePumpProgram.methods.claimTokenIncentives().accountsPartial({
4418
- user,
4419
- payer,
4420
- mint,
4421
- tokenProgram
4422
- }).instruction(),
4423
- ...await this.pumpAmmSdk.claimTokenIncentives(
4436
+ await this.claimTokenIncentives(user, payer, mint, tokenProgram),
4437
+ await this.pumpAmmSdk.claimTokenIncentives(
4424
4438
  user,
4425
4439
  payer,
4426
4440
  mint,
@@ -4445,10 +4459,12 @@ var PumpSdk = class {
4445
4459
  const userVolumeAccumulator = this.decodeUserVolumeAccumulator(
4446
4460
  userVolumeAccumulatorAccountInfo
4447
4461
  );
4448
- return totalUnclaimedTokens(
4449
- globalVolumeAccumulator,
4450
- userVolumeAccumulator
4451
- ).add(await this.pumpAmmSdk.getCurrentDayTokens(user));
4462
+ return totalUnclaimedTokens(globalVolumeAccumulator, userVolumeAccumulator);
4463
+ }
4464
+ async getTotalUnclaimedTokensBothPrograms(user) {
4465
+ return (await this.getTotalUnclaimedTokens(user)).add(
4466
+ await this.pumpAmmSdk.getTotalUnclaimedTokens(user)
4467
+ );
4452
4468
  }
4453
4469
  async getCurrentDayTokens(user) {
4454
4470
  const [
@@ -4467,7 +4483,10 @@ var PumpSdk = class {
4467
4483
  const userVolumeAccumulator = this.decodeUserVolumeAccumulator(
4468
4484
  userVolumeAccumulatorAccountInfo
4469
4485
  );
4470
- return currentDayTokens(globalVolumeAccumulator, userVolumeAccumulator).add(
4486
+ return currentDayTokens(globalVolumeAccumulator, userVolumeAccumulator);
4487
+ }
4488
+ async getCurrentDayTokensBothPrograms(user) {
4489
+ return (await this.getCurrentDayTokens(user)).add(
4471
4490
  await this.pumpAmmSdk.getCurrentDayTokens(user)
4472
4491
  );
4473
4492
  }
package/dist/index.d.mts CHANGED
@@ -7902,10 +7902,14 @@ declare class PumpSdk {
7902
7902
  collectCoinCreatorFeeInstructions(coinCreator: PublicKey): Promise<TransactionInstruction[]>;
7903
7903
  adminSetCoinCreatorInstructions(newCoinCreator: PublicKey, mint: PublicKey): Promise<TransactionInstruction[]>;
7904
7904
  getCreatorVaultBalance(creator: PublicKey): Promise<BN>;
7905
- adminUpdateTokenIncentives(startTime: BN, endTime: BN, dayNumber: BN, tokenSupplyPerDay: BN, secondsInADay?: BN, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction[]>;
7906
- claimTokenIncentives(user: PublicKey, payer: PublicKey, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction[]>;
7905
+ adminUpdateTokenIncentives(startTime: BN, endTime: BN, dayNumber: BN, tokenSupplyPerDay: BN, secondsInADay?: BN, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction>;
7906
+ adminUpdateTokenIncentivesBothPrograms(startTime: BN, endTime: BN, dayNumber: BN, tokenSupplyPerDay: BN, secondsInADay?: BN, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction[]>;
7907
+ claimTokenIncentives(user: PublicKey, payer: PublicKey, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction>;
7908
+ claimTokenIncentivesBothPrograms(user: PublicKey, payer: PublicKey, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction[]>;
7907
7909
  getTotalUnclaimedTokens(user: PublicKey): Promise<BN>;
7910
+ getTotalUnclaimedTokensBothPrograms(user: PublicKey): Promise<BN>;
7908
7911
  getCurrentDayTokens(user: PublicKey): Promise<BN>;
7912
+ getCurrentDayTokensBothPrograms(user: PublicKey): Promise<BN>;
7909
7913
  }
7910
7914
 
7911
7915
  declare function totalUnclaimedTokens(globalVolumeAccumulator: GlobalVolumeAccumulator, userVolumeAccumulator: UserVolumeAccumulator, currentTimestamp?: number): BN;
package/dist/index.d.ts CHANGED
@@ -7902,10 +7902,14 @@ declare class PumpSdk {
7902
7902
  collectCoinCreatorFeeInstructions(coinCreator: PublicKey): Promise<TransactionInstruction[]>;
7903
7903
  adminSetCoinCreatorInstructions(newCoinCreator: PublicKey, mint: PublicKey): Promise<TransactionInstruction[]>;
7904
7904
  getCreatorVaultBalance(creator: PublicKey): Promise<BN>;
7905
- adminUpdateTokenIncentives(startTime: BN, endTime: BN, dayNumber: BN, tokenSupplyPerDay: BN, secondsInADay?: BN, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction[]>;
7906
- claimTokenIncentives(user: PublicKey, payer: PublicKey, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction[]>;
7905
+ adminUpdateTokenIncentives(startTime: BN, endTime: BN, dayNumber: BN, tokenSupplyPerDay: BN, secondsInADay?: BN, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction>;
7906
+ adminUpdateTokenIncentivesBothPrograms(startTime: BN, endTime: BN, dayNumber: BN, tokenSupplyPerDay: BN, secondsInADay?: BN, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction[]>;
7907
+ claimTokenIncentives(user: PublicKey, payer: PublicKey, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction>;
7908
+ claimTokenIncentivesBothPrograms(user: PublicKey, payer: PublicKey, mint?: PublicKey, tokenProgram?: PublicKey): Promise<TransactionInstruction[]>;
7907
7909
  getTotalUnclaimedTokens(user: PublicKey): Promise<BN>;
7910
+ getTotalUnclaimedTokensBothPrograms(user: PublicKey): Promise<BN>;
7908
7911
  getCurrentDayTokens(user: PublicKey): Promise<BN>;
7912
+ getCurrentDayTokensBothPrograms(user: PublicKey): Promise<BN>;
7909
7913
  }
7910
7914
 
7911
7915
  declare function totalUnclaimedTokens(globalVolumeAccumulator: GlobalVolumeAccumulator, userVolumeAccumulator: UserVolumeAccumulator, currentTimestamp?: number): BN;
package/dist/index.js CHANGED
@@ -4435,19 +4435,30 @@ var PumpSdk = class {
4435
4435
  }
4436
4436
  async adminUpdateTokenIncentives(startTime, endTime, dayNumber, tokenSupplyPerDay, secondsInADay = new import_bn3.default(86400), mint = PUMP_TOKEN_MINT, tokenProgram = import_spl_token.TOKEN_2022_PROGRAM_ID) {
4437
4437
  const { authority } = await this.fetchGlobal();
4438
+ return await this.offlinePumpProgram.methods.adminUpdateTokenIncentives(
4439
+ startTime,
4440
+ endTime,
4441
+ secondsInADay,
4442
+ dayNumber,
4443
+ tokenSupplyPerDay
4444
+ ).accountsPartial({
4445
+ global: this.globalPda(),
4446
+ authority,
4447
+ mint,
4448
+ tokenProgram
4449
+ }).instruction();
4450
+ }
4451
+ async adminUpdateTokenIncentivesBothPrograms(startTime, endTime, dayNumber, tokenSupplyPerDay, secondsInADay = new import_bn3.default(86400), mint = PUMP_TOKEN_MINT, tokenProgram = import_spl_token.TOKEN_2022_PROGRAM_ID) {
4438
4452
  return [
4439
- await this.offlinePumpProgram.methods.adminUpdateTokenIncentives(
4453
+ await this.adminUpdateTokenIncentives(
4440
4454
  startTime,
4441
4455
  endTime,
4442
- secondsInADay,
4443
4456
  dayNumber,
4444
- tokenSupplyPerDay
4445
- ).accountsPartial({
4446
- global: this.globalPda(),
4447
- authority,
4457
+ tokenSupplyPerDay,
4458
+ secondsInADay,
4448
4459
  mint,
4449
4460
  tokenProgram
4450
- }).instruction(),
4461
+ ),
4451
4462
  await this.pumpAmmAdminSdk.adminUpdateTokenIncentives(
4452
4463
  startTime,
4453
4464
  endTime,
@@ -4460,14 +4471,17 @@ var PumpSdk = class {
4460
4471
  ];
4461
4472
  }
4462
4473
  async claimTokenIncentives(user, payer, mint = PUMP_TOKEN_MINT, tokenProgram = import_spl_token.TOKEN_2022_PROGRAM_ID) {
4474
+ return await this.offlinePumpProgram.methods.claimTokenIncentives().accountsPartial({
4475
+ user,
4476
+ payer,
4477
+ mint,
4478
+ tokenProgram
4479
+ }).instruction();
4480
+ }
4481
+ async claimTokenIncentivesBothPrograms(user, payer, mint = PUMP_TOKEN_MINT, tokenProgram = import_spl_token.TOKEN_2022_PROGRAM_ID) {
4463
4482
  return [
4464
- await this.offlinePumpProgram.methods.claimTokenIncentives().accountsPartial({
4465
- user,
4466
- payer,
4467
- mint,
4468
- tokenProgram
4469
- }).instruction(),
4470
- ...await this.pumpAmmSdk.claimTokenIncentives(
4483
+ await this.claimTokenIncentives(user, payer, mint, tokenProgram),
4484
+ await this.pumpAmmSdk.claimTokenIncentives(
4471
4485
  user,
4472
4486
  payer,
4473
4487
  mint,
@@ -4492,10 +4506,12 @@ var PumpSdk = class {
4492
4506
  const userVolumeAccumulator = this.decodeUserVolumeAccumulator(
4493
4507
  userVolumeAccumulatorAccountInfo
4494
4508
  );
4495
- return totalUnclaimedTokens(
4496
- globalVolumeAccumulator,
4497
- userVolumeAccumulator
4498
- ).add(await this.pumpAmmSdk.getCurrentDayTokens(user));
4509
+ return totalUnclaimedTokens(globalVolumeAccumulator, userVolumeAccumulator);
4510
+ }
4511
+ async getTotalUnclaimedTokensBothPrograms(user) {
4512
+ return (await this.getTotalUnclaimedTokens(user)).add(
4513
+ await this.pumpAmmSdk.getTotalUnclaimedTokens(user)
4514
+ );
4499
4515
  }
4500
4516
  async getCurrentDayTokens(user) {
4501
4517
  const [
@@ -4514,7 +4530,10 @@ var PumpSdk = class {
4514
4530
  const userVolumeAccumulator = this.decodeUserVolumeAccumulator(
4515
4531
  userVolumeAccumulatorAccountInfo
4516
4532
  );
4517
- return currentDayTokens(globalVolumeAccumulator, userVolumeAccumulator).add(
4533
+ return currentDayTokens(globalVolumeAccumulator, userVolumeAccumulator);
4534
+ }
4535
+ async getCurrentDayTokensBothPrograms(user) {
4536
+ return (await this.getCurrentDayTokens(user)).add(
4518
4537
  await this.pumpAmmSdk.getCurrentDayTokens(user)
4519
4538
  );
4520
4539
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pump-fun/pump-sdk",
3
- "version": "1.8.0",
3
+ "version": "1.8.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.85",
42
+ "@pump-fun/pump-swap-sdk": "^0.0.1-beta.86",
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
@@ -52,6 +52,7 @@ export function getPumpProgram(
52
52
  export const PUMP_PROGRAM_ID = new PublicKey(
53
53
  "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P",
54
54
  );
55
+
55
56
  export const PUMP_AMM_PROGRAM_ID = new PublicKey(
56
57
  "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA",
57
58
  );
@@ -564,28 +565,48 @@ export class PumpSdk {
564
565
  endTime: BN,
565
566
  dayNumber: BN,
566
567
  tokenSupplyPerDay: BN,
567
- secondsInADay: BN = new BN(86400),
568
+ secondsInADay: BN = new BN(86_400),
568
569
  mint: PublicKey = PUMP_TOKEN_MINT,
569
570
  tokenProgram: PublicKey = TOKEN_2022_PROGRAM_ID,
570
- ): Promise<TransactionInstruction[]> {
571
+ ): Promise<TransactionInstruction> {
571
572
  const { authority } = await this.fetchGlobal();
572
573
 
574
+ return await this.offlinePumpProgram.methods
575
+ .adminUpdateTokenIncentives(
576
+ startTime,
577
+ endTime,
578
+ secondsInADay,
579
+ dayNumber,
580
+ tokenSupplyPerDay,
581
+ )
582
+ .accountsPartial({
583
+ global: this.globalPda(),
584
+ authority,
585
+ mint,
586
+ tokenProgram,
587
+ })
588
+ .instruction();
589
+ }
590
+
591
+ async adminUpdateTokenIncentivesBothPrograms(
592
+ startTime: BN,
593
+ endTime: BN,
594
+ dayNumber: BN,
595
+ tokenSupplyPerDay: BN,
596
+ secondsInADay: BN = new BN(86_400),
597
+ mint: PublicKey = PUMP_TOKEN_MINT,
598
+ tokenProgram: PublicKey = TOKEN_2022_PROGRAM_ID,
599
+ ): Promise<TransactionInstruction[]> {
573
600
  return [
574
- await this.offlinePumpProgram.methods
575
- .adminUpdateTokenIncentives(
576
- startTime,
577
- endTime,
578
- secondsInADay,
579
- dayNumber,
580
- tokenSupplyPerDay,
581
- )
582
- .accountsPartial({
583
- global: this.globalPda(),
584
- authority,
585
- mint,
586
- tokenProgram,
587
- })
588
- .instruction(),
601
+ await this.adminUpdateTokenIncentives(
602
+ startTime,
603
+ endTime,
604
+ dayNumber,
605
+ tokenSupplyPerDay,
606
+ secondsInADay,
607
+ mint,
608
+ tokenProgram,
609
+ ),
589
610
  await this.pumpAmmAdminSdk.adminUpdateTokenIncentives(
590
611
  startTime,
591
612
  endTime,
@@ -603,23 +624,32 @@ export class PumpSdk {
603
624
  payer: PublicKey,
604
625
  mint: PublicKey = PUMP_TOKEN_MINT,
605
626
  tokenProgram: PublicKey = TOKEN_2022_PROGRAM_ID,
627
+ ): Promise<TransactionInstruction> {
628
+ return await this.offlinePumpProgram.methods
629
+ .claimTokenIncentives()
630
+ .accountsPartial({
631
+ user,
632
+ payer,
633
+ mint,
634
+ tokenProgram,
635
+ })
636
+ .instruction();
637
+ }
638
+
639
+ async claimTokenIncentivesBothPrograms(
640
+ user: PublicKey,
641
+ payer: PublicKey,
642
+ mint: PublicKey = PUMP_TOKEN_MINT,
643
+ tokenProgram: PublicKey = TOKEN_2022_PROGRAM_ID,
606
644
  ): Promise<TransactionInstruction[]> {
607
645
  return [
608
- await this.offlinePumpProgram.methods
609
- .claimTokenIncentives()
610
- .accountsPartial({
611
- user,
612
- payer,
613
- mint,
614
- tokenProgram,
615
- })
616
- .instruction(),
617
- ...(await this.pumpAmmSdk.claimTokenIncentives(
646
+ await this.claimTokenIncentives(user, payer, mint, tokenProgram),
647
+ await this.pumpAmmSdk.claimTokenIncentives(
618
648
  user,
619
649
  payer,
620
650
  mint,
621
651
  tokenProgram,
622
- )),
652
+ ),
623
653
  ];
624
654
  }
625
655
 
@@ -646,10 +676,13 @@ export class PumpSdk {
646
676
  userVolumeAccumulatorAccountInfo,
647
677
  );
648
678
 
649
- return totalUnclaimedTokens(
650
- globalVolumeAccumulator,
651
- userVolumeAccumulator,
652
- ).add(await this.pumpAmmSdk.getCurrentDayTokens(user));
679
+ return totalUnclaimedTokens(globalVolumeAccumulator, userVolumeAccumulator);
680
+ }
681
+
682
+ async getTotalUnclaimedTokensBothPrograms(user: PublicKey): Promise<BN> {
683
+ return (await this.getTotalUnclaimedTokens(user)).add(
684
+ await this.pumpAmmSdk.getTotalUnclaimedTokens(user),
685
+ );
653
686
  }
654
687
 
655
688
  async getCurrentDayTokens(user: PublicKey): Promise<BN> {
@@ -675,7 +708,11 @@ export class PumpSdk {
675
708
  userVolumeAccumulatorAccountInfo,
676
709
  );
677
710
 
678
- return currentDayTokens(globalVolumeAccumulator, userVolumeAccumulator).add(
711
+ return currentDayTokens(globalVolumeAccumulator, userVolumeAccumulator);
712
+ }
713
+
714
+ async getCurrentDayTokensBothPrograms(user: PublicKey): Promise<BN> {
715
+ return (await this.getCurrentDayTokens(user)).add(
679
716
  await this.pumpAmmSdk.getCurrentDayTokens(user),
680
717
  );
681
718
  }