@drift-labs/sdk 2.97.0-beta.5 → 2.97.0-beta.6

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.97.0-beta.5
1
+ 2.97.0-beta.6
package/lib/config.d.ts CHANGED
@@ -43,7 +43,7 @@ export declare const initialize: (props: {
43
43
  env: DriftEnv;
44
44
  overrideEnv?: Partial<DriftConfig>;
45
45
  }) => DriftConfig;
46
- export declare function getMarketsAndOraclesForSubscription(env: DriftEnv): {
46
+ export declare function getMarketsAndOraclesForSubscription(env: DriftEnv, perpMarkets?: PerpMarketConfig[], spotMarkets?: SpotMarketConfig[]): {
47
47
  perpMarketIndexes: number[];
48
48
  spotMarketIndexes: number[];
49
49
  oracleInfos: OracleInfo[];
package/lib/config.js CHANGED
@@ -66,18 +66,20 @@ const initialize = (props) => {
66
66
  return currentConfig;
67
67
  };
68
68
  exports.initialize = initialize;
69
- function getMarketsAndOraclesForSubscription(env) {
69
+ function getMarketsAndOraclesForSubscription(env, perpMarkets, spotMarkets) {
70
+ const perpMarketsToUse = (perpMarkets === null || perpMarkets === void 0 ? void 0 : perpMarkets.length) > 0 ? perpMarkets : perpMarkets_1.PerpMarkets[env];
71
+ const spotMarketsToUse = (spotMarkets === null || spotMarkets === void 0 ? void 0 : spotMarkets.length) > 0 ? spotMarkets : spotMarkets_1.SpotMarkets[env];
70
72
  const perpMarketIndexes = [];
71
73
  const spotMarketIndexes = [];
72
74
  const oracleInfos = new Map();
73
- for (const market of perpMarkets_1.PerpMarkets[env]) {
75
+ for (const market of perpMarketsToUse) {
74
76
  perpMarketIndexes.push(market.marketIndex);
75
77
  oracleInfos.set(market.oracle.toString(), {
76
78
  publicKey: market.oracle,
77
79
  source: market.oracleSource,
78
80
  });
79
81
  }
80
- for (const spotMarket of spotMarkets_1.SpotMarkets[env]) {
82
+ for (const spotMarket of spotMarketsToUse) {
81
83
  spotMarketIndexes.push(spotMarket.marketIndex);
82
84
  oracleInfos.set(spotMarket.oracle.toString(), {
83
85
  publicKey: spotMarket.oracle,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.97.0-beta.5",
3
+ "version": "2.97.0-beta.6",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
package/src/config.ts CHANGED
@@ -114,16 +114,25 @@ export const initialize = (props: {
114
114
  return currentConfig;
115
115
  };
116
116
 
117
- export function getMarketsAndOraclesForSubscription(env: DriftEnv): {
117
+ export function getMarketsAndOraclesForSubscription(
118
+ env: DriftEnv,
119
+ perpMarkets?: PerpMarketConfig[],
120
+ spotMarkets?: SpotMarketConfig[]
121
+ ): {
118
122
  perpMarketIndexes: number[];
119
123
  spotMarketIndexes: number[];
120
124
  oracleInfos: OracleInfo[];
121
125
  } {
126
+ const perpMarketsToUse =
127
+ perpMarkets?.length > 0 ? perpMarkets : PerpMarkets[env];
128
+ const spotMarketsToUse =
129
+ spotMarkets?.length > 0 ? spotMarkets : SpotMarkets[env];
130
+
122
131
  const perpMarketIndexes = [];
123
132
  const spotMarketIndexes = [];
124
133
  const oracleInfos = new Map<string, OracleInfo>();
125
134
 
126
- for (const market of PerpMarkets[env]) {
135
+ for (const market of perpMarketsToUse) {
127
136
  perpMarketIndexes.push(market.marketIndex);
128
137
  oracleInfos.set(market.oracle.toString(), {
129
138
  publicKey: market.oracle,
@@ -131,7 +140,7 @@ export function getMarketsAndOraclesForSubscription(env: DriftEnv): {
131
140
  });
132
141
  }
133
142
 
134
- for (const spotMarket of SpotMarkets[env]) {
143
+ for (const spotMarket of spotMarketsToUse) {
135
144
  spotMarketIndexes.push(spotMarket.marketIndex);
136
145
  oracleInfos.set(spotMarket.oracle.toString(), {
137
146
  publicKey: spotMarket.oracle,