Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OK-34490: Fix EIP-1559 support detection for custom networks #6390

Merged
merged 2 commits into from
Dec 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions packages/kit-bg/src/vaults/impls/evm/sdkEvm/ClientEvm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,20 @@ export class ClientEvm extends JsonRPCRequest {
baseFeePerGas: string;
}>('eth_getBlockByNumber', ['latest', false]);
const baseFeePerGas = new BigNumber(hexBlock.baseFeePerGas);
const isEIP1559FeeEnabled = !(
baseFeePerGas.isNaN() || baseFeePerGas.isEqualTo(0)
); // 0 also means not 1559
return { isEIP1559FeeEnabled };

// 0 also means not 1559
if (baseFeePerGas.isNaN() || baseFeePerGas.isEqualTo(0)) {
return { isEIP1559FeeEnabled: false };
}

let maxPriorityFeeSupported = true;
try {
await this.call('eth_maxPriorityFeePerGas');
} catch (error) {
maxPriorityFeeSupported = false;
}
originalix marked this conversation as resolved.
Show resolved Hide resolved

return { isEIP1559FeeEnabled: maxPriorityFeeSupported };
originalix marked this conversation as resolved.
Show resolved Hide resolved
}

async broadcastTransaction(rawTx: string): Promise<string> {
Expand Down
Loading