|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
var request = require('request-promise');
|
|
|
|
|
var options = require('../connect');
|
|
|
|
|
var common = require('../common');
|
|
|
|
|
var logger = require('./logger');
|
|
|
|
|
var options = {};
|
|
|
|
|
|
|
|
|
|
getAliasForChannel = (channel, channelType) => {
|
|
|
|
|
return new Promise(function(resolve, reject) {
|
|
|
|
@ -25,6 +25,7 @@ getAliasForChannel = (channel, channelType) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
exports.getChannels = (req, res, next) => {
|
|
|
|
|
options = common.options;
|
|
|
|
|
if (undefined === req.params.channelType || req.params.channelType === 'all') {
|
|
|
|
|
options.url = common.lnd_server_url + '/channels';
|
|
|
|
|
} else {
|
|
|
|
@ -73,6 +74,7 @@ exports.getChannels = (req, res, next) => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.postChannel = (req, res, next) => {
|
|
|
|
|
options = common.options;
|
|
|
|
|
options.url = common.lnd_server_url + '/channels';
|
|
|
|
|
options.form = JSON.stringify({
|
|
|
|
|
node_pubkey_string: req.body.node_pubkey,
|
|
|
|
@ -99,6 +101,7 @@ exports.postChannel = (req, res, next) => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
exports.postTransactions = (req, res, next) => {
|
|
|
|
|
options = common.options;
|
|
|
|
|
options.url = common.lnd_server_url + '/channels/transactions';
|
|
|
|
|
if(req.body.paymentReq) {
|
|
|
|
|
options.form = JSON.stringify({
|
|
|
|
@ -139,6 +142,7 @@ exports.postTransactions = (req, res, next) => {
|
|
|
|
|
|
|
|
|
|
exports.closeChannel = (req, res, next) => {
|
|
|
|
|
req.setTimeout(60000 * 10); // timeout 10 mins
|
|
|
|
|
options = common.options;
|
|
|
|
|
let channelpoint = req.params.channelPoint.replace(':', '/');
|
|
|
|
|
options.url = common.lnd_server_url + '/channels/' + channelpoint + '?force=' + req.query.force;
|
|
|
|
|
logger.info('\r\nChannels: 144: ' + JSON.stringify(Date.now()) + ': INFO: Closing Channel: ' + options.url);
|
|
|
|
@ -163,6 +167,7 @@ exports.closeChannel = (req, res, next) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
exports.postChanPolicy = (req, res, next) => {
|
|
|
|
|
options = common.options;
|
|
|
|
|
options.url = common.lnd_server_url + '/chanpolicy';
|
|
|
|
|
if(req.body.chanPoint === 'all') {
|
|
|
|
|
options.form = JSON.stringify({
|
|
|
|
|