From 76d9791ae8b056cf1ee587c831ffca3fd02994f0 Mon Sep 17 00:00:00 2001 From: Nour Alharithi Date: Sat, 11 Nov 2023 09:37:33 -0800 Subject: [PATCH] fix drift client --- src/index.ts | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/index.ts b/src/index.ts index 678ea36..6b16267 100644 --- a/src/index.ts +++ b/src/index.ts @@ -166,21 +166,22 @@ const main = async () => { }); const bulkAccountLoader = new BulkAccountLoader( - connection, - stateCommitment, - ORDERBOOK_UPDATE_INTERVAL - ), - driftClient = new DriftClient({ - connection, - wallet, - programID: clearingHousePublicKey, - accountSubscription: { - type: 'polling', - accountLoader: bulkAccountLoader, - }, - env: driftEnv, - userStats: true, - }); + connection, + stateCommitment, + ORDERBOOK_UPDATE_INTERVAL + ); + + driftClient = new DriftClient({ + connection, + wallet, + programID: clearingHousePublicKey, + accountSubscription: { + type: 'polling', + accountLoader: bulkAccountLoader, + }, + env: driftEnv, + userStats: true, + }); const dlobCoder = DLOBOrdersCoder.create(); const slotSubscriber = new SlotSubscriber(connection, {}); @@ -213,7 +214,11 @@ const main = async () => { await userMap.subscribe(); const userStatsMap = new UserStatsMap(driftClient, { type: 'polling', - accountLoader: bulkAccountLoader, + accountLoader: new BulkAccountLoader( + connection, + stateCommitment, + ORDERBOOK_UPDATE_INTERVAL * 10 + ), }); await userStatsMap.subscribe();