diff --git a/derive_client/_bridge/client.py b/derive_client/_bridge/client.py index e4d3e81a..92daa0ef 100644 --- a/derive_client/_bridge/client.py +++ b/derive_client/_bridge/client.py @@ -26,7 +26,6 @@ CONTROLLER_ABI_PATH, CONTROLLER_V0_ABI_PATH, DEFAULT_GAS_FUNDING_AMOUNT, - DEPOSIT_GAS_LIMIT, DEPOSIT_HELPER_ABI_PATH, DEPOSIT_HOOK_ABI_PATH, DERIVE_ABI_PATH, @@ -565,7 +564,7 @@ def poll_bridge_progress(self, tx_result: BridgeTxResult) -> BridgeTxResult: return tx_result - def _ensure_derive_eth_balance(self, tx:dict[str, str]): + def _ensure_derive_eth_balance(self, tx: dict[str, str]): """Ensure that the Derive EOA wallet has sufficient ETH balance for gas.""" balance_of_owner = self.derive_w3.eth.get_balance(self.owner) required_gas = tx['maxFeePerGas'] * tx['gas'] @@ -594,8 +593,10 @@ def bridge_mainnet_eth_to_derive(self, amount: int) -> TxResult: ) require_gas = tx['maxFeePerGas'] * tx['gas'] current_balance = w3.eth.get_balance(self.account.address) - if not current_balance >= (amount + require_gas ) * 1.1: - raise InsufficientGas(f"Insufficient ETH balance for bridging amount {amount} + gas {require_gas}. Balance: {current_balance}") + if not current_balance >= (amount + require_gas) * 1.1: + raise InsufficientGas( + f"Insufficient ETH balance for bridging amount {amount} + gas {require_gas}. Balance: {current_balance}" + ) tx_result = send_and_confirm_tx( w3=w3, tx=tx, private_key=self.private_key, action="bridgeETH()", logger=self.logger ) diff --git a/derive_client/utils/w3.py b/derive_client/utils/w3.py index bb1a98fa..4d167652 100644 --- a/derive_client/utils/w3.py +++ b/derive_client/utils/w3.py @@ -19,7 +19,7 @@ from derive_client.constants import ABI_DATA_DIR, DEFAULT_RPC_ENDPOINTS, GAS_FEE_BUFFER from derive_client.data_types import ChainID, RPCEndpoints, TxResult, TxStatus -from derive_client.exceptions import NoAvailableRPC, TxSubmissionError +from derive_client.exceptions import NoAvailableRPC from derive_client.utils.logger import get_logger from derive_client.utils.retry import exp_backoff_retry @@ -250,7 +250,7 @@ def send_and_confirm_tx( """Send and confirm transactions.""" try: - + tx_hash = sign_and_send_tx(w3=w3, tx=tx, private_key=private_key, logger=logger) tx_result = TxResult(tx_hash=tx_hash.to_0x_hex(), tx_receipt=None, exception=None) diff --git a/poetry.lock b/poetry.lock index 490ab447..4033e5f4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -785,21 +785,21 @@ cython = ["cython"] [[package]] name = "derive-action-signing" -version = "0.0.11" +version = "0.0.12" description = "Python package to sign on-chain self-custodial requests for orders, transfers, deposits, withdrawals and RFQs." optional = false python-versions = "<4.0,>=3.9" groups = ["main"] markers = "python_version <= \"3.11\" or python_version >= \"3.12\"" files = [ - {file = "derive_action_signing-0.0.11-py3-none-any.whl", hash = "sha256:3b8c3ee7b3928ef874a9ac57cae6f7e376eeda56312c8ae0b043d47f35213c84"}, - {file = "derive_action_signing-0.0.11.tar.gz", hash = "sha256:96e49a4a27e0357b0803843a9c9a42e19c9c582c3db5ac0a23621d7df93784c9"}, + {file = "derive_action_signing-0.0.12-py3-none-any.whl", hash = "sha256:c7fbee46e8fc6abac9204bec6fee9922d22800f647fee4c44f0e15a72eecd187"}, + {file = "derive_action_signing-0.0.12.tar.gz", hash = "sha256:2ede7861234fd677abd05f88d2e0f27e27966753e02735e938a97be173bd277f"}, ] [package.dependencies] eth-abi = ">=4.2.1" eth-account = ">=0.13.4" -eth-typing = "4.0.0" +eth-typing = ">=4,<6" hexbytes = ">=0.3.1" setuptools = ">=75.8.0,<76.0.0" web3 = ">=6.4.0,<7.0.0" @@ -3516,4 +3516,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.1" python-versions = ">=3.9,<=3.12" -content-hash = "c97f166b5e8df7ff7d28ffcd3b86a48dce2197109ad7fc789621cd332eaf2cee" +content-hash = "51c56da059c0ddc0152a67ba6dbfe9ccd611075194caf9c8520e7341d7ae81d7" diff --git a/pyproject.toml b/pyproject.toml index fe012f90..34e4e04e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ rich-click = "^1.7.1" python-dotenv = ">=0.14.0,<2" pandas = ">=1,<=3" eth-account = ">=0.13" -derive-action-signing = "^0.0.11" +derive-action-signing = "^0.0.12" pydantic = "^2.11.3" aiolimiter = "^1.2.1"