diff --git a/waku/src/general/mod.rs b/waku/src/general/mod.rs index 3fbb5cd..289baac 100644 --- a/waku/src/general/mod.rs +++ b/waku/src/general/mod.rs @@ -3,6 +3,9 @@ use serde::{Deserialize, Serialize}; // internal +pub type PubsubTopic = String; +pub type ContentTopic = String; + /// JsonResponse wrapper. /// `go-waku` ffi returns this type as a `char *` as per the [specification](https://rfc.vac.dev/spec/36/#jsonresponse-type) /// This is internal, as it is better to use rust plain `Result` type. @@ -33,7 +36,7 @@ impl From> for Response { pub struct WakuMessage { payload: Box<[u8]>, /// The content topic to be set on the message - content_topic: String, + content_topic: ContentTopic, /// The Waku Message version number version: usize, /// Unix timestamp in nanoseconds @@ -58,7 +61,7 @@ pub struct DecodedPayload { #[serde(rename_all = "camelCase")] pub struct ContentFilter { /// The content topic of a Waku message - content_topic: String, + content_topic: ContentTopic, } /// The criteria to create subscription to a light node in JSON Format @@ -69,7 +72,7 @@ pub struct FilterSubscription { /// Array of [`ContentFilter`] being subscribed to / unsubscribed from content_filters: Vec, /// Optional pubsub topic - pubsub_topic: Option, + pubsub_topic: Option, } /// Criteria used to retrieve historical messages @@ -77,7 +80,7 @@ pub struct FilterSubscription { #[serde(rename_all = "camelCase")] pub struct StoreQuery { /// The pubsub topic on which messages are published - pubsub_topic: Option, + pubsub_topic: Option, /// Array of [`ContentFilter`] to query for historical messages content_filters: Vec, /// The inclusive lower bound on the timestamp of queried messages. @@ -124,5 +127,5 @@ pub struct MessageIndex { /// UNIX timestamp in nanoseconds at which the message is generated by its sender sender_time: usize, /// The pubsub topic of the message at this [`MessageIndex`] - pubsub_topic: String, + pubsub_topic: PubsubTopic, }