Skip to content

Commit

Permalink
Add circulating supply endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Doy-lee committed Feb 12, 2019
1 parent ee5f69c commit 04eb6cb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
12 changes: 12 additions & 0 deletions README.md
Expand Up @@ -710,6 +710,18 @@ curl -w "\n" -X GET "http://127.0.0.1:8081/api/emission"

Emission only works when the emission monitoring thread is enabled.

#### api/circulating\_supply

```bash
curl -w "\n" -X GET "http://127.0.0.1:8081/api/circulating_supply"
```

```
15606500
```

Circulating supply only works when the emission monitoring thread is enabled.

#### api/version

```bash
Expand Down
7 changes: 6 additions & 1 deletion main.cpp
Expand Up @@ -6,6 +6,7 @@
#include "ext/crow/crow.h"
#include "src/CmdLineOptions.h"
#include "src/MicroCore.h"
#include "src/CurrentBlockchainStatus.h"

#include <fstream>
#include <regex>
Expand Down Expand Up @@ -730,10 +731,14 @@ main(int ac, const char* av[])
([&]() {

mylok::jsonresponse r{lokblocks.json_emission()};

return r;
});

CROW_ROUTE(app, "/api/circulating_supply") ([&]() {
std::string result = std::to_string(lokeg::CurrentBlockchainStatus::circulating_supply);
return std::move(result);
});

CROW_ROUTE(app, "/api/outputs").methods("GET"_method)
([&](const crow::request &req) {

Expand Down

0 comments on commit 04eb6cb

Please sign in to comment.