Skip to content

Commit

Permalink
fix: minor things
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandro-Morales committed Oct 4, 2023
1 parent c3160f2 commit 96df1d9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion python/examples/01-first-agent/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@agent.on_event("startup")
async def introduce_agent(ctx: Context):
ctx.logger.info(f"Hello, I'm agent {ctx.name} and my address is {ctx.identifier}.")
ctx.logger.info(f"Hello, I'm agent {ctx.name} and my address is {ctx.address}.")


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion python/examples/02-interval-task/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@agent.on_event("startup")
async def introduce_agent(ctx: Context):
ctx.logger.info(f"Hello, I'm agent {ctx.name} and my address is {ctx.identifier}.")
ctx.logger.info(f"Hello, I'm agent {ctx.name} and my address is {ctx.address}.")


@agent.on_interval(period=2.0)
Expand Down
2 changes: 1 addition & 1 deletion python/examples/05-send-msg/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Message(Model):
@alice.on_interval(period=2.0)
async def send_message(ctx: Context):
msg = f"Hello there {bob.name} my name is {alice.name}."
await ctx.send(bob.identifier, Message(text=msg))
await ctx.send(bob.address, Message(text=msg))


@bob.on_message(model=Message)
Expand Down
21 changes: 13 additions & 8 deletions python/src/uagents/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,12 @@ def is_domain_public(self, domain: str):
return res["is_public"]

def get_registration_tx(
self, name: str, wallet_address: str, agent_address: str, domain: str, test: bool
self,
name: str,
wallet_address: str,
agent_address: str,
domain: str,
test: bool,
):
"""
Get the registration transaction for registering a name within a domain.
Expand Down Expand Up @@ -358,9 +363,7 @@ def get_registration_tx(
contract = TESTNET_CONTRACT_NAME_SERVICE if test else CONTRACT_NAME_SERVICE
transaction = Transaction()
transaction.add_message(
create_cosmwasm_execute_msg(
wallet_address, contract, registration_msg
)
create_cosmwasm_execute_msg(wallet_address, contract, registration_msg)
)

return transaction
Expand Down Expand Up @@ -401,7 +404,11 @@ async def register(
return

transaction = self.get_registration_tx(
name, str(wallet.address()), agent_address, domain, chain_id == "dorado-1",
name,
str(wallet.address()),
agent_address,
domain,
chain_id == "dorado-1",
)

if transaction is None:
Expand All @@ -416,9 +423,7 @@ async def register(
logger.info("Registering name...complete")


_name_service_contract = NameServiceContract(
None, _ledger, CONTRACT_NAME_SERVICE
)
_name_service_contract = NameServiceContract(None, _ledger, CONTRACT_NAME_SERVICE)
_testnet_name_service_contract = NameServiceContract(
None, _testnet_ledger, TESTNET_CONTRACT_NAME_SERVICE
)
Expand Down

0 comments on commit 96df1d9

Please sign in to comment.