From 35eecb5520f387665de079ba8afa126d5dfd5983 Mon Sep 17 00:00:00 2001 From: James Riehl Date: Tue, 7 Jan 2025 14:04:13 +0000 Subject: [PATCH] fix(core): mainnet registration support --- python/src/uagents/config.py | 2 +- python/src/uagents/network.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/python/src/uagents/config.py b/python/src/uagents/config.py index edee6c3d..504a8843 100644 --- a/python/src/uagents/config.py +++ b/python/src/uagents/config.py @@ -26,10 +26,10 @@ "fetch1mxz8kn3l5ksaftx8a9pj9a6prpzk2uhxnqdkwuqvuh37tw80xu6qges77l" ) REGISTRATION_FEE = 500000000000000000 -REGISTRATION_DENOM = "atestfet" REGISTRATION_UPDATE_INTERVAL_SECONDS = 3600 REGISTRATION_RETRY_INTERVAL_SECONDS = 60 AVERAGE_BLOCK_INTERVAL = 6 +DEFAULT_LEDGER_TX_WAIT_SECONDS = 30 ALMANAC_CONTRACT_VERSION = "2.0.0" AGENTVERSE_URL = "https://agentverse.ai" diff --git a/python/src/uagents/network.py b/python/src/uagents/network.py index 51dd25a6..cc42dfd0 100644 --- a/python/src/uagents/network.py +++ b/python/src/uagents/network.py @@ -25,9 +25,9 @@ ALMANAC_CONTRACT_VERSION, ALMANAC_REGISTRATION_WAIT, AVERAGE_BLOCK_INTERVAL, + DEFAULT_LEDGER_TX_WAIT_SECONDS, MAINNET_CONTRACT_ALMANAC, MAINNET_CONTRACT_NAME_SERVICE, - REGISTRATION_DENOM, REGISTRATION_FEE, TESTNET_CONTRACT_ALMANAC, TESTNET_CONTRACT_NAME_SERVICE, @@ -399,19 +399,21 @@ async def register( address=agent_address, ) + denom = self._client.network_config.fee_denomination transaction.add_message( create_cosmwasm_execute_msg( wallet.address(), self.address, almanac_msg, - funds=f"{REGISTRATION_FEE}{REGISTRATION_DENOM}", + funds=f"{REGISTRATION_FEE}{denom}", ) ) transaction = prepare_and_broadcast_basic_transaction( ledger, transaction, wallet ) - await wait_for_tx_to_complete(transaction.tx_hash, ledger) + timeout = timedelta(seconds=DEFAULT_LEDGER_TX_WAIT_SECONDS) + await wait_for_tx_to_complete(transaction.tx_hash, ledger, timeout=timeout) async def register_batch( self, @@ -447,19 +449,21 @@ async def register_batch( address=record.agent_address, ) + denom = self._client.network_config.fee_denomination transaction.add_message( create_cosmwasm_execute_msg( wallet.address(), self.address, almanac_msg, - funds=f"{REGISTRATION_FEE}{REGISTRATION_DENOM}", + funds=f"{REGISTRATION_FEE}{denom}", ) ) transaction = prepare_and_broadcast_basic_transaction( ledger, transaction, wallet ) - await wait_for_tx_to_complete(transaction.tx_hash, ledger) + timeout = timedelta(seconds=DEFAULT_LEDGER_TX_WAIT_SECONDS) + await wait_for_tx_to_complete(transaction.tx_hash, ledger, timeout=timeout) def get_sequence(self, address: str) -> int: """