@@ -88,11 +88,11 @@ const signTransaction = async ({
8888 const from = wallet.address;
8989 const estimate = await estimateGasLimit({ ...txn, from }, web3);
9090
91− let block = await web3.eth.getBlock('pending');
91+ let block =
92+ (await web3.eth.getBlock('pending')) || (await web3.eth.getBlock('latest'));
9293
93− // in case pending block doesn't return anything
94− if (!block || !block.baseFeePerGas) {
95− block = await web3.eth.getBlock('latest');
94+ if (!block?.baseFeePerGas) {
95+ throw new Error('Unable to fetch baseFeePerGas from the network');
9696 }
9797
9898 const baseFeeWei = block.baseFeePerGas;