relay.ts raw

   1  /**
   2   * Infrastructure utilities for relay info checking.
   3   *
   4   * These are infrastructure-level helpers that check relay capabilities
   5   * and metadata. They don't contain domain logic and are appropriate
   6   * for use throughout the codebase.
   7   *
   8   * Note: For relay URL handling, use the domain RelayUrl value object:
   9   *   import { RelayUrl } from '@/domain'
  10   */
  11  
  12  import { TRelayInfo } from '@/types'
  13  
  14  export function checkAlgoRelay(relayInfo: TRelayInfo | undefined) {
  15    return relayInfo?.software === 'https://github.com/bitvora/algo-relay' // hardcode for now
  16  }
  17  
  18  export function checkSearchRelay(relayInfo: TRelayInfo | undefined) {
  19    return relayInfo?.supported_nips?.includes(50)
  20  }
  21  
  22  export function checkNip43Support(relayInfo: TRelayInfo | undefined) {
  23    return relayInfo?.supported_nips?.includes(43) && !!relayInfo.pubkey
  24  }
  25