This commit is contained in:
Nour Alharithi
2023-11-11 09:28:19 -08:00
parent 384e785371
commit bd520a4c62

View File

@@ -165,17 +165,22 @@ const main = async () => {
commitment: stateCommitment, commitment: stateCommitment,
}); });
driftClient = new DriftClient({ const bulkAccountLoader = new BulkAccountLoader(
connection, connection,
wallet, stateCommitment,
programID: clearingHousePublicKey, ORDERBOOK_UPDATE_INTERVAL * 10
accountSubscription: { ),
type: 'websocket', driftClient = new DriftClient({
resubTimeoutMs: 60000, connection,
}, wallet,
env: driftEnv, programID: clearingHousePublicKey,
userStats: true, accountSubscription: {
}); type: 'polling',
accountLoader: bulkAccountLoader,
},
env: driftEnv,
userStats: true,
});
const dlobCoder = DLOBOrdersCoder.create(); const dlobCoder = DLOBOrdersCoder.create();
const slotSubscriber = new SlotSubscriber(connection, {}); const slotSubscriber = new SlotSubscriber(connection, {});
@@ -208,11 +213,7 @@ const main = async () => {
await userMap.subscribe(); await userMap.subscribe();
const userStatsMap = new UserStatsMap(driftClient, { const userStatsMap = new UserStatsMap(driftClient, {
type: 'polling', type: 'polling',
accountLoader: new BulkAccountLoader( accountLoader: bulkAccountLoader,
connection,
stateCommitment,
ORDERBOOK_UPDATE_INTERVAL * 10
),
}); });
await userStatsMap.subscribe(); await userStatsMap.subscribe();