From ba4b665a73bf4f9218118d8db4726b209c845c0f Mon Sep 17 00:00:00 2001 From: Nour Alharithi Date: Mon, 13 Nov 2023 09:29:30 -0800 Subject: [PATCH] wsPublish polls RPC --- src/wsPublish.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/wsPublish.ts b/src/wsPublish.ts index 977163a..69d84e1 100644 --- a/src/wsPublish.ts +++ b/src/wsPublish.ts @@ -9,6 +9,7 @@ import { SlotSubscriber, UserMap, Wallet, + BulkAccountLoader, } from '@drift-labs/sdk'; import { logger, setLogLevel } from './utils/logger'; @@ -50,12 +51,19 @@ const main = async () => { commitment: stateCommitment, }); + const bulkAccountLoader = new BulkAccountLoader( + connection, + stateCommitment, + ORDERBOOK_UPDATE_INTERVAL + ); + driftClient = new DriftClient({ connection, wallet, programID: clearingHousePublicKey, accountSubscription: { - type: 'websocket', + type: 'polling', + accountLoader: bulkAccountLoader, }, env: driftEnv, userStats: true,