commit cec74fe72a816d288546ca1169d52b6b3c58d62b
parent 3b3bc3b87e137391a9825fdb9ffbd0f41c522c1a
Author: triesap <triesap@radroots.dev>
Date: Wed, 7 Jan 2026 17:17:16 +0000
nostr: update nip89 handler announcement
- announce trade listing DVM kinds on startup
- include metadata content when available
- publish through shared nostr helper
- log publish failures without aborting
Diffstat:
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/src/lib.rs b/src/lib.rs
@@ -17,7 +17,13 @@ use crate::{
rhi::{Rhi, start_subscriber},
};
use radroots_identity::RadrootsIdentity;
-use radroots_nostr::prelude::{radroots_nostr_publish_identity_profile, RadrootsNostrMetadata};
+use radroots_nostr::prelude::{
+ radroots_nostr_publish_application_handler,
+ radroots_nostr_publish_identity_profile,
+ RadrootsNostrApplicationHandlerSpec,
+ RadrootsNostrMetadata,
+};
+use radroots_trade::listing::dvm_kinds::TRADE_LISTING_DVM_KINDS;
use tracing::{info, warn};
fn metadata_has_fields(md: &RadrootsNostrMetadata) -> bool {
@@ -70,6 +76,22 @@ pub async fn run_rhi(settings: &config::Settings, args: &cli_args) -> Result<()>
info!("Published metadata on startup");
}
}
+
+ let handler_kinds = TRADE_LISTING_DVM_KINDS
+ .iter()
+ .map(|kind| *kind as u32)
+ .collect();
+ let handler_spec = RadrootsNostrApplicationHandlerSpec {
+ kinds: handler_kinds,
+ identifier: None,
+ metadata: Some(md.clone()),
+ extra_tags: Vec::new(),
+ };
+ if let Err(e) = radroots_nostr_publish_application_handler(&client, &handler_spec).await {
+ warn!("Failed to publish NIP-89 announcement: {e}");
+ } else {
+ info!("Published NIP-89 announcement");
+ }
}
let handle = start_subscriber(