Skip to content

Commit 1e7e82c

Browse files
authored
Fix enabling EIP-1559 support (#367)
1 parent e5f9461 commit 1e7e82c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,8 @@ export const handleNewAccounts = (newAccounts) => {
715715
gasPriceDiv.style.display = 'block';
716716
maxFeeDiv.style.display = 'none';
717717
maxPriorityDiv.style.display = 'none';
718+
719+
handleEIP1559Support();
718720
};
719721

720722
let chainIdInt;
@@ -785,14 +787,18 @@ const getNetworkAndChainId = async () => {
785787
};
786788

787789
const handleEIP1559Support = async () => {
790+
if (!Array.isArray(accounts) || accounts.length <= 0) {
791+
return;
792+
}
793+
788794
const block = await provider.request({
789795
method: 'eth_getBlockByNumber',
790796
params: ['latest', false],
791797
});
792798

793799
const supported = block.baseFeePerGas !== undefined;
794800

795-
if (supported && Array.isArray(accounts) && accounts.length >= 1) {
801+
if (supported) {
796802
sendEIP1559Button.disabled = false;
797803
sendEIP1559Button.hidden = false;
798804
sendEIP1559WithoutGasButton.disabled = false;

0 commit comments

Comments
 (0)