From d9de65911bdb6eace942c6c8d5b928b4fe316c0a Mon Sep 17 00:00:00 2001 From: MrTuxedo Date: Sat, 22 Apr 2023 19:37:10 -0700 Subject: [PATCH] don't prefetch txns --- src/blockchain.ts | 2 +- src/index.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/blockchain.ts b/src/blockchain.ts index b0937c1..202b348 100644 --- a/src/blockchain.ts +++ b/src/blockchain.ts @@ -12,7 +12,7 @@ const provider = new WebSocketProvider(rpcUrl); const blockBaseFeePerGasObservable$ = new Observable((observer) => { provider.on('block', async (blockNumber) => { try { - const { baseFeePerGas } = await provider.getBlock(blockNumber, true) || {}; + const { baseFeePerGas } = await provider.getBlock(blockNumber) || {}; if (!baseFeePerGas) throw new Error(`Error fetching block! ${blockNumber}`); diff --git a/src/index.ts b/src/index.ts index 3156f3b..2fdc781 100644 --- a/src/index.ts +++ b/src/index.ts @@ -82,7 +82,11 @@ client.login(token) await redisClient.set('current-prices', JSON.stringify(averageGasPrices)) await doAlerts(averageGasPrices); }, - error: console.error, + error: (err) => console.error(err), complete: () => console.log("Blockchain data stream closed") }) - }); + }) + .catch( + (err) => console.log(`Bot runtime error! +${err}`) + );