gnosis/safe/safe_tx.py
def execute(self,
                tx_sender_private_key: str,
                tx_gas: Optional[int] = None,
                tx_gas_price: Optional[int] = None,
                tx_nonce: Optional[int] = None,
                block_identifier='pending') -> Tuple[bytes, Dict[str, any]]:
        """
        Send multisig tx to the Safe
        :param tx_sender_private_key: Sender private key
        :param tx_gas: Gas for the external tx. If not, `(safe_tx_gas + data_gas) * 2` will be used
        :param tx_gas_price: Gas price of the external tx. If not, `gas_price` will be used
        :param tx_nonce: Force nonce for `tx_sender`
        :param block_identifier: `latest` or `pending`
        :return: Tuple(tx_hash, tx)
        :raises: InvalidMultisigTx: If user tx cannot go through the Safe
        """

        tx_gas_price = tx_gas_price or self.gas_price  # Use wrapped tx gas_price if not provided
        tx_gas = tx_gas or (self.safe_tx_gas + self.data_gas) * 2
        tx_sender_address = Account.privateKeyToAccount(tx_sender_private_key).address

        tx_parameters = {
            'from': tx_sender_address,
            'gas': tx_gas,
            'gasPrice': tx_gas_price,
        }
        if tx_nonce is not None:
            tx_parameters['nonce'] = tx_nonce

        self.tx = self.w3_tx.buildTransaction(tx_parameters)
        self.tx_hash = self.ethereum_client.send_unsigned_transaction(self.tx,
                                                                      private_key=tx_sender_private_key,
                                                                      retry=True,
                                                                      block_identifier=block_identifier)
        return self.tx_hash, self.tx
def execute(self,
                tx_sender_private_key: str,
                tx_gas: Optional[int] = None,
                tx_gas_price: Optional[int] = None,
                tx_nonce: Optional[int] = None,
                block_identifier='pending') -> Tuple[bytes, Dict[str, any]]:
        """
        Send multisig tx to the Safe
        :param tx_sender_private_key: Sender private key
        :param tx_gas: Gas for the external tx. If not, `(safe_tx_gas + data_gas) * 2` will be used
        :param tx_gas_price: Gas price of the external tx. If not, `gas_price` will be used
        :param tx_nonce: Force nonce for `tx_sender`
        :param block_identifier: `latest` or `pending`
        :return: Tuple(tx_hash, tx)
        :raises: InvalidMultisigTx: If user tx cannot go through the Safe
        """

        tx_gas_price = tx_gas_price or self.gas_price  # Use wrapped tx gas_price if not provided
        tx_gas = tx_gas or (self.safe_tx_gas + self.data_gas) * 2
        tx_sender_address = Account.privateKeyToAccount(tx_sender_private_key).address

        tx_parameters = {
            'from': tx_sender_address,
            'gas': tx_gas,
            'gasPrice': tx_gas_price,
        }
        if tx_nonce is not None:
            tx_parameters['nonce'] = tx_nonce

        self.tx = self.w3_tx.buildTransaction(tx_parameters)
        self.tx_hash = self.ethereum_client.send_unsigned_transaction(self.tx,
                                                                      private_key=tx_sender_private_key,
                                                                      retry=True,
                                                                      block_identifier=block_identifier)
        return self.tx_hash, self.tx
Send multisig tx to the Safe
        :param tx_sender_private_key: Sender private key
        :param tx_gas: Gas for the external tx. If not, `(safe_tx_gas + data_gas) * 2` will be used
        :param tx_gas_price: Gas price of the external tx. If not, `gas_price` will be used
        :param tx_nonce: Force nonce for `tx_sender`
        :param block_identifier: `latest` or `pending`
        :return: Tuple(tx_hash, tx)
        :raises: InvalidMultisigTx: If user tx cannot go through the Safe