@drift-labs/sdk 2.65.0-beta.7 → 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 +1 -1
- package/lib/constants/spotMarkets.js +1 -0
- package/lib/userMap/userMap.js +7 -3
- package/package.json +1 -1
- package/src/constants/spotMarkets.ts +3 -0
- package/src/userMap/userMap.ts +13 -3
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.65.0-beta.
|
|
1
|
+
2.65.0-beta.9
|
|
@@ -108,6 +108,7 @@ exports.MainnetSpotMarkets = [
|
|
|
108
108
|
precision: new __1.BN(10).pow(numericConstants_1.NINE),
|
|
109
109
|
precisionExp: numericConstants_1.NINE,
|
|
110
110
|
serumMarket: new web3_js_1.PublicKey('DkbVbMhFxswS32xnn1K2UY4aoBugXooBTxdzkWWDWRkH'),
|
|
111
|
+
phoenixMarket: new web3_js_1.PublicKey('5LQLfGtqcC5rm2WuGxJf4tjqYmDjsQAbKo2AMLQ8KB7p'),
|
|
111
112
|
},
|
|
112
113
|
{
|
|
113
114
|
symbol: 'PYTH',
|
package/lib/userMap/userMap.js
CHANGED
|
@@ -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
|
|
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 :
|
|
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:
|
|
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
|
@@ -137,6 +137,9 @@ export const MainnetSpotMarkets: SpotMarketConfig[] = [
|
|
|
137
137
|
precision: new BN(10).pow(NINE),
|
|
138
138
|
precisionExp: NINE,
|
|
139
139
|
serumMarket: new PublicKey('DkbVbMhFxswS32xnn1K2UY4aoBugXooBTxdzkWWDWRkH'),
|
|
140
|
+
phoenixMarket: new PublicKey(
|
|
141
|
+
'5LQLfGtqcC5rm2WuGxJf4tjqYmDjsQAbKo2AMLQ8KB7p'
|
|
142
|
+
),
|
|
140
143
|
},
|
|
141
144
|
{
|
|
142
145
|
symbol: 'PYTH',
|
package/src/userMap/userMap.ts
CHANGED
|
@@ -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
|
-
|
|
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()
|
|
173
|
+
slot: slot ?? user.getUserAccountAndSlot()?.slot,
|
|
164
174
|
});
|
|
165
175
|
}
|
|
166
176
|
|