@pump-fun/pump-sdk 1.17.6 → 1.18.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.
package/dist/esm/index.js CHANGED
@@ -657,7 +657,8 @@ var pump_default = {
657
657
  }
658
658
  },
659
659
  {
660
- name: "program"
660
+ name: "program",
661
+ address: "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"
661
662
  },
662
663
  {
663
664
  name: "global_volume_accumulator",
@@ -736,6 +737,75 @@ var pump_default = {
736
737
  }
737
738
  ]
738
739
  }
740
+ },
741
+ {
742
+ name: "fee_config",
743
+ optional: true,
744
+ pda: {
745
+ seeds: [
746
+ {
747
+ kind: "const",
748
+ value: [
749
+ 102,
750
+ 101,
751
+ 101,
752
+ 95,
753
+ 99,
754
+ 111,
755
+ 110,
756
+ 102,
757
+ 105,
758
+ 103
759
+ ]
760
+ },
761
+ {
762
+ kind: "const",
763
+ value: [
764
+ 1,
765
+ 86,
766
+ 224,
767
+ 246,
768
+ 147,
769
+ 102,
770
+ 90,
771
+ 207,
772
+ 68,
773
+ 219,
774
+ 21,
775
+ 104,
776
+ 191,
777
+ 23,
778
+ 91,
779
+ 170,
780
+ 81,
781
+ 137,
782
+ 203,
783
+ 151,
784
+ 245,
785
+ 210,
786
+ 255,
787
+ 59,
788
+ 101,
789
+ 93,
790
+ 43,
791
+ 182,
792
+ 253,
793
+ 109,
794
+ 24,
795
+ 176
796
+ ]
797
+ }
798
+ ],
799
+ program: {
800
+ kind: "account",
801
+ path: "fee_program"
802
+ }
803
+ }
804
+ },
805
+ {
806
+ name: "fee_program",
807
+ optional: true,
808
+ address: "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ"
739
809
  }
740
810
  ],
741
811
  args: [
@@ -1011,7 +1081,8 @@ var pump_default = {
1011
1081
  }
1012
1082
  },
1013
1083
  {
1014
- name: "program"
1084
+ name: "program",
1085
+ address: "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"
1015
1086
  },
1016
1087
  {
1017
1088
  name: "payer",
@@ -2493,7 +2564,77 @@ var pump_default = {
2493
2564
  }
2494
2565
  },
2495
2566
  {
2496
- name: "program"
2567
+ name: "program",
2568
+ address: "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"
2569
+ },
2570
+ {
2571
+ name: "fee_config",
2572
+ optional: true,
2573
+ pda: {
2574
+ seeds: [
2575
+ {
2576
+ kind: "const",
2577
+ value: [
2578
+ 102,
2579
+ 101,
2580
+ 101,
2581
+ 95,
2582
+ 99,
2583
+ 111,
2584
+ 110,
2585
+ 102,
2586
+ 105,
2587
+ 103
2588
+ ]
2589
+ },
2590
+ {
2591
+ kind: "const",
2592
+ value: [
2593
+ 1,
2594
+ 86,
2595
+ 224,
2596
+ 246,
2597
+ 147,
2598
+ 102,
2599
+ 90,
2600
+ 207,
2601
+ 68,
2602
+ 219,
2603
+ 21,
2604
+ 104,
2605
+ 191,
2606
+ 23,
2607
+ 91,
2608
+ 170,
2609
+ 81,
2610
+ 137,
2611
+ 203,
2612
+ 151,
2613
+ 245,
2614
+ 210,
2615
+ 255,
2616
+ 59,
2617
+ 101,
2618
+ 93,
2619
+ 43,
2620
+ 182,
2621
+ 253,
2622
+ 109,
2623
+ 24,
2624
+ 176
2625
+ ]
2626
+ }
2627
+ ],
2628
+ program: {
2629
+ kind: "account",
2630
+ path: "fee_program"
2631
+ }
2632
+ }
2633
+ },
2634
+ {
2635
+ name: "fee_program",
2636
+ optional: true,
2637
+ address: "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ"
2497
2638
  }
2498
2639
  ],
2499
2640
  args: [
@@ -3244,6 +3385,19 @@ var pump_default = {
3244
3385
  96
3245
3386
  ]
3246
3387
  },
3388
+ {
3389
+ name: "FeeConfig",
3390
+ discriminator: [
3391
+ 143,
3392
+ 52,
3393
+ 146,
3394
+ 187,
3395
+ 219,
3396
+ 123,
3397
+ 76,
3398
+ 155
3399
+ ]
3400
+ },
3247
3401
  {
3248
3402
  name: "Global",
3249
3403
  discriminator: [
@@ -4049,6 +4203,80 @@ var pump_default = {
4049
4203
  ]
4050
4204
  }
4051
4205
  },
4206
+ {
4207
+ name: "FeeConfig",
4208
+ type: {
4209
+ kind: "struct",
4210
+ fields: [
4211
+ {
4212
+ name: "bump",
4213
+ type: "u8"
4214
+ },
4215
+ {
4216
+ name: "admin",
4217
+ type: "pubkey"
4218
+ },
4219
+ {
4220
+ name: "flat_fees",
4221
+ type: {
4222
+ defined: {
4223
+ name: "Fees"
4224
+ }
4225
+ }
4226
+ },
4227
+ {
4228
+ name: "fee_tiers",
4229
+ type: {
4230
+ vec: {
4231
+ defined: {
4232
+ name: "FeeTier"
4233
+ }
4234
+ }
4235
+ }
4236
+ }
4237
+ ]
4238
+ }
4239
+ },
4240
+ {
4241
+ name: "FeeTier",
4242
+ type: {
4243
+ kind: "struct",
4244
+ fields: [
4245
+ {
4246
+ name: "market_cap_lamports_threshold",
4247
+ type: "u128"
4248
+ },
4249
+ {
4250
+ name: "fees",
4251
+ type: {
4252
+ defined: {
4253
+ name: "Fees"
4254
+ }
4255
+ }
4256
+ }
4257
+ ]
4258
+ }
4259
+ },
4260
+ {
4261
+ name: "Fees",
4262
+ type: {
4263
+ kind: "struct",
4264
+ fields: [
4265
+ {
4266
+ name: "lp_fee_bps",
4267
+ type: "u64"
4268
+ },
4269
+ {
4270
+ name: "protocol_fee_bps",
4271
+ type: "u64"
4272
+ },
4273
+ {
4274
+ name: "creator_fee_bps",
4275
+ type: "u64"
4276
+ }
4277
+ ]
4278
+ }
4279
+ },
4052
4280
  {
4053
4281
  name: "Global",
4054
4282
  type: {
@@ -4499,20 +4727,13 @@ var pump_default = {
4499
4727
  ]
4500
4728
  };
4501
4729
 
4730
+ // src/fees.ts
4731
+ import BN2 from "bn.js";
4732
+ import { PublicKey as PublicKey2 } from "@solana/web3.js";
4733
+
4502
4734
  // src/bondingCurve.ts
4503
- import { PublicKey } from "@solana/web3.js";
4504
4735
  import BN from "bn.js";
4505
- function getFee(global, bondingCurve, amount, isNewBondingCurve) {
4506
- return computeFee(amount, global.feeBasisPoints).add(
4507
- isNewBondingCurve || !PublicKey.default.equals(bondingCurve.creator) ? computeFee(amount, global.creatorFeeBasisPoints) : new BN(0)
4508
- );
4509
- }
4510
- function computeFee(amount, feeBasisPoints) {
4511
- return ceilDiv(amount.mul(feeBasisPoints), new BN(1e4));
4512
- }
4513
- function ceilDiv(a, b) {
4514
- return a.add(b.subn(1)).div(b);
4515
- }
4736
+ import { PublicKey } from "@solana/web3.js";
4516
4737
  function newBondingCurve(global) {
4517
4738
  return {
4518
4739
  virtualTokenReserves: global.initialVirtualTokenReserves,
@@ -4545,7 +4766,13 @@ function getSellSolAmountFromTokenAmountQuote({
4545
4766
  }) {
4546
4767
  return inputAmount.mul(virtualSolReserves).div(virtualTokenReserves.add(inputAmount));
4547
4768
  }
4548
- function getBuyTokenAmountFromSolAmount(global, bondingCurve, amount) {
4769
+ function getBuyTokenAmountFromSolAmount({
4770
+ global,
4771
+ feeConfig,
4772
+ mintSupply,
4773
+ bondingCurve,
4774
+ amount
4775
+ }) {
4549
4776
  if (amount.eq(new BN(0))) {
4550
4777
  return new BN(0);
4551
4778
  }
@@ -4557,8 +4784,16 @@ function getBuyTokenAmountFromSolAmount(global, bondingCurve, amount) {
4557
4784
  if (bondingCurve.virtualTokenReserves.eq(new BN(0))) {
4558
4785
  return new BN(0);
4559
4786
  }
4560
- const totalFeeBasisPoints = global.feeBasisPoints.add(
4561
- isNewBondingCurve || !PublicKey.default.equals(bondingCurve.creator) ? global.creatorFeeBasisPoints : new BN(0)
4787
+ const { virtualSolReserves, virtualTokenReserves } = bondingCurve;
4788
+ const { protocolFeeBps, creatorFeeBps } = computeFeesBps({
4789
+ global,
4790
+ feeConfig,
4791
+ mintSupply,
4792
+ virtualSolReserves,
4793
+ virtualTokenReserves
4794
+ });
4795
+ const totalFeeBasisPoints = protocolFeeBps.add(
4796
+ isNewBondingCurve || !PublicKey.default.equals(bondingCurve.creator) ? creatorFeeBps : new BN(0)
4562
4797
  );
4563
4798
  const inputAmount = amount.muln(1e4).div(totalFeeBasisPoints.addn(1e4));
4564
4799
  const tokensReceived = getBuyTokenAmountFromSolAmountQuote({
@@ -4568,7 +4803,13 @@ function getBuyTokenAmountFromSolAmount(global, bondingCurve, amount) {
4568
4803
  });
4569
4804
  return BN.min(tokensReceived, bondingCurve.realTokenReserves);
4570
4805
  }
4571
- function getBuySolAmountFromTokenAmount(global, bondingCurve, amount) {
4806
+ function getBuySolAmountFromTokenAmount({
4807
+ global,
4808
+ feeConfig,
4809
+ mintSupply,
4810
+ bondingCurve,
4811
+ amount
4812
+ }) {
4572
4813
  if (amount.eq(new BN(0))) {
4573
4814
  return new BN(0);
4574
4815
  }
@@ -4586,9 +4827,22 @@ function getBuySolAmountFromTokenAmount(global, bondingCurve, amount) {
4586
4827
  virtualTokenReserves: bondingCurve.virtualTokenReserves,
4587
4828
  virtualSolReserves: bondingCurve.virtualSolReserves
4588
4829
  });
4589
- return solCost.add(getFee(global, bondingCurve, solCost, isNewBondingCurve));
4830
+ return solCost.add(getFee({
4831
+ global,
4832
+ feeConfig,
4833
+ mintSupply,
4834
+ bondingCurve,
4835
+ amount: solCost,
4836
+ isNewBondingCurve
4837
+ }));
4590
4838
  }
4591
- function getSellSolAmountFromTokenAmount(global, bondingCurve, amount) {
4839
+ function getSellSolAmountFromTokenAmount({
4840
+ global,
4841
+ feeConfig,
4842
+ mintSupply,
4843
+ bondingCurve,
4844
+ amount
4845
+ }) {
4592
4846
  if (amount.eq(new BN(0))) {
4593
4847
  return new BN(0);
4594
4848
  }
@@ -4600,7 +4854,14 @@ function getSellSolAmountFromTokenAmount(global, bondingCurve, amount) {
4600
4854
  virtualTokenReserves: bondingCurve.virtualTokenReserves,
4601
4855
  virtualSolReserves: bondingCurve.virtualSolReserves
4602
4856
  });
4603
- return solCost.sub(getFee(global, bondingCurve, solCost, false));
4857
+ return solCost.sub(getFee({
4858
+ global,
4859
+ feeConfig,
4860
+ mintSupply,
4861
+ bondingCurve,
4862
+ amount: solCost,
4863
+ isNewBondingCurve: false
4864
+ }));
4604
4865
  }
4605
4866
  function getStaticRandomFeeRecipient() {
4606
4867
  const randomIndex = Math.floor(Math.random() * CURRENT_FEE_RECIPIENTS.length);
@@ -4616,9 +4877,101 @@ var CURRENT_FEE_RECIPIENTS = [
4616
4877
  "FWsW1xNtWscwNmKv6wVsU1iTzRN6wmmk3MjxRP5tT7hz",
4617
4878
  "G5UZAVbAf46s7cKWoyKu8kYTip9DGTpbLZ2qa9Aq69dP"
4618
4879
  ];
4880
+ function bondingCurveMarketCap({
4881
+ mintSupply,
4882
+ virtualSolReserves,
4883
+ virtualTokenReserves
4884
+ }) {
4885
+ if (virtualTokenReserves.isZero()) {
4886
+ throw new Error("Division by zero: virtual token reserves cannot be zero");
4887
+ }
4888
+ return virtualSolReserves.mul(mintSupply).div(virtualTokenReserves);
4889
+ }
4890
+
4891
+ // src/fees.ts
4892
+ function createFeeConfigFromGlobalConfig(globalConfig) {
4893
+ let fees = {
4894
+ lpFeeBps: new BN2(0),
4895
+ // unused for pump
4896
+ protocolFeeBps: globalConfig.feeBasisPoints,
4897
+ creatorFeeBps: globalConfig.creatorFeeBasisPoints
4898
+ };
4899
+ return {
4900
+ admin: globalConfig.authority,
4901
+ flatFees: fees,
4902
+ feeTiers: [
4903
+ {
4904
+ marketCapLamportsThreshold: new BN2(0),
4905
+ // unused for pump
4906
+ fees
4907
+ }
4908
+ ]
4909
+ };
4910
+ }
4911
+ function getFee({
4912
+ global,
4913
+ feeConfig,
4914
+ mintSupply,
4915
+ bondingCurve,
4916
+ amount,
4917
+ isNewBondingCurve
4918
+ }) {
4919
+ const { virtualSolReserves, virtualTokenReserves } = bondingCurve;
4920
+ const { protocolFeeBps, creatorFeeBps } = computeFeesBps({
4921
+ global,
4922
+ feeConfig,
4923
+ mintSupply,
4924
+ virtualSolReserves,
4925
+ virtualTokenReserves
4926
+ });
4927
+ return fee(amount, protocolFeeBps).add(
4928
+ isNewBondingCurve || !PublicKey2.default.equals(bondingCurve.creator) ? fee(amount, creatorFeeBps) : new BN2(0)
4929
+ );
4930
+ }
4931
+ function computeFeesBps({
4932
+ global,
4933
+ feeConfig,
4934
+ mintSupply,
4935
+ virtualSolReserves,
4936
+ virtualTokenReserves
4937
+ }) {
4938
+ if (feeConfig != null && mintSupply != null) {
4939
+ const marketCap = bondingCurveMarketCap({
4940
+ mintSupply,
4941
+ virtualSolReserves,
4942
+ virtualTokenReserves
4943
+ });
4944
+ return calculateFeeTier({
4945
+ feeTiers: feeConfig.feeTiers,
4946
+ marketCap
4947
+ });
4948
+ }
4949
+ return {
4950
+ protocolFeeBps: global.feeBasisPoints,
4951
+ creatorFeeBps: global.creatorFeeBasisPoints
4952
+ };
4953
+ }
4954
+ function calculateFeeTier({ feeTiers, marketCap }) {
4955
+ const firstTier = feeTiers[0];
4956
+ if (marketCap.lt(firstTier.marketCapLamportsThreshold)) {
4957
+ return firstTier.fees;
4958
+ }
4959
+ for (const tier of feeTiers.slice().reverse()) {
4960
+ if (marketCap.gte(tier.marketCapLamportsThreshold)) {
4961
+ return tier.fees;
4962
+ }
4963
+ }
4964
+ return firstTier.fees;
4965
+ }
4966
+ function fee(amount, feeBasisPoints) {
4967
+ return ceilDiv(amount.mul(feeBasisPoints), new BN2(1e4));
4968
+ }
4969
+ function ceilDiv(a, b) {
4970
+ return a.add(b.subn(1)).div(b);
4971
+ }
4619
4972
 
4620
4973
  // src/pda.ts
4621
- import { PublicKey as PublicKey3 } from "@solana/web3.js";
4974
+ import { PublicKey as PublicKey4 } from "@solana/web3.js";
4622
4975
  import { NATIVE_MINT as NATIVE_MINT2 } from "@solana/spl-token";
4623
4976
  import { poolPda } from "@pump-fun/pump-swap-sdk";
4624
4977
 
@@ -4633,12 +4986,12 @@ import {
4633
4986
  TOKEN_PROGRAM_ID
4634
4987
  } from "@solana/spl-token";
4635
4988
  import {
4636
- PublicKey as PublicKey2
4989
+ PublicKey as PublicKey3
4637
4990
  } from "@solana/web3.js";
4638
- import BN3 from "bn.js";
4991
+ import BN4 from "bn.js";
4639
4992
 
4640
4993
  // src/tokenIncentives.ts
4641
- import BN2 from "bn.js";
4994
+ import BN3 from "bn.js";
4642
4995
  function totalUnclaimedTokens(globalVolumeAccumulator, userVolumeAccumulator, currentTimestamp = Date.now() / 1e3) {
4643
4996
  const { startTime, endTime, secondsInADay, totalTokenSupply, solVolumes } = globalVolumeAccumulator;
4644
4997
  const { totalUnclaimedTokens: totalUnclaimedTokens2, currentSolVolume, lastUpdateTimestamp } = userVolumeAccumulator;
@@ -4646,7 +4999,7 @@ function totalUnclaimedTokens(globalVolumeAccumulator, userVolumeAccumulator, cu
4646
4999
  if (startTime.eqn(0) || endTime.eqn(0) || secondsInADay.eqn(0)) {
4647
5000
  return result;
4648
5001
  }
4649
- let currentTimestampBn = new BN2(currentTimestamp);
5002
+ let currentTimestampBn = new BN3(currentTimestamp);
4650
5003
  if (currentTimestampBn.lt(startTime)) {
4651
5004
  return result;
4652
5005
  }
@@ -4675,27 +5028,27 @@ function currentDayTokens(globalVolumeAccumulator, userVolumeAccumulator, curren
4675
5028
  const { startTime, endTime, secondsInADay, totalTokenSupply, solVolumes } = globalVolumeAccumulator;
4676
5029
  const { currentSolVolume, lastUpdateTimestamp } = userVolumeAccumulator;
4677
5030
  if (startTime.eqn(0) || endTime.eqn(0) || secondsInADay.eqn(0)) {
4678
- return new BN2(0);
5031
+ return new BN3(0);
4679
5032
  }
4680
- let currentTimestampBn = new BN2(currentTimestamp);
5033
+ let currentTimestampBn = new BN3(currentTimestamp);
4681
5034
  if (currentTimestampBn.lt(startTime) || currentTimestampBn.gt(endTime)) {
4682
- return new BN2(0);
5035
+ return new BN3(0);
4683
5036
  }
4684
5037
  const currentDayIndex = currentTimestampBn.sub(startTime).div(secondsInADay).toNumber();
4685
5038
  if (lastUpdateTimestamp.lt(startTime)) {
4686
- return new BN2(0);
5039
+ return new BN3(0);
4687
5040
  }
4688
5041
  const lastUpdatedIndex = lastUpdateTimestamp.sub(startTime).div(secondsInADay).toNumber();
4689
5042
  if (endTime.lt(startTime)) {
4690
- return new BN2(0);
5043
+ return new BN3(0);
4691
5044
  }
4692
5045
  if (currentDayIndex !== lastUpdatedIndex) {
4693
- return new BN2(0);
5046
+ return new BN3(0);
4694
5047
  }
4695
5048
  const currentDayTokenSupply = totalTokenSupply[currentDayIndex];
4696
5049
  const currentDaySolVolume = solVolumes[currentDayIndex];
4697
5050
  if (currentDaySolVolume.eqn(0)) {
4698
- return new BN2(0);
5051
+ return new BN3(0);
4699
5052
  }
4700
5053
  return currentSolVolume.mul(currentDayTokenSupply).div(currentDaySolVolume);
4701
5054
  }
@@ -4707,14 +5060,17 @@ function getPumpProgram(connection) {
4707
5060
  new AnchorProvider(connection, null, {})
4708
5061
  );
4709
5062
  }
4710
- var PUMP_PROGRAM_ID = new PublicKey2(
5063
+ var PUMP_PROGRAM_ID = new PublicKey3(
4711
5064
  "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"
4712
5065
  );
4713
- var PUMP_AMM_PROGRAM_ID = new PublicKey2(
5066
+ var PUMP_AMM_PROGRAM_ID = new PublicKey3(
4714
5067
  "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA"
4715
5068
  );
5069
+ var PUMP_FEE_PROGRAM_ID = new PublicKey3(
5070
+ "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ"
5071
+ );
4716
5072
  var BONDING_CURVE_NEW_SIZE = 150;
4717
- var PUMP_TOKEN_MINT = new PublicKey2(
5073
+ var PUMP_TOKEN_MINT = new PublicKey3(
4718
5074
  "pumpCmXqMfrsAkQ5r49WcJnRayYRqmXz6ae8H7H9Dfn"
4719
5075
  );
4720
5076
  var PumpSdk = class {
@@ -4734,6 +5090,12 @@ var PumpSdk = class {
4734
5090
  accountInfo.data
4735
5091
  );
4736
5092
  }
5093
+ decodeFeeConfig(accountInfo) {
5094
+ return this.offlinePumpProgram.coder.accounts.decode(
5095
+ "feeConfig",
5096
+ accountInfo.data
5097
+ );
5098
+ }
4737
5099
  decodeBondingCurve(accountInfo) {
4738
5100
  return this.offlinePumpProgram.coder.accounts.decode(
4739
5101
  "bondingCurve",
@@ -4755,6 +5117,9 @@ var PumpSdk = class {
4755
5117
  async fetchGlobal() {
4756
5118
  return await this.pumpProgram.account.global.fetch(globalPda());
4757
5119
  }
5120
+ async fetchFeeConfig() {
5121
+ return await this.pumpProgram.account.feeConfig.fetch(pumpFeeConfigPda());
5122
+ }
4758
5123
  async fetchBondingCurve(mint) {
4759
5124
  return await this.pumpProgram.account.bondingCurve.fetch(
4760
5125
  bondingCurvePda(mint)
@@ -4805,14 +5170,14 @@ var PumpSdk = class {
4805
5170
  const userVolumeAccumulator = await this.fetchUserVolumeAccumulator(
4806
5171
  user
4807
5172
  ) ?? {
4808
- totalUnclaimedTokens: new BN3(0),
4809
- totalClaimedTokens: new BN3(0),
4810
- currentSolVolume: new BN3(0)
5173
+ totalUnclaimedTokens: new BN4(0),
5174
+ totalClaimedTokens: new BN4(0),
5175
+ currentSolVolume: new BN4(0)
4811
5176
  };
4812
5177
  const userVolumeAccumulatorAmm = await this.pumpAmmSdk.fetchUserVolumeAccumulator(user) ?? {
4813
- totalUnclaimedTokens: new BN3(0),
4814
- totalClaimedTokens: new BN3(0),
4815
- currentSolVolume: new BN3(0)
5178
+ totalUnclaimedTokens: new BN4(0),
5179
+ totalClaimedTokens: new BN4(0),
5180
+ currentSolVolume: new BN4(0)
4816
5181
  };
4817
5182
  return {
4818
5183
  totalUnclaimedTokens: userVolumeAccumulator.totalUnclaimedTokens.add(
@@ -4938,7 +5303,7 @@ var PumpSdk = class {
4938
5303
  feeRecipient: getFeeRecipient(global),
4939
5304
  amount,
4940
5305
  solAmount: solAmount.add(
4941
- solAmount.mul(new BN3(Math.floor(slippage * 10))).div(new BN3(1e3))
5306
+ solAmount.mul(new BN4(Math.floor(slippage * 10))).div(new BN4(1e3))
4942
5307
  )
4943
5308
  });
4944
5309
  }
@@ -4969,7 +5334,7 @@ var PumpSdk = class {
4969
5334
  feeRecipient: getFeeRecipient(global),
4970
5335
  amount,
4971
5336
  solAmount: solAmount.sub(
4972
- solAmount.mul(new BN3(Math.floor(slippage * 10))).div(new BN3(1e3))
5337
+ solAmount.mul(new BN4(Math.floor(slippage * 10))).div(new BN4(1e3))
4973
5338
  )
4974
5339
  })
4975
5340
  );
@@ -5044,22 +5409,22 @@ var PumpSdk = class {
5044
5409
  const creatorVault = creatorVaultPda(creator);
5045
5410
  const accountInfo = await this.connection.getAccountInfo(creatorVault);
5046
5411
  if (accountInfo === null) {
5047
- return new BN3(0);
5412
+ return new BN4(0);
5048
5413
  }
5049
5414
  const rentExemptionLamports = await this.connection.getMinimumBalanceForRentExemption(
5050
5415
  accountInfo.data.length
5051
5416
  );
5052
5417
  if (accountInfo.lamports < rentExemptionLamports) {
5053
- return new BN3(0);
5418
+ return new BN4(0);
5054
5419
  }
5055
- return new BN3(accountInfo.lamports - rentExemptionLamports);
5420
+ return new BN4(accountInfo.lamports - rentExemptionLamports);
5056
5421
  }
5057
5422
  async getCreatorVaultBalanceBothPrograms(creator) {
5058
5423
  const balance = await this.getCreatorVaultBalance(creator);
5059
5424
  const ammBalance = await this.pumpAmmSdk.getCoinCreatorVaultBalance(creator);
5060
5425
  return balance.add(ammBalance);
5061
5426
  }
5062
- async adminUpdateTokenIncentives(startTime, endTime, dayNumber, tokenSupplyPerDay, secondsInADay = new BN3(86400), mint = PUMP_TOKEN_MINT, tokenProgram = TOKEN_2022_PROGRAM_ID) {
5427
+ async adminUpdateTokenIncentives(startTime, endTime, dayNumber, tokenSupplyPerDay, secondsInADay = new BN4(86400), mint = PUMP_TOKEN_MINT, tokenProgram = TOKEN_2022_PROGRAM_ID) {
5063
5428
  const { authority } = await this.fetchGlobal();
5064
5429
  return await this.offlinePumpProgram.methods.adminUpdateTokenIncentives(
5065
5430
  startTime,
@@ -5073,7 +5438,7 @@ var PumpSdk = class {
5073
5438
  tokenProgram
5074
5439
  }).instruction();
5075
5440
  }
5076
- async adminUpdateTokenIncentivesBothPrograms(startTime, endTime, dayNumber, tokenSupplyPerDay, secondsInADay = new BN3(86400), mint = PUMP_TOKEN_MINT, tokenProgram = TOKEN_2022_PROGRAM_ID) {
5441
+ async adminUpdateTokenIncentivesBothPrograms(startTime, endTime, dayNumber, tokenSupplyPerDay, secondsInADay = new BN4(86400), mint = PUMP_TOKEN_MINT, tokenProgram = TOKEN_2022_PROGRAM_ID) {
5077
5442
  return [
5078
5443
  await this.adminUpdateTokenIncentives(
5079
5444
  startTime,
@@ -5097,7 +5462,7 @@ var PumpSdk = class {
5097
5462
  }
5098
5463
  async claimTokenIncentives(user, payer) {
5099
5464
  const { mint } = await this.fetchGlobalVolumeAccumulator();
5100
- if (mint.equals(PublicKey2.default)) {
5465
+ if (mint.equals(PublicKey3.default)) {
5101
5466
  return [];
5102
5467
  }
5103
5468
  const [mintAccountInfo, userAccumulatorAccountInfo] = await this.connection.getMultipleAccountsInfo([
@@ -5134,7 +5499,7 @@ var PumpSdk = class {
5134
5499
  userVolumeAccumulatorPda(user)[0]
5135
5500
  ]);
5136
5501
  if (!globalVolumeAccumulatorAccountInfo || !userVolumeAccumulatorAccountInfo) {
5137
- return new BN3(0);
5502
+ return new BN4(0);
5138
5503
  }
5139
5504
  const globalVolumeAccumulator = this.decodeGlobalVolumeAccumulator(
5140
5505
  globalVolumeAccumulatorAccountInfo
@@ -5158,7 +5523,7 @@ var PumpSdk = class {
5158
5523
  userVolumeAccumulatorPda(user)[0]
5159
5524
  ]);
5160
5525
  if (!globalVolumeAccumulatorAccountInfo || !userVolumeAccumulatorAccountInfo) {
5161
- return new BN3(0);
5526
+ return new BN4(0);
5162
5527
  }
5163
5528
  const globalVolumeAccumulator = this.decodeGlobalVolumeAccumulator(
5164
5529
  globalVolumeAccumulatorAccountInfo
@@ -5277,28 +5642,34 @@ function getFeeRecipient(global) {
5277
5642
 
5278
5643
  // src/pda.ts
5279
5644
  function globalPda() {
5280
- const [globalPda2] = PublicKey3.findProgramAddressSync(
5645
+ const [globalPda2] = PublicKey4.findProgramAddressSync(
5281
5646
  [Buffer.from("global")],
5282
5647
  PUMP_PROGRAM_ID
5283
5648
  );
5284
5649
  return globalPda2;
5285
5650
  }
5651
+ function pumpFeeConfigPda() {
5652
+ return PublicKey4.findProgramAddressSync(
5653
+ [Buffer.from("fee_config"), PUMP_PROGRAM_ID.toBuffer()],
5654
+ PUMP_FEE_PROGRAM_ID
5655
+ )[0];
5656
+ }
5286
5657
  function bondingCurvePda(mint) {
5287
- const [bondingCurvePda2] = PublicKey3.findProgramAddressSync(
5288
- [Buffer.from("bonding-curve"), new PublicKey3(mint).toBuffer()],
5658
+ const [bondingCurvePda2] = PublicKey4.findProgramAddressSync(
5659
+ [Buffer.from("bonding-curve"), new PublicKey4(mint).toBuffer()],
5289
5660
  PUMP_PROGRAM_ID
5290
5661
  );
5291
5662
  return bondingCurvePda2;
5292
5663
  }
5293
5664
  function creatorVaultPda(creator) {
5294
- const [creatorVault] = PublicKey3.findProgramAddressSync(
5665
+ const [creatorVault] = PublicKey4.findProgramAddressSync(
5295
5666
  [Buffer.from("creator-vault"), creator.toBuffer()],
5296
5667
  PUMP_PROGRAM_ID
5297
5668
  );
5298
5669
  return creatorVault;
5299
5670
  }
5300
5671
  function pumpPoolAuthorityPda(mint) {
5301
- return PublicKey3.findProgramAddressSync(
5672
+ return PublicKey4.findProgramAddressSync(
5302
5673
  [Buffer.from("pool-authority"), mint.toBuffer()],
5303
5674
  PUMP_PROGRAM_ID
5304
5675
  );
@@ -5315,13 +5686,13 @@ function canonicalPumpPoolPda(mint) {
5315
5686
  );
5316
5687
  }
5317
5688
  function globalVolumeAccumulatorPda() {
5318
- return PublicKey3.findProgramAddressSync(
5689
+ return PublicKey4.findProgramAddressSync(
5319
5690
  [Buffer.from("global_volume_accumulator")],
5320
5691
  PUMP_PROGRAM_ID
5321
5692
  );
5322
5693
  }
5323
5694
  function userVolumeAccumulatorPda(user) {
5324
- return PublicKey3.findProgramAddressSync(
5695
+ return PublicKey4.findProgramAddressSync(
5325
5696
  [Buffer.from("user_volume_accumulator"), user.toBuffer()],
5326
5697
  PUMP_PROGRAM_ID
5327
5698
  );
@@ -5332,8 +5703,10 @@ export {
5332
5703
  PUMP_AMM_PROGRAM_ID,
5333
5704
  PUMP_PROGRAM_ID,
5334
5705
  PumpSdk,
5706
+ bondingCurveMarketCap,
5335
5707
  bondingCurvePda,
5336
5708
  canonicalPumpPoolPda,
5709
+ createFeeConfigFromGlobalConfig,
5337
5710
  creatorVaultPda,
5338
5711
  currentDayTokens,
5339
5712
  getBuySolAmountFromTokenAmount,