mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2024-11-19 01:40:29 +01:00
Remove version from server urls #369
This commit is contained in:
parent
8586b18a00
commit
536f26389a
@ -104,8 +104,8 @@ Example RTL-Config.json:
|
||||
"bitcoindConfigPath": "<Optional: path of bitcoind.conf path if available locally>",
|
||||
"enableLogging": true,
|
||||
"fiatConversion": false,
|
||||
"lnServerUrl": "<url for LND REST APIs for node #1 e.g. https://192.168.0.1:8080/v1>",
|
||||
"swapServerUrl": "<url for swap server REST APIs for the node. e.g. http://localhost:8081/v1>"
|
||||
"lnServerUrl": "<url for LND REST APIs for node #1 e.g. https://192.168.0.1:8080>",
|
||||
"swapServerUrl": "<url for swap server REST APIs for the node. e.g. http://localhost:8081>"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
32
connect.js
32
connect.js
@ -63,8 +63,8 @@ connect.setDefaultConfig = () => {
|
||||
themeColor: "PURPLE",
|
||||
channelBackupPath: channelBackupPath,
|
||||
enableLogging: false,
|
||||
lnServerUrl: "https://localhost:8080/v1",
|
||||
swapServerUrl: "http://localhost:8081/v1",
|
||||
lnServerUrl: "https://localhost:8080",
|
||||
swapServerUrl: "http://localhost:8081",
|
||||
fiatConversion: false
|
||||
}
|
||||
}
|
||||
@ -166,13 +166,13 @@ connect.validateNodeConfig = (config) => {
|
||||
}
|
||||
|
||||
if(process.env.LN_SERVER_URL && process.env.LN_SERVER_URL.trim() !== '') {
|
||||
common.nodes[idx].ln_server_url = process.env.LN_SERVER_URL;
|
||||
common.nodes[idx].ln_server_url = process.env.LN_SERVER_URL.endsWith('/v1') ? process.env.LN_SERVER_URL.slice(0, -3) : process.env.LN_SERVER_URL;
|
||||
} else if(process.env.LND_SERVER_URL && process.env.LND_SERVER_URL.trim() !== '') {
|
||||
common.nodes[idx].ln_server_url = process.env.LND_SERVER_URL;
|
||||
common.nodes[idx].ln_server_url = process.env.LND_SERVER_URL.endsWith('/v1') ? process.env.LND_SERVER_URL.slice(0, -3) : process.env.LND_SERVER_URL;
|
||||
} else if(node.Settings.lnServerUrl && node.Settings.lnServerUrl.trim() !== '') {
|
||||
common.nodes[idx].ln_server_url = node.Settings.lnServerUrl;
|
||||
} else if(node.Settings.lndServerUrl && node.Settings.lndServerUrl.trim() !== '') {
|
||||
common.nodes[idx].ln_server_url = node.Settings.lndServerUrl;
|
||||
common.nodes[idx].ln_server_url = node.Settings.lnServerUrl.endsWith('/v1') ? node.Settings.lnServerUrl.slice(0, -3) : node.Settings.lnServerUrl;
|
||||
} else if(node.Settings.lndServerUrl && node.Settings.lndServerUrl.trim() !== '') {
|
||||
common.nodes[idx].ln_server_url = node.Settings.lndServerUrl.endsWith('/v1') ? node.Settings.lndServerUrl.slice(0, -3) : node.Settings.lndServerUrl;
|
||||
} else {
|
||||
errMsg = errMsg + '\nPlease set LN Server URL for node index ' + node.index + ' in RTL-Config.json!';
|
||||
}
|
||||
@ -183,7 +183,13 @@ connect.validateNodeConfig = (config) => {
|
||||
if(common.nodes[idx].fiat_conversion) {
|
||||
common.nodes[idx].currency_unit = node.Settings.currencyUnit ? node.Settings.currencyUnit : 'USD';
|
||||
}
|
||||
common.nodes[idx].swap_server_url = process.env.SWAP_SERVER_URL ? process.env.SWAP_SERVER_URL : (node.Settings.swapServerUrl) ? node.Settings.swapServerUrl.trim() : '';
|
||||
if(process.env.SWAP_SERVER_URL && process.env.SWAP_SERVER_URL.trim() !== '') {
|
||||
common.nodes[idx].swap_server_url = process.env.SWAP_SERVER_URL.endsWith('/v1') ? process.env.SWAP_SERVER_URL.slice(0, -3) : process.env.SWAP_SERVER_URL;
|
||||
} else if(node.Settings.swapServerUrl && node.Settings.swapServerUrl.trim() !== '') {
|
||||
common.nodes[idx].swap_server_url = node.Settings.swapServerUrl.endsWith('/v1') ? node.Settings.swapServerUrl.slice(0, -3) : node.Settings.swapServerUrl;
|
||||
} else {
|
||||
common.nodes[idx].swap_server_url = '';
|
||||
}
|
||||
common.nodes[idx].bitcoind_config_path = process.env.BITCOIND_CONFIG_PATH ? process.env.BITCOIND_CONFIG_PATH : (node.Settings.bitcoindConfigPath) ? node.Settings.bitcoindConfigPath : '';
|
||||
common.nodes[idx].enable_logging = (node.Settings.enableLogging) ? !!node.Settings.enableLogging : false;
|
||||
common.nodes[idx].channel_backup_path = process.env.CHANNEL_BACKUP_PATH ? process.env.CHANNEL_BACKUP_PATH : (node.Settings.channelBackupPath) ? node.Settings.channelBackupPath : common.rtl_conf_file_path + common.path_separator + 'backup' + common.path_separator + 'node-' + node.index;
|
||||
@ -428,9 +434,9 @@ connect.modifyJsonMultiNodeConfig = (confFileFullPath) => {
|
||||
newNode.Settings.channelBackupPath = node.Settings.channelBackupPath;
|
||||
}
|
||||
if (node.Settings.lnServerUrl) {
|
||||
newNode.Settings.lnServerUrl = node.Settings.lnServerUrl;
|
||||
newNode.Settings.lnServerUrl = node.Settings.lnServerUrl.endsWith('/v1') ? node.Settings.lnServerUrl.slice(0, -3) : node.Settings.lnServerUrl;
|
||||
} else if (node.Settings.lndServerUrl) {
|
||||
newNode.Settings.lnServerUrl = node.Settings.lndServerUrl;
|
||||
newNode.Settings.lnServerUrl = node.Settings.lndServerUrl.endsWith('/v1') ? node.Settings.lndServerUrl.slice(0, -3) : node.Settings.lndServerUrl;
|
||||
}
|
||||
newConfig.nodes.push(newNode);
|
||||
});
|
||||
@ -493,11 +499,11 @@ connect.modifyIniSingleNodeConfig = (confFileFullPath) => {
|
||||
newConfig.nodes[0].Settings.channelBackupPath = config.Settings.channelBackupPath;
|
||||
}
|
||||
if (config.Settings.lnServerUrl) {
|
||||
newConfig.nodes[0].Settings.lnServerUrl = config.Settings.lnServerUrl;
|
||||
newConfig.nodes[0].Settings.lnServerUrl = config.Settings.lnServerUrl.endsWith('/v1') ? config.Settings.lnServerUrl.slice(0, -3) : config.Settings.lnServerUrl;
|
||||
} else if (config.Settings.lndServerUrl) {
|
||||
newConfig.nodes[0].Settings.lnServerUrl = config.Settings.lndServerUrl;
|
||||
newConfig.nodes[0].Settings.lnServerUrl = config.Settings.lndServerUrl.endsWith('/v1') ? config.Settings.lndServerUrl.slice(0, -3) : config.Settings.lndServerUrl;
|
||||
} else if (config.Authentication.lndServerUrl) {
|
||||
newConfig.nodes[0].Settings.lnServerUrl = config.Authentication.lndServerUrl;
|
||||
newConfig.nodes[0].Settings.lnServerUrl = config.Authentication.lndServerUrl.endsWith('/v1') ? config.Authentication.lndServerUrl.slice(0, -3) : config.Authentication.lndServerUrl;
|
||||
}
|
||||
newConfig.multiPassHashed = config.Authentication.rtlPassHashed ? config.Authentication.rtlPassHashed : config.Authentication.rtlPass ? hash.update(config.Authentication.rtlPass).digest('hex') : '';
|
||||
fs.writeFileSync(confFileFullPath, JSON.stringify(newConfig, null, 2), 'utf-8');
|
||||
|
@ -5,7 +5,7 @@ var options = {};
|
||||
|
||||
exports.getBalance = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/getBalance';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/getBalance';
|
||||
request(options).then((body) => {
|
||||
logger.info({fileName: 'Balance', msg: 'Balance Received: ' + JSON.stringify(body)});
|
||||
if(!body.totalBalance) {
|
||||
|
@ -5,7 +5,7 @@ var options = {};
|
||||
|
||||
exports.listChannels = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/channel/listChannels';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/channel/listChannels';
|
||||
request(options).then(function (body) {
|
||||
logger.info({fileName: 'Channels', msg: 'List Channels: ' + JSON.stringify(body)});
|
||||
body.map(channel => {
|
||||
@ -35,7 +35,7 @@ exports.listChannels = (req, res, next) => {
|
||||
|
||||
exports.openChannel = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/channel/openChannel';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/channel/openChannel';
|
||||
options.body = req.body;
|
||||
logger.info({fileName: 'Channels', msg: 'Open Channel Options: ' + JSON.stringify(options.body)});
|
||||
request.post(options).then((body) => {
|
||||
@ -68,7 +68,7 @@ exports.openChannel = (req, res, next) => {
|
||||
|
||||
exports.setChannelFee = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/channel/setChannelFee';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/channel/setChannelFee';
|
||||
options.body = req.body;
|
||||
logger.info({fileName: 'Channels', msg: 'Update Channel Policy Options: ' + JSON.stringify(options.body)});
|
||||
request.post(options).then((body) => {
|
||||
@ -102,7 +102,7 @@ exports.setChannelFee = (req, res, next) => {
|
||||
exports.closeChannel = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
const unilateralTimeoutQuery = req.query.unilateralTimeout ? '?unilateralTimeout=' + req.query.unilateralTimeout : '';
|
||||
options.url = common.getSelLNServerUrl() + '/channel/closeChannel/' + req.params.channelId + unilateralTimeoutQuery;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/channel/closeChannel/' + req.params.channelId + unilateralTimeoutQuery;
|
||||
logger.info({fileName: 'Channels', msg: 'Closing Channel: ' + options.url});
|
||||
request.delete(options).then((body) => {
|
||||
logger.info({fileName: 'Channels', msg: 'Close Channel Response: ' + JSON.stringify(body)});
|
||||
@ -134,7 +134,7 @@ exports.closeChannel = (req, res, next) => {
|
||||
|
||||
exports.getLocalRemoteBalance = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/channel/localremotebal';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/channel/localremotebal';
|
||||
request(options).then(function (body) {
|
||||
logger.info({fileName: 'Channels', msg: 'Local Remote Balance: ' + JSON.stringify(body)});
|
||||
if(!body.localBalance) {
|
||||
@ -169,7 +169,7 @@ exports.getLocalRemoteBalance = (req, res, next) => {
|
||||
|
||||
exports.listForwards = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/channel/listForwards/';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/channel/listForwards/';
|
||||
request.get(options).then((body) => {
|
||||
logger.info({fileName: 'Channels', msg: 'Forwarding History Response: ' + JSON.stringify(body)});
|
||||
if(!body || body.error) {
|
||||
|
@ -5,7 +5,7 @@ var options = {};
|
||||
|
||||
exports.getFees = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/getFees';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/getFees';
|
||||
request(options).then((body) => {
|
||||
logger.info({fileName: 'Fees', msg: 'Fee Received: ' + JSON.stringify(body)});
|
||||
if(!body || body.error) {
|
||||
|
@ -6,7 +6,7 @@ var options = {};
|
||||
exports.getInfo = (req, res, next) => {
|
||||
common.setOptions();
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/getinfo';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/getinfo';
|
||||
logger.info({fileName:'GetInfo', msg: 'Selected Node: ' + JSON.stringify(common.selectedNode.ln_node)});
|
||||
logger.info({fileName: 'GetInfo', msg: 'Calling Info from C-Lightning server url: ' + options.url});
|
||||
if (!options.headers || !options.headers.macaroon) {
|
||||
|
@ -6,7 +6,7 @@ var options = {};
|
||||
exports.deleteExpiredInvoice = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
const queryStr = req.query.maxExpiry ? '?maxexpiry=' + req.query.maxExpiry : '';
|
||||
options.url = common.getSelLNServerUrl() + '/invoice/delExpiredInvoice' + queryStr;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/invoice/delExpiredInvoice' + queryStr;
|
||||
request.delete(options).then((body) => {
|
||||
logger.info({fileName: 'Invoice', msg: 'Invoices Deleted: ' + JSON.stringify(body)});
|
||||
if(!body || body.error) {
|
||||
@ -37,7 +37,7 @@ exports.deleteExpiredInvoice = (req, res, next) => {
|
||||
exports.listInvoices = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
const labelQuery = req.query.label ? '?label=' + req.query.label : '';
|
||||
options.url = common.getSelLNServerUrl() + '/invoice/listInvoices' + labelQuery;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/invoice/listInvoices' + labelQuery;
|
||||
request(options).then((body) => {
|
||||
logger.info({fileName: 'Invoice', msg: 'Invoices List Received: ' + body});
|
||||
if(!body || body.error) {
|
||||
@ -76,7 +76,7 @@ exports.listInvoices = (req, res, next) => {
|
||||
|
||||
exports.addInvoice = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/invoice/genInvoice';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/invoice/genInvoice';
|
||||
options.body = req.body;
|
||||
request.post(options).then((body) => {
|
||||
logger.info({fileName: 'Invoice', msg: 'Add Invoice Responce: ' + JSON.stringify(body)});
|
||||
|
@ -5,7 +5,7 @@ var options = {};
|
||||
|
||||
exports.signMessage = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/utility/signMessage';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/utility/signMessage';
|
||||
options.form = { message: req.body.message };
|
||||
request.post(options, (error, response, body) => {
|
||||
logger.info({fileName: 'Messages', msg: 'Message Signed: ' + JSON.stringify(body)});
|
||||
@ -37,7 +37,7 @@ exports.signMessage = (req, res, next) => {
|
||||
|
||||
exports.verifyMessage = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/utility/checkMessage/' + req.body.message + '/' + req.body.signature;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/utility/checkMessage/' + req.body.message + '/' + req.body.signature;
|
||||
request.get(options, (error, response, body) => {
|
||||
logger.info({fileName: 'Messages', msg: 'Message Verified: ' + JSON.stringify(body)});
|
||||
if(!body || body.error) {
|
||||
|
@ -5,7 +5,7 @@ var options = {};
|
||||
|
||||
exports.getRoute = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/network/getRoute/' + req.params.destPubkey + '/' + req.params.amount;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/network/getRoute/' + req.params.destPubkey + '/' + req.params.amount;
|
||||
request(options).then((body) => {
|
||||
logger.info({fileName: 'Network', msg: 'Query Routes Received: ' + JSON.stringify(body)});
|
||||
if(!body || body.error) {
|
||||
@ -35,7 +35,7 @@ exports.getRoute = (req, res, next) => {
|
||||
|
||||
exports.listNode = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/network/listNode/' + req.params.id;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/network/listNode/' + req.params.id;
|
||||
request(options).then(function (body) {
|
||||
logger.info({fileName: 'Network', msg: 'Node Lookup: ' + JSON.stringify(body)});
|
||||
body.forEach(node => {
|
||||
@ -61,7 +61,7 @@ exports.listNode = (req, res, next) => {
|
||||
|
||||
exports.listChannel = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/network/listChannel/' + req.params.channelShortId;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/network/listChannel/' + req.params.channelShortId;
|
||||
request(options).then(function (body) {
|
||||
logger.info({fileName: 'Network', msg: 'Channel Lookup: ' + JSON.stringify(body)});
|
||||
body[0].last_update_str = (body.length > 0 && body[0].last_update) ? common.convertTimestampToDate(body[0].last_update) : '';
|
||||
@ -86,7 +86,7 @@ exports.listChannel = (req, res, next) => {
|
||||
|
||||
exports.feeRates = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/network/feeRates/' + req.params.feeRateStyle;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/network/feeRates/' + req.params.feeRateStyle;
|
||||
request(options).then(function (body) {
|
||||
res.status(200).json(body);
|
||||
})
|
||||
|
@ -5,7 +5,7 @@ var options = {};
|
||||
|
||||
exports.getNewAddress = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/newaddr?addrType=' + req.query.type;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/newaddr?addrType=' + req.query.type;
|
||||
request(options).then((body) => {
|
||||
res.status(200).json(body);
|
||||
})
|
||||
@ -27,7 +27,7 @@ exports.getNewAddress = (req, res, next) => {
|
||||
|
||||
exports.onChainWithdraw = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/withdraw';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/withdraw';
|
||||
options.body = req.body;
|
||||
logger.info({fileName: 'OnChain', msg: 'OnChain Withdraw Options: ' + JSON.stringify(options.body)});
|
||||
request.post(options).then((body) => {
|
||||
@ -60,7 +60,7 @@ exports.onChainWithdraw = (req, res, next) => {
|
||||
|
||||
exports.getTransactions = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/listFunds';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/listFunds';
|
||||
request(options).then((body) => {
|
||||
if (body.outputs) { body.outputs = common.sortDescByStrKey(body.outputs, 'status'); }
|
||||
res.status(200).json(body);
|
||||
|
@ -5,7 +5,7 @@ var options = {};
|
||||
|
||||
exports.listPayments = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/pay/listPayments';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/pay/listPayments';
|
||||
request(options).then((body) => {
|
||||
logger.info({fileName: 'Payments', msg: 'Payment List Received: ' + JSON.stringify(body.payments)});
|
||||
if(!body || body.error) {
|
||||
@ -42,7 +42,7 @@ exports.listPayments = (req, res, next) => {
|
||||
|
||||
exports.decodePayment = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/pay/decodePay/' + req.params.invoice;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/pay/decodePay/' + req.params.invoice;
|
||||
request(options).then((body) => {
|
||||
logger.info({fileName: 'Payments', msg: 'Payment Decode Received: ' + JSON.stringify(body)});
|
||||
if(!body || body.error) {
|
||||
@ -76,9 +76,9 @@ exports.decodePayment = (req, res, next) => {
|
||||
exports.postPayment = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
if (req.params.type === 'keysend') {
|
||||
options.url = common.getSelLNServerUrl() + '/pay/keysend';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/pay/keysend';
|
||||
} else {
|
||||
options.url = common.getSelLNServerUrl() + '/pay';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/pay';
|
||||
}
|
||||
options.body = req.body;
|
||||
request.post(options).then((body) => {
|
||||
|
@ -5,7 +5,7 @@ var options = {};
|
||||
|
||||
exports.getPeers = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/peer/listPeers';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/peer/listPeers';
|
||||
request(options).then(function (body) {
|
||||
body.forEach(peer => { if (!peer.alias || peer.alias === '') { peer.alias = peer.id.substring(0, 20);}});
|
||||
let peers = (body) ? common.sortDescByStrKey(body, 'alias') : [];
|
||||
@ -30,7 +30,7 @@ exports.getPeers = (req, res, next) => {
|
||||
|
||||
exports.postPeer = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/peer/connect';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/peer/connect';
|
||||
options.body = req.body;
|
||||
request.post(options, (error, response, body) => {
|
||||
if(!body || body.error) {
|
||||
@ -41,7 +41,7 @@ exports.postPeer = (req, res, next) => {
|
||||
});
|
||||
} else {
|
||||
logger.info({fileName: 'Peers', msg: 'Peer Added: ' + JSON.stringify(body)});
|
||||
options.url = common.getSelLNServerUrl() + '/peer/listPeers';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/peer/listPeers';
|
||||
request(options).then(function (body) {
|
||||
let peers = ( body) ? common.sortDescByStrKey(body, 'alias') : [];
|
||||
peers = common.newestOnTop(peers, 'id', req.body.id);
|
||||
@ -68,7 +68,7 @@ exports.postPeer = (req, res, next) => {
|
||||
|
||||
exports.deletePeer = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/peer/disconnect/' + req.params.peerId + '?force=' + req.query.force;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/peer/disconnect/' + req.params.peerId + '?force=' + req.query.force;
|
||||
request.delete(options).then((body) => {
|
||||
logger.info({fileName: 'Peers', msg: 'Detach Peer Response: ' + JSON.stringify(body)});
|
||||
if(!body || body.error) {
|
||||
|
@ -6,7 +6,7 @@ var options = {};
|
||||
|
||||
exports.getBalance = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/balance/' + req.params.source;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/balance/' + req.params.source;
|
||||
options.qs = req.query;
|
||||
request(options).then((body) => {
|
||||
logger.info({fileName: 'Balance', msg: 'Request params: ' + JSON.stringify(req.params) + 'Request Query: ' + JSON.stringify(req.query) + ' Balance Received: ' + JSON.stringify(body)});
|
||||
|
@ -6,7 +6,7 @@ var options = {};
|
||||
getAliasForChannel = (channel) => {
|
||||
return new Promise(function(resolve, reject) {
|
||||
let pubkey = (channel.remote_pubkey) ? channel.remote_pubkey : (channel.remote_node_pub) ? channel.remote_node_pub : '';
|
||||
options.url = common.getSelLNServerUrl() + '/graph/node/' + pubkey;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/graph/node/' + pubkey;
|
||||
request(options).then(function(aliasBody) {
|
||||
logger.info({fileName: 'Channels', msg: 'Alias: ' + JSON.stringify(aliasBody.node.alias)});
|
||||
channel.remote_alias = aliasBody.node.alias;
|
||||
@ -21,7 +21,7 @@ getAliasForChannel = (channel) => {
|
||||
|
||||
exports.getAllChannels = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/channels';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/channels';
|
||||
options.qs = req.query;
|
||||
let local = 0;
|
||||
let remote = 0;
|
||||
@ -80,7 +80,7 @@ exports.getAllChannels = (req, res, next) => {
|
||||
|
||||
exports.getPendingChannels = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/channels/pending';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/channels/pending';
|
||||
options.qs = req.query;
|
||||
request(options).then(function (body) {
|
||||
if (!body.total_limbo_balance) {
|
||||
@ -139,7 +139,7 @@ exports.getPendingChannels = (req, res, next) => {
|
||||
|
||||
exports.getClosedChannels = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/channels/closed';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/channels/closed';
|
||||
options.qs = req.query;
|
||||
request(options).then(function (body) {
|
||||
if (body.channels && body.channels.length > 0) {
|
||||
@ -191,7 +191,7 @@ exports.getClosedChannels = (req, res, next) => {
|
||||
|
||||
exports.postChannel = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/channels';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/channels';
|
||||
options.form = {
|
||||
node_pubkey_string: req.body.node_pubkey,
|
||||
local_funding_amount: req.body.local_funding_amount,
|
||||
@ -234,7 +234,7 @@ exports.postChannel = (req, res, next) => {
|
||||
|
||||
exports.postTransactions = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/channels/transactions';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/channels/transactions';
|
||||
if(req.body.paymentReq) {
|
||||
options.form = {
|
||||
payment_request: req.body.paymentReq
|
||||
@ -291,7 +291,7 @@ exports.closeChannel = (req, res, next) => {
|
||||
req.setTimeout(60000 * 10); // timeout 10 mins
|
||||
options = common.getOptions();
|
||||
let channelpoint = req.params.channelPoint.replace(':', '/');
|
||||
options.url = common.getSelLNServerUrl() + '/channels/' + channelpoint + '?force=' + req.query.force;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/channels/' + channelpoint + '?force=' + req.query.force;
|
||||
if(req.query.target_conf) { options.url = options.url + '&target_conf=' + req.query.target_conf; }
|
||||
if(req.query.sat_per_byte) { options.url = options.url + '&sat_per_byte=' + req.query.sat_per_byte; }
|
||||
logger.info({fileName: 'Channels', msg: 'Closing Channel: ' + options.url});
|
||||
@ -325,7 +325,7 @@ exports.closeChannel = (req, res, next) => {
|
||||
|
||||
exports.postChanPolicy = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/chanpolicy';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/chanpolicy';
|
||||
if(req.body.chanPoint === 'all') {
|
||||
options.form = JSON.stringify({
|
||||
global: true,
|
||||
|
@ -33,12 +33,12 @@ exports.getBackup = (req, res, next) => {
|
||||
if (req.params.channelPoint === 'ALL') {
|
||||
channel_backup_file = common.selectedNode.channel_backup_path + common.path_separator + 'channel-all.bak';
|
||||
message = 'All Channels Backup Successful.';
|
||||
options.url = common.getSelLNServerUrl() + '/channels/backup';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/channels/backup';
|
||||
} else {
|
||||
channel_backup_file = common.selectedNode.channel_backup_path + common.path_separator + 'channel-' + req.params.channelPoint.replace(':', '-') + '.bak';
|
||||
message = 'Channel Backup Successful.';
|
||||
let channelpoint = req.params.channelPoint.replace(':', '/');
|
||||
options.url = common.getSelLNServerUrl() + '/channels/backup/' + channelpoint;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/channels/backup/' + channelpoint;
|
||||
let exists = fs.existsSync(channel_backup_file);
|
||||
if (exists) {
|
||||
fs.writeFile(channel_backup_file, '', () => { });
|
||||
@ -96,7 +96,7 @@ exports.getBackup = (req, res, next) => {
|
||||
|
||||
exports.postBackupVerify = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/channels/backup/verify';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/channels/backup/verify';
|
||||
let channel_verify_file = '';
|
||||
let message = '';
|
||||
let verify_backup = '';
|
||||
@ -153,7 +153,7 @@ exports.postBackupVerify = (req, res, next) => {
|
||||
|
||||
exports.postRestore = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/channels/backup/restore';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/channels/backup/restore';
|
||||
let channel_restore_file = '';
|
||||
let message = '';
|
||||
let restore_backup = '';
|
||||
|
@ -6,7 +6,7 @@ var options = {};
|
||||
|
||||
exports.getFees = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/fees';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/fees';
|
||||
request(options).then((body) => {
|
||||
logger.info({fileName: 'Fees', msg: 'Fee Received: ' + JSON.stringify(body)});
|
||||
if(!body || body.error) {
|
||||
|
@ -7,7 +7,7 @@ var options = {};
|
||||
exports.getInfo = (req, res, next) => {
|
||||
common.setOptions();
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/getinfo';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/getinfo';
|
||||
logger.info({fileName:'GetInfo', msg: 'Selected Node: ' + JSON.stringify(common.selectedNode.ln_node)});
|
||||
logger.info({fileName: 'GetInfo', msg: 'Calling Info from LND server url: ' + options.url});
|
||||
if (!options.headers || !options.headers['Grpc-Metadata-macaroon']) {
|
||||
|
@ -5,7 +5,7 @@ var options = {};
|
||||
|
||||
getAliasFromPubkey = (hop) => {
|
||||
return new Promise(function(resolve, reject) {
|
||||
options.url = common.getSelLNServerUrl() + '/graph/node/' + hop.pub_key;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/graph/node/' + hop.pub_key;
|
||||
request(options)
|
||||
.then(function(aliasBody) {
|
||||
logger.info({fileName: 'Graph', msg: 'Alias: ' + JSON.stringify(aliasBody.node.alias)});
|
||||
@ -18,7 +18,7 @@ getAliasFromPubkey = (hop) => {
|
||||
|
||||
exports.getDescribeGraph = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/graph';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/graph';
|
||||
request.get(options).then((body) => {
|
||||
const body_str = (!body) ? '' : JSON.stringify(body);
|
||||
const search_idx = (!body) ? -1 : body_str.search('Not Found');
|
||||
@ -51,7 +51,7 @@ exports.getDescribeGraph = (req, res, next) => {
|
||||
|
||||
exports.getGraphInfo = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/graph/info';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/graph/info';
|
||||
request.get(options).then((body) => {
|
||||
const body_str = (!body) ? '' : JSON.stringify(body);
|
||||
const search_idx = (!body) ? -1 : body_str.search('Not Found');
|
||||
@ -89,7 +89,7 @@ exports.getGraphInfo = (req, res, next) => {
|
||||
|
||||
exports.getGraphNode = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/graph/node/' + req.params.pubKey;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/graph/node/' + req.params.pubKey;
|
||||
request(options).then((body) => {
|
||||
logger.info({fileName: 'Graph', msg: 'Node Info Received: ' + JSON.stringify(body)});
|
||||
if(!body || body.error) {
|
||||
@ -122,7 +122,7 @@ exports.getGraphNode = (req, res, next) => {
|
||||
|
||||
exports.getGraphEdge = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/graph/edge/' + req.params.chanid;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/graph/edge/' + req.params.chanid;
|
||||
request(options).then((body) => {
|
||||
logger.info({fileName: 'Graph', msg: 'Edge Info Received: ' + JSON.stringify(body)});
|
||||
if(!body || body.error) {
|
||||
@ -155,7 +155,7 @@ exports.getGraphEdge = (req, res, next) => {
|
||||
|
||||
exports.getQueryRoutes = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/graph/routes/' + req.params.destPubkey + '/' + req.params.amount;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/graph/routes/' + req.params.destPubkey + '/' + req.params.amount;
|
||||
if(req.query.outgoing_chan_id) {
|
||||
options.url = options.url + '?outgoing_chan_id=' + req.query.outgoing_chan_id;
|
||||
}
|
||||
@ -218,7 +218,7 @@ exports.getQueryRoutes = (req, res, next) => {
|
||||
|
||||
exports.getRemoteFeePolicy = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/graph/edge/' + req.params.chanid;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/graph/edge/' + req.params.chanid;
|
||||
request(options).then((body) => {
|
||||
logger.info({fileName: 'Graph', msg: 'Edge Info Received: ' + JSON.stringify(body)});
|
||||
if(!body || body.error) {
|
||||
|
@ -4,7 +4,7 @@ var options = {};
|
||||
|
||||
exports.getGraphInfo = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/graph/info';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/graph/info';
|
||||
request(options).then((body) => {
|
||||
const body_str = (!body) ? '' : JSON.stringify(body);
|
||||
const search_idx = (!body) ? -1 : body_str.search('Not Found');
|
||||
|
@ -5,7 +5,7 @@ var options = {};
|
||||
|
||||
exports.getInvoice = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/invoice/' + req.params.rHashStr;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/invoice/' + req.params.rHashStr;
|
||||
request(options).then((body) => {
|
||||
logger.info({fileName: 'Invoice', msg: 'Invoice Info Received: ' + JSON.stringify(body)});
|
||||
if(!body || body.error) {
|
||||
@ -35,7 +35,7 @@ exports.getInvoice = (req, res, next) => {
|
||||
|
||||
exports.listInvoices = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/invoices?num_max_invoices=' + req.query.num_max_invoices + '&index_offset=' + req.query.index_offset +
|
||||
options.url = common.getSelLNServerUrl() + '/v1/invoices?num_max_invoices=' + req.query.num_max_invoices + '&index_offset=' + req.query.index_offset +
|
||||
'&reversed=' + req.query.reversed;
|
||||
request(options).then((body) => {
|
||||
const body_str = (!body) ? '' : JSON.stringify(body);
|
||||
@ -79,7 +79,7 @@ exports.listInvoices = (req, res, next) => {
|
||||
|
||||
exports.addInvoice = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/invoices';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/invoices';
|
||||
options.form = {
|
||||
memo: req.body.memo,
|
||||
private: req.body.private,
|
||||
|
@ -7,7 +7,7 @@ var swapServerUrl = '';
|
||||
exports.loopOut = (req, res, next) => {
|
||||
swapServerUrl = common.getSelSwapServerUrl();
|
||||
if(swapServerUrl === '') { return res.status(500).json({message: "Loop Out Failed!",error: { message: 'Loop Server URL is missing in the configuration.'}}); }
|
||||
options.url = swapServerUrl + '/loop/out';
|
||||
options.url = swapServerUrl + '/v1/loop/out';
|
||||
let body = {
|
||||
amt: req.body.amount,
|
||||
sweep_conf_target: req.body.targetConf,
|
||||
@ -53,7 +53,7 @@ exports.loopOut = (req, res, next) => {
|
||||
exports.loopOutTerms = (req, res, next) => {
|
||||
swapServerUrl = common.getSelSwapServerUrl();
|
||||
if(swapServerUrl === '') { return res.status(500).json({message: "Loop Out Terms Failed!",error: { message: 'Loop Server URL is missing in the configuration.'}}); }
|
||||
options.url = swapServerUrl + '/loop/out/terms';
|
||||
options.url = swapServerUrl + '/v1/loop/out/terms';
|
||||
request(options).then(function (body) {
|
||||
logger.info({fileName: 'Loop', msg: 'Loop Out Terms: ' + JSON.stringify(body)});
|
||||
res.status(200).json(body);
|
||||
@ -77,7 +77,7 @@ exports.loopOutTerms = (req, res, next) => {
|
||||
exports.loopOutQuote = (req, res, next) => {
|
||||
swapServerUrl = common.getSelSwapServerUrl();
|
||||
if(swapServerUrl === '') { return res.status(500).json({message: "Loop Out Quote Failed!",error: { message: 'Loop Server URL is missing in the configuration.'}}); }
|
||||
options.url = swapServerUrl + '/loop/out/quote/' + req.params.amount + '?conf_target=' + (req.query.targetConf ? req.query.targetConf : '2') + '&swap_publication_deadline=' + req.query.swapPublicationDeadline;
|
||||
options.url = swapServerUrl + '/v1/loop/out/quote/' + req.params.amount + '?conf_target=' + (req.query.targetConf ? req.query.targetConf : '2') + '&swap_publication_deadline=' + req.query.swapPublicationDeadline;
|
||||
logger.info({fileName: 'Loop', msg: 'Loop Out Quote URL: ' + options.url});
|
||||
request(options).then(function (body) {
|
||||
logger.info({fileName: 'Loop', msg: 'Loop Out Quote: ' + body});
|
||||
@ -105,13 +105,13 @@ exports.loopOutQuote = (req, res, next) => {
|
||||
exports.loopOutTermsAndQuotes = (req, res, next) => {
|
||||
swapServerUrl = common.getSelSwapServerUrl();
|
||||
if(swapServerUrl === '') { return res.status(500).json({message: "Loop Out Terms And Quotes Failed!",error: { message: 'Loop Server URL is missing in the configuration.'}}); }
|
||||
options.url = swapServerUrl + '/loop/out/terms';
|
||||
options.url = swapServerUrl + '/v1/loop/out/terms';
|
||||
request(options).then(function(terms) {
|
||||
logger.info({fileName: 'Loop', msg: 'Loop Out Terms: ' + JSON.stringify(terms)});
|
||||
const options1 = {}; const options2 = {};
|
||||
terms = JSON.parse(terms);
|
||||
options1.url = swapServerUrl + '/loop/out/quote/' + terms.min_swap_amount + '?conf_target=' + (req.query.targetConf ? req.query.targetConf : '2') + '&swap_publication_deadline=' + req.query.swapPublicationDeadline;
|
||||
options2.url = swapServerUrl + '/loop/out/quote/' + terms.max_swap_amount + '?conf_target=' + (req.query.targetConf ? req.query.targetConf : '2') + '&swap_publication_deadline=' + req.query.swapPublicationDeadline;
|
||||
options1.url = swapServerUrl + '/v1/loop/out/quote/' + terms.min_swap_amount + '?conf_target=' + (req.query.targetConf ? req.query.targetConf : '2') + '&swap_publication_deadline=' + req.query.swapPublicationDeadline;
|
||||
options2.url = swapServerUrl + '/v1/loop/out/quote/' + terms.max_swap_amount + '?conf_target=' + (req.query.targetConf ? req.query.targetConf : '2') + '&swap_publication_deadline=' + req.query.swapPublicationDeadline;
|
||||
logger.info({fileName: 'Loop', msg: 'Loop Out Min Quote Options: ' + JSON.stringify(options1)});
|
||||
logger.info({fileName: 'Loop', msg: 'Loop Out Max Quote Options: ' + JSON.stringify(options2)});
|
||||
Promise.all([request(options1), request(options2)]).then(function(values) {
|
||||
@ -159,7 +159,7 @@ exports.loopOutTermsAndQuotes = (req, res, next) => {
|
||||
exports.loopIn = (req, res, next) => {
|
||||
swapServerUrl = common.getSelSwapServerUrl();
|
||||
if(swapServerUrl === '') { return res.status(500).json({message: "Loop In Failed!",error: { message: 'Loop Server URL is missing in the configuration.'}}); }
|
||||
options.url = swapServerUrl + '/loop/in';
|
||||
options.url = swapServerUrl + '/v1/loop/in';
|
||||
options.body = JSON.stringify({
|
||||
amt: req.body.amount,
|
||||
max_swap_fee: req.body.swapFee,
|
||||
@ -196,7 +196,7 @@ exports.loopIn = (req, res, next) => {
|
||||
exports.loopInTerms = (req, res, next) => {
|
||||
swapServerUrl = common.getSelSwapServerUrl();
|
||||
if(swapServerUrl === '') { return res.status(500).json({message: "Loop In Terms Failed!",error: { message: 'Loop Server URL is missing in the configuration.'}}); }
|
||||
options.url = swapServerUrl + '/loop/in/terms';
|
||||
options.url = swapServerUrl + '/v1/loop/in/terms';
|
||||
request(options).then(function (body) {
|
||||
logger.info({fileName: 'Loop', msg: 'Loop In Terms: ' + JSON.stringify(body)});
|
||||
res.status(200).json(body);
|
||||
@ -220,7 +220,7 @@ exports.loopInTerms = (req, res, next) => {
|
||||
exports.loopInQuote = (req, res, next) => {
|
||||
swapServerUrl = common.getSelSwapServerUrl();
|
||||
if(swapServerUrl === '') { return res.status(500).json({message: "Loop In Quote Failed!",error: { message: 'Loop Server URL is missing in the configuration.'}}); }
|
||||
options.url = swapServerUrl + '/loop/in/quote/' + req.params.amount + '?conf_target=' + (req.query.targetConf ? req.query.targetConf : '2') + '&swap_publication_deadline=' + req.query.swapPublicationDeadline;
|
||||
options.url = swapServerUrl + '/v1/loop/in/quote/' + req.params.amount + '?conf_target=' + (req.query.targetConf ? req.query.targetConf : '2') + '&swap_publication_deadline=' + req.query.swapPublicationDeadline;
|
||||
logger.info({fileName: 'Loop', msg: 'Loop In Quote Options: ' + options.url});
|
||||
request(options).then(function (body) {
|
||||
logger.info({fileName: 'Loop', msg: 'Loop In Quote: ' + JSON.stringify(body)});
|
||||
@ -248,13 +248,13 @@ exports.loopInQuote = (req, res, next) => {
|
||||
exports.loopInTermsAndQuotes = (req, res, next) => {
|
||||
swapServerUrl = common.getSelSwapServerUrl();
|
||||
if(swapServerUrl === '') { return res.status(500).json({message: "Loop In Terms And Quotes Failed!",error: { message: 'Loop Server URL is missing in the configuration.'}}); }
|
||||
options.url = swapServerUrl + '/loop/in/terms';
|
||||
options.url = swapServerUrl + '/v1/loop/in/terms';
|
||||
request(options).then(function(terms) {
|
||||
logger.info({fileName: 'Loop', msg: 'Loop In Terms: ' + JSON.stringify(terms)});
|
||||
const options1 = {}; const options2 = {};
|
||||
terms = JSON.parse(terms);
|
||||
options1.url = swapServerUrl + '/loop/in/quote/' + terms.min_swap_amount + '?conf_target=' + (req.query.targetConf ? req.query.targetConf : '2') + '&swap_publication_deadline=' + req.query.swapPublicationDeadline;
|
||||
options2.url = swapServerUrl + '/loop/in/quote/' + terms.max_swap_amount + '?conf_target=' + (req.query.targetConf ? req.query.targetConf : '2') + '&swap_publication_deadline=' + req.query.swapPublicationDeadline;
|
||||
options1.url = swapServerUrl + '/v1/loop/in/quote/' + terms.min_swap_amount + '?conf_target=' + (req.query.targetConf ? req.query.targetConf : '2') + '&swap_publication_deadline=' + req.query.swapPublicationDeadline;
|
||||
options2.url = swapServerUrl + '/v1/loop/in/quote/' + terms.max_swap_amount + '?conf_target=' + (req.query.targetConf ? req.query.targetConf : '2') + '&swap_publication_deadline=' + req.query.swapPublicationDeadline;
|
||||
logger.info({fileName: 'Loop', msg: 'Loop In Min Quote Options: ' + JSON.stringify(options1)});
|
||||
logger.info({fileName: 'Loop', msg: 'Loop In Max Quote Options: ' + JSON.stringify(options2)});
|
||||
Promise.all([request(options1), request(options2)]).then(function(values) {
|
||||
@ -302,7 +302,7 @@ exports.loopInTermsAndQuotes = (req, res, next) => {
|
||||
exports.swaps = (req, res, next) => {
|
||||
swapServerUrl = common.getSelSwapServerUrl();
|
||||
if(swapServerUrl === '') { return res.status(500).json({message: "Loop Out Failed!",error: { message: 'Loop Server URL is missing in the configuration.'}}); }
|
||||
options.url = swapServerUrl + '/loop/swaps';
|
||||
options.url = swapServerUrl + '/v1/loop/swaps';
|
||||
request(options).then(function (body) {
|
||||
logger.info({fileName: 'Loop', msg: 'Loop Swaps: ' + body});
|
||||
body = JSON.parse(body);
|
||||
@ -335,7 +335,7 @@ exports.swaps = (req, res, next) => {
|
||||
exports.swap = (req, res, next) => {
|
||||
swapServerUrl = common.getSelSwapServerUrl();
|
||||
if(swapServerUrl === '') { return res.status(500).json({message: "Loop Out Failed!",error: { message: 'Loop Server URL is missing in the configuration.'}}); }
|
||||
options.url = swapServerUrl + '/loop/swap/' + req.params.id;
|
||||
options.url = swapServerUrl + '/v1/loop/swap/' + req.params.id;
|
||||
request(options).then(function (body) {
|
||||
logger.info({fileName: 'Loop', msg: 'Loop Swap: ' + body});
|
||||
body = JSON.parse(body);
|
||||
|
@ -5,7 +5,7 @@ var options = {};
|
||||
|
||||
exports.signMessage = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/signmessage';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/signmessage';
|
||||
options.form = JSON.stringify({
|
||||
msg: Buffer.from(req.body.message).toString('base64')
|
||||
});
|
||||
@ -39,7 +39,7 @@ exports.signMessage = (req, res, next) => {
|
||||
|
||||
exports.verifyMessage = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/verifymessage';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/verifymessage';
|
||||
options.form = JSON.stringify({
|
||||
msg: Buffer.from(req.body.message).toString('base64'),
|
||||
signature: req.body.signature
|
||||
|
@ -5,7 +5,7 @@ var options = {};
|
||||
|
||||
exports.getNewAddress = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/newaddress?type=' + req.query.type;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/newaddress?type=' + req.query.type;
|
||||
request(options).then((body) => {
|
||||
const body_str = (!body) ? '' : JSON.stringify(body);
|
||||
const search_idx = (!body) ? -1 : body_str.search('Not Found');
|
||||
|
@ -5,7 +5,7 @@ var options = {};
|
||||
|
||||
exports.decodePayment = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/payreq/' + req.params.payRequest;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/payreq/' + req.params.payRequest;
|
||||
request(options).then((body) => {
|
||||
const body_str = (!body) ? '' : JSON.stringify(body);
|
||||
const search_idx = (!body) ? -1 : body_str.search('Not Found');
|
||||
|
@ -5,7 +5,7 @@ var options = {};
|
||||
|
||||
exports.getPayments = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/payments';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/payments';
|
||||
request(options).then((body) => {
|
||||
const body_str = (!body) ? '' : JSON.stringify(body);
|
||||
const search_idx = (!body) ? -1 : body_str.search('Not Found');
|
||||
|
@ -5,7 +5,7 @@ var options = {};
|
||||
|
||||
getAliasForPeers = (peer) => {
|
||||
return new Promise(function(resolve, reject) {
|
||||
options.url = common.getSelLNServerUrl() + '/graph/node/' + peer.pub_key;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/graph/node/' + peer.pub_key;
|
||||
request(options)
|
||||
.then(function(aliasBody) {
|
||||
logger.info({fileName: 'Peers', msg: 'Alias: ' + JSON.stringify(aliasBody.node.alias)});
|
||||
@ -21,7 +21,7 @@ getAliasForPeers = (peer) => {
|
||||
|
||||
exports.getPeers = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/peers';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/peers';
|
||||
request(options).then(function (body) {
|
||||
logger.info({fileName: 'Peers', msg: 'Peers Received: ' + JSON.stringify(body)});
|
||||
let peers = !body.peers ? [] : body.peers;
|
||||
@ -56,7 +56,7 @@ exports.getPeers = (req, res, next) => {
|
||||
|
||||
exports.postPeer = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/peers';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/peers';
|
||||
options.form = JSON.stringify({
|
||||
addr: { host: req.body.host, pubkey: req.body.pubkey },
|
||||
perm: req.body.perm
|
||||
@ -70,7 +70,7 @@ exports.postPeer = (req, res, next) => {
|
||||
error: (!body) ? 'Error From Server!' : body.error
|
||||
});
|
||||
} else {
|
||||
options.url = common.getSelLNServerUrl() + '/peers';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/peers';
|
||||
request(options).then(function (body) {
|
||||
let peers = (!body.peers) ? [] : body.peers;
|
||||
Promise.all(
|
||||
@ -108,7 +108,7 @@ exports.postPeer = (req, res, next) => {
|
||||
|
||||
exports.deletePeer = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/peers/' + req.params.peerPubKey;
|
||||
options.url = common.getSelLNServerUrl() + '/v1/peers/' + req.params.peerPubKey;
|
||||
request.delete(options).then((body) => {
|
||||
logger.info({fileName: 'Peers', msg: 'Detach Peer Response: ' + JSON.stringify(body)});
|
||||
if(!body || body.error) {
|
||||
|
@ -19,7 +19,7 @@ exports.forwardingHistory = (req, res, next) => {
|
||||
exports.getAllForwardingEvents = (start, end, offset, callback) => {
|
||||
if (offset === 0) { responseData = { forwarding_events: [], last_offset_index: 0 }; }
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/switch';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/switch';
|
||||
options.form = {};
|
||||
if (start) { options.form.start_time = start; }
|
||||
if (end) { options.form.end_time = end; }
|
||||
|
@ -5,7 +5,7 @@ var options = {};
|
||||
|
||||
exports.getTransactions = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/transactions';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/transactions';
|
||||
request(options).then((body) => {
|
||||
const body_str = (!body) ? '' : JSON.stringify(body);
|
||||
const search_idx = (!body) ? -1 : body_str.search('Not Found');
|
||||
@ -44,7 +44,7 @@ exports.getTransactions = (req, res, next) => {
|
||||
|
||||
exports.postTransactions = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/transactions';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/transactions';
|
||||
options.form = {
|
||||
amount: req.body.amount,
|
||||
addr: req.body.address,
|
||||
|
@ -7,9 +7,9 @@ var options = {};
|
||||
exports.genSeed = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
if ( req.params.passphrase) {
|
||||
options.url = common.getSelLNServerUrl() + '/genseed?aezeed_passphrase=' + Buffer.from(atob(req.params.passphrase)).toString('base64');
|
||||
options.url = common.getSelLNServerUrl() + '/v1/genseed?aezeed_passphrase=' + Buffer.from(atob(req.params.passphrase)).toString('base64');
|
||||
} else {
|
||||
options.url = common.getSelLNServerUrl() + '/genseed';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/genseed';
|
||||
}
|
||||
request(options).then((body) => {
|
||||
if(!body || body.error) {
|
||||
@ -42,13 +42,13 @@ exports.operateWallet = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.method = 'POST';
|
||||
if (!req.params.operation || req.params.operation === 'unlockwallet') {
|
||||
options.url = common.getSelLNServerUrl() + '/unlockwallet';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/unlockwallet';
|
||||
options.form = JSON.stringify({
|
||||
wallet_password: Buffer.from(atob(req.body.wallet_password)).toString('base64')
|
||||
});
|
||||
err_message = 'Unlocking wallet failed! Verify that lnd is running and the wallet is locked!';
|
||||
} else {
|
||||
options.url = common.getSelLNServerUrl() + '/initwallet';
|
||||
options.url = common.getSelLNServerUrl() + '/v1/initwallet';
|
||||
if ( req.body.aezeed_passphrase && req.body.aezeed_passphrase !== '') {
|
||||
options.form = JSON.stringify({
|
||||
wallet_password: Buffer.from(atob(req.body.wallet_password)).toString('base64'),
|
||||
|
@ -81,10 +81,10 @@ services:
|
||||
PORT: ${RTL_PORT}
|
||||
HOST: 192.168.0.27
|
||||
MACAROON_PATH: /shared
|
||||
LN_SERVER_URL: https://${LIGHTNING_HOST}:${LIGHTNING_REST_PORT}/v1
|
||||
LN_SERVER_URL: https://${LIGHTNING_HOST}:${LIGHTNING_REST_PORT}
|
||||
CONFIG_PATH: ''
|
||||
LN_IMPLEMENTATION: LND
|
||||
SWAP_SERVER_URL: http://${LIGHTNING_HOST}:${LIGHTNING_LOOP_PORT}/v1
|
||||
SWAP_SERVER_URL: http://${LIGHTNING_HOST}:${LIGHTNING_LOOP_PORT}
|
||||
RTL_SSO: 0
|
||||
RTL_COOKIE_PATH: ''
|
||||
LOGOUT_REDIRECT_LINK: ''
|
||||
|
@ -32,8 +32,8 @@ parameters have `default` values for initial setup and can be updated after RTL
|
||||
"enableLogging": <Parameter to turn RTL logging off/on. Allowed values - true, false, default false, Required>,
|
||||
"fiatConversion": <parameter to turn fiat conversion off/on. Allowed values - true, false, default false, Required>,
|
||||
"currencyUnit": "<Optional: Fiat current Unit for currency conversion, default 'USD' If fiatConversion is true, Required if fiatConversion is true>",
|
||||
"lnServerUrl": "<Service url for LND/CLightning REST APIs for the node, e.g. https://192.168.0.1:8080/v1 OR https://192.168.0.1:3001/v1 OR http://192.168.0.1:8080. Default 'https://localhost:8080/v1', Required",
|
||||
"swapServerUrl": "<Service url for swap server REST APIs for the node, e.g. http://localhost:8081/v1, Optional>",
|
||||
"lnServerUrl": "<Service url for LND/CLightning REST APIs for the node, e.g. https://192.168.0.1:8080 OR https://192.168.0.1:3001 OR http://192.168.0.1:8080. Default 'https://localhost:8080', Required",
|
||||
"swapServerUrl": "<Service url for swap server REST APIs for the node, e.g. http://localhost:8081, Optional>",
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -45,8 +45,8 @@ parameters have `default` values for initial setup and can be updated after RTL
|
||||
PORT (port number for the rtl node server, default 3000, Required)
|
||||
HOST (host for the rtl node server, default localhost, Optional)
|
||||
LN_IMPLEMENTATION (LND/CLT/ECL. Default 'LND', Required)
|
||||
LN_SERVER_URL (LN server URL for LNP REST APIs, default https://localhost:8080/v1) (Required)
|
||||
SWAP_SERVER_URL (Swap server URL for REST APIs, default http://localhost:8081/v1) (Optional)
|
||||
LN_SERVER_URL (LN server URL for LNP REST APIs, default https://localhost:8080) (Required)
|
||||
SWAP_SERVER_URL (Swap server URL for REST APIs, default http://localhost:8081) (Optional)
|
||||
CONFIG_PATH (Full path of the LNP .conf file including the file name) (Optional for LND & CLT, Mandatory for ECL if LN_API_PASSWORD is undefined)
|
||||
MACAROON_PATH (Path for the folder containing 'admin.macaroon' (LND)/'access.macaroon' (CLT) file, Required for LND & CLT)
|
||||
RTL_SSO (1 - single sign on via an external cookie, 0 - stand alone RTL authentication, Optional)
|
||||
|
@ -80,7 +80,7 @@ Ensure that the follow values are correct per your config:
|
||||
"bitcoindConfigPath": "",
|
||||
"enableLogging": true,
|
||||
"fiatConversion": false,
|
||||
"lnServerUrl": "https://<cl-rest api server ip address>:3001/v1"
|
||||
"lnServerUrl": "https://<cl-rest api server ip address>:3001"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
@ -23,8 +23,8 @@ This step is only required to configure the nodes, which will be remotely connec
|
||||
5. `SSO` section can be used for single-sign-on from applications like BTCPayserver. If using RTL as a stand-alone app to connect with the nodes, keep the `rtlSSO=0` and ignore the rest of `SSO` section.
|
||||
6. `nodes` section is a json array, with each element of the array representing the specific parameters for the LND node to connect with. `index` must be a number and start with 1. This number must be unique for each node in the array. For each element, two items need to be configured for each node on the network (`macaroonPath` and `lnServerUrl`).
|
||||
7. `macaroonPath` should be set to the local path of the folder containing `admin.macaroon` file for each node. Each node must have a different folder for the `admin.macaroon` on the RTL server.
|
||||
8. `lnServerUrl` must be set to the service url for LND/C Lightining REST APIs for each node, with the unique ip address of the node hosting lnd/clightning e.g. https://192.168.0.1:8080/v1 OR https://192.168.0.1:3001/v1. In this case the ip address of the node hosting lnd/clightning is '192.168.0.1'
|
||||
9. `swapServerUrl` must be set to the swap service url. e.g. http://localhost:8081/v1.
|
||||
8. `lnServerUrl` must be set to the service url for LND/C Lightining REST APIs for each node, with the unique ip address of the node hosting lnd/clightning e.g. https://192.168.0.1:8080 OR https://192.168.0.1:3001. In this case the ip address of the node hosting lnd/clightning is '192.168.0.1'
|
||||
9. `swapServerUrl` must be set to the swap service url. e.g. http://localhost:8081.
|
||||
10. `configPath` and `bitcoindConfigPath` are optional parameters which can be set only if the RTL is running locally on the same node. Else it can be set to "" or removed from the conf file all together.
|
||||
11. `lnApiPassword` is mandatory in the ln implementation is ECL and configPath is missing. It is used to provide password for API authentication. It will be ignored in other ln implementations.
|
||||
|
||||
|
@ -37,8 +37,8 @@ If your running RTL and LND on different devices on your local LAN, certain conf
|
||||
"bitcoindConfigPath": "<Optional: path of bitcoind.conf path if available locally>",
|
||||
"enableLogging": false,
|
||||
"fiatConversion": false,
|
||||
"lnServerUrl": "<https://<ip-address-of-device-running-lnd>:8080/v1; e.g. https://192.168.0.1:8080/v1>",
|
||||
"swapServerUrl": "<http://<localhost>:8081/v1>",
|
||||
"lnServerUrl": "<https://<ip-address-of-device-running-lnd>:8080; e.g. https://192.168.0.1:8080>",
|
||||
"swapServerUrl": "<http://<localhost>:8081>",
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -22,8 +22,8 @@
|
||||
"themeColor": "PURPLE",
|
||||
"channelBackupPath": "C:\\Users\\shaha\\backup\\node-1",
|
||||
"enableLogging": false,
|
||||
"lnServerUrl": "https://localhost:8080/v1",
|
||||
"swapServerUrl": "http://localhost:8081/v1",
|
||||
"lnServerUrl": "https://localhost:8080",
|
||||
"swapServerUrl": "http://localhost:8081",
|
||||
"fiatConversion": false
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user