Bookmark
Endpoint Resolver
query_
record
def query_record(agent_address: str, service: str) -> dict
Query a record from the Almanac contract.
Arguments:
agent_address
str - The address of the agent.service
str - The type of service to query.
Returns:
dict
- The query result.
get_
agent_
address
def get_agent_address(name: str) -> str
Get the agent address associated with the provided name from the name service contract.
Arguments:
name
str - The name to query.
Returns:
str
- The associated agent address.
is_
agent_
address
def is_agent_address(address)
Check if the provided address is a valid agent address.
Arguments:
address
- The address to check.
Returns:
bool
- True if the address is a valid agent address, False otherwise.
Resolver Objects
class Resolver(ABC)
resolve
@abstractmethod
async def resolve(destination: str) -> Optional[str]
Resolve the destination to an endpoint.
Arguments:
destination
str - The destination to resolve.
Returns:
Optional[str]
- The resolved endpoint or None.
GlobalResolver Objects
class GlobalResolver(Resolver)
resolve
async def resolve(destination: str) -> Optional[str]
Resolve the destination using a combination of Almanac and NameService resolvers.
Arguments:
destination
str - The destination to resolve.
Returns:
Optional[str]
- The resolved endpoint or None.
AlmanacResolver Objects
class AlmanacResolver(Resolver)
resolve
async def resolve(destination: str) -> Optional[str]
Resolve the destination using the Almanac contract.
Arguments:
destination
str - The destination to resolve.
Returns:
Optional[str]
- The resolved endpoint or None.
NameServiceResolver Objects
class NameServiceResolver(Resolver)
resolve
async def resolve(destination: str) -> Optional[str]
Resolve the destination using the NameService contract.
Arguments:
destination
str - The destination to resolve.
Returns:
Optional[str]
- The resolved endpoint or None.
RulesBasedResolver Objects
class RulesBasedResolver(Resolver)
__
init__
def __init__(rules: Dict[str, str])
Initialize the RulesBasedResolver with the provided rules.
Arguments:
rules
Dict[str, str] - A dictionary of rules mapping destinations to endpoints.
resolve
async def resolve(destination: str) -> Optional[str]
Resolve the destination using the provided rules.
Arguments:
destination
str - The destination to resolve.
Returns:
Optional[str]
- The resolved endpoint or None.