From 61fe5beaed9bf0f5a55d35b821b53264f0c394c7 Mon Sep 17 00:00:00 2001 From: Alexandre ABRIOUX Date: Tue, 8 Feb 2022 13:44:26 +0100 Subject: [PATCH] fix: hexidecimal number for eth_feehistory blockcount --- src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 064f4db..da27065 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,5 @@ import { JsonRpcProvider } from '@ethersproject/providers'; +import { utils } from 'ethers'; import { ema } from 'moving-averages'; import { BASE_FEE_ADDITIONAL_PADDING, @@ -27,7 +28,7 @@ export const suggestMaxBaseFee = async ( blockCountHistory = 100 ): Promise => { const feeHistory: FeeHistoryResponse = await provider.send('eth_feeHistory', [ - blockCountHistory, + utils.hexStripZeros(utils.hexlify(blockCountHistory)), fromBlock, [], ]); @@ -109,7 +110,7 @@ export const suggestMaxPriorityFee = async ( fromBlock = 'latest' ): Promise => { const feeHistory: FeeHistoryResponse = await provider.send('eth_feeHistory', [ - 10, + utils.hexStripZeros(utils.hexlify(10)), fromBlock, [10, 15, 30, 45], ]);