@drift-labs/sdk 2.38.1-beta.0 → 2.38.1-beta.1
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.1
|
|
@@ -2,6 +2,7 @@
|
|
|
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");
|
|
5
6
|
const events_1 = require("events");
|
|
6
7
|
const pda_1 = require("../addresses/pda");
|
|
7
8
|
const utils_1 = require("./utils");
|
|
@@ -137,7 +138,18 @@ class PollingDriftClientAccountSubscriber {
|
|
|
137
138
|
accountToPoll.callbackId = await this.accountLoader.addAccount(accountToPoll.publicKey, (buffer, slot) => {
|
|
138
139
|
if (!buffer)
|
|
139
140
|
return;
|
|
140
|
-
|
|
141
|
+
let account;
|
|
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
|
+
}
|
|
141
153
|
const dataAndSlot = {
|
|
142
154
|
data: account,
|
|
143
155
|
slot,
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
NotSubscribedError,
|
|
7
7
|
OraclesToPoll,
|
|
8
8
|
} from './types';
|
|
9
|
-
import { Program } from '@coral-xyz/anchor';
|
|
9
|
+
import { BorshAccountsCoder, Program } from '@coral-xyz/anchor';
|
|
10
10
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
11
11
|
import { EventEmitter } from 'events';
|
|
12
12
|
import {
|
|
@@ -225,9 +225,27 @@ export class PollingDriftClientAccountSubscriber
|
|
|
225
225
|
(buffer: Buffer, slot: number) => {
|
|
226
226
|
if (!buffer) return;
|
|
227
227
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
228
|
+
let account;
|
|
229
|
+
try {
|
|
230
|
+
account = this.program.account[
|
|
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
|
+
}
|
|
231
249
|
const dataAndSlot = {
|
|
232
250
|
data: account,
|
|
233
251
|
slot,
|