1
0
Fork 0
forked from lthn/blockchain

changed damn api because react native promise resolver is not willing to work with long

This commit is contained in:
cryptozoidberg 2020-02-28 07:38:40 +01:00
parent c50102d2a1
commit 11194722d5
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC

View file

@ -211,7 +211,7 @@ namespace plain_wallet
}
uint64_t async_call(const std::string& method_name, uint64_t instance_id, const std::string& params)
std::string async_call(const std::string& method_name, uint64_t instance_id, const std::string& params)
{
std::function<void()> async_callback;
@ -268,7 +268,7 @@ namespace plain_wallet
std::thread t([async_callback]() {async_callback(); });
t.detach();
LOG_PRINT_L0("[ASYNC_CALL]: started " << method_name << ", job id: " << job_id);
return job_id;
return std::string("{ \"job_id\": ") + std::to_string(job_id) + "}";
}
std::string try_pull_result(uint64_t job_id)
{
@ -279,7 +279,7 @@ namespace plain_wallet
{
return "{delivered: false}";
}
std::string res = "{delivered: true, result: ";
std::string res = "{\"delivered\": true, \"result\": ";
res += it->second;
res += " }";
gjobs.erase(it);