Skip to content

Commit

Permalink
Fix enabling EIP-1559 support (#367)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpuri authored Oct 24, 2024
1 parent e5f9461 commit 1e7e82c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,8 @@ export const handleNewAccounts = (newAccounts) => {
gasPriceDiv.style.display = 'block';
maxFeeDiv.style.display = 'none';
maxPriorityDiv.style.display = 'none';

handleEIP1559Support();
};

let chainIdInt;
Expand Down Expand Up @@ -785,14 +787,18 @@ 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],
});

const supported = block.baseFeePerGas !== undefined;

if (supported && Array.isArray(accounts) && accounts.length >= 1) {
if (supported) {
sendEIP1559Button.disabled = false;
sendEIP1559Button.hidden = false;
sendEIP1559WithoutGasButton.disabled = false;
Expand Down

0 comments on commit 1e7e82c

Please sign in to comment.