Skip to content

Commit

Permalink
fix: receipt cls
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Dec 18, 2024
1 parent be8f67e commit 66b8dc4
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions src/ape_ethereum/ecosystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,30 +588,16 @@ def decode_receipt(self, data: dict) -> "ReceiptAPI":
"transaction": self.create_transaction(**data),
}

receipt_cls: type[Receipt]
if any(
x in data
for x in (
"blobGasPrice",
"blobGasUsed",
"blobVersionedHashes",
"maxFeePerBlobGas",
"blob_gas_price",
"blob_gas_used",
)
):
blob_gas_price = data.get("blob_gas_price", data.get("blobGasPrice"))
if data.get("type") == 3:
receipt_cls = SharedBlobReceipt
blob_gas_price = data.get("blob_gas_price")
if blob_gas_price is None:
# Not actually a blob-receipt? Some providers may give you
# empty values here when meaning the other types of receipts.
receipt_cls = Receipt
blob_gas_price = data.get("blobGasPrice")

else:
receipt_cls = SharedBlobReceipt
receipt_kwargs["blobGasPrice"] = blob_gas_price
receipt_kwargs["blobGasUsed"] = (
receipt_kwargs["blobGasPrice"] = blob_gas_price
receipt_kwargs["blobGasUsed"] = (
data.get("blob_gas_used", data.get("blobGasUsed")) or 0
)
)

else:
receipt_cls = Receipt
Expand Down

0 comments on commit 66b8dc4

Please sign in to comment.