commit 14b9d138aab07bdc86b33c1d619fa11f0e17bc23 parent 78d2e0f7fbc4f1f63acc11b211560ed72b7a6646 Author: triesap <tyson@radroots.org> Date: Sat, 4 Oct 2025 22:11:05 +0100 net-core: add async and blocking text note publish apis Diffstat:
| M | crates/net-core/src/nostr_client.rs | | | 16 | ++++++++++++++++ |
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/crates/net-core/src/nostr_client.rs b/crates/net-core/src/nostr_client.rs @@ -252,6 +252,22 @@ impl NostrClientManager { }) } + pub async fn publish_text_note(&self, content: String) -> Result<String> { + let out = self + .inner + .client + .send_event_builder(EventBuilder::text_note(content)) + .await + .map_err(|e| NetError::Msg(e.to_string()))?; + Ok(out.val.to_string()) + } + + pub fn publish_text_note_blocking(&self, content: String) -> Result<String> { + let rt = self.inner.rt.clone(); + let this = self.clone(); + rt.block_on(async move { this.publish_text_note(content).await }) + } + fn spawn_status_watcher(&self) { let inner = self.inner.clone(); let rt = inner.rt.clone();