@drift-labs/sdk 2.48.0-beta.14 → 2.48.0-beta.16
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/accounts/bulkAccountLoader.js +1 -1
- package/lib/accounts/webSocketAccountSubscriber.js +1 -1
- package/lib/accounts/webSocketProgramAccountSubscriber.js +1 -1
- package/lib/accounts/webSocketUserAccountSubscriber.js +1 -1
- package/lib/constants/spotMarkets.js +10 -0
- package/lib/orderSubscriber/OrderSubscriber.js +1 -1
- package/package.json +1 -1
- package/src/accounts/bulkAccountLoader.ts +1 -1
- package/src/accounts/webSocketAccountSubscriber.ts +1 -1
- package/src/accounts/webSocketProgramAccountSubscriber.ts +1 -1
- package/src/accounts/webSocketUserAccountSubscriber.ts +1 -1
- package/src/constants/spotMarkets.ts +10 -0
- package/src/orderSubscriber/OrderSubscriber.ts +1 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.48.0-beta.
|
|
1
|
+
2.48.0-beta.16
|
|
@@ -139,7 +139,7 @@ class BulkAccountLoader {
|
|
|
139
139
|
accountsToLoad.forEach((accountToLoad, j) => {
|
|
140
140
|
const key = accountToLoad.publicKey.toBase58();
|
|
141
141
|
const oldRPCResponse = this.bufferAndSlotMap.get(key);
|
|
142
|
-
if (oldRPCResponse && newSlot
|
|
142
|
+
if (oldRPCResponse && newSlot < oldRPCResponse.slot) {
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
145
|
let newBuffer = undefined;
|
|
@@ -51,7 +51,7 @@ class WebSocketUserAccountSubscriber {
|
|
|
51
51
|
updateData(userAccount, slot) {
|
|
52
52
|
var _a;
|
|
53
53
|
const currentDataSlot = ((_a = this.userDataAccountSubscriber.dataAndSlot) === null || _a === void 0 ? void 0 : _a.slot) || 0;
|
|
54
|
-
if (currentDataSlot
|
|
54
|
+
if (currentDataSlot <= slot) {
|
|
55
55
|
this.userDataAccountSubscriber.setData(userAccount, slot);
|
|
56
56
|
this.eventEmitter.emit('userAccountUpdate', userAccount);
|
|
57
57
|
this.eventEmitter.emit('update');
|
|
@@ -120,6 +120,16 @@ exports.MainnetSpotMarkets = [
|
|
|
120
120
|
serumMarket: new web3_js_1.PublicKey('4E17F3BxtNVqzVsirxguuqkpYLtFgCR6NfTpccPh82WE'),
|
|
121
121
|
phoenixMarket: new web3_js_1.PublicKey('2sTMN9A1D1qeZLF95XQgJCUPiKe5DiV52jLfZGqMP46m'),
|
|
122
122
|
},
|
|
123
|
+
{
|
|
124
|
+
symbol: 'bSOL',
|
|
125
|
+
marketIndex: 8,
|
|
126
|
+
oracle: new web3_js_1.PublicKey('AFrYBhb5wKQtxRS9UA9YRS4V3dwFm7SqmS6DHKq6YVgo'),
|
|
127
|
+
oracleSource: __1.OracleSource.PYTH,
|
|
128
|
+
mint: new web3_js_1.PublicKey('bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1'),
|
|
129
|
+
precision: new __1.BN(10).pow(numericConstants_1.NINE),
|
|
130
|
+
precisionExp: numericConstants_1.NINE,
|
|
131
|
+
serumMarket: new web3_js_1.PublicKey('ARjaHVxGCQfTvvKjLd7U7srvk6orthZSE6uqWchCczZc'),
|
|
132
|
+
},
|
|
123
133
|
];
|
|
124
134
|
exports.SpotMarkets = {
|
|
125
135
|
devnet: exports.DevnetSpotMarkets,
|
|
@@ -77,7 +77,7 @@ class OrderSubscriber {
|
|
|
77
77
|
this.mostRecentSlot = slot;
|
|
78
78
|
}
|
|
79
79
|
const slotAndUserAccount = this.usersAccounts.get(key);
|
|
80
|
-
if (!slotAndUserAccount || slotAndUserAccount.slot
|
|
80
|
+
if (!slotAndUserAccount || slotAndUserAccount.slot <= slot) {
|
|
81
81
|
let userAccount;
|
|
82
82
|
// Polling leads to a lot of redundant decoding, so we only decode if data is from a fresh slot
|
|
83
83
|
if (dataType === 'raw') {
|
package/package.json
CHANGED
|
@@ -193,7 +193,7 @@ export class BulkAccountLoader {
|
|
|
193
193
|
const key = accountToLoad.publicKey.toBase58();
|
|
194
194
|
const oldRPCResponse = this.bufferAndSlotMap.get(key);
|
|
195
195
|
|
|
196
|
-
if (oldRPCResponse && newSlot
|
|
196
|
+
if (oldRPCResponse && newSlot < oldRPCResponse.slot) {
|
|
197
197
|
return;
|
|
198
198
|
}
|
|
199
199
|
|
|
@@ -94,7 +94,7 @@ export class WebSocketUserAccountSubscriber implements UserAccountSubscriber {
|
|
|
94
94
|
public updateData(userAccount: UserAccount, slot: number) {
|
|
95
95
|
const currentDataSlot =
|
|
96
96
|
this.userDataAccountSubscriber.dataAndSlot?.slot || 0;
|
|
97
|
-
if (currentDataSlot
|
|
97
|
+
if (currentDataSlot <= slot) {
|
|
98
98
|
this.userDataAccountSubscriber.setData(userAccount, slot);
|
|
99
99
|
this.eventEmitter.emit('userAccountUpdate', userAccount);
|
|
100
100
|
this.eventEmitter.emit('update');
|
|
@@ -150,6 +150,16 @@ export const MainnetSpotMarkets: SpotMarketConfig[] = [
|
|
|
150
150
|
'2sTMN9A1D1qeZLF95XQgJCUPiKe5DiV52jLfZGqMP46m'
|
|
151
151
|
),
|
|
152
152
|
},
|
|
153
|
+
{
|
|
154
|
+
symbol: 'bSOL',
|
|
155
|
+
marketIndex: 8,
|
|
156
|
+
oracle: new PublicKey('AFrYBhb5wKQtxRS9UA9YRS4V3dwFm7SqmS6DHKq6YVgo'),
|
|
157
|
+
oracleSource: OracleSource.PYTH,
|
|
158
|
+
mint: new PublicKey('bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1'),
|
|
159
|
+
precision: new BN(10).pow(NINE),
|
|
160
|
+
precisionExp: NINE,
|
|
161
|
+
serumMarket: new PublicKey('ARjaHVxGCQfTvvKjLd7U7srvk6orthZSE6uqWchCczZc'),
|
|
162
|
+
},
|
|
153
163
|
];
|
|
154
164
|
|
|
155
165
|
export const SpotMarkets: { [key in DriftEnv]: SpotMarketConfig[] } = {
|
|
@@ -116,7 +116,7 @@ export class OrderSubscriber {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
const slotAndUserAccount = this.usersAccounts.get(key);
|
|
119
|
-
if (!slotAndUserAccount || slotAndUserAccount.slot
|
|
119
|
+
if (!slotAndUserAccount || slotAndUserAccount.slot <= slot) {
|
|
120
120
|
let userAccount: UserAccount;
|
|
121
121
|
// Polling leads to a lot of redundant decoding, so we only decode if data is from a fresh slot
|
|
122
122
|
if (dataType === 'raw') {
|