@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 +1 -1
- package/lib/driftClient.js +12 -10
- package/package.json +1 -1
- package/src/driftClient.ts +14 -12
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.63.0-beta.
|
|
1
|
+
2.63.0-beta.3
|
package/lib/driftClient.js
CHANGED
|
@@ -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
package/src/driftClient.ts
CHANGED
|
@@ -586,23 +586,25 @@ export class DriftClient {
|
|
|
586
586
|
? new Map([[this.authority.toString(), subAccountIds]])
|
|
587
587
|
: new Map<string, number[]>();
|
|
588
588
|
|
|
589
|
-
|
|
589
|
+
/* Reset user stats account */
|
|
590
|
+
if (this.userStats?.isSubscribed) {
|
|
591
|
+
await this.userStats.unsubscribe();
|
|
592
|
+
}
|
|
590
593
|
|
|
591
|
-
|
|
592
|
-
await Promise.all(this.unsubscribeUsers());
|
|
594
|
+
this.userStats = undefined;
|
|
593
595
|
|
|
594
|
-
|
|
595
|
-
|
|
596
|
+
this.userStats = new UserStats({
|
|
597
|
+
driftClient: this,
|
|
598
|
+
userStatsAccountPublicKey: this.getUserStatsAccountPublicKey(),
|
|
599
|
+
accountSubscription: this.userStatsAccountSubscriptionConfig,
|
|
600
|
+
});
|
|
596
601
|
|
|
597
|
-
|
|
598
|
-
driftClient: this,
|
|
599
|
-
userStatsAccountPublicKey: this.getUserStatsAccountPublicKey(),
|
|
600
|
-
accountSubscription: this.userStatsAccountSubscriptionConfig,
|
|
601
|
-
});
|
|
602
|
+
await this.userStats.subscribe();
|
|
602
603
|
|
|
603
|
-
|
|
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
|
}
|