View Source Nostr.Event (Nostr v0.1.2)
Represents the basic structure of anything that's being sent to/from relays
Link to this section Summary
Functions
Simplifies the creation of an event, adding the created_at and tags fields and requiring the bare minimum to do so
Link to this section Functions
@spec create(binary(), K256.Schnorr.verifying_key()) :: %Nostr.Event{ content: term(), created_at: term(), id: term(), kind: term(), pubkey: term(), sig: term(), tags: term() }
Simplifies the creation of an event, adding the created_at and tags fields and requiring the bare minimum to do so
examples
Examples
iex> now = DateTime.utc_now()
...> pubkey = <<0xEFC83F01C8FB309DF2C8866B8C7924CC8B6F0580AFDDE1D6E16E2B6107C2862C::256>>
...> event = Nostr.Event.create("this is the content", pubkey)
...> %{event | created_at: now}
%Nostr.Event{
id: nil,
pubkey: <<0xefc83f01c8fb309df2c8866b8c7924cc8b6f0580afdde1d6e16e2b6107c2862c::256>>,
kind: nil,
created_at: now,
tags: [],
content: "this is the content",
sig: nil
}