Nostr.Event.DMRelayList (Nostr Lib v0.2.1) (event) (nip17)

View Source

DM Relay List (Kind 10_050)

Indicates the user's preferred relays for receiving direct messages per NIP-17. This is a replaceable event that clients should publish to help others find where to send encrypted DMs.

Defined in NIP 17 https://github.com/nostr-protocol/nips/blob/master/17.md

Summary

Functions

Create a new DM relay list event

Parse a kind 10_050 event into a DMRelayList struct

Types

t()

@type t() :: %Nostr.Event.DMRelayList{event: Nostr.Event.t(), relays: [URI.t()]}

Functions

create(relays, opts \\ [])

@spec create(relays :: [binary()], opts :: Keyword.t()) :: t()

Create a new DM relay list event

Arguments

  • relays - list of relay URIs (strings)
  • opts - optional event arguments (pubkey, created_at)

Example

iex> list = Nostr.Event.DMRelayList.create(["wss://relay1.com", "wss://relay2.com"])
iex> length(list.relays)
2
iex> list.event.kind
10_050

parse(event)

@spec parse(Nostr.Event.t()) :: t()

Parse a kind 10_050 event into a DMRelayList struct