diff --git a/package.json b/package.json index ebc7dd52..2dee4506 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,8 @@ "main": "lib/index.js", "license": "Apache-2.0", "dependencies": { - "@drift-labs/jit-proxy": "0.10.154", - "@drift-labs/sdk": "2.53.0-beta.1", + "@drift-labs/jit-proxy": "0.10.155", + "@drift-labs/sdk": "2.53.0-beta.2", "@opentelemetry/api": "^1.1.0", "@opentelemetry/auto-instrumentations-node": "^0.31.1", "@opentelemetry/exporter-prometheus": "^0.31.0", diff --git a/src/config.ts b/src/config.ts index a5409c03..5ba4da19 100644 --- a/src/config.ts +++ b/src/config.ts @@ -85,6 +85,7 @@ export interface GlobalConfig { jitoBlockEngineUrl?: string; jitoAuthPrivateKey?: string; txRetryTimeoutMs?: number; + txSenderType?: 'fast' | 'retry'; } export interface Config { diff --git a/src/index.ts b/src/index.ts index e739c6b5..01294773 100644 --- a/src/index.ts +++ b/src/index.ts @@ -149,6 +149,10 @@ program '--event-susbcriber', 'Explicitly intialize an eventSubscriber (RPC heavy' ) + .option( + '--tx-sender-type ', + 'Choose tx sender type, options are: fast, retry' + ) .parse(); const opts = program.opts(); @@ -263,18 +267,24 @@ const runBot = async () => { commitment: stateCommitment, disableRetryOnRateLimit: true, }); - // const txSender = new FastSingleTxSender({ - // connection: sendTxConnection, - // blockhashRefreshInterval: 10_000, - // wallet, - // opts, - // }); - const txSender = new RetryTxSender({ - connection: sendTxConnection, - wallet, - opts, - timeout: 3000, - }); + + const txSenderType = config.global.txSenderType || 'retry'; + let txSender; + if (txSenderType === 'retry') { + txSender = new RetryTxSender({ + connection: sendTxConnection, + wallet, + opts, + timeout: 3000, + }); + } else { + txSender = new FastSingleTxSender({ + connection: sendTxConnection, + blockhashRefreshInterval: 1000, + wallet, + opts, + }); + } /** * Creating and subscribing to the drift client