commit 734db3c665c65347dd4aec0ff9b9239096fd8c43 parent 5f066309ff7ffc40c167168b583de2ded52d1794 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();