Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit f2ca0d8

Browse files
committed
Type check refactors for _handleTxPricing
1 parent d4f1363 commit f2ca0d8

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

packages/web3-eth-accounts/src/index.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -354,24 +354,17 @@ function _handleTxType(tx) {
354354
function _handleTxPricing(_this, tx) {
355355
return new Promise((resolve, reject) => {
356356
try {
357-
if (
358-
(
359-
tx.type === undefined ||
360-
tx.type === '0x0' ||
361-
tx.type === '0x1'
362-
) && tx.gasPrice !== undefined)
363-
{
364-
// Legacy transaction, return provided gasPrice
365-
resolve({ gasPrice: tx.gasPrice })
357+
if (tx.type < '0x2' && tx.gasPrice !== undefined) {
358+
// gasPrice already set, return
359+
resolve()
366360
} else {
367361
Promise.all([
368362
_this._ethereumCall.getBlockByNumber(),
369363
_this._ethereumCall.getGasPrice()
370364
]).then(responses => {
371365
const [block, gasPrice] = responses;
372366
if (
373-
(tx.type !== '0x0' &&
374-
tx.type !== '0x1') &&
367+
(tx.type === '0x2') &&
375368
block && block.baseFeePerGas
376369
) {
377370
// The network supports EIP-1559

0 commit comments

Comments
 (0)