| 1181 | |
| 1182 | @dataclass |
| 1183 | class TransactionSlot: |
| 1184 | from_address: Address |
| 1185 | data: Union[SmartContractCall, ByteCode, EthTransfer] |
| 1186 | eth_node: Optional[EthClient] |
| 1187 | extra_log_details: Dict[str, Any] |
| 1188 | startgas: int |
| 1189 | gas_price: int |
| 1190 | nonce: Nonce |
| 1191 | |
| 1192 | def __post_init__(self) -> None: |
| 1193 | self.extra_log_details.setdefault("token", str(uuid4())) |
| 1194 | |
| 1195 | typecheck(self.from_address, T_Address) |
| 1196 | typecheck(self.data, (SmartContractCall, ByteCode, EthTransfer)) |
| 1197 | typecheck(self.startgas, int) |
| 1198 | typecheck(self.gas_price, int) |
| 1199 | typecheck(self.nonce, T_Nonce) |
| 1200 | |
| 1201 | def to_log_details(self) -> Dict[str, Any]: |
| 1202 | log_details = self.data.to_log_details() |
| 1203 | log_details.update(self.extra_log_details) |
| 1204 | log_details.update( |
| 1205 | { |
| 1206 | "node": to_checksum_address(client.address), |
| 1207 | "from_address": to_checksum_address(self.from_address), |
| 1208 | "eth_node": self.eth_node, |
| 1209 | "startgas": self.startgas, |
| 1210 | "gas_price": self.gas_price, |
| 1211 | "nonce": self.nonce, |
| 1212 | } |
| 1213 | ) |
| 1214 | return log_details |
| 1215 | |
| 1216 | # The class is hidden in the method to force this method to be called, |
| 1217 | # this is necessary to enforce the monotonicity of the `nonce`. |