safe.execute

Documentation for eth_defi.safe.execute Python module.

Fix broken Safe Python SDK stuff.

The upstream safe_eth library manages transaction nonces internally by reading from the RPC node. On load-balanced endpoints this often returns stale values, causing “nonce too low” errors when multiple transactions are sent in quick succession (e.g. during multichain vault deployment).

All functions in this module accept an optional HotWallet parameter. When provided the nonce is allocated from the wallet’s internal counter instead of querying the RPC, keeping it in sync with other HotWallet-managed transactions in the same deployment flow.

Functions

execute_safe_tx(self, tx_sender_private_key)

Fixed version of SafeTx.execute().

execute_safe_tx(self, tx_sender_private_key, tx_gas=None, tx_gas_price=None, tx_nonce=None, block_identifier='latest', eip1559_speed=None, gas_fee=None, hot_wallet=None)

Fixed version of SafeTx.execute().

  • See the original as safe_eth.safe.safe_tx.SafeTx.execute()

  • Handle gas fees correctly, don’t fail randomly

Parameters
  • gas_fee (GasPriceSuggestion) – Gas fee to apply to the transaction, don’t try to use broken Safe logic to get gas fee filled in, as it will result to broken transactions rejected by the node.

  • hot_wallet (HotWallet | None) – When provided, allocate the transaction nonce from the wallet’s internal counter instead of reading from the RPC node. This avoids stale-nonce errors on load-balanced endpoints. Takes precedence over tx_nonce.

  • self (SafeTx) –

  • tx_sender_private_key (str) –

  • tx_gas (Optional[int]) –

  • tx_gas_price (Optional[int]) –

  • tx_nonce (Optional[int]) –

  • block_identifier (Optional[BlockIdentifier]) –

  • eip1559_speed (Optional[TxSpeed]) –

Return type

Tuple[HexBytes, TxParams]