nostr_tools.fetch_relay_metadata

async nostr_tools.fetch_relay_metadata(client, sec, pub, event_creation_timeout=None)[source]

Compute comprehensive relay metadata including NIP-11 and connection data.

This function performs a complete relay analysis by fetching NIP-11 metadata and testing connection capabilities. It automatically detects proof-of-work requirements from NIP-11 limitations.

Parameters:
  • client (Client) – An instance of Client (must not be already connected)

  • sec (str) – Private key for signing test events

  • pub (str) – Public key corresponding to the private key

  • event_creation_timeout (Optional[int]) – Timeout for event creation

Returns:

Complete metadata object for the relay

Return type:

RelayMetadata

Raises:

ClientConnectionError – If client is already connected