mirror of
https://github.com/OpenCoin/oc-mint-cpp.git
synced 2024-12-22 07:39:40 +01:00
added RequestCDDC::from_json
This commit is contained in:
parent
1696e6a88d
commit
b044d1883e
@ -97,7 +97,6 @@ crow::json::wvalue MintKeyCert::to_json() const {
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
crow::json::wvalue ResponseCDDC::to_json() const
|
||||
{
|
||||
crow::json::wvalue r;
|
||||
@ -109,6 +108,18 @@ crow::json::wvalue ResponseCDDC::to_json() const
|
||||
r["type"]= "response cddc";
|
||||
return r;
|
||||
}
|
||||
std::optional<RequestCDDC> RequestCDDC::from_json(const crow::json::rvalue & json) {
|
||||
|
||||
if (json.has("cdd_serial")&&json.has("message_reference")) {
|
||||
auto r = std::make_optional<RequestCDDC>();
|
||||
r->cdd_serial=json["cdd_serial"].u();
|
||||
r->message_reference= json["message_reference"].u();
|
||||
return r;
|
||||
}
|
||||
else {
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
/** blafasel */
|
||||
class DefaultModel : public Model {
|
||||
@ -122,7 +133,7 @@ private:
|
||||
CDDC m_cddc;
|
||||
};
|
||||
|
||||
std::unique_ptr<Model> Model::getModel(const std::string& backend_name)
|
||||
std::unique_ptr<Model> Model::getModel(const std::string& /*backend_name*/)
|
||||
{
|
||||
//:wq
|
||||
//if (backend_name=="default")
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
#include <optional>
|
||||
|
||||
#include "crow/json.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user