uAgents icon indicating copy to clipboard operation
uAgents copied to clipboard

Asyncio wrappers for CosmPy transactions

Open jrriehl opened this issue 2 years ago • 1 comments
trafficstars

jrriehl avatar Nov 21 '22 11:11 jrriehl

Currently we use this to wrap the registration transaction in an async function, but it would probably be better to come up with a standard way of doing this, maybe even fro eventual addition to the CosmPy repo:

logging.info(f"Registering Agent {self._name}...")
transaction = await self._loop.run_in_executor(
    None,
    functools.partial(
        self._reg_contract.execute,
        msg,
        ctx.wallet,
        funds=f"{REGISTRATION_FEE}{REGISTRATION_DENOM}",
    ),
)
await self._loop.run_in_executor(None, transaction.wait_to_complete)
logging.info(f"Registering Agent {self._name}...complete")

jrriehl avatar Nov 22 '22 10:11 jrriehl

Is this still valid? The network module has async registration capabilities and as far as I know the only part in which you would need something like this is when using wait_for_tx_to_complete() so I'd say we are good for now. Do you have another specific use-case in mind?

Archento avatar Jul 22 '24 10:07 Archento

Yes, this was completed quite a while ago. Closing now.

jrriehl avatar Jul 22 '24 10:07 jrriehl