Skip to content

Commit

Permalink
chore: doc string update and typing assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
jrriehl committed Oct 29, 2024
1 parent a5b75d7 commit b380dd9
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions python/src/uagents/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,21 +722,28 @@ def sign_digest(self, digest: bytes) -> str:
return self._identity.sign_digest(digest)

def sign_registration(
self, current_time: int, sender_address: Optional[str] = None
self, timestamp: int, sender_address: Optional[str] = None
) -> str:
"""
Sign the registration data for Almanac contract.
Args:
timestamp (int): The timestamp for the registration.
sender_address (Optional[str]): The address of the sender.
Returns:
str: The signature of the registration data.
Raises:
AssertionError: If the Almanac contract address is None.
AssertionError: If the Almanac contract is None.
"""
sender_address = sender_address or str(self.wallet.address())

assert self._almanac_contract.address is not None
assert self._almanac_contract is not None

return self._identity.sign_registration(
str(self._almanac_contract.address),
current_time,
timestamp,
sender_address,
)

Expand Down Expand Up @@ -791,6 +798,8 @@ async def register(self):
if necessary.
"""
assert self._registration_policy is not None, "Agent has no registration policy"

await self._registration_policy.register(
self.address, list(self.protocols.keys()), self._endpoints, self._metadata
)
Expand Down

0 comments on commit b380dd9

Please sign in to comment.