diff --git a/ape_arbitrum/ecosystem.py b/ape_arbitrum/ecosystem.py index 17cdc0e..ab4250f 100644 --- a/ape_arbitrum/ecosystem.py +++ b/ape_arbitrum/ecosystem.py @@ -4,7 +4,7 @@ from ape.api.transactions import ConfirmationsProgressBar, ReceiptAPI, TransactionAPI from ape.exceptions import ApeException, TransactionError from ape.logging import logger -from ape.types import GasLimit, TransactionSignature +from ape.types import GasLimit, HexInt, TransactionSignature from ape_ethereum.ecosystem import BaseEthereumConfig, Ethereum, NetworkConfig from ape_ethereum.transactions import ( AccessListTransaction, @@ -40,6 +40,8 @@ class ApeArbitrumError(ApeException): class ArbitrumReceipt(Receipt): + gas_used_for_L1: HexInt = Field(default=0, alias="gasUsedForL1") + def await_confirmations(self) -> "ReceiptAPI": """ Overridden to handle skipping nonce-check for internal txns. @@ -257,6 +259,7 @@ def decode_receipt(self, data: dict) -> ReceiptAPI: gas_limit=data.get("gas", data.get("gas_limit", data.get("gasLimit"))) or 0, gas_price=data.get("gas_price", data.get("gasPrice")) or 0, gas_used=data.get("gas_used", data.get("gasUsed")) or 0, + gasUsedForL1=data.get("gas_used_for_L1", data.get("gasUsedForL1")) or 0, logs=data.get("logs", []), status=status, txn_hash=txn_hash, diff --git a/setup.cfg b/setup.cfg index c362920..67b74dc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,7 @@ [flake8] max-line-length = 100 exclude = + .venv* venv* .eggs docs diff --git a/tests/test_ecosystem.py b/tests/test_ecosystem.py index bb85e19..d5a6f45 100644 --- a/tests/test_ecosystem.py +++ b/tests/test_ecosystem.py @@ -99,7 +99,10 @@ def test_decode_receipt(arbitrum): ), "status": 1, "l1BlockNumber": "0x11148fc", - "gasUsedForL1": "0x0", + "gasUsedForL1": "0x7", } actual = arbitrum.decode_receipt(data) assert isinstance(actual, ArbitrumReceipt) + + # Check that the receipt decodes HexInt correctly + assert actual.gas_used_for_L1 == 7