Payment Options & Total Fee Transactions

Payment Options & Total Fee Transactions
pull/260/head
Shahana Farooqui 4 years ago
parent 5b6bf4de1b
commit 36236e05d1

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -9,8 +9,8 @@
<link rel="icon" type="image/png" sizes="32x32" href="assets/images/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon/favicon-16x16.png">
<link rel="manifest" href="assets/images/favicon/site.webmanifest">
<link rel="stylesheet" href="styles.54797b8c7ca5eeaa7ffc.css"></head>
<link rel="stylesheet" href="styles.84a3ca15f237e7d708f3.css"></head>
<body>
<rtl-app></rtl-app>
<script src="runtime.4a3b4a1aaa893c04c130.js" defer></script><script src="polyfills-es5.b8e32dec482ae69710a2.js" nomodule defer></script><script src="polyfills.ebf9033c33aa4a5af12a.js" defer></script><script src="main.7ace4ba4a92ddbc420f7.js" defer></script></body>
<script src="runtime.dee2c800c6a182585bb1.js" defer></script><script src="polyfills-es5.b8e32dec482ae69710a2.js" nomodule defer></script><script src="polyfills.ebf9033c33aa4a5af12a.js" defer></script><script src="main.cb4e9f676564b92e59d1.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 +0,0 @@
!function(e){function r(r){for(var n,a,i=r[0],c=r[1],f=r[2],p=0,s=[];p<i.length;p++)a=i[p],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&s.push(o[a][0]),o[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(l&&l(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++)0!==o[t[i]]&&(n=!1);n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={0:0},u=[];function a(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,a),t.l=!0,t.exports}a.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,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+""+({}[e]||e)+"."+{1:"3de0a26964d460363d96",6:"75a1a1653f2c3e123992",7:"8193b919efcf21b097ae"}[e]+".js"}(e);var c=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(f);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 f=setTimeout((function(){u({type:"timeout",target:i})}),12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,(function(r){return e[r]}).bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="",a.oe=function(e){throw console.error(e),e};var i=window.webpackJsonp=window.webpackJsonp||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var f=0;f<i.length;f++)r(i[f]);var l=c;t()}([]);

@ -0,0 +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:"3de0a26964d460363d96",6:"f324f927e59831e67524",7:"bc81c5d83e6736182735"}[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()}([]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -470,19 +470,13 @@ connect.logEnvVariables = () => {
logger.info({fileName: 'Config Setup Variable', msg: 'DEFAULT_NODE_INDEX: ' + common.selectedNode.index});
logger.info({fileName: 'Config Setup Variable', msg: 'NODE_SETUP: MULTI', node});
logger.info({fileName: 'Config Setup Variable', msg: 'RTL_SSO: ' + common.rtl_sso, node});
logger.info({fileName: 'Config Setup Variable', msg: 'RTL_COOKIE_PATH: ' + common.rtl_cookie_path, node});
logger.info({fileName: 'Config Setup Variable', msg: 'LOGOUT_REDIRECT_LINK: ' + common.logout_redirect_link + '\r\n', node});
logger.info({fileName: 'Config Setup Variable', msg: 'INDEX: ' + node.index, node});
logger.info({fileName: 'Config Setup Variable', msg: 'LN NODE: ' + node.ln_node, node});
logger.info({fileName: 'Config Setup Variable', msg: 'LN IMPLEMENTATION: ' + node.ln_implementation, node});
logger.info({fileName: 'Config Setup Variable', msg: 'PORT: ' + common.port, node});
logger.info({fileName: 'Config Setup Variable', msg: 'CURRENCY_UNIT: ' + common.currency_unit, node});
logger.info({fileName: 'Config Setup Variable', msg: 'MACAROON_PATH: ' + node.macaroon_path, node});
logger.info({fileName: 'Config Setup Variable', msg: 'LND_SERVER_URL: ' + node.ln_server_url, node});
logger.info({fileName: 'Config Setup Variable', msg: 'RTL_CONFIG_PATH: ' + node.rtl_conf_file_path, node});
logger.info({fileName: 'Config Setup Variable', msg: 'CONFIG_PATH: ' + node.config_path, node});
logger.info({fileName: 'Config Setup Variable', msg: 'BITCOIND_CONFIG_PATH: ' + node.bitcoind_config_path, node});
logger.info({fileName: 'Config Setup Variable', msg: 'CHANNEL_BACKUP_PATH: ' + node.channel_backup_path, node});
});
} else {
if (!common.nodes[0].enable_logging) { return; }
@ -490,14 +484,7 @@ connect.logEnvVariables = () => {
logger.info({fileName: 'Config Setup Variable', msg: 'PORT: ' + common.port});
logger.info({fileName: 'Config Setup Variable', msg: 'CURRENCY_UNIT: ' + common.currency_unit});
logger.info({fileName: 'Config Setup Variable', msg: 'LND_SERVER_URL: ' + common.nodes[0].ln_server_url});
logger.info({fileName: 'Config Setup Variable', msg: 'MACAROON_PATH: ' + common.nodes[0].macaroon_path});
logger.info({fileName: 'Config Setup Variable', msg: 'NODE_AUTH_TYPE: ' + common.node_auth_type});
logger.info({fileName: 'Config Setup Variable', msg: 'CONFIG_PATH: ' + common.nodes[0].config_path});
logger.info({fileName: 'Config Setup Variable', msg: 'RTL_CONFIG_PATH: ' + common.rtl_conf_file_path});
logger.info({fileName: 'Config Setup Variable', msg: 'BITCOIND_CONFIG_PATH: ' + common.nodes[0].bitcoind_config_path});
logger.info({fileName: 'Config Setup Variable', msg: 'CHANNEL_BACKUP_PATH: ' + common.nodes[0].channel_backup_path});
logger.info({fileName: 'Config Setup Variable', msg: 'RTL_SSO: ' + common.rtl_sso});
logger.info({fileName: 'Config Setup Variable', msg: 'RTL_COOKIE_PATH: ' + common.rtl_cookie_path});
logger.info({fileName: 'Config Setup Variable', msg: 'LOGOUT_REDIRECT_LINK: ' + common.logout_redirect_link});
}
}

@ -23,7 +23,7 @@ exports.openChannel = (req, res, next) => {
options = common.getOptions();
options.url = common.getSelLNServerUrl() + '/channel/openChannel';
options.body = req.body;
logger.info({fileName: 'Channels', msg: 'Open Channel Options: ' + JSON.stringify(options)});
logger.info({fileName: 'Channels', msg: 'Open Channel Options: ' + JSON.stringify(options.body)});
request.post(options).then((body) => {
logger.info({fileName: 'Channels', msg: 'Open Channel Response: ' + JSON.stringify(body)});
if(undefined === body || body.error) {
@ -48,7 +48,7 @@ exports.setChannelFee = (req, res, next) => {
options = common.getOptions();
options.url = common.getSelLNServerUrl() + '/channel/setChannelFee';
options.body = req.body;
logger.info({fileName: 'Channels', msg: 'Update Channel Policy Options: ' + JSON.stringify(options)});
logger.info({fileName: 'Channels', msg: 'Update Channel Policy Options: ' + JSON.stringify(options.body)});
request.post(options).then((body) => {
logger.info({fileName: 'Channels', msg: 'Update Channel Policy: ' + JSON.stringify(body)});
if(undefined === body || body.error) {

@ -21,7 +21,7 @@ exports.onChainWithdraw = (req, res, next) => {
options = common.getOptions();
options.url = common.getSelLNServerUrl() + '/withdraw';
options.body = req.body;
logger.info({fileName: 'OnChain', msg: 'OnChain Withdraw Options: ' + JSON.stringify(options)});
logger.info({fileName: 'OnChain', msg: 'OnChain Withdraw Options: ' + JSON.stringify(options.body)});
request.post(options).then((body) => {
logger.info({fileName: 'OnChain', msg: 'OnChain Withdraw Response: ' + JSON.stringify(body)});
if(undefined === body || body.error) {

@ -145,17 +145,25 @@ exports.postTransactions = (req, res, next) => {
options = common.getOptions();
options.url = common.getSelLNServerUrl() + '/channels/transactions';
if(req.body.paymentReq) {
options.form = JSON.stringify({
options.form = {
payment_request: req.body.paymentReq
});
};
} else if(req.body.paymentDecoded) {
options.form = JSON.stringify({
options.form = {
payment_hash_string: req.body.paymentDecoded.payment_hash,
final_cltv_delta: parseInt(req.body.paymentDecoded.cltv_expiry),
amt: req.body.paymentDecoded.num_satoshis,
dest_string: req.body.paymentDecoded.destination
});
};
}
if(req.body.feeLimit) {
options.form.fee_limit = req.body.feeLimit;
}
if(req.body.outgoingChannel) {
options.form.outgoing_chan_id = req.body.outgoingChannel;
}
options.form = JSON.stringify(options.form);
logger.info({fileName: 'Channels', msg: 'Send Payment Options: ' + options.form});
request.post(options).then((body) => {
logger.info({fileName: 'Channels', msg: 'Send Payment Response: ' + JSON.stringify(body)});
if(undefined === body || body.error) {
@ -228,7 +236,7 @@ exports.postChanPolicy = (req, res, next) => {
chan_point: {funding_txid_str: txid_str, output_index: parseInt(output_idx)}
});
}
logger.info({fileName: 'Channels', msg: 'Update Channel Policy Options: ' + JSON.stringify(options)});
logger.info({fileName: 'Channels', msg: 'Update Channel Policy Options: ' + JSON.stringify(options.form)});
request.post(options).then((body) => {
logger.info({fileName: 'Channels', msg: 'Update Channel Policy: ' + JSON.stringify(body)});
if(undefined === body || body.error) {

@ -9,7 +9,7 @@ exports.decodePayment = (req, res, next) => {
request(options).then((body) => {
const body_str = (undefined === body) ? '' : JSON.stringify(body);
const search_idx = (undefined === body) ? -1 : body_str.search('Not Found');
logger.info({fileName: 'PayReq', msg: 'Payment Decodd Received: ' + body_str});
logger.info({fileName: 'PayReq', msg: 'Payment Decode Received: ' + body_str});
if(undefined === body || search_idx > -1 || body.error) {
res.status(500).json({
message: "Payment Request Decode Failed!",

@ -20,11 +20,11 @@ exports.forwardingHistory = (req, res, next) => {
options.form.start_time = req.body.start_time;
}
options.form = JSON.stringify(options.form);
logger.info({fileName: 'Switch', msg: 'Switch Post Options: ' + JSON.stringify(options)});
logger.info({fileName: 'Switch', msg: 'Forwarding History Start Time: ' + options.form.start_time});
logger.info({fileName: 'Switch', msg: 'Forwarding History End Time: ' + options.form.end_time});
request.post(options).then((body) => {
logger.info({fileName: 'Switch', msg: 'Switch Post Response: ' + JSON.stringify(body)});
if(undefined === body || body.error) {
logger.error({fileName: 'Switch', lineNum: 27, msg: 'Switch Post Error: ' + JSON.stringify((undefined === body) ? 'Error From Server!' : body.error)});
logger.error({fileName: 'Switch', lineNum: 27, msg: 'Forwarding History Error: ' + JSON.stringify((undefined === body) ? 'Error From Server!' : body.error)});
res.status(500).json({
message: "Switch post failed!",
error: (undefined === body) ? 'Error From Server!' : body.error
@ -41,7 +41,7 @@ exports.forwardingHistory = (req, res, next) => {
}
})
.catch(function (err) {
logger.error({fileName: 'Switch', lineNum: 44, msg: 'Switch Post Error: ' + JSON.stringify(err)});
logger.error({fileName: 'Switch', lineNum: 44, msg: 'Forwarding History Error: ' + JSON.stringify(err)});
return res.status(500).json({
message: "Switch post failed!",
error: err.error

@ -1,4 +1,4 @@
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between stretch">
<div fxLayout="column" fxFlex="50" fxLayoutAlign="space-between stretch">
<div>
<h4 fxLayoutAlign="start" class="dashboard-info-title">Daily</h4>
<div class="overflow-wrap dashboard-info-value">{{fees?.day_fee_sum | number}} Sats</div>
@ -16,3 +16,21 @@
<span class="overflow-wrap dashboard-info-value"></span>
</div>
</div>
<div fxLayout="column" fxFlex="50" fxLayoutAlign="space-between stretch">
<div>
<h4 fxLayoutAlign="start" class="dashboard-info-title">Transactions</h4>
<div class="overflow-wrap dashboard-info-value">{{fees?.daily_tx_count | number}}</div>
</div>
<div>
<h4 fxLayoutAlign="start" class="dashboard-info-title">Transactions</h4>
<div class="overflow-wrap dashboard-info-value">{{fees?.weekly_tx_count | number}}</div>
</div>
<div>
<h4 fxLayoutAlign="start" class="dashboard-info-title">Transactions</h4>
<div class="overflow-wrap dashboard-info-value">{{fees?.monthly_tx_count | number}}</div>
</div>
<div fxFlex="20">
<h4 class="dashboard-info-title"></h4>
<span class="overflow-wrap dashboard-info-value"></span>
</div>
</div>

@ -18,7 +18,7 @@ import { AlertTypeEnum, DataTypeEnum, ScreenSizeEnum } from '../../../shared/ser
})
export class RoutingPeersComponent implements OnInit, OnChanges {
@ViewChild(MatSort, { static: true }) sortIn: MatSort;
@ViewChild(MatSort, { static: true }) sortOut: MatSort;
@ViewChild('tableOut', {read: MatSort, static: true}) sortOut: MatSort;
@Input() routingPeersData: any;
public displayedColumns = [];
public RoutingPeersIncoming: any;

@ -14,7 +14,7 @@ import { SessionService } from '../../shared/services/session.service';
import { GetInfo, GetInfoChain, Fees, Balance, NetworkInfo, Payment, GraphNode, Transaction, SwitchReq, ListInvoices, PendingChannelsGroup } from '../../shared/models/lndModels';
import { InvoiceInformationComponent } from '../../shared/components/data-modal/invoice-information/invoice-information.component';
import { OpenChannelComponent } from '../../shared/components/data-modal/open-channel/open-channel.component';
import { CurrencyUnitEnum, AlertTypeEnum } from '../../shared/services/consts-enums-functions';
import { CurrencyUnitEnum, AlertTypeEnum, FEE_LIMIT_TYPES } from '../../shared/services/consts-enums-functions';
import * as RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
@ -646,10 +646,17 @@ export class LNDEffects implements OnDestroy {
withLatestFrom(this.store.select('root')),
mergeMap(([action, store]: [RTLActions.SendPayment, any]) => {
let queryHeaders = {};
if (action.payload[2]) {
queryHeaders = { paymentDecoded: action.payload[1] };
if(action.payload.feeLimitType && action.payload.feeLimitType !== FEE_LIMIT_TYPES[0]) {
queryHeaders['feeLimit'] = {};
queryHeaders['feeLimit'][action.payload.feeLimitType.id] = action.payload.feeLimit;
}
if(action.payload.outgoingChannel) {
queryHeaders['outgoingChannel'] = action.payload.outgoingChannel.chan_id;
}
if (action.payload.zeroAmtInvoice) {
queryHeaders['paymentDecoded'] = action.payload.paymentDecoded;
} else {
queryHeaders = { paymentReq: action.payload[0] };
queryHeaders['paymentReq'] = action.payload.paymentReq;
}
return this.httpClient.post(this.CHILD_API_URL + environment.CHANNELS_API + '/transactions', queryHeaders)
.pipe(

@ -1,10 +1,37 @@
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between stretch" class="padding-gap">
<form fxLayout="column" fxLayoutAlign="space-between stretch" fxLayout.gt-sm="row wrap" #sendPaymentForm="ngForm">
<mat-form-field class="w-100">
<mat-form-field [fxFlex]="showDetails ? '82' : '100'">
<input matInput placeholder="Payment Request" name="paymentRequest" [(ngModel)]="paymentRequest" tabindex="1" (keyup)="onPaymentRequestEntry()" required #paymentReq="ngModel">
<mat-hint *ngIf="paymentRequest && paymentDecodedHint !== ''">{{paymentDecodedHint}}</mat-hint>
<mat-error *ngIf="!paymentRequest">Payment request is required.</mat-error>
</mat-form-field>
<div *ngIf="showDetails" fxFlex="100" fxFlex.gt-sm="17" fxLayoutAlign="start center" [ngClass]="{'mt-2': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM}">
<button fxFlex="100" mat-stroked-button color="primary" type="reset" (click)="onShowAdvanced()" tabindex="4">
<p *ngIf="!showAdvanced; else hideAdvancedText">Show Advanced</p>
<ng-template #hideAdvancedText><p>Hide Advanced</p></ng-template>
</button>
</div>
<div *ngIf="showDetails && showAdvanced" fxFlex="100" fxLayout="column" fxLayoutAlign="space-between stretch" fxLayout.gt-sm="row wrap">
<mat-form-field fxFlex="32" fxLayoutAlign="start end">
<mat-select tabindex="5" [(value)]="selFeeLimitType">
<mat-option *ngFor="let feeLimitType of feeLimitTypes" [value]="feeLimitType">
{{feeLimitType.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field fxFlex="33">
<input matInput [(ngModel)]="feeLimit" placeholder="Fee Limit" type="number" name="feeLimit" step="1" min="0" required tabindex="6" #feeLmt="ngModel" [disabled]="selFeeLimitType === feeLimitTypes[0]">
<mat-error *ngIf="selFeeLimitType !== feeLimitTypes[0] && !feeLimit">Fees Limit is required.</mat-error>
</mat-form-field>
<mat-form-field fxFlex="33" fxLayoutAlign="start end">
<mat-select tabindex="7" [(value)]="selActiveChannel">
<mat-option [value]="null"></mat-option>
<mat-option *ngFor="let activeChannel of activeChannels" [value]="activeChannel">
{{activeChannel.remote_alias || activeChannel.chan_id}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
<div fxLayout="row" fxFlex="100" fxFlex.gt-sm="30" fxLayoutAlign="space-between stretch" *ngIf="showDetails" class="mt-2">
<button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="2" type="reset" (click)="resetData()">Clear Field</button>
<button fxFlex="48" fxLayoutAlign="center center" mat-raised-button color="primary" (click)="onSendPayment();" tabindex="3">Send Payment</button>

@ -6,8 +6,8 @@ import { Store } from '@ngrx/store';
import { faHistory } from '@fortawesome/free-solid-svg-icons';
import { MatTableDataSource, MatSort, MatPaginator, MatPaginatorIntl } from '@angular/material';
import { GetInfo, Payment, PayRequest } from '../../../shared/models/lndModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, CurrencyUnitEnum, CURRENCY_UNIT_FORMATS } from '../../../shared/services/consts-enums-functions';
import { GetInfo, Payment, PayRequest, Channel } from '../../../shared/models/lndModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, CurrencyUnitEnum, CURRENCY_UNIT_FORMATS, FEE_LIMIT_TYPES } from '../../../shared/services/consts-enums-functions';
import { LoggerService } from '../../../shared/services/logger.service';
import { CommonService } from '../../../shared/services/common.service';
@ -44,6 +44,12 @@ export class LightningPaymentsComponent implements OnInit, OnDestroy {
public paymentDecoded: PayRequest = {};
public paymentRequest = '';
public paymentDecodedHint = '';
public showAdvanced = false;
public selActiveChannel: Channel = {};
public activeChannels = {};
public feeLimit = null;
public selFeeLimitType = FEE_LIMIT_TYPES[0];
public feeLimitTypes = FEE_LIMIT_TYPES;
public flgSticky = false;
public pageSize = PAGE_SIZE;
public pageSizeOptions = PAGE_SIZE_OPTIONS;
@ -79,6 +85,7 @@ export class LightningPaymentsComponent implements OnInit, OnDestroy {
});
this.information = rtlStore.information;
this.selNode = rtlStore.nodeSettings;
this.activeChannels = rtlStore.allChannels.filter(channel => channel.active);
this.paymentJSONArr = (null !== rtlStore.payments && rtlStore.payments.length > 0) ? rtlStore.payments : [];
this.payments = (undefined === rtlStore.payments || null == rtlStore.payments) ? new MatTableDataSource([]) : new MatTableDataSource<Payment>([...this.paymentJSONArr]);
this.payments.data = this.paymentJSONArr;
@ -94,7 +101,6 @@ export class LightningPaymentsComponent implements OnInit, OnDestroy {
}
onSendPayment() {
console.warn('SEND PAYMENT');
if(!this.paymentRequest) { return true; }
if (undefined !== this.paymentDecoded.timestamp_str) {
this.sendPayment();
@ -149,7 +155,7 @@ export class LightningPaymentsComponent implements OnInit, OnDestroy {
if (confirmRes) {
this.paymentDecoded.num_satoshis = confirmRes[0].inputValue;
this.store.dispatch(new RTLActions.OpenSpinner('Sending Payment...'));
this.store.dispatch(new RTLActions.SendPayment([this.paymentRequest, this.paymentDecoded, true]));
this.store.dispatch(new RTLActions.SendPayment({paymentDecoded: this.paymentDecoded, outgoingChannel: this.selActiveChannel, feeLimitType: this.selFeeLimitType, feeLimit: this.feeLimit, zeroAmtInvoice: true}));
this.resetData();
}
});
@ -175,7 +181,7 @@ export class LightningPaymentsComponent implements OnInit, OnDestroy {
.subscribe(confirmRes => {
if (confirmRes) {
this.store.dispatch(new RTLActions.OpenSpinner('Sending Payment...'));
this.store.dispatch(new RTLActions.SendPayment([this.paymentRequest, this.paymentDecoded, false]));
this.store.dispatch(new RTLActions.SendPayment({paymentReq: this.paymentRequest, outgoingChannel: this.selActiveChannel, feeLimitType: this.selFeeLimitType, feeLimit: this.feeLimit, zeroAmtInvoice: false}));
this.resetData();
}
});
@ -202,9 +208,20 @@ export class LightningPaymentsComponent implements OnInit, OnDestroy {
}
}
onShowAdvanced() {
this.showAdvanced = !this.showAdvanced;
if (!this.showAdvanced) {
this.selActiveChannel = null;
this.feeLimit = null;
this.selFeeLimitType = FEE_LIMIT_TYPES[0];
this.feeLimitTypes = FEE_LIMIT_TYPES;
}
}
resetData() {
this.paymentDecoded = {};
this.paymentRequest = '';
this.showAdvanced = false;
this.form.reset();
}

@ -41,7 +41,7 @@ export interface Channel {
remote_pubkey?: string;
remote_alias?: string;
channel_point?: string;
chan_id?: number;
chan_id?: string;
capacity?: number;
local_balance?: number;
remote_balance?: number;
@ -145,6 +145,9 @@ export interface Fees {
btc_day_fee_sum?: number;
btc_week_fee_sum?: number;
btc_month_fee_sum?: number;
daily_tx_count?: number;
weekly_tx_count?: number;
monthly_tx_count?: number;
}
export interface GetInfoChain {

@ -35,6 +35,13 @@ export const TRANS_TYPES = [
{id: '2', name: 'Fee'}
];
export const FEE_LIMIT_TYPES = [
{id: 'none', name: 'No Limit'},
{id: 'fixed', name: 'Fixed in Sats'},
{id: 'fixed_msat', name: 'Fixed in mSats'},
{id: 'percent', name: 'Percentage of Payment Amount'}
];
export const NODE_SETTINGS = {
themes: [
{id: 'purple', name: 'Diogo'},

@ -390,6 +390,20 @@
border: 1px solid $foreground-divider;
}
.more-button {
color: $foreground-disabled;
}
.dashboard-tabs-group {
& .mat-tab-label:last-child {
padding-right: 0;
& .more-button {
position: absolute;
right: 0
}
}
}
.modal-info-header {
color: $foreground-text;
font-weight: 500;

@ -951,4 +951,4 @@ table {
.mat-vertical-content-container {
margin-left: 2rem !important;
}
}

@ -480,7 +480,7 @@ export class SetDecodedPayment implements Action {
export class SendPayment implements Action {
readonly type = SEND_PAYMENT;
constructor(public payload: [string, PayRequest, boolean]) {} // payload = [paymentReqStr, paymentDecoded, EmptyAmtInvoice]
constructor(public payload: { paymentReq?: string, paymentDecoded?: PayRequest, outgoingChannel?: Channel, feeLimitType?: {id: string, name: string}, feeLimit?: number, zeroAmtInvoice: boolean }) {}
}
export class FetchGraphNode implements Action {

Loading…
Cancel
Save