Skip to content

Commit

Permalink
testing if getmnstatus works
Browse files Browse the repository at this point in the history
  • Loading branch information
Shangaman committed Nov 4, 2022
1 parent ff01ba5 commit afd2de0
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fetch('http://127.0.0.1:51473/', {
}
})();

async function getgoogle(){
async function test_balance(){
try{
let output= await fetch('http://127.0.0.1:51473/', {
method: 'POST',
Expand All @@ -49,15 +49,41 @@ async function getgoogle(){
}
}

async function GetMnStatus(txid){
try{
let output= await fetch('http://127.0.0.1:51473/', {
method: 'POST',
headers: {
'content-type': 'text/plain;',
'Authorization': 'Basic ' + encodeBase64('masternode_test:p')
},
body: '{"jsonrpc": "1.0", "id":"curltest", "method": "listmasternodes", "params": ['+txid+'] }'});
return output.text()
}catch(error){
if (error.name === 'AbortError') {
return "request was aborted'";
}else{
return "non u sac";
}
}
}


app.get('/', (req, res) => {
res.send('Hello World!')
})


app.get('/getbalance', async (req, res) => {
res.send(await getgoogle());
res.send(await test_balance());
})
//ce9efce67bf55fed12a162ab3c02e5b58e8f69ceac51524ae067ab06ad558a7f


app.get('/mnstatus', async function(req, res) {
//res.send('txid ' + req.query.txid);
res.send(await GetMnStatus(req.query.txid))
});

app.listen(port, () => {
console.log(`Example app listening on port ${port}`)
Expand Down

0 comments on commit afd2de0

Please sign in to comment.