Browse Source

05/25/2021 08:05:08 PM MST

master
coldstar 3 years ago
parent
commit
f283aeaa34
1 changed files with 10 additions and 3 deletions
  1. +10
    -3
      routes/baseActionsRouter.js

+ 10
- 3
routes/baseActionsRouter.js View File

@@ -307,6 +307,7 @@ router.get("/address/:address", function(req, res) {


var address = req.params.address; var address = req.params.address;



res.locals.address = address; res.locals.address = address;


console.log("address is:" + address); console.log("address is:" + address);
@@ -316,6 +317,11 @@ router.get("/address/:address", function(req, res) {
res.locals.result = {}; res.locals.result = {};


const { exec } = require('child_process'); const { exec } = require('child_process');

var balance = "Not Found";
var received = "Not Found";


var yourscript = exec('/usr/local/bin/vivo-cli -conf=/etc/masternodes/vivo_n1.conf getaddressbalance \'{\"addresses\": [\"' + address + '"]}\'', var yourscript = exec('/usr/local/bin/vivo-cli -conf=/etc/masternodes/vivo_n1.conf getaddressbalance \'{\"addresses\": [\"' + address + '"]}\'',
//var yourscript = exec('whoami', //var yourscript = exec('whoami',
(error, stdout, stderr) => { (error, stdout, stderr) => {
@@ -327,11 +333,12 @@ router.get("/address/:address", function(req, res) {
console.log(obj.balance); console.log(obj.balance);
console.log(obj.received); console.log(obj.received);


res.locals.address = obj.address;
res.locals.balance = obj.balance;
res.locals.received = obj.received;
balance = obj.balance;
received = obj.received;


console.log(stderr); console.log(stderr);

if (error !== null) { if (error !== null) {
console.log(`exec error: ${error}`); console.log(`exec error: ${error}`);
} }


Loading…
Cancel
Save