Address Labels -> Claim Address
This commit is contained in:
@@ -19,7 +19,7 @@ nodeapi.setWalletDetails(settings.wallet);
|
||||
if (settings.heavy != true) {
|
||||
nodeapi.setAccess('only', ['getinfo', 'getnetworkhashps', 'getmininginfo','getdifficulty', 'getconnectioncount',
|
||||
'getmasternodecount', 'getmasternodelist', 'getvotelist', 'getblockcount', 'getblockhash', 'getblock', 'getrawtransaction',
|
||||
'getpeerinfo', 'gettxoutsetinfo']);
|
||||
'getpeerinfo', 'gettxoutsetinfo', 'verifymessage']);
|
||||
} else {
|
||||
// enable additional heavy api calls
|
||||
/*
|
||||
@@ -36,7 +36,7 @@ if (settings.heavy != true) {
|
||||
nodeapi.setAccess('only', ['getinfo', 'getstakinginfo', 'getnetworkhashps', 'getdifficulty', 'getconnectioncount',
|
||||
'getmasternodecount', 'getmasternodelist', 'getvotelist', 'getblockcount', 'getblockhash',
|
||||
'getblock', 'getrawtransaction', 'getmaxmoney', 'getvote', 'getmaxvote', 'getphase', 'getreward', 'getpeerinfo',
|
||||
'getnextrewardestimate', 'getnextrewardwhenstr', 'getnextrewardwhensec', 'getsupply', 'gettxoutsetinfo']);
|
||||
'getnextrewardestimate', 'getnextrewardwhenstr', 'getnextrewardwhensec', 'getsupply', 'gettxoutsetinfo', 'verifymessage']);
|
||||
}
|
||||
// determine if cors should be enabled
|
||||
if (settings.usecors == true) {
|
||||
@@ -244,6 +244,27 @@ app.use('/ext/getaddresstxsajax/:address', function(req,res){
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/address/:hash/claim', function(req, res){
|
||||
var address = req.body.address;
|
||||
var signature = req.body.signature;
|
||||
var message = req.body.message;
|
||||
request({
|
||||
url: 'http://127.0.0.1:' + settings.port + '/api/verifymessage?address='+address+ '&signature='+ signature + '&message=' + message,
|
||||
method: 'GET',
|
||||
}, function(error, response, body){
|
||||
//console.log('error', error);
|
||||
//console.log('response', response);
|
||||
if(body == "false"){
|
||||
console.log('failed');
|
||||
res.json({"status": "failed", "error":true, "message": error});
|
||||
}else if(body == "true"){
|
||||
db.update_label(address, message, function(){
|
||||
res.json({"status": "success"});
|
||||
})
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
app.use('/ext/connections', function(req,res){
|
||||
db.get_peers(function(peers){
|
||||
res.send({data: peers});
|
||||
|
||||
Reference in New Issue
Block a user