mod.rs (1176B)
1 #![allow(dead_code)] 2 3 use radroots_events::{RadrootsNostrEvent, RadrootsNostrEventPtr, RadrootsNostrEventRef}; 4 5 pub fn event_ref(id: &str, author: &str, kind: u32) -> RadrootsNostrEventRef { 6 RadrootsNostrEventRef { 7 id: id.to_string(), 8 author: author.to_string(), 9 kind, 10 d_tag: None, 11 relays: None, 12 } 13 } 14 15 pub fn event_ref_with_d( 16 id: &str, 17 author: &str, 18 kind: u32, 19 d_tag: &str, 20 relays: Option<Vec<String>>, 21 ) -> RadrootsNostrEventRef { 22 RadrootsNostrEventRef { 23 id: id.to_string(), 24 author: author.to_string(), 25 kind, 26 d_tag: Some(d_tag.to_string()), 27 relays, 28 } 29 } 30 31 pub fn event_ptr(id: &str, relays: Option<&str>) -> RadrootsNostrEventPtr { 32 RadrootsNostrEventPtr { 33 id: id.to_string(), 34 relays: relays.map(|s| s.to_string()), 35 } 36 } 37 38 pub fn nostr_event(kind: u32, content: &str, tags: Vec<Vec<String>>) -> RadrootsNostrEvent { 39 RadrootsNostrEvent { 40 id: "id".to_string(), 41 author: "author".to_string(), 42 created_at: 123, 43 kind, 44 tags, 45 content: content.to_string(), 46 sig: "sig".to_string(), 47 } 48 }