Move mev inspect code to mev_inspect module

This commit is contained in:
Luke Van Seters
2021-07-15 10:39:32 -04:00
parent cc64187c3f
commit 39a2038d95
12 changed files with 35 additions and 20 deletions

View File

@@ -0,0 +1,44 @@
import json
from enum import Enum
from typing import Dict, List, Optional
from pydantic import BaseModel
from .utils import CamelModel, Web3Model
class BlockCallType(Enum):
call = "call"
create = "create"
delegate_call = "delegateCall"
reward = "reward"
suicide = "suicide"
class BlockCall(CamelModel):
action: dict
block_hash: str
block_number: int
result: Optional[dict]
subtraces: int
trace_address: List[int]
transaction_hash: Optional[str]
transaction_position: Optional[int]
type: BlockCallType
error: Optional[str]
class Block(Web3Model):
block_number: int
calls: List[BlockCall]
data: dict
logs: List[dict]
receipts: dict
transaction_hashes: List[str]
txs_gas_data: Dict[str, dict]
def get_filtered_calls(self, hash: str) -> List[BlockCall]:
return [
call for call in self.calls
if call.transaction_hash == hash
]