commit d7a493da239527b4117e5bba495210ba8c2ff859
parent dcfaef659ca41ba48cab68f683721f608b3d56f0
Author: triesap <triesap@radroots.dev>
Date: Wed, 24 Dec 2025 22:21:37 +0000
trade_listing: refactor DVM envelope tags builder
- Add public_key field to identity.json
- Import shared trade_listing_dvm_tags helper
- Replace manual tag vector construction with helper call
- Normalize tag capacity/allocation logic in send_envelope
Diffstat:
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/identity.json b/identity.json
@@ -1,3 +1,4 @@
{
- "secret_key": "b13b688e1aa9f113739745549484901d90a7b0e84d4c78d8baf969670d5cfce4"
+ "secret_key": "b13b688e1aa9f113739745549484901d90a7b0e84d4c78d8baf969670d5cfce4",
+ "public_key": "1bdeb157e3ec787d13db044b2d0675fc0c9886ef0292fd0b2f480f172877a157"
}
\ No newline at end of file
diff --git a/src/features/trade_listing/handlers/dvm.rs b/src/features/trade_listing/handlers/dvm.rs
@@ -28,6 +28,7 @@ use radroots_trade::listing::{
TradeFulfillmentUpdate, TradeOrder, TradeOrderRevision, TradeOrderStatus, TradeQuestion,
TradeReceipt,
},
+ tags::trade_listing_dvm_tags,
validation::{validate_listing_event, TradeListingValidationError},
};
use serde::de::DeserializeOwned;
@@ -904,12 +905,7 @@ async fn send_envelope<T: serde::Serialize + Clone>(
payload.clone(),
);
let content = serde_json::to_string(&envelope)?;
- let mut tags = Vec::with_capacity(3);
- tags.push(vec!["p".into(), recipient_pubkey]);
- tags.push(vec!["a".into(), listing_addr.to_string()]);
- if let Some(order_id) = order_id {
- tags.push(vec!["d".into(), order_id.to_string()]);
- }
+ let tags = trade_listing_dvm_tags(recipient_pubkey, listing_addr, order_id);
let builder = radroots_nostr_build_event(message_type.kind() as u32, content, tags)?;
radroots_nostr_send_event(client, builder).await?;
Ok(())