@drift-labs/sdk 2.65.0-beta.8 → 2.65.0-beta.9

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.65.0-beta.8
1
+ 2.65.0-beta.9
@@ -73,16 +73,20 @@ class UserMap {
73
73
  await this.subscription.subscribe();
74
74
  }
75
75
  async addPubkey(userAccountPublicKey, userAccount, slot, accountSubscription) {
76
- var _a, _b;
76
+ var _a;
77
77
  const user = new __1.User({
78
78
  driftClient: this.driftClient,
79
79
  userAccountPublicKey,
80
- accountSubscription: accountSubscription !== null && accountSubscription !== void 0 ? accountSubscription : this.driftClient.userAccountSubscriptionConfig,
80
+ accountSubscription: accountSubscription !== null && accountSubscription !== void 0 ? accountSubscription : {
81
+ type: 'custom',
82
+ // OneShotUserAccountSubscriber used here so we don't load up the RPC with AccountSubscribes
83
+ userAccountSubscriber: new __1.OneShotUserAccountSubscriber(this.driftClient.program, userAccountPublicKey, userAccount, slot, this.commitment),
84
+ },
81
85
  });
82
86
  await user.subscribe(userAccount);
83
87
  this.userMap.set(userAccountPublicKey.toString(), {
84
88
  data: user,
85
- slot: (_b = (_a = user.getUserAccountAndSlot().slot) !== null && _a !== void 0 ? _a : slot) !== null && _b !== void 0 ? _b : -1,
89
+ slot: slot !== null && slot !== void 0 ? slot : (_a = user.getUserAccountAndSlot()) === null || _a === void 0 ? void 0 : _a.slot,
86
90
  });
87
91
  }
88
92
  has(key) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.65.0-beta.8",
3
+ "version": "2.65.0-beta.9",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -16,6 +16,7 @@ import {
16
16
  BN,
17
17
  UserSubscriptionConfig,
18
18
  DataAndSlot,
19
+ OneShotUserAccountSubscriber,
19
20
  } from '..';
20
21
 
21
22
  import {
@@ -154,13 +155,22 @@ export class UserMap implements UserMapInterface {
154
155
  const user = new User({
155
156
  driftClient: this.driftClient,
156
157
  userAccountPublicKey,
157
- accountSubscription:
158
- accountSubscription ?? this.driftClient.userAccountSubscriptionConfig,
158
+ accountSubscription: accountSubscription ?? {
159
+ type: 'custom',
160
+ // OneShotUserAccountSubscriber used here so we don't load up the RPC with AccountSubscribes
161
+ userAccountSubscriber: new OneShotUserAccountSubscriber(
162
+ this.driftClient.program,
163
+ userAccountPublicKey,
164
+ userAccount,
165
+ slot,
166
+ this.commitment
167
+ ),
168
+ },
159
169
  });
160
170
  await user.subscribe(userAccount);
161
171
  this.userMap.set(userAccountPublicKey.toString(), {
162
172
  data: user,
163
- slot: user.getUserAccountAndSlot().slot ?? slot ?? -1,
173
+ slot: slot ?? user.getUserAccountAndSlot()?.slot,
164
174
  });
165
175
  }
166
176