initial note posting

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-07-01 06:42:04 -07:00
parent 8dc829791e
commit a04df88ff6
9 changed files with 70 additions and 45 deletions

17
src/post.rs Normal file
View File

@@ -0,0 +1,17 @@
use nostrdb::NoteBuilder;
pub struct NewPost {
pub content: String,
pub account: usize,
}
impl NewPost {
pub fn to_note(&self, seckey: &[u8; 32]) -> nostrdb::Note {
NoteBuilder::new()
.kind(1)
.content(&self.content)
.sign(seckey)
.build()
.expect("note should be ok")
}
}