Small Non-Zero Invoice Fix

Small Non-Zero Invoice Fix
pull/260/head v0.6.4
Shahana Farooqui 4 years ago
parent a865b361de
commit ab85543adf

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -12,5 +12,5 @@
<link rel="stylesheet" href="styles.76f25502eb3f17a51952.css"></head>
<body>
<rtl-app></rtl-app>
<script src="runtime.bd15680a9b84bab2ef08.js" defer></script><script src="polyfills-es5.37b2eeccc22c1df73ce7.js" nomodule defer></script><script src="polyfills.f1c3d2a0bcdfc4e93ca8.js" defer></script><script src="main.df6ee6d1e5bed4756848.js" defer></script></body>
<script src="runtime.829d82b26d0492e8b1c6.js" defer></script><script src="polyfills-es5.37b2eeccc22c1df73ce7.js" nomodule defer></script><script src="polyfills.f1c3d2a0bcdfc4e93ca8.js" defer></script><script src="main.7b44046928ceed139a89.js" defer></script></body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +1 @@
!function(e){function r(r){for(var n,i,a=r[0],c=r[1],l=r[2],p=0,s=[];p<a.length;p++)i=a[p],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&s.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++)0!==o[t[a]]&&(n=!1);n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={0:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+""+({}[e]||e)+"."+{1:"b78c4146e439be098e08",6:"3745fb0b662c2ed95634",7:"96c25bc9ca5994f524b4"}[e]+".js"}(e);var c=new Error;u=function(r){a.onerror=a.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,(function(r){return e[r]}).bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="",i.oe=function(e){throw console.error(e),e};var a=window.webpackJsonp=window.webpackJsonp||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var l=0;l<a.length;l++)r(a[l]);var f=c;t()}([]);
!function(e){function r(r){for(var n,i,a=r[0],c=r[1],l=r[2],p=0,s=[];p<a.length;p++)i=a[p],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&s.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++)0!==o[t[a]]&&(n=!1);n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={0:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+""+({}[e]||e)+"."+{1:"b78c4146e439be098e08",6:"3745fb0b662c2ed95634",7:"74280ad542cd630518fb"}[e]+".js"}(e);var c=new Error;u=function(r){a.onerror=a.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,(function(r){return e[r]}).bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="",i.oe=function(e){throw console.error(e),e};var a=window.webpackJsonp=window.webpackJsonp||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var l=0;l<a.length;l++)r(a[l]);var f=c;t()}([]);

@ -23,6 +23,7 @@ exports.getAllChannels = (req, res, next) => {
let remote = 0;
let total = 0;
request(options).then(function (body) {
logger.info({fileName: 'Channels', msg: 'All Channels Received: ' + JSON.stringify(body)});
if(body.channels) {
Promise.all(
body.channels.map(channel => {

@ -62,12 +62,17 @@ exports.listInvoices = (req, res, next) => {
exports.addInvoice = (req, res, next) => {
options = common.getOptions();
options.url = common.getSelLNServerUrl() + '/invoices';
options.form = JSON.stringify({
options.form = {
memo: req.body.memo,
value: req.body.amount,
private: req.body.private,
expiry: req.body.expiry
});
};
if (req.body.amount > 0 && req.body.amount < 1) {
options.form.value_msat = req.body.amount * 1000;
} else {
options.form.value = req.body.amount;
}
options.form = JSON.stringify(options.form);
request.post(options).then((body) => {
logger.info({fileName: 'Invoice', msg: 'Add Invoice Responce: ' + JSON.stringify(body)});
if(undefined === body || body.error) {

@ -7,17 +7,17 @@ exports.decodePayment = (req, res, next) => {
options = common.getOptions();
options.url = common.getSelLNServerUrl() + '/payreq/' + req.params.payRequest;
request(options).then((body) => {
const body_str = (undefined === body) ? '' : JSON.stringify(body);
const search_idx = (undefined === body) ? -1 : body_str.search('Not Found');
const body_str = (!body) ? '' : JSON.stringify(body);
const search_idx = (!body) ? -1 : body_str.search('Not Found');
logger.info({fileName: 'PayReq', msg: 'Payment Decode Received: ' + body_str});
if(undefined === body || search_idx > -1 || body.error) {
if(!body || search_idx > -1 || body.error) {
res.status(500).json({
message: "Payment Request Decode Failed!",
error: (undefined === body || search_idx > -1) ? 'Error From Server!' : body.error
error: (!body || search_idx > -1) ? 'Error From Server!' : body.error
});
} else {
body.btc_num_satoshis = (undefined === body.num_satoshis) ? 0 : common.convertToBTC(body.num_satoshis);
body.timestamp_str = (undefined === body.timestamp) ? '' : common.convertTimestampToDate(body.timestamp);
body.btc_num_satoshis = (!body.num_satoshis) ? 0 : common.convertToBTC(body.num_satoshis);
body.timestamp_str = (!body.timestamp) ? '' : common.convertTimestampToDate(body.timestamp);
res.status(200).json(body);
}
})

@ -20,20 +20,23 @@ exports.getPeers = (req, res, next) => {
options = common.getOptions();
options.url = common.getSelLNServerUrl() + '/peers';
request(options).then(function (body) {
logger.info({fileName: 'Peers', msg: 'Peers Received: ' + JSON.stringify(body)});
let peers = (undefined === body.peers) ? [] : body.peers;
Promise.all(
peers.map(peer => {
return getAliasForPeers(peer);
}))
.then(function(values) {
logger.info({fileName: 'Peers', msg: 'Peers with Alias before Sort: ' + JSON.stringify(body)});
if (undefined !== body.peers) {
body.peers = common.sortDescByKey(body.peers, 'alias');
}
logger.info({fileName: 'Peers', msg: 'Peers with Alias: ' + JSON.stringify(body)});
logger.info({fileName: 'Peers', msg: 'Peers with Alias after Sort: ' + JSON.stringify(body)});
res.status(200).json(body.peers);
});
})
.catch((err) => {
logger.error({fileName: 'Peers', lineNum: 39, msg: 'Peers List Failed: ' + JSON.stringify(err)});
return res.status(500).json({
message: "Peers Fetched Failed!",
error: err.error

@ -4,7 +4,7 @@ var common = require('../common');
exports.info = (msgJSON, selNode = common.selectedNode) => {
const msgStr = '\r\nINFO: ' + msgJSON.fileName + ' => ' + msgJSON.msg;
if (msgJSON.fileName !== 'Config Setup Variable') {
console.log('Console: ' + msgStr);
console.log(msgStr);
}
if(selNode && selNode.enable_logging) {
fs.appendFile(selNode.log_file, msgStr, function(err) {
@ -19,7 +19,7 @@ exports.info = (msgJSON, selNode = common.selectedNode) => {
exports.error = (msgJSON, selNode = common.selectedNode) => {
const msgStr = '\r\nERROR: ' + msgJSON.fileName + '(' + msgJSON.lineNum + ') => ' + msgJSON.msg;
console.error('Console: ' + msgStr);
console.error(msgStr);
if(selNode && selNode.enable_logging) {
fs.appendFile(selNode.log_file, msgStr, function(err) {
if (err) {

@ -111,8 +111,10 @@ export class LightningPaymentsComponent implements OnInit, OnDestroy {
.pipe(take(1))
.subscribe(decodedPayment => {
this.paymentDecoded = decodedPayment;
if (undefined !== this.paymentDecoded.timestamp_str) {
if (undefined === this.paymentDecoded.num_satoshis) {
if (this.paymentDecoded.timestamp_str) {
if (this.paymentDecoded.num_msat && !this.paymentDecoded.num_satoshis) {
this.paymentDecoded.num_satoshis = (+this.paymentDecoded.num_msat / 1000).toString();
} else {
this.paymentDecoded.num_satoshis = '0';
}
this.sendPayment();
@ -127,7 +129,10 @@ export class LightningPaymentsComponent implements OnInit, OnDestroy {
sendPayment() {
this.flgAnimate = true;
this.newlyAddedPayment = this.paymentDecoded.payment_hash;
if (undefined === this.paymentDecoded.num_satoshis || this.paymentDecoded.num_satoshis === '' || this.paymentDecoded.num_satoshis === '0') {
if (this.paymentDecoded.num_msat && !this.paymentDecoded.num_satoshis) {
this.paymentDecoded.num_satoshis = (+this.paymentDecoded.num_msat / 1000).toString();
}
if (!this.paymentDecoded.num_satoshis || this.paymentDecoded.num_satoshis === '' || this.paymentDecoded.num_satoshis === '0') {
const reorderedPaymentDecoded = [
[{key: 'payment_hash', value: this.paymentDecoded.payment_hash, title: 'Payment Hash', width: 100}],
[{key: 'destination', value: this.paymentDecoded.destination, title: 'Destination', width: 100}],
@ -195,6 +200,9 @@ export class LightningPaymentsComponent implements OnInit, OnDestroy {
this.store.dispatch(new RTLActions.DecodePayment(this.paymentRequest));
this.lndEffects.setDecodedPayment.subscribe(decodedPayment => {
this.paymentDecoded = decodedPayment;
if (this.paymentDecoded.num_msat && !this.paymentDecoded.num_satoshis) {
this.paymentDecoded.num_satoshis = (+this.paymentDecoded.num_msat / 1000).toString();
}
if(this.paymentDecoded.num_satoshis) {
this.commonService.convertCurrency(+this.paymentDecoded.num_satoshis, CurrencyUnitEnum.SATS, this.selNode.currencyUnits[2], this.selNode.fiatConversion)
.pipe(takeUntil(this.unSubs[1]))

@ -1,6 +1,6 @@
<div perfectScrollbar fxLayout="column" fxLayout.gt-sm="row" fxLayoutAlign="space-between stretch">
<div fxFlex="30" fxLayoutAlign="center start" class="modal-qr-code-container padding-gap-large" [ngClass]="{'display-none': showQRField === '' || screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM}">
<qrcode [qrdata]="showQRField" [margin]="2" [width]="210" [errorCorrectionLevel]="'L'" [allowEmptyString]="true"></qrcode>
<qrcode *ngIf="showQRField !== ''" [qrdata]="showQRField" [margin]="2" [width]="240" [errorCorrectionLevel]="'L'"></qrcode>
</div>
<div [fxFlex]="showQRField === '' || screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM ? '100' : '70'" class="padding-gap-large pl-3">
<mat-card-header fxLayout="row" fxLayoutAlign="space-between center" class="modal-info-header">
@ -12,7 +12,7 @@
<mat-card-content class="mt-5px mb-0 pr-2">
<div fxLayout="column">
<div fxFlex="50" fxLayoutAlign="center start" class="modal-qr-code-container padding-gap-large mb-1" [ngClass]="{'display-none': showQRField === '' || (screenSize !== screenSizeEnum.XS && screenSize !== screenSizeEnum.SM)}">
<qrcode [qrdata]="showQRField" [margin]="2" [width]="210" [errorCorrectionLevel]="'L'" [allowEmptyString]="true"></qrcode>
<qrcode *ngIf="showQRField !== ''" [qrdata]="showQRField" [margin]="2" [width]="240" [errorCorrectionLevel]="'L'"></qrcode>
</div>
<div fxLayout="row" fxFlex="100">
<p *ngIf="data.titleMessage" fxLayoutAlign="start center" class="pb-1">{{data.titleMessage}}</p>

@ -282,6 +282,7 @@ export interface PayRequest {
destination?: string;
expiry?: number;
description?: string;
num_msat?: string;
num_satoshis?: string;
btc_num_satoshis?: string;
}

@ -1 +1 @@
export const VERSION = '0.6.4-beta';
export const VERSION = '0.6.4-beta';
Loading…
Cancel
Save