remove phoenix subscribers from spot markets

This commit is contained in:
Nour Alharithi
2024-12-08 10:38:09 -08:00
parent 46af8fc353
commit 919aebf10d
2 changed files with 1 additions and 35 deletions

View File

@@ -17,8 +17,6 @@ import {
initialize,
isVariant,
OrderSubscriber,
PhoenixSubscriber,
BulkAccountLoader,
isOperationPaused,
PerpOperation,
DelistedMarketSetting,
@@ -157,38 +155,6 @@ const initializeAllMarketSubscribers = async (driftClient: DriftClient) => {
openbook: undefined,
};
if (market.phoenixMarket) {
const phoenixConfigAccount =
await driftClient.getPhoenixV1FulfillmentConfig(market.phoenixMarket);
if (isVariant(phoenixConfigAccount.status, 'enabled')) {
const bulkAccountLoader = new BulkAccountLoader(
driftClient.connection,
stateCommitment,
5_000
);
const phoenixSubscriber = new PhoenixSubscriber({
connection: driftClient.connection,
programId: new PublicKey(sdkConfig.PHOENIX),
marketAddress: phoenixConfigAccount.phoenixMarket,
accountSubscription: {
type: 'polling',
accountLoader: bulkAccountLoader,
},
});
await phoenixSubscriber.subscribe();
// Test get L2 to know if we should add
try {
phoenixSubscriber.getL2Asks();
phoenixSubscriber.getL2Bids();
markets[market.marketIndex].phoenix = phoenixSubscriber;
} catch (e) {
logger.info(
`Excluding phoenix for ${market.marketIndex}, error: ${e}`
);
}
}
}
if (market.openbookMarket) {
const openbookConfigAccount =
await driftClient.getOpenbookV2FulfillmentConfig(market.openbookMarket);