remove phoenix subscribers from spot markets
This commit is contained in:
Submodule drift-common updated: ebeabb37a3...e91ef8b3ea
34
src/index.ts
34
src/index.ts
@@ -17,8 +17,6 @@ import {
|
|||||||
initialize,
|
initialize,
|
||||||
isVariant,
|
isVariant,
|
||||||
OrderSubscriber,
|
OrderSubscriber,
|
||||||
PhoenixSubscriber,
|
|
||||||
BulkAccountLoader,
|
|
||||||
isOperationPaused,
|
isOperationPaused,
|
||||||
PerpOperation,
|
PerpOperation,
|
||||||
DelistedMarketSetting,
|
DelistedMarketSetting,
|
||||||
@@ -157,38 +155,6 @@ const initializeAllMarketSubscribers = async (driftClient: DriftClient) => {
|
|||||||
openbook: undefined,
|
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) {
|
if (market.openbookMarket) {
|
||||||
const openbookConfigAccount =
|
const openbookConfigAccount =
|
||||||
await driftClient.getOpenbookV2FulfillmentConfig(market.openbookMarket);
|
await driftClient.getOpenbookV2FulfillmentConfig(market.openbookMarket);
|
||||||
|
|||||||
Reference in New Issue
Block a user