Skip to content

Commit e654b01

Browse files
committed
fix: correct type for gas and gas_limit (int, not Wei)
1 parent 4770d0a commit e654b01

File tree

7 files changed

+66
-66
lines changed

7 files changed

+66
-66
lines changed

docs/middleware.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Buffered Gas Estimate
7878
This adds a gas estimate to transactions if ``gas`` is not present in the transaction
7979
parameters. Sets gas to:
8080
``min(w3.eth.estimate_gas + gas_buffer, gas_limit)``
81-
where the gas_buffer default is 100,000 Wei
81+
where the gas_buffer default is 100,000
8282

8383
HTTPRequestRetry
8484
~~~~~~~~~~~~~~~~~~

web3/_utils/async_transactions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717

1818
async def get_block_gas_limit(
1919
web3_eth: "AsyncEth", block_identifier: Optional[BlockIdentifier] = None
20-
) -> Wei:
20+
) -> int:
2121
if block_identifier is None:
2222
block_identifier = await web3_eth.block_number
2323
block = await web3_eth.get_block(block_identifier)
2424
return block['gasLimit']
2525

2626

2727
async def get_buffered_gas_estimate(
28-
web3: "Web3", transaction: TxParams, gas_buffer: Wei = Wei(100000)
29-
) -> Wei:
28+
web3: "Web3", transaction: TxParams, gas_buffer: int = 100000
29+
) -> int:
3030
gas_estimate_transaction = cast(TxParams, dict(**transaction))
3131

3232
gas_estimate = await web3.eth.estimate_gas(gas_estimate_transaction) # type: ignore
@@ -40,4 +40,4 @@ async def get_buffered_gas_estimate(
4040
"limit: {1}".format(gas_estimate, gas_limit)
4141
)
4242

43-
return Wei(min(gas_limit, gas_estimate + gas_buffer))
43+
return min(gas_limit, gas_estimate + gas_buffer)

0 commit comments

Comments
 (0)