From 1e7e82c908528e5fa9507912d2db7905fd026a6c Mon Sep 17 00:00:00 2001 From: Jyoti Puri Date: Thu, 24 Oct 2024 16:31:01 +0530 Subject: [PATCH] Fix enabling EIP-1559 support (#367) --- src/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 4d0f1279..800329ea 100644 --- a/src/index.js +++ b/src/index.js @@ -715,6 +715,8 @@ export const handleNewAccounts = (newAccounts) => { gasPriceDiv.style.display = 'block'; maxFeeDiv.style.display = 'none'; maxPriorityDiv.style.display = 'none'; + + handleEIP1559Support(); }; let chainIdInt; @@ -785,6 +787,10 @@ const getNetworkAndChainId = async () => { }; const handleEIP1559Support = async () => { + if (!Array.isArray(accounts) || accounts.length <= 0) { + return; + } + const block = await provider.request({ method: 'eth_getBlockByNumber', params: ['latest', false], @@ -792,7 +798,7 @@ const handleEIP1559Support = async () => { const supported = block.baseFeePerGas !== undefined; - if (supported && Array.isArray(accounts) && accounts.length >= 1) { + if (supported) { sendEIP1559Button.disabled = false; sendEIP1559Button.hidden = false; sendEIP1559WithoutGasButton.disabled = false;