From 94a9c8d64a3de4d7149e06960a3ec1b35e1aa45b Mon Sep 17 00:00:00 2001 From: Nour Alharithi Date: Mon, 11 Nov 2024 18:20:46 -0800 Subject: [PATCH] add slothash subscriber and change default interval ms --- src/bots/switchboardCranker.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/bots/switchboardCranker.ts b/src/bots/switchboardCranker.ts index 9b2285ff..578a09aa 100644 --- a/src/bots/switchboardCranker.ts +++ b/src/bots/switchboardCranker.ts @@ -8,7 +8,6 @@ import { SlothashSubscriber, TxSigAndSlot, } from '@drift-labs/sdk'; -import { SwitchboardOnDemandClient } from '@drift-labs/sdk'; import { BundleSender } from '../bundleSender'; import { AddressLookupTableAccount, @@ -29,9 +28,7 @@ const SIM_CU_ESTIMATE_MULTIPLIER = 1.5; export class SwitchboardCrankerBot implements Bot { public name: string; public dryRun: boolean; - private intervalMs: number; - private oracleClient: SwitchboardOnDemandClient; - public defaultIntervalMs = 30_000; + public defaultIntervalMs: number; private blockhashSubscriber: BlockhashSubscriber; private slothashSubscriber: SlothashSubscriber; @@ -46,15 +43,11 @@ export class SwitchboardCrankerBot implements Bot { ) { this.name = crankConfigs.botId; this.dryRun = crankConfigs.dryRun; - this.intervalMs = crankConfigs.intervalMs; + this.defaultIntervalMs = crankConfigs.intervalMs || 10_000; this.blockhashSubscriber = new BlockhashSubscriber({ connection: driftClient.connection, }); - this.oracleClient = new SwitchboardOnDemandClient( - this.driftClient.connection - ); - this.slothashSubscriber = new SlothashSubscriber( this.driftClient.connection, { @@ -78,7 +71,7 @@ export class SwitchboardCrankerBot implements Bot { await this.driftClient.unsubscribe(); } - async startIntervalLoop(intervalMs = this.intervalMs): Promise { + async startIntervalLoop(intervalMs = this.defaultIntervalMs): Promise { logger.info(`Starting ${this.name} bot with interval ${intervalMs} ms`); await sleepMs(5000); await this.runCrankLoop();