@drift-labs/sdk 2.63.0-beta.2 → 2.63.0-beta.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/VERSION CHANGED
@@ -1 +1 @@
1
- 2.63.0-beta.2
1
+ 2.63.0-beta.3
@@ -304,7 +304,7 @@ class DriftClient {
304
304
  * @param includeDelegates
305
305
  */
306
306
  async updateWallet(newWallet, subAccountIds, activeSubAccountId, includeDelegates, authoritySubaccountMap) {
307
- var _a, _b;
307
+ var _a, _b, _c;
308
308
  const newProvider = new anchor_1.AnchorProvider(this.connection,
309
309
  // @ts-ignore
310
310
  newWallet, this.opts);
@@ -337,18 +337,20 @@ class DriftClient {
337
337
  : subAccountIds
338
338
  ? new Map([[this.authority.toString(), subAccountIds]])
339
339
  : new Map();
340
+ /* Reset user stats account */
341
+ if ((_c = this.userStats) === null || _c === void 0 ? void 0 : _c.isSubscribed) {
342
+ await this.userStats.unsubscribe();
343
+ }
344
+ this.userStats = undefined;
345
+ this.userStats = new userStats_1.UserStats({
346
+ driftClient: this,
347
+ userStatsAccountPublicKey: this.getUserStatsAccountPublicKey(),
348
+ accountSubscription: this.userStatsAccountSubscriptionConfig,
349
+ });
350
+ await this.userStats.subscribe();
340
351
  let success = true;
341
352
  if (this.isSubscribed) {
342
353
  await Promise.all(this.unsubscribeUsers());
343
- if (this.userStats) {
344
- await this.userStats.unsubscribe();
345
- this.userStats = new userStats_1.UserStats({
346
- driftClient: this,
347
- userStatsAccountPublicKey: this.getUserStatsAccountPublicKey(),
348
- accountSubscription: this.userStatsAccountSubscriptionConfig,
349
- });
350
- await this.userStats.subscribe();
351
- }
352
354
  this.users.clear();
353
355
  success = await this.addAndSubscribeToUsers();
354
356
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.63.0-beta.2",
3
+ "version": "2.63.0-beta.3",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -586,23 +586,25 @@ export class DriftClient {
586
586
  ? new Map([[this.authority.toString(), subAccountIds]])
587
587
  : new Map<string, number[]>();
588
588
 
589
- let success = true;
589
+ /* Reset user stats account */
590
+ if (this.userStats?.isSubscribed) {
591
+ await this.userStats.unsubscribe();
592
+ }
590
593
 
591
- if (this.isSubscribed) {
592
- await Promise.all(this.unsubscribeUsers());
594
+ this.userStats = undefined;
593
595
 
594
- if (this.userStats) {
595
- await this.userStats.unsubscribe();
596
+ this.userStats = new UserStats({
597
+ driftClient: this,
598
+ userStatsAccountPublicKey: this.getUserStatsAccountPublicKey(),
599
+ accountSubscription: this.userStatsAccountSubscriptionConfig,
600
+ });
596
601
 
597
- this.userStats = new UserStats({
598
- driftClient: this,
599
- userStatsAccountPublicKey: this.getUserStatsAccountPublicKey(),
600
- accountSubscription: this.userStatsAccountSubscriptionConfig,
601
- });
602
+ await this.userStats.subscribe();
602
603
 
603
- await this.userStats.subscribe();
604
- }
604
+ let success = true;
605
605
 
606
+ if (this.isSubscribed) {
607
+ await Promise.all(this.unsubscribeUsers());
606
608
  this.users.clear();
607
609
  success = await this.addAndSubscribeToUsers();
608
610
  }