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;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
crow::json::wvalue ResponseCDDC::to_json() const
|
crow::json::wvalue ResponseCDDC::to_json() const
|
||||||
{
|
{
|
||||||
crow::json::wvalue r;
|
crow::json::wvalue r;
|
||||||
@ -109,6 +108,18 @@ crow::json::wvalue ResponseCDDC::to_json() const
|
|||||||
r["type"]= "response cddc";
|
r["type"]= "response cddc";
|
||||||
return r;
|
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 */
|
/** blafasel */
|
||||||
class DefaultModel : public Model {
|
class DefaultModel : public Model {
|
||||||
@ -122,7 +133,7 @@ private:
|
|||||||
CDDC m_cddc;
|
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
|
//:wq
|
||||||
//if (backend_name=="default")
|
//if (backend_name=="default")
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
#include "crow/json.h"
|
#include "crow/json.h"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user