@pump-fun/pump-sdk 1.18.2 → 1.18.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/esm/index.js CHANGED
@@ -4777,8 +4777,9 @@ function getBuyTokenAmountFromSolAmount({
4777
4777
  return new BN(0);
4778
4778
  }
4779
4779
  let isNewBondingCurve = false;
4780
- if (bondingCurve === null) {
4780
+ if (bondingCurve === null || mintSupply === null) {
4781
4781
  bondingCurve = newBondingCurve(global);
4782
+ mintSupply = global.tokenTotalSupply;
4782
4783
  isNewBondingCurve = true;
4783
4784
  }
4784
4785
  if (bondingCurve.virtualTokenReserves.eq(new BN(0))) {
@@ -4814,8 +4815,9 @@ function getBuySolAmountFromTokenAmount({
4814
4815
  return new BN(0);
4815
4816
  }
4816
4817
  let isNewBondingCurve = false;
4817
- if (bondingCurve === null) {
4818
+ if (bondingCurve === null || mintSupply === null) {
4818
4819
  bondingCurve = newBondingCurve(global);
4820
+ mintSupply = global.tokenTotalSupply;
4819
4821
  isNewBondingCurve = true;
4820
4822
  }
4821
4823
  if (bondingCurve.virtualTokenReserves.eq(new BN(0))) {
@@ -4935,7 +4937,7 @@ function computeFeesBps({
4935
4937
  virtualSolReserves,
4936
4938
  virtualTokenReserves
4937
4939
  }) {
4938
- if (feeConfig != null && mintSupply != null) {
4940
+ if (feeConfig != null) {
4939
4941
  const marketCap = bondingCurveMarketCap({
4940
4942
  mintSupply,
4941
4943
  virtualSolReserves,
package/dist/index.d.mts CHANGED
@@ -9579,7 +9579,7 @@ declare function getBuySolAmountFromTokenAmount({ global, feeConfig, mintSupply,
9579
9579
  declare function getSellSolAmountFromTokenAmount({ global, feeConfig, mintSupply, bondingCurve, amount, }: {
9580
9580
  global: Global;
9581
9581
  feeConfig: FeeConfig | null;
9582
- mintSupply: BN | null;
9582
+ mintSupply: BN;
9583
9583
  bondingCurve: BondingCurve;
9584
9584
  amount: BN;
9585
9585
  }): BN;
package/dist/index.d.ts CHANGED
@@ -9579,7 +9579,7 @@ declare function getBuySolAmountFromTokenAmount({ global, feeConfig, mintSupply,
9579
9579
  declare function getSellSolAmountFromTokenAmount({ global, feeConfig, mintSupply, bondingCurve, amount, }: {
9580
9580
  global: Global;
9581
9581
  feeConfig: FeeConfig | null;
9582
- mintSupply: BN | null;
9582
+ mintSupply: BN;
9583
9583
  bondingCurve: BondingCurve;
9584
9584
  amount: BN;
9585
9585
  }): BN;
package/dist/index.js CHANGED
@@ -4838,8 +4838,9 @@ function getBuyTokenAmountFromSolAmount({
4838
4838
  return new import_bn.default(0);
4839
4839
  }
4840
4840
  let isNewBondingCurve = false;
4841
- if (bondingCurve === null) {
4841
+ if (bondingCurve === null || mintSupply === null) {
4842
4842
  bondingCurve = newBondingCurve(global);
4843
+ mintSupply = global.tokenTotalSupply;
4843
4844
  isNewBondingCurve = true;
4844
4845
  }
4845
4846
  if (bondingCurve.virtualTokenReserves.eq(new import_bn.default(0))) {
@@ -4875,8 +4876,9 @@ function getBuySolAmountFromTokenAmount({
4875
4876
  return new import_bn.default(0);
4876
4877
  }
4877
4878
  let isNewBondingCurve = false;
4878
- if (bondingCurve === null) {
4879
+ if (bondingCurve === null || mintSupply === null) {
4879
4880
  bondingCurve = newBondingCurve(global);
4881
+ mintSupply = global.tokenTotalSupply;
4880
4882
  isNewBondingCurve = true;
4881
4883
  }
4882
4884
  if (bondingCurve.virtualTokenReserves.eq(new import_bn.default(0))) {
@@ -4996,7 +4998,7 @@ function computeFeesBps({
4996
4998
  virtualSolReserves,
4997
4999
  virtualTokenReserves
4998
5000
  }) {
4999
- if (feeConfig != null && mintSupply != null) {
5001
+ if (feeConfig != null) {
5000
5002
  const marketCap = bondingCurveMarketCap({
5001
5003
  mintSupply,
5002
5004
  virtualSolReserves,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pump-fun/pump-sdk",
3
- "version": "1.18.2",
3
+ "version": "1.18.3",
4
4
  "description": "Pump Bonding Curve SDK",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/pump-fun/pump-sdk#readme",
@@ -77,8 +77,9 @@ export function getBuyTokenAmountFromSolAmount({
77
77
 
78
78
  let isNewBondingCurve = false;
79
79
 
80
- if (bondingCurve === null) {
80
+ if (bondingCurve === null || mintSupply === null) {
81
81
  bondingCurve = newBondingCurve(global);
82
+ mintSupply = global.tokenTotalSupply;
82
83
  isNewBondingCurve = true;
83
84
  }
84
85
 
@@ -132,8 +133,9 @@ export function getBuySolAmountFromTokenAmount({
132
133
 
133
134
  let isNewBondingCurve = false;
134
135
 
135
- if (bondingCurve === null) {
136
+ if (bondingCurve === null || mintSupply === null) {
136
137
  bondingCurve = newBondingCurve(global);
138
+ mintSupply = global.tokenTotalSupply;
137
139
  isNewBondingCurve = true;
138
140
  }
139
141
 
@@ -169,7 +171,7 @@ export function getSellSolAmountFromTokenAmount({
169
171
  }: {
170
172
  global: Global;
171
173
  feeConfig: FeeConfig | null;
172
- mintSupply: BN | null;
174
+ mintSupply: BN;
173
175
  bondingCurve: BondingCurve;
174
176
  amount: BN;
175
177
  }): BN {
package/src/fees.ts CHANGED
@@ -41,7 +41,7 @@ export function getFee({
41
41
  }: {
42
42
  global: Global;
43
43
  feeConfig: FeeConfig | null;
44
- mintSupply: BN | null;
44
+ mintSupply: BN;
45
45
  bondingCurve: BondingCurve;
46
46
  amount: BN;
47
47
  isNewBondingCurve: boolean;
@@ -69,11 +69,11 @@ export function computeFeesBps({
69
69
  }: {
70
70
  global: Global;
71
71
  feeConfig: FeeConfig | null;
72
- mintSupply: BN | null;
72
+ mintSupply: BN;
73
73
  virtualSolReserves: BN;
74
74
  virtualTokenReserves: BN;
75
75
  }): CalculatedFeesBps {
76
- if (feeConfig != null && mintSupply != null) {
76
+ if (feeConfig != null) {
77
77
  const marketCap = bondingCurveMarketCap({
78
78
  mintSupply,
79
79
  virtualSolReserves,