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], ]);