2021-08-23 16:17:29 -04:00

29 lines
582 B
Python

from pydantic import validator
from mev_inspect.utils import hex_to_int
from .utils import CamelModel
class Receipt(CamelModel):
block_number: int
transaction_hash: str
transaction_index: int
gas_used: int
effective_gas_price: int
cumulative_gas_used: int
to: str
@validator(
"block_number",
"transaction_index",
"gas_used",
"effective_gas_price",
"cumulative_gas_used",
pre=True,
)
def maybe_hex_to_int(v):
if isinstance(v, str):
return hex_to_int(v)
return v