diff --git a/pyproject.toml b/pyproject.toml index 192c99b..adc861d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "vana" -version = "0.36.0" +version = "0.37.0" description = "" authors = ["Tim Nunamaker ", "Volodymyr Isai ", "Kahtaf Alam "] readme = "README.md" diff --git a/vana/__init__.py b/vana/__init__.py index c87fe42..7be2bee 100644 --- a/vana/__init__.py +++ b/vana/__init__.py @@ -15,7 +15,7 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. -__version__ = "0.36.0" +__version__ = "0.37.0" import rich diff --git a/vana/chain_manager.py b/vana/chain_manager.py index f7c5f48..440432e 100644 --- a/vana/chain_manager.py +++ b/vana/chain_manager.py @@ -197,15 +197,20 @@ def state( return state_ - def send_transaction(self, function: ContractFunction, account: LocalAccount, value=0, max_retries=3, - base_gas_multiplier=1.5): + def send_transaction(self, + function: ContractFunction, + account: LocalAccount, + value=0, + max_retries=3, + base_gas_multiplier=1.5, + tx_manager=None + ): """ Send a transaction using the TransactionManager """ - """ - Send a transaction using the TransactionManager - """ - tx_manager = TransactionManager(self.web3, account) + if tx_manager is None: + # Create new TransactionManager only if not provided + tx_manager = TransactionManager(self.web3, account) return tx_manager.send_transaction( function=function, value=self.web3.to_wei(value, 'ether'), diff --git a/vana/client.py b/vana/client.py index e8fe6c2..bb896e1 100644 --- a/vana/client.py +++ b/vana/client.py @@ -6,6 +6,7 @@ from typing import Optional from vana.chain_data import Proof, ProofData from vana.contracts import contracts +from vana.utils.transaction import TransactionManager from vana.utils.web3 import as_wad @@ -47,6 +48,7 @@ def __init__(self, config: vana.Config): self.wallet = vana.Wallet(config=self.config) self.chain_manager = vana.ChainManager(config=self.config) self.network = self.config.chain.network + self.tx_manager = TransactionManager(self.chain_manager.web3, self.wallet.hotkey) # Load contracts data_registry_contract_path = os.path.join( @@ -172,7 +174,12 @@ def add_proof(self, proof_data: ProofData, file_id: int | None = None, job_id: i add_proof_fn = self.data_registry_contract.functions.addProof(file_id, proof_tuple) else: add_proof_fn = self.tee_pool_contract.functions.addProof(job_id, proof_tuple) - return self.chain_manager.send_transaction(add_proof_fn, self.wallet.hotkey) + return self.tx_manager.send_transaction( + function=add_proof_fn, + value=0, + max_retries=3, + base_gas_multiplier=1.5 + ) def claim(self): """