@pump-fun/pump-sdk 1.13.0 → 1.14.0-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
@@ -4710,13 +4710,23 @@ var PumpSdk = class {
4710
4710
  );
4711
4711
  }
4712
4712
  async fetchUserVolumeAccumulator(user) {
4713
- return await this.pumpProgram.account.userVolumeAccumulator.fetch(
4713
+ return await this.pumpProgram.account.userVolumeAccumulator.fetchNullable(
4714
4714
  userVolumeAccumulatorPda(user)[0]
4715
4715
  );
4716
4716
  }
4717
4717
  async fetchUserVolumeAccumulatorTotalStats(user) {
4718
- const userVolumeAccumulator = await this.fetchUserVolumeAccumulator(user);
4719
- const userVolumeAccumulatorAmm = await this.pumpAmmSdk.fetchUserVolumeAccumulator(user);
4718
+ const userVolumeAccumulator = await this.fetchUserVolumeAccumulator(
4719
+ user
4720
+ ) ?? {
4721
+ totalUnclaimedTokens: new BN3(0),
4722
+ totalClaimedTokens: new BN3(0),
4723
+ currentSolVolume: new BN3(0)
4724
+ };
4725
+ const userVolumeAccumulatorAmm = await this.pumpAmmSdk.fetchUserVolumeAccumulator(user) ?? {
4726
+ totalUnclaimedTokens: new BN3(0),
4727
+ totalClaimedTokens: new BN3(0),
4728
+ currentSolVolume: new BN3(0)
4729
+ };
4720
4730
  return {
4721
4731
  totalUnclaimedTokens: userVolumeAccumulator.totalUnclaimedTokens.add(
4722
4732
  userVolumeAccumulatorAmm.totalUnclaimedTokens
package/dist/index.d.mts CHANGED
@@ -9036,7 +9036,7 @@ declare class PumpSdk {
9036
9036
  bondingCurve: BondingCurve;
9037
9037
  }>;
9038
9038
  fetchGlobalVolumeAccumulator(): Promise<GlobalVolumeAccumulator>;
9039
- fetchUserVolumeAccumulator(user: PublicKey): Promise<UserVolumeAccumulator>;
9039
+ fetchUserVolumeAccumulator(user: PublicKey): Promise<UserVolumeAccumulator | null>;
9040
9040
  fetchUserVolumeAccumulatorTotalStats(user: PublicKey): Promise<UserVolumeAccumulatorTotalStats>;
9041
9041
  createInstruction({ mint, name, symbol, uri, creator, user, }: {
9042
9042
  mint: PublicKey;
package/dist/index.d.ts CHANGED
@@ -9036,7 +9036,7 @@ declare class PumpSdk {
9036
9036
  bondingCurve: BondingCurve;
9037
9037
  }>;
9038
9038
  fetchGlobalVolumeAccumulator(): Promise<GlobalVolumeAccumulator>;
9039
- fetchUserVolumeAccumulator(user: PublicKey): Promise<UserVolumeAccumulator>;
9039
+ fetchUserVolumeAccumulator(user: PublicKey): Promise<UserVolumeAccumulator | null>;
9040
9040
  fetchUserVolumeAccumulatorTotalStats(user: PublicKey): Promise<UserVolumeAccumulatorTotalStats>;
9041
9041
  createInstruction({ mint, name, symbol, uri, creator, user, }: {
9042
9042
  mint: PublicKey;
package/dist/index.js CHANGED
@@ -4757,13 +4757,23 @@ var PumpSdk = class {
4757
4757
  );
4758
4758
  }
4759
4759
  async fetchUserVolumeAccumulator(user) {
4760
- return await this.pumpProgram.account.userVolumeAccumulator.fetch(
4760
+ return await this.pumpProgram.account.userVolumeAccumulator.fetchNullable(
4761
4761
  userVolumeAccumulatorPda(user)[0]
4762
4762
  );
4763
4763
  }
4764
4764
  async fetchUserVolumeAccumulatorTotalStats(user) {
4765
- const userVolumeAccumulator = await this.fetchUserVolumeAccumulator(user);
4766
- const userVolumeAccumulatorAmm = await this.pumpAmmSdk.fetchUserVolumeAccumulator(user);
4765
+ const userVolumeAccumulator = await this.fetchUserVolumeAccumulator(
4766
+ user
4767
+ ) ?? {
4768
+ totalUnclaimedTokens: new import_bn3.default(0),
4769
+ totalClaimedTokens: new import_bn3.default(0),
4770
+ currentSolVolume: new import_bn3.default(0)
4771
+ };
4772
+ const userVolumeAccumulatorAmm = await this.pumpAmmSdk.fetchUserVolumeAccumulator(user) ?? {
4773
+ totalUnclaimedTokens: new import_bn3.default(0),
4774
+ totalClaimedTokens: new import_bn3.default(0),
4775
+ currentSolVolume: new import_bn3.default(0)
4776
+ };
4767
4777
  return {
4768
4778
  totalUnclaimedTokens: userVolumeAccumulator.totalUnclaimedTokens.add(
4769
4779
  userVolumeAccumulatorAmm.totalUnclaimedTokens
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pump-fun/pump-sdk",
3
- "version": "1.13.0",
3
+ "version": "1.14.0-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": "^1.5.1",
42
+ "@pump-fun/pump-swap-sdk": "^1.5.2",
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
@@ -167,8 +167,8 @@ export class PumpSdk {
167
167
 
168
168
  async fetchUserVolumeAccumulator(
169
169
  user: PublicKey,
170
- ): Promise<UserVolumeAccumulator> {
171
- return await this.pumpProgram.account.userVolumeAccumulator.fetch(
170
+ ): Promise<UserVolumeAccumulator | null> {
171
+ return await this.pumpProgram.account.userVolumeAccumulator.fetchNullable(
172
172
  userVolumeAccumulatorPda(user)[0],
173
173
  );
174
174
  }
@@ -176,9 +176,20 @@ export class PumpSdk {
176
176
  async fetchUserVolumeAccumulatorTotalStats(
177
177
  user: PublicKey,
178
178
  ): Promise<UserVolumeAccumulatorTotalStats> {
179
- const userVolumeAccumulator = await this.fetchUserVolumeAccumulator(user);
179
+ const userVolumeAccumulator = (await this.fetchUserVolumeAccumulator(
180
+ user,
181
+ )) ?? {
182
+ totalUnclaimedTokens: new BN(0),
183
+ totalClaimedTokens: new BN(0),
184
+ currentSolVolume: new BN(0),
185
+ };
186
+
180
187
  const userVolumeAccumulatorAmm =
181
- await this.pumpAmmSdk.fetchUserVolumeAccumulator(user);
188
+ (await this.pumpAmmSdk.fetchUserVolumeAccumulator(user)) ?? {
189
+ totalUnclaimedTokens: new BN(0),
190
+ totalClaimedTokens: new BN(0),
191
+ currentSolVolume: new BN(0),
192
+ };
182
193
 
183
194
  return {
184
195
  totalUnclaimedTokens: userVolumeAccumulator.totalUnclaimedTokens.add(