Skip to content

Commit

Permalink
change publisher spot market initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
NourAlharithi committed Dec 4, 2023
1 parent 1e93a55 commit 5996143
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions src/publishers/dlobPublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
SlotSource,
DriftClientSubscriptionConfig,
SlotSubscriber,
isVariant,
} from '@drift-labs/sdk';

import { logger, setLogLevel } from '../utils/logger';
Expand Down Expand Up @@ -70,23 +71,32 @@ const initializeAllMarketSubscribers = async (driftClient: DriftClient) => {
};

if (market.phoenixMarket) {
const phoenixSubscriber = getPhoenixSubscriber(
driftClient,
market,
sdkConfig
);
await phoenixSubscriber.subscribe();
markets[market.marketIndex].phoenix = phoenixSubscriber;
const phoenixConfigAccount =
await driftClient.getPhoenixV1FulfillmentConfig(market.phoenixMarket);
if (isVariant(phoenixConfigAccount.status, 'enabled')) {
const phoenixSubscriber = getPhoenixSubscriber(
driftClient,
market,
sdkConfig
);
await phoenixSubscriber.subscribe();
markets[market.marketIndex].phoenix = phoenixSubscriber;
}
}

if (market.serumMarket) {
const serumSubscriber = getSerumSubscriber(
driftClient,
market,
sdkConfig
const serumConfigAccount = await driftClient.getSerumV3FulfillmentConfig(
market.serumMarket
);
await serumSubscriber.subscribe();
markets[market.marketIndex].serum = serumSubscriber;
if (isVariant(serumConfigAccount.status, 'enabled')) {
const serumSubscriber = getSerumSubscriber(
driftClient,
market,
sdkConfig
);
await serumSubscriber.subscribe();
markets[market.marketIndex].serum = serumSubscriber;
}
}
}

Expand Down

0 comments on commit 5996143

Please sign in to comment.