@drift-labs/sdk 2.38.1-beta.1 → 2.38.1-beta.2
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.38.1-beta.
|
|
1
|
+
2.38.1-beta.2
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PollingDriftClientAccountSubscriber = void 0;
|
|
4
4
|
const types_1 = require("./types");
|
|
5
|
-
const anchor_1 = require("@coral-xyz/anchor");
|
|
6
5
|
const events_1 = require("events");
|
|
7
6
|
const pda_1 = require("../addresses/pda");
|
|
8
7
|
const utils_1 = require("./utils");
|
|
@@ -138,18 +137,7 @@ class PollingDriftClientAccountSubscriber {
|
|
|
138
137
|
accountToPoll.callbackId = await this.accountLoader.addAccount(accountToPoll.publicKey, (buffer, slot) => {
|
|
139
138
|
if (!buffer)
|
|
140
139
|
return;
|
|
141
|
-
|
|
142
|
-
try {
|
|
143
|
-
account = this.program.account[accountToPoll.key].coder.accounts.decode((0, utils_1.capitalize)(accountToPoll.key), buffer);
|
|
144
|
-
}
|
|
145
|
-
catch (e) {
|
|
146
|
-
console.error(e);
|
|
147
|
-
console.log('account key', accountToPoll.key);
|
|
148
|
-
console.log('accountToPoll.publicKey', accountToPoll.publicKey.toString());
|
|
149
|
-
console.log('buffer', buffer.toString('base64'));
|
|
150
|
-
console.log('discriminator', anchor_1.BorshAccountsCoder.accountDiscriminator((0, utils_1.capitalize)(accountToPoll.key)).toString('base64'));
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
140
|
+
const account = this.program.account[accountToPoll.key].coder.accounts.decodeUnchecked((0, utils_1.capitalize)(accountToPoll.key), buffer);
|
|
153
141
|
const dataAndSlot = {
|
|
154
142
|
data: account,
|
|
155
143
|
slot,
|
|
@@ -188,7 +176,7 @@ class PollingDriftClientAccountSubscriber {
|
|
|
188
176
|
for (const [_, accountToPoll] of this.accountsToPoll) {
|
|
189
177
|
const { buffer, slot } = this.accountLoader.getBufferAndSlot(accountToPoll.publicKey);
|
|
190
178
|
if (buffer) {
|
|
191
|
-
const account = this.program.account[accountToPoll.key].coder.accounts.
|
|
179
|
+
const account = this.program.account[accountToPoll.key].coder.accounts.decodeUnchecked((0, utils_1.capitalize)(accountToPoll.key), buffer);
|
|
192
180
|
if (accountToPoll.mapKey != undefined) {
|
|
193
181
|
this[accountToPoll.key].set(accountToPoll.mapKey, {
|
|
194
182
|
data: account,
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
NotSubscribedError,
|
|
7
7
|
OraclesToPoll,
|
|
8
8
|
} from './types';
|
|
9
|
-
import {
|
|
9
|
+
import { Program } from '@coral-xyz/anchor';
|
|
10
10
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
11
11
|
import { EventEmitter } from 'events';
|
|
12
12
|
import {
|
|
@@ -225,27 +225,9 @@ export class PollingDriftClientAccountSubscriber
|
|
|
225
225
|
(buffer: Buffer, slot: number) => {
|
|
226
226
|
if (!buffer) return;
|
|
227
227
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
accountToPoll.key
|
|
232
|
-
].coder.accounts.decode(capitalize(accountToPoll.key), buffer);
|
|
233
|
-
} catch (e) {
|
|
234
|
-
console.error(e);
|
|
235
|
-
console.log('account key', accountToPoll.key);
|
|
236
|
-
console.log(
|
|
237
|
-
'accountToPoll.publicKey',
|
|
238
|
-
accountToPoll.publicKey.toString()
|
|
239
|
-
);
|
|
240
|
-
console.log('buffer', buffer.toString('base64'));
|
|
241
|
-
console.log(
|
|
242
|
-
'discriminator',
|
|
243
|
-
BorshAccountsCoder.accountDiscriminator(
|
|
244
|
-
capitalize(accountToPoll.key)
|
|
245
|
-
).toString('base64')
|
|
246
|
-
);
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
228
|
+
const account = this.program.account[
|
|
229
|
+
accountToPoll.key
|
|
230
|
+
].coder.accounts.decodeUnchecked(capitalize(accountToPoll.key), buffer);
|
|
249
231
|
const dataAndSlot = {
|
|
250
232
|
data: account,
|
|
251
233
|
slot,
|
|
@@ -306,7 +288,7 @@ export class PollingDriftClientAccountSubscriber
|
|
|
306
288
|
if (buffer) {
|
|
307
289
|
const account = this.program.account[
|
|
308
290
|
accountToPoll.key
|
|
309
|
-
].coder.accounts.
|
|
291
|
+
].coder.accounts.decodeUnchecked(capitalize(accountToPoll.key), buffer);
|
|
310
292
|
|
|
311
293
|
if (accountToPoll.mapKey != undefined) {
|
|
312
294
|
this[accountToPoll.key].set(accountToPoll.mapKey, {
|