Merge pull request #35 from drift-labs/master
change publisher spot market initializer
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
|||||||
SlotSource,
|
SlotSource,
|
||||||
DriftClientSubscriptionConfig,
|
DriftClientSubscriptionConfig,
|
||||||
SlotSubscriber,
|
SlotSubscriber,
|
||||||
|
isVariant,
|
||||||
} from '@drift-labs/sdk';
|
} from '@drift-labs/sdk';
|
||||||
|
|
||||||
import { logger, setLogLevel } from '../utils/logger';
|
import { logger, setLogLevel } from '../utils/logger';
|
||||||
@@ -70,23 +71,32 @@ const initializeAllMarketSubscribers = async (driftClient: DriftClient) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (market.phoenixMarket) {
|
if (market.phoenixMarket) {
|
||||||
const phoenixSubscriber = getPhoenixSubscriber(
|
const phoenixConfigAccount =
|
||||||
driftClient,
|
await driftClient.getPhoenixV1FulfillmentConfig(market.phoenixMarket);
|
||||||
market,
|
if (isVariant(phoenixConfigAccount.status, 'enabled')) {
|
||||||
sdkConfig
|
const phoenixSubscriber = getPhoenixSubscriber(
|
||||||
);
|
driftClient,
|
||||||
await phoenixSubscriber.subscribe();
|
market,
|
||||||
markets[market.marketIndex].phoenix = phoenixSubscriber;
|
sdkConfig
|
||||||
|
);
|
||||||
|
await phoenixSubscriber.subscribe();
|
||||||
|
markets[market.marketIndex].phoenix = phoenixSubscriber;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (market.serumMarket) {
|
if (market.serumMarket) {
|
||||||
const serumSubscriber = getSerumSubscriber(
|
const serumConfigAccount = await driftClient.getSerumV3FulfillmentConfig(
|
||||||
driftClient,
|
market.serumMarket
|
||||||
market,
|
|
||||||
sdkConfig
|
|
||||||
);
|
);
|
||||||
await serumSubscriber.subscribe();
|
if (isVariant(serumConfigAccount.status, 'enabled')) {
|
||||||
markets[market.marketIndex].serum = serumSubscriber;
|
const serumSubscriber = getSerumSubscriber(
|
||||||
|
driftClient,
|
||||||
|
market,
|
||||||
|
sdkConfig
|
||||||
|
);
|
||||||
|
await serumSubscriber.subscribe();
|
||||||
|
markets[market.marketIndex].serum = serumSubscriber;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user