From 687f95a8857d29a88ef70f1b8f483faf0e6b75cf Mon Sep 17 00:00:00 2001 From: coldstar Date: Tue, 25 May 2021 14:36:32 -0700 Subject: [PATCH] 05/25/2021 02:36:32 PM MST --- package.json | 59 +++++++++++++++++++------------------ routes/baseActionsRouter.js | 26 +++++++++++++--- 2 files changed, 52 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index 0a14484..8f08245 100755 --- a/package.json +++ b/package.json @@ -1,30 +1,31 @@ { - "name": "rpc-explorer", - "version": "1.0.0", - "scripts": { - "start": "node ./bin/www" - }, - "repository": { - "type": "git", - "url": "https://github.com/smartcash/rpc-explorer.git" - }, - "dependencies": { - "bitcoin": "3.0.1", - "body-parser": "~1.16.0", - "cookie-parser": "~1.4.3", - "crypto-js": "3.1.9-1", - "debug": "~2.6.0", - "decimal.js": "7.2.3", - "express": "~4.14.1", - "express-session": "1.15.2", - "jstransformer-markdown-it": "^2.0.0", - "moment": "^2.18.1", - "moment-duration-format": "1.3.0", - "monk": "^4.0.0", - "morgan": "~1.7.0", - "pug": "2.0.0-rc.2", - "serve-favicon": "~2.3.2", - "simple-git": "1.73.0" - }, - "license": "MIT" -} + "name": "vivo-explorer", + "version": "1.0.0", + "scripts": { + "start": "node ./bin/www" + }, + "repository": { + "type": "git", + "url": "https://gt.clarifylife.net/ddp/vivo-explorer.git" + }, + "dependencies": { + "bitcoin": "3.0.1", + "body-parser": "~1.16.0", + "cookie-parser": "~1.4.3", + "crypto-js": "3.1.9-1", + "debug": "~2.6.0", + "decimal.js": "7.2.3", + "express": "~4.14.1", + "express-session": "1.15.2", + "jstransformer-markdown-it": "^2.0.0", + "moment": "^2.18.1", + "moment-duration-format": "1.3.0", + "monk": "^4.0.0", + "morgan": "~1.7.0", + "pug": "2.0.0-rc.2", + "serve-favicon": "~2.3.2", + "simple-git": "1.73.0", + "exec-sync": "0.1.6" + }, + "license": "MIT" +} \ No newline at end of file diff --git a/routes/baseActionsRouter.js b/routes/baseActionsRouter.js index 63235b5..dbf74a7 100755 --- a/routes/baseActionsRouter.js +++ b/routes/baseActionsRouter.js @@ -309,13 +309,31 @@ router.get("/address/:address", function(req, res) { res.locals.result = {}; - // TODO handle RPC error - rpcApi.getBalance(client, address).then(function(result) { - res.locals.result.address = result.address; - res.render("address"); + const { spawn } = require("child_process"); + + const ls = spawn("/usr/local/bin/vivo-cli -conf=/etc/masternodes/vivo_n1.conf", [" \'{\"addresses\": [\"" + address + "\"]}\'"]); + + ls.stdout.on("data", data => { + console.log(`stdout: ${data}`); + }); + + ls.stderr.on("data", data => { + console.log(`stderr: ${data}`); + }); + + ls.on('error', (error) => { + console.log(`error: ${error.message}`); + }); + + ls.on("close", code => { + console.log(`child process exited with code ${code}`); }); + + //res.render("address"); + }); + router.get("/tx/:transactionId", function(req, res) { var txid = req.params.transactionId;