@drift-labs/sdk 2.95.0-beta.13 → 2.95.0-beta.14

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.95.0-beta.13
1
+ 2.95.0-beta.14
@@ -24,8 +24,10 @@ export declare class PollingDriftClientAccountSubscriber implements DriftClientA
24
24
  state?: DataAndSlot<StateAccount>;
25
25
  perpMarket: Map<number, DataAndSlot<PerpMarketAccount>>;
26
26
  perpOracleMap: Map<number, PublicKey>;
27
+ perpOracleStringMap: Map<number, string>;
27
28
  spotMarket: Map<number, DataAndSlot<SpotMarketAccount>>;
28
29
  spotOracleMap: Map<number, PublicKey>;
30
+ spotOracleStringMap: Map<number, string>;
29
31
  oracles: Map<string, DataAndSlot<OraclePriceData>>;
30
32
  user?: DataAndSlot<UserAccount>;
31
33
  private isSubscribing;
@@ -58,7 +60,7 @@ export declare class PollingDriftClientAccountSubscriber implements DriftClientA
58
60
  getMarketAccountsAndSlots(): DataAndSlot<PerpMarketAccount>[];
59
61
  getSpotMarketAccountAndSlot(marketIndex: number): DataAndSlot<SpotMarketAccount> | undefined;
60
62
  getSpotMarketAccountsAndSlots(): DataAndSlot<SpotMarketAccount>[];
61
- getOraclePriceDataAndSlot(oraclePublicKey: PublicKey): DataAndSlot<OraclePriceData> | undefined;
63
+ getOraclePriceDataAndSlot(oraclePublicKey: PublicKey | string): DataAndSlot<OraclePriceData> | undefined;
62
64
  getOraclePriceDataAndSlotForPerpMarket(marketIndex: number): DataAndSlot<OraclePriceData> | undefined;
63
65
  getOraclePriceDataAndSlotForSpotMarket(marketIndex: number): DataAndSlot<OraclePriceData> | undefined;
64
66
  updateAccountLoaderPollingFrequency(pollingFrequency: number): void;
@@ -9,6 +9,7 @@ const web3_js_1 = require("@solana/web3.js");
9
9
  const oracleClientCache_1 = require("../oracles/oracleClientCache");
10
10
  const quoteAssetOracleClient_1 = require("../oracles/quoteAssetOracleClient");
11
11
  const config_1 = require("../config");
12
+ const ORACLE_DEFAULT_KEY = web3_js_1.PublicKey.default.toBase58();
12
13
  class PollingDriftClientAccountSubscriber {
13
14
  constructor(program, accountLoader, perpMarketIndexes, spotMarketIndexes, oracleInfos, shouldFindAllMarketsAndOracles) {
14
15
  this.oracleClientCache = new oracleClientCache_1.OracleClientCache();
@@ -16,8 +17,10 @@ class PollingDriftClientAccountSubscriber {
16
17
  this.oraclesToPoll = new Map();
17
18
  this.perpMarket = new Map();
18
19
  this.perpOracleMap = new Map();
20
+ this.perpOracleStringMap = new Map();
19
21
  this.spotMarket = new Map();
20
22
  this.spotOracleMap = new Map();
23
+ this.spotOracleStringMap = new Map();
21
24
  this.oracles = new Map();
22
25
  this.isSubscribing = false;
23
26
  this.isSubscribed = false;
@@ -300,6 +303,7 @@ class PollingDriftClientAccountSubscriber {
300
303
  }));
301
304
  }
302
305
  this.perpOracleMap.set(perpMarketIndex, oracle);
306
+ this.perpOracleStringMap.set(perpMarketIndex, oracle.toBase58());
303
307
  }
304
308
  await Promise.all(oraclePromises);
305
309
  }
@@ -317,6 +321,7 @@ class PollingDriftClientAccountSubscriber {
317
321
  }));
318
322
  }
319
323
  this.spotOracleMap.set(spotMarketIndex, oracle);
324
+ this.spotOracleStringMap.set(spotMarketIndex, oracle.toBase58());
320
325
  }
321
326
  await Promise.all(oraclePromises);
322
327
  }
@@ -343,17 +348,21 @@ class PollingDriftClientAccountSubscriber {
343
348
  }
344
349
  getOraclePriceDataAndSlot(oraclePublicKey) {
345
350
  this.assertIsSubscribed();
346
- if (oraclePublicKey.equals(web3_js_1.PublicKey.default)) {
351
+ const oracleString = typeof oraclePublicKey === 'string'
352
+ ? oraclePublicKey
353
+ : oraclePublicKey.toBase58();
354
+ if (oracleString === ORACLE_DEFAULT_KEY) {
347
355
  return {
348
356
  data: quoteAssetOracleClient_1.QUOTE_ORACLE_PRICE_DATA,
349
357
  slot: 0,
350
358
  };
351
359
  }
352
- return this.oracles.get(oraclePublicKey.toString());
360
+ return this.oracles.get(oracleString);
353
361
  }
354
362
  getOraclePriceDataAndSlotForPerpMarket(marketIndex) {
355
363
  const perpMarketAccount = this.getMarketAccountAndSlot(marketIndex);
356
364
  const oracle = this.perpOracleMap.get(marketIndex);
365
+ const oracleString = this.perpOracleStringMap.get(marketIndex);
357
366
  if (!perpMarketAccount || !oracle) {
358
367
  return undefined;
359
368
  }
@@ -361,11 +370,12 @@ class PollingDriftClientAccountSubscriber {
361
370
  // If the oracle has changed, we need to update the oracle map in background
362
371
  this.setPerpOracleMap();
363
372
  }
364
- return this.getOraclePriceDataAndSlot(oracle);
373
+ return this.getOraclePriceDataAndSlot(oracleString);
365
374
  }
366
375
  getOraclePriceDataAndSlotForSpotMarket(marketIndex) {
367
376
  const spotMarketAccount = this.getSpotMarketAccountAndSlot(marketIndex);
368
377
  const oracle = this.spotOracleMap.get(marketIndex);
378
+ const oracleString = this.spotOracleStringMap.get(marketIndex);
369
379
  if (!spotMarketAccount || !oracle) {
370
380
  return undefined;
371
381
  }
@@ -373,7 +383,7 @@ class PollingDriftClientAccountSubscriber {
373
383
  // If the oracle has changed, we need to update the oracle map in background
374
384
  this.setSpotOracleMap();
375
385
  }
376
- return this.getOraclePriceDataAndSlot(oracle);
386
+ return this.getOraclePriceDataAndSlot(oracleString);
377
387
  }
378
388
  updateAccountLoaderPollingFrequency(pollingFrequency) {
379
389
  this.accountLoader.updatePollingFrequency(pollingFrequency);
@@ -45,7 +45,7 @@ export interface DriftClientAccountSubscriber {
45
45
  getMarketAccountsAndSlots(): DataAndSlot<PerpMarketAccount>[];
46
46
  getSpotMarketAccountAndSlot(marketIndex: number): DataAndSlot<SpotMarketAccount> | undefined;
47
47
  getSpotMarketAccountsAndSlots(): DataAndSlot<SpotMarketAccount>[];
48
- getOraclePriceDataAndSlot(oraclePublicKey: PublicKey): DataAndSlot<OraclePriceData> | undefined;
48
+ getOraclePriceDataAndSlot(oraclePublicKey: PublicKey | string): DataAndSlot<OraclePriceData> | undefined;
49
49
  getOraclePriceDataAndSlotForPerpMarket(marketIndex: number): DataAndSlot<OraclePriceData> | undefined;
50
50
  getOraclePriceDataAndSlotForSpotMarket(marketIndex: number): DataAndSlot<OraclePriceData> | undefined;
51
51
  updateAccountLoaderPollingFrequency?: (pollingFrequency: number) => void;
@@ -22,8 +22,10 @@ export declare class WebSocketDriftClientAccountSubscriber implements DriftClien
22
22
  stateAccountSubscriber?: AccountSubscriber<StateAccount>;
23
23
  perpMarketAccountSubscribers: Map<number, AccountSubscriber<PerpMarketAccount>>;
24
24
  perpOracleMap: Map<number, PublicKey>;
25
+ perpOracleStringMap: Map<number, string>;
25
26
  spotMarketAccountSubscribers: Map<number, AccountSubscriber<SpotMarketAccount>>;
26
27
  spotOracleMap: Map<number, PublicKey>;
28
+ spotOracleStringMap: Map<number, string>;
27
29
  oracleSubscribers: Map<string, AccountSubscriber<OraclePriceData>>;
28
30
  initialPerpMarketAccountData: Map<number, PerpMarketAccount>;
29
31
  initialSpotMarketAccountData: Map<number, SpotMarketAccount>;
@@ -57,7 +59,7 @@ export declare class WebSocketDriftClientAccountSubscriber implements DriftClien
57
59
  getMarketAccountsAndSlots(): DataAndSlot<PerpMarketAccount>[];
58
60
  getSpotMarketAccountAndSlot(marketIndex: number): DataAndSlot<SpotMarketAccount> | undefined;
59
61
  getSpotMarketAccountsAndSlots(): DataAndSlot<SpotMarketAccount>[];
60
- getOraclePriceDataAndSlot(oraclePublicKey: PublicKey): DataAndSlot<OraclePriceData> | undefined;
62
+ getOraclePriceDataAndSlot(oraclePublicKey: PublicKey | string): DataAndSlot<OraclePriceData> | undefined;
61
63
  getOraclePriceDataAndSlotForPerpMarket(marketIndex: number): DataAndSlot<OraclePriceData> | undefined;
62
64
  getOraclePriceDataAndSlotForSpotMarket(marketIndex: number): DataAndSlot<OraclePriceData> | undefined;
63
65
  }
@@ -9,13 +9,16 @@ const web3_js_1 = require("@solana/web3.js");
9
9
  const oracleClientCache_1 = require("../oracles/oracleClientCache");
10
10
  const quoteAssetOracleClient_1 = require("../oracles/quoteAssetOracleClient");
11
11
  const config_1 = require("../config");
12
+ const ORACLE_DEFAULT_KEY = web3_js_1.PublicKey.default.toBase58();
12
13
  class WebSocketDriftClientAccountSubscriber {
13
14
  constructor(program, perpMarketIndexes, spotMarketIndexes, oracleInfos, shouldFindAllMarketsAndOracles, resubOpts, commitment) {
14
15
  this.oracleClientCache = new oracleClientCache_1.OracleClientCache();
15
16
  this.perpMarketAccountSubscribers = new Map();
16
17
  this.perpOracleMap = new Map();
18
+ this.perpOracleStringMap = new Map();
17
19
  this.spotMarketAccountSubscribers = new Map();
18
20
  this.spotOracleMap = new Map();
21
+ this.spotOracleStringMap = new Map();
19
22
  this.oracleSubscribers = new Map();
20
23
  this.isSubscribing = false;
21
24
  this.isSubscribed = false;
@@ -224,6 +227,7 @@ class WebSocketDriftClientAccountSubscriber {
224
227
  }));
225
228
  }
226
229
  this.perpOracleMap.set(perpMarketIndex, oracle);
230
+ this.perpOracleStringMap.set(perpMarketIndex, oracle.toBase58());
227
231
  }
228
232
  await Promise.all(addOraclePromises);
229
233
  }
@@ -244,6 +248,7 @@ class WebSocketDriftClientAccountSubscriber {
244
248
  }));
245
249
  }
246
250
  this.spotOracleMap.set(spotMarketIndex, oracle);
251
+ this.spotOracleStringMap.set(spotMarketIndex, oracle.toBase58());
247
252
  }
248
253
  await Promise.all(addOraclePromises);
249
254
  }
@@ -272,17 +277,21 @@ class WebSocketDriftClientAccountSubscriber {
272
277
  }
273
278
  getOraclePriceDataAndSlot(oraclePublicKey) {
274
279
  this.assertIsSubscribed();
275
- if (oraclePublicKey.equals(web3_js_1.PublicKey.default)) {
280
+ const oracleString = typeof oraclePublicKey === 'string'
281
+ ? oraclePublicKey
282
+ : oraclePublicKey.toBase58();
283
+ if (oracleString === ORACLE_DEFAULT_KEY) {
276
284
  return {
277
285
  data: quoteAssetOracleClient_1.QUOTE_ORACLE_PRICE_DATA,
278
286
  slot: 0,
279
287
  };
280
288
  }
281
- return this.oracleSubscribers.get(oraclePublicKey.toString()).dataAndSlot;
289
+ return this.oracleSubscribers.get(oracleString).dataAndSlot;
282
290
  }
283
291
  getOraclePriceDataAndSlotForPerpMarket(marketIndex) {
284
292
  const perpMarketAccount = this.getMarketAccountAndSlot(marketIndex);
285
293
  const oracle = this.perpOracleMap.get(marketIndex);
294
+ const oracleString = this.perpOracleStringMap.get(marketIndex);
286
295
  if (!perpMarketAccount || !oracle) {
287
296
  return undefined;
288
297
  }
@@ -290,11 +299,12 @@ class WebSocketDriftClientAccountSubscriber {
290
299
  // If the oracle has changed, we need to update the oracle map in background
291
300
  this.setPerpOracleMap();
292
301
  }
293
- return this.getOraclePriceDataAndSlot(oracle);
302
+ return this.getOraclePriceDataAndSlot(oracleString);
294
303
  }
295
304
  getOraclePriceDataAndSlotForSpotMarket(marketIndex) {
296
305
  const spotMarketAccount = this.getSpotMarketAccountAndSlot(marketIndex);
297
306
  const oracle = this.spotOracleMap.get(marketIndex);
307
+ const oracleString = this.spotOracleStringMap.get(marketIndex);
298
308
  if (!spotMarketAccount || !oracle) {
299
309
  return undefined;
300
310
  }
@@ -302,7 +312,7 @@ class WebSocketDriftClientAccountSubscriber {
302
312
  // If the oracle has changed, we need to update the oracle map in background
303
313
  this.setSpotOracleMap();
304
314
  }
305
- return this.getOraclePriceDataAndSlot(oracle);
315
+ return this.getOraclePriceDataAndSlot(oracleString);
306
316
  }
307
317
  }
308
318
  exports.WebSocketDriftClientAccountSubscriber = WebSocketDriftClientAccountSubscriber;
@@ -309,7 +309,7 @@ class DriftClient {
309
309
  return this.accountSubscriber.getSpotMarketAccountAndSlot(numericConstants_1.QUOTE_SPOT_MARKET_INDEX).data;
310
310
  }
311
311
  getOraclePriceDataAndSlot(oraclePublicKey) {
312
- return this.accountSubscriber.getOraclePriceDataAndSlot(oraclePublicKey);
312
+ return this.accountSubscriber.getOraclePriceDataAndSlot(oraclePublicKey.toBase58());
313
313
  }
314
314
  async getSerumV3FulfillmentConfig(serumMarket) {
315
315
  const address = await (0, pda_1.getSerumFulfillmentConfigPublicKey)(this.program.programId, serumMarket);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.95.0-beta.13",
3
+ "version": "2.95.0-beta.14",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -28,6 +28,8 @@ import { OracleClientCache } from '../oracles/oracleClientCache';
28
28
  import { QUOTE_ORACLE_PRICE_DATA } from '../oracles/quoteAssetOracleClient';
29
29
  import { findAllMarketAndOracles } from '../config';
30
30
 
31
+ const ORACLE_DEFAULT_KEY = PublicKey.default.toBase58();
32
+
31
33
  export class PollingDriftClientAccountSubscriber
32
34
  implements DriftClientAccountSubscriber
33
35
  {
@@ -50,8 +52,10 @@ export class PollingDriftClientAccountSubscriber
50
52
  state?: DataAndSlot<StateAccount>;
51
53
  perpMarket = new Map<number, DataAndSlot<PerpMarketAccount>>();
52
54
  perpOracleMap = new Map<number, PublicKey>();
55
+ perpOracleStringMap = new Map<number, string>();
53
56
  spotMarket = new Map<number, DataAndSlot<SpotMarketAccount>>();
54
57
  spotOracleMap = new Map<number, PublicKey>();
58
+ spotOracleStringMap = new Map<number, string>();
55
59
  oracles = new Map<string, DataAndSlot<OraclePriceData>>();
56
60
  user?: DataAndSlot<UserAccount>;
57
61
 
@@ -470,6 +474,7 @@ export class PollingDriftClientAccountSubscriber
470
474
  );
471
475
  }
472
476
  this.perpOracleMap.set(perpMarketIndex, oracle);
477
+ this.perpOracleStringMap.set(perpMarketIndex, oracle.toBase58());
473
478
  }
474
479
  await Promise.all(oraclePromises);
475
480
  }
@@ -490,6 +495,7 @@ export class PollingDriftClientAccountSubscriber
490
495
  );
491
496
  }
492
497
  this.spotOracleMap.set(spotMarketIndex, oracle);
498
+ this.spotOracleStringMap.set(spotMarketIndex, oracle.toBase58());
493
499
  }
494
500
  await Promise.all(oraclePromises);
495
501
  }
@@ -528,17 +534,21 @@ export class PollingDriftClientAccountSubscriber
528
534
  }
529
535
 
530
536
  public getOraclePriceDataAndSlot(
531
- oraclePublicKey: PublicKey
537
+ oraclePublicKey: PublicKey | string
532
538
  ): DataAndSlot<OraclePriceData> | undefined {
533
539
  this.assertIsSubscribed();
534
- if (oraclePublicKey.equals(PublicKey.default)) {
540
+ const oracleString =
541
+ typeof oraclePublicKey === 'string'
542
+ ? oraclePublicKey
543
+ : oraclePublicKey.toBase58();
544
+ if (oracleString === ORACLE_DEFAULT_KEY) {
535
545
  return {
536
546
  data: QUOTE_ORACLE_PRICE_DATA,
537
547
  slot: 0,
538
548
  };
539
549
  }
540
550
 
541
- return this.oracles.get(oraclePublicKey.toString());
551
+ return this.oracles.get(oracleString);
542
552
  }
543
553
 
544
554
  public getOraclePriceDataAndSlotForPerpMarket(
@@ -546,6 +556,7 @@ export class PollingDriftClientAccountSubscriber
546
556
  ): DataAndSlot<OraclePriceData> | undefined {
547
557
  const perpMarketAccount = this.getMarketAccountAndSlot(marketIndex);
548
558
  const oracle = this.perpOracleMap.get(marketIndex);
559
+ const oracleString = this.perpOracleStringMap.get(marketIndex);
549
560
 
550
561
  if (!perpMarketAccount || !oracle) {
551
562
  return undefined;
@@ -556,7 +567,7 @@ export class PollingDriftClientAccountSubscriber
556
567
  this.setPerpOracleMap();
557
568
  }
558
569
 
559
- return this.getOraclePriceDataAndSlot(oracle);
570
+ return this.getOraclePriceDataAndSlot(oracleString);
560
571
  }
561
572
 
562
573
  public getOraclePriceDataAndSlotForSpotMarket(
@@ -564,6 +575,7 @@ export class PollingDriftClientAccountSubscriber
564
575
  ): DataAndSlot<OraclePriceData> | undefined {
565
576
  const spotMarketAccount = this.getSpotMarketAccountAndSlot(marketIndex);
566
577
  const oracle = this.spotOracleMap.get(marketIndex);
578
+ const oracleString = this.spotOracleStringMap.get(marketIndex);
567
579
  if (!spotMarketAccount || !oracle) {
568
580
  return undefined;
569
581
  }
@@ -573,7 +585,7 @@ export class PollingDriftClientAccountSubscriber
573
585
  this.setSpotOracleMap();
574
586
  }
575
587
 
576
- return this.getOraclePriceDataAndSlot(oracle);
588
+ return this.getOraclePriceDataAndSlot(oracleString);
577
589
  }
578
590
 
579
591
  public updateAccountLoaderPollingFrequency(pollingFrequency: number): void {
@@ -72,7 +72,7 @@ export interface DriftClientAccountSubscriber {
72
72
  ): DataAndSlot<SpotMarketAccount> | undefined;
73
73
  getSpotMarketAccountsAndSlots(): DataAndSlot<SpotMarketAccount>[];
74
74
  getOraclePriceDataAndSlot(
75
- oraclePublicKey: PublicKey
75
+ oraclePublicKey: PublicKey | string
76
76
  ): DataAndSlot<OraclePriceData> | undefined;
77
77
  getOraclePriceDataAndSlotForPerpMarket(
78
78
  marketIndex: number
@@ -24,6 +24,8 @@ import * as Buffer from 'buffer';
24
24
  import { QUOTE_ORACLE_PRICE_DATA } from '../oracles/quoteAssetOracleClient';
25
25
  import { findAllMarketAndOracles } from '../config';
26
26
 
27
+ const ORACLE_DEFAULT_KEY = PublicKey.default.toBase58();
28
+
27
29
  export class WebSocketDriftClientAccountSubscriber
28
30
  implements DriftClientAccountSubscriber
29
31
  {
@@ -45,11 +47,13 @@ export class WebSocketDriftClientAccountSubscriber
45
47
  AccountSubscriber<PerpMarketAccount>
46
48
  >();
47
49
  perpOracleMap = new Map<number, PublicKey>();
50
+ perpOracleStringMap = new Map<number, string>();
48
51
  spotMarketAccountSubscribers = new Map<
49
52
  number,
50
53
  AccountSubscriber<SpotMarketAccount>
51
54
  >();
52
55
  spotOracleMap = new Map<number, PublicKey>();
56
+ spotOracleStringMap = new Map<number, string>();
53
57
  oracleSubscribers = new Map<string, AccountSubscriber<OraclePriceData>>();
54
58
 
55
59
  initialPerpMarketAccountData: Map<number, PerpMarketAccount>;
@@ -432,6 +436,7 @@ export class WebSocketDriftClientAccountSubscriber
432
436
  );
433
437
  }
434
438
  this.perpOracleMap.set(perpMarketIndex, oracle);
439
+ this.perpOracleStringMap.set(perpMarketIndex, oracle.toBase58());
435
440
  }
436
441
  await Promise.all(addOraclePromises);
437
442
  }
@@ -455,6 +460,7 @@ export class WebSocketDriftClientAccountSubscriber
455
460
  );
456
461
  }
457
462
  this.spotOracleMap.set(spotMarketIndex, oracle);
463
+ this.spotOracleStringMap.set(spotMarketIndex, oracle.toBase58());
458
464
  }
459
465
  await Promise.all(addOraclePromises);
460
466
  }
@@ -499,16 +505,20 @@ export class WebSocketDriftClientAccountSubscriber
499
505
  }
500
506
 
501
507
  public getOraclePriceDataAndSlot(
502
- oraclePublicKey: PublicKey
508
+ oraclePublicKey: PublicKey | string
503
509
  ): DataAndSlot<OraclePriceData> | undefined {
504
510
  this.assertIsSubscribed();
505
- if (oraclePublicKey.equals(PublicKey.default)) {
511
+ const oracleString =
512
+ typeof oraclePublicKey === 'string'
513
+ ? oraclePublicKey
514
+ : oraclePublicKey.toBase58();
515
+ if (oracleString === ORACLE_DEFAULT_KEY) {
506
516
  return {
507
517
  data: QUOTE_ORACLE_PRICE_DATA,
508
518
  slot: 0,
509
519
  };
510
520
  }
511
- return this.oracleSubscribers.get(oraclePublicKey.toString()).dataAndSlot;
521
+ return this.oracleSubscribers.get(oracleString).dataAndSlot;
512
522
  }
513
523
 
514
524
  public getOraclePriceDataAndSlotForPerpMarket(
@@ -516,6 +526,7 @@ export class WebSocketDriftClientAccountSubscriber
516
526
  ): DataAndSlot<OraclePriceData> | undefined {
517
527
  const perpMarketAccount = this.getMarketAccountAndSlot(marketIndex);
518
528
  const oracle = this.perpOracleMap.get(marketIndex);
529
+ const oracleString = this.perpOracleStringMap.get(marketIndex);
519
530
  if (!perpMarketAccount || !oracle) {
520
531
  return undefined;
521
532
  }
@@ -525,7 +536,7 @@ export class WebSocketDriftClientAccountSubscriber
525
536
  this.setPerpOracleMap();
526
537
  }
527
538
 
528
- return this.getOraclePriceDataAndSlot(oracle);
539
+ return this.getOraclePriceDataAndSlot(oracleString);
529
540
  }
530
541
 
531
542
  public getOraclePriceDataAndSlotForSpotMarket(
@@ -533,6 +544,7 @@ export class WebSocketDriftClientAccountSubscriber
533
544
  ): DataAndSlot<OraclePriceData> | undefined {
534
545
  const spotMarketAccount = this.getSpotMarketAccountAndSlot(marketIndex);
535
546
  const oracle = this.spotOracleMap.get(marketIndex);
547
+ const oracleString = this.spotOracleStringMap.get(marketIndex);
536
548
  if (!spotMarketAccount || !oracle) {
537
549
  return undefined;
538
550
  }
@@ -542,6 +554,6 @@ export class WebSocketDriftClientAccountSubscriber
542
554
  this.setSpotOracleMap();
543
555
  }
544
556
 
545
- return this.getOraclePriceDataAndSlot(oracle);
557
+ return this.getOraclePriceDataAndSlot(oracleString);
546
558
  }
547
559
  }
@@ -538,7 +538,9 @@ export class DriftClient {
538
538
  public getOraclePriceDataAndSlot(
539
539
  oraclePublicKey: PublicKey
540
540
  ): DataAndSlot<OraclePriceData> | undefined {
541
- return this.accountSubscriber.getOraclePriceDataAndSlot(oraclePublicKey);
541
+ return this.accountSubscriber.getOraclePriceDataAndSlot(
542
+ oraclePublicKey.toBase58()
543
+ );
542
544
  }
543
545
 
544
546
  public async getSerumV3FulfillmentConfig(