-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0deb170
commit 7d311c7
Showing
23 changed files
with
329 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.HttpServer = undefined;var _http = require('http');var _http2 = _interopRequireDefault(_http); | ||
var _express = require('express');var _express2 = _interopRequireDefault(_express);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} | ||
|
||
const HttpServer = exports.HttpServer = ({ blocks, status }) => { | ||
const app = (0, _express2.default)(); | ||
const httpServer = _http2.default.Server(app); | ||
app.set('etag', false); | ||
app.set('x-powered-by', false); | ||
|
||
app.use('/status', (req, res) => { | ||
const data = status.getState().data; | ||
res.send(data); | ||
}); | ||
|
||
app.use('/circulating', (req, res) => { | ||
const data = blocks.getCirculatingSupply().data; | ||
res.send(data); | ||
}); | ||
|
||
// 404 | ||
app.use((req, res, next) => res.status(404).send()); | ||
return httpServer; | ||
};exports.default = | ||
|
||
HttpServer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict';Object.defineProperty(exports, "__esModule", { value: true });var _config = require('../lib/config');var _config2 = _interopRequireDefault(_config); | ||
var _types = require('../lib/types'); | ||
var _utils = require('../lib/utils');function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} | ||
const { bridgeAddress } = _config2.default;exports.default = | ||
|
||
async function (collection) { | ||
try { | ||
let { balance, decimals } = await collection.findOne({ address: bridgeAddress }); | ||
decimals = decimals || 18; | ||
const bridgeBalance = (0, _utils.applyDecimals)(balance, decimals).toString(10); | ||
let circulatingSupply = (0, _utils.bigNumberDifference)(_types.TOTAL_SUPPLY, bridgeBalance).toString(10); | ||
return { circulatingSupply, totalSupply: _types.TOTAL_SUPPLY, bridgeBalance }; | ||
} catch (err) { | ||
return Promise.reject(err); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.