aboutsummaryrefslogtreecommitdiff
path: root/src/event.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/event.cpp')
-rw-r--r--src/event.cpp51
1 files changed, 25 insertions, 26 deletions
diff --git a/src/event.cpp b/src/event.cpp
index 75f2ee8..0e4e159 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -1,38 +1,37 @@
-#pragma once
-
#include <string>
#include <vector>
#include <nlohmann/json.hpp>
#include "nostr.hpp"
+using nlohmann::json;
using std::string;
namespace nostr
{
- nlohmann::json Event::serialize() const
- {
- nlohmann::json j = {
- {"id", this->id},
- {"pubkey", this->pubkey},
- {"created_at", this->created_at},
- {"kind", this->kind},
- {"tags", this->tags},
- {"content", this->content},
- {"sig", this->sig}
- };
- return j.dump();
+json Event::serialize() const
+{
+ json j = {
+ {"id", this->id},
+ {"pubkey", this->pubkey},
+ {"created_at", this->created_at},
+ {"kind", this->kind},
+ {"tags", this->tags},
+ {"content", this->content},
+ {"sig", this->sig}
};
+ return j.dump();
+};
- void Event::deserialize(string jsonString)
- {
- nlohmann::json j = nlohmann::json::parse(jsonString);
- this->id = j["id"];
- this->pubkey = j["pubkey"];
- this->created_at = j["created_at"];
- this->kind = j["kind"];
- this->tags = j["tags"];
- this->content = j["content"];
- this->sig = j["sig"];
- };
-}
+void Event::deserialize(string jsonString)
+{
+ json j = json::parse(jsonString);
+ this->id = j["id"];
+ this->pubkey = j["pubkey"];
+ this->created_at = j["created_at"];
+ this->kind = j["kind"];
+ this->tags = j["tags"];
+ this->content = j["content"];
+ this->sig = j["sig"];
+};
+} // namespace nostr