Skip to content

Commit e2f1536

Browse files
committed
Improve Blockchain Client test module
1 parent 5eae5a9 commit e2f1536

File tree

2 files changed

+707
-403
lines changed

2 files changed

+707
-403
lines changed

src/models/blockchain_client.py

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def _determine_transaction_nonce(self, sender_address: ChecksumAddress, replace:
316316
return nonce
317317

318318

319-
def _get_gas_prices(self, replace: bool) -> Tuple[int, int]:
319+
def _get_gas_prices(self) -> Tuple[int, int]:
320320
"""Get base fee and max priority fee for transaction."""
321321
# Get current gas prices with detailed logging
322322
try:
@@ -400,29 +400,6 @@ def _build_and_sign_transaction(
400400
raise
401401

402402

403-
def _handle_transaction_error(self, error_msg: str) -> None:
404-
"""Handle and log specific transaction error types."""
405-
# If the error message contains "insufficient funds", log the error
406-
if "insufficient funds" in error_msg.lower():
407-
logger.error("Insufficient funds to pay for gas")
408-
409-
# If the error message contains "nonce too low", log the error
410-
elif "nonce too low" in error_msg.lower():
411-
logger.error("Nonce is too low - transaction may have already been sent")
412-
413-
# If the error message contains "nonce too high", log the error
414-
elif "nonce too high" in error_msg.lower():
415-
logger.error("Nonce is too high - there may be pending transactions")
416-
417-
# If the error message contains "gas", log the error
418-
elif "gas" in error_msg.lower():
419-
logger.error("Gas-related issue - transaction may consume too much gas")
420-
421-
# If the error message contains "400", log the error
422-
elif "400" in error_msg:
423-
logger.error("HTTP 400 Bad Request - RPC provider rejected the request")
424-
425-
426403
def _send_signed_transaction(self, signed_tx: Any) -> str:
427404
"""
428405
Send a signed transaction and wait for the receipt.
@@ -531,7 +508,7 @@ def _execute_complete_transaction(self, params: Dict) -> str:
531508
nonce = self._determine_transaction_nonce(sender_address, replace)
532509

533510
# 5. Get gas prices
534-
base_fee, max_priority_fee = self._get_gas_prices(replace)
511+
base_fee, max_priority_fee = self._get_gas_prices()
535512

536513
# 6. Build transaction parameters
537514
tx_params = self._build_transaction_params(

0 commit comments

Comments
 (0)