Merge pull request #1247 from Ride-The-Lightning/cln-msat-migration

msatoshi migration without backward compatibility
pull/1246/head
ShahanaFarooqui 12 months ago committed by GitHub
commit 6a72950fbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,8 +17,9 @@ export const listPeerChannels = (req, res, next) => {
channel.alias = channel.peer_id.substring(0, 20); channel.alias = channel.peer_id.substring(0, 20);
} }
const local = channel.to_us_msat || 0; const local = channel.to_us_msat || 0;
const remote = (channel.total_msat - channel.to_us_msat) || 0; const remote = (channel.total_msat - local) || 0;
const total = channel.total_msat || 0; const total = channel.total_msat || 0;
channel.to_them_msat = remote;
channel.balancedness = (total === 0) ? 1 : (1 - Math.abs((local - remote) / total)).toFixed(3); channel.balancedness = (total === 0) ? 1 : (1 - Math.abs((local - remote) / total)).toFixed(3);
return channel; return channel;
}); });
@ -35,20 +36,16 @@ export const listChannels = (req, res, next) => {
if (options.error) { if (options.error) {
return res.status(options.statusCode).json({ message: options.message, error: options.error }); return res.status(options.statusCode).json({ message: options.message, error: options.error });
} }
if (common.isVersionCompatible(req.session.selectedNode.api_version, '0.10.2')) { options.url = req.session.selectedNode.ln_server_url + '/v1/channel/listPeerChannels';
options.url = req.session.selectedNode.ln_server_url + '/v1/channel/listPeerChannels';
}
else {
options.url = req.session.selectedNode.ln_server_url + '/v1/channel/listChannels';
}
request(options).then((body) => { request(options).then((body) => {
body?.map((channel) => { body?.map((channel) => {
if (!channel.alias || channel.alias === '') { if (!channel.alias || channel.alias === '') {
channel.alias = channel.id.substring(0, 20); channel.alias = channel.id.substring(0, 20);
} }
const local = (channel.msatoshi_to_us) ? channel.msatoshi_to_us : (channel.to_us_msat || 0); const local = channel.to_us_msat || 0;
const remote = (channel.msatoshi_to_them) ? channel.msatoshi_to_them : ((channel.total_msat - channel.to_us_msat) || 0); const remote = (channel.total_msat - local) || 0;
const total = channel.msatoshi_total ? channel.msatoshi_total : (channel.total_msat || 0); const total = channel.total_msat || 0;
channel.to_them_msat = remote;
channel.balancedness = (total === 0) ? 1 : (1 - Math.abs((local - remote) / total)).toFixed(3); channel.balancedness = (total === 0) ? 1 : (1 - Math.abs((local - remote) / total)).toFixed(3);
return channel; return channel;
}); });

@ -22,8 +22,8 @@ function paymentReducer(accumulator, currentPayment) {
} }
function summaryReducer(accumulator, mpp) { function summaryReducer(accumulator, mpp) {
if (mpp.status === 'complete') { if (mpp.status === 'complete') {
accumulator.msatoshi = accumulator.msatoshi + mpp.msatoshi; accumulator.amount_msat = accumulator.amount_msat + mpp.amount_msat;
accumulator.msatoshi_sent = accumulator.msatoshi_sent + mpp.msatoshi_sent; accumulator.amount_sent_msat = accumulator.amount_sent_msat + mpp.amount_sent_msat;
accumulator.status = mpp.status; accumulator.status = mpp.status;
} }
if (mpp.bolt11) { if (mpp.bolt11) {
@ -47,10 +47,10 @@ function groupBy(payments) {
delete temp.partid; delete temp.partid;
} }
else { else {
const paySummary = curr?.reduce(summaryReducer, { msatoshi: 0, msatoshi_sent: 0, status: (curr[0] && curr[0].status) ? curr[0].status : 'failed' }); const paySummary = curr?.reduce(summaryReducer, { amount_msat: 0, amount_sent_msat: 0, status: (curr[0] && curr[0].status) ? curr[0].status : 'failed' });
temp = { temp = {
is_group: true, is_expanded: false, total_parts: (curr.length ? curr.length : 0), status: paySummary.status, payment_hash: curr[0].payment_hash, is_group: true, is_expanded: false, total_parts: (curr.length ? curr.length : 0), status: paySummary.status, payment_hash: curr[0].payment_hash,
destination: curr[0].destination, msatoshi: paySummary.msatoshi, msatoshi_sent: paySummary.msatoshi_sent, created_at: curr[0].created_at, destination: curr[0].destination, amount_msat: paySummary.amount_msat, amount_sent_msat: paySummary.amount_sent_msat, created_at: curr[0].created_at,
mpps: curr mpps: curr
}; };
if (paySummary.bolt11) { if (paySummary.bolt11) {

@ -72,17 +72,12 @@ export class CLWebSocketClient {
this.wsServer.sendEventsToAllLNClients(msgStr, clWsClt.selectedNode); this.wsServer.sendEventsToAllLNClients(msgStr, clWsClt.selectedNode);
}; };
clWsClt.webSocketClient.onerror = (err) => { clWsClt.webSocketClient.onerror = (err) => {
if (clWsClt.selectedNode.api_version === '' || !clWsClt.selectedNode.api_version || this.common.isVersionCompatible(clWsClt.selectedNode.api_version, '0.6.0')) { this.logger.log({ selectedNode: clWsClt.selectedNode, level: 'ERROR', fileName: 'CLWebSocket', msg: 'Web socket error', error: err });
this.logger.log({ selectedNode: clWsClt.selectedNode, level: 'ERROR', fileName: 'CLWebSocket', msg: 'Web socket error', error: err }); const errStr = ((typeof err === 'object' && err.message) ? JSON.stringify({ error: err.message }) : (typeof err === 'object') ? JSON.stringify({ error: err }) : ('{ "error": ' + err + ' }'));
const errStr = ((typeof err === 'object' && err.message) ? JSON.stringify({ error: err.message }) : (typeof err === 'object') ? JSON.stringify({ error: err }) : ('{ "error": ' + err + ' }')); this.wsServer.sendErrorToAllLNClients(errStr, clWsClt.selectedNode);
this.wsServer.sendErrorToAllLNClients(errStr, clWsClt.selectedNode); clWsClt.webSocketClient.close();
clWsClt.webSocketClient.close(); if (clWsClt.reConnect) {
if (clWsClt.reConnect) { this.reconnet(clWsClt);
this.reconnet(clWsClt);
}
}
else {
clWsClt.reConnect = false;
} }
}; };
}; };

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

File diff suppressed because one or more lines are too long

4
package-lock.json generated

@ -1,12 +1,12 @@
{ {
"name": "rtl", "name": "rtl",
"version": "0.13.7-beta", "version": "0.14.0-beta",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "rtl", "name": "rtl",
"version": "0.13.7-beta", "version": "0.14.0-beta",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@ngrx/effects": "^15.0.0", "@ngrx/effects": "^15.0.0",

@ -1,6 +1,6 @@
{ {
"name": "rtl", "name": "rtl",
"version": "0.13.7-beta", "version": "0.14.0-beta",
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
"scripts": { "scripts": {

@ -14,8 +14,9 @@ export const listPeerChannels = (req, res, next) => {
body?.map((channel) => { body?.map((channel) => {
if (!channel.alias || channel.alias === '') { channel.alias = channel.peer_id.substring(0, 20); } if (!channel.alias || channel.alias === '') { channel.alias = channel.peer_id.substring(0, 20); }
const local = channel.to_us_msat || 0; const local = channel.to_us_msat || 0;
const remote = (channel.total_msat - channel.to_us_msat) || 0; const remote = (channel.total_msat - local) || 0;
const total = channel.total_msat || 0; const total = channel.total_msat || 0;
channel.to_them_msat = remote;
channel.balancedness = (total === 0) ? 1 : (1 - Math.abs((local - remote) / total)).toFixed(3); channel.balancedness = (total === 0) ? 1 : (1 - Math.abs((local - remote) / total)).toFixed(3);
return channel; return channel;
}); });
@ -31,17 +32,14 @@ export const listChannels = (req, res, next) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Channels', msg: 'Getting Channels..' }); logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Channels', msg: 'Getting Channels..' });
options = common.getOptions(req); options = common.getOptions(req);
if (options.error) { return res.status(options.statusCode).json({ message: options.message, error: options.error }); } if (options.error) { return res.status(options.statusCode).json({ message: options.message, error: options.error }); }
if (common.isVersionCompatible(req.session.selectedNode.api_version, '0.10.2')) { options.url = req.session.selectedNode.ln_server_url + '/v1/channel/listPeerChannels';
options.url = req.session.selectedNode.ln_server_url + '/v1/channel/listPeerChannels';
} else {
options.url = req.session.selectedNode.ln_server_url + '/v1/channel/listChannels';
}
request(options).then((body) => { request(options).then((body) => {
body?.map((channel) => { body?.map((channel) => {
if (!channel.alias || channel.alias === '') { channel.alias = channel.id.substring(0, 20); } if (!channel.alias || channel.alias === '') { channel.alias = channel.id.substring(0, 20); }
const local = (channel.msatoshi_to_us) ? channel.msatoshi_to_us : (channel.to_us_msat || 0); const local = channel.to_us_msat || 0;
const remote = (channel.msatoshi_to_them) ? channel.msatoshi_to_them : ((channel.total_msat - channel.to_us_msat) || 0); const remote = (channel.total_msat - local) || 0;
const total = channel.msatoshi_total ? channel.msatoshi_total : (channel.total_msat || 0); const total = channel.total_msat || 0;
channel.to_them_msat = remote;
channel.balancedness = (total === 0) ? 1 : (1 - Math.abs((local - remote) / total)).toFixed(3); channel.balancedness = (total === 0) ? 1 : (1 - Math.abs((local - remote) / total)).toFixed(3);
return channel; return channel;
}); });

@ -22,8 +22,8 @@ function paymentReducer(accumulator, currentPayment) {
function summaryReducer(accumulator, mpp) { function summaryReducer(accumulator, mpp) {
if (mpp.status === 'complete') { if (mpp.status === 'complete') {
accumulator.msatoshi = accumulator.msatoshi + mpp.msatoshi; accumulator.amount_msat = accumulator.amount_msat + mpp.amount_msat;
accumulator.msatoshi_sent = accumulator.msatoshi_sent + mpp.msatoshi_sent; accumulator.amount_sent_msat = accumulator.amount_sent_msat + mpp.amount_sent_msat;
accumulator.status = mpp.status; accumulator.status = mpp.status;
} }
if (mpp.bolt11) { accumulator.bolt11 = mpp.bolt11; } if (mpp.bolt11) { accumulator.bolt11 = mpp.bolt11; }
@ -43,10 +43,10 @@ function groupBy(payments) {
temp.total_parts = 1; temp.total_parts = 1;
delete temp.partid; delete temp.partid;
} else { } else {
const paySummary = curr?.reduce(summaryReducer, { msatoshi: 0, msatoshi_sent: 0, status: (curr[0] && curr[0].status) ? curr[0].status : 'failed' }); const paySummary = curr?.reduce(summaryReducer, { amount_msat: 0, amount_sent_msat: 0, status: (curr[0] && curr[0].status) ? curr[0].status : 'failed' });
temp = { temp = {
is_group: true, is_expanded: false, total_parts: (curr.length ? curr.length : 0), status: paySummary.status, payment_hash: curr[0].payment_hash, is_group: true, is_expanded: false, total_parts: (curr.length ? curr.length : 0), status: paySummary.status, payment_hash: curr[0].payment_hash,
destination: curr[0].destination, msatoshi: paySummary.msatoshi, msatoshi_sent: paySummary.msatoshi_sent, created_at: curr[0].created_at, destination: curr[0].destination, amount_msat: paySummary.amount_msat, amount_sent_msat: paySummary.amount_sent_msat, created_at: curr[0].created_at,
mpps: curr mpps: curr
}; };
if (paySummary.bolt11) { temp.bolt11 = paySummary.bolt11; } if (paySummary.bolt11) { temp.bolt11 = paySummary.bolt11; }

@ -85,15 +85,11 @@ export class CLWebSocketClient {
}; };
clWsClt.webSocketClient.onerror = (err) => { clWsClt.webSocketClient.onerror = (err) => {
if (clWsClt.selectedNode.api_version === '' || !clWsClt.selectedNode.api_version || this.common.isVersionCompatible(clWsClt.selectedNode.api_version, '0.6.0')) { this.logger.log({ selectedNode: clWsClt.selectedNode, level: 'ERROR', fileName: 'CLWebSocket', msg: 'Web socket error', error: err });
this.logger.log({ selectedNode: clWsClt.selectedNode, level: 'ERROR', fileName: 'CLWebSocket', msg: 'Web socket error', error: err }); const errStr = ((typeof err === 'object' && err.message) ? JSON.stringify({ error: err.message }) : (typeof err === 'object') ? JSON.stringify({ error: err }) : ('{ "error": ' + err + ' }'));
const errStr = ((typeof err === 'object' && err.message) ? JSON.stringify({ error: err.message }) : (typeof err === 'object') ? JSON.stringify({ error: err }) : ('{ "error": ' + err + ' }')); this.wsServer.sendErrorToAllLNClients(errStr, clWsClt.selectedNode);
this.wsServer.sendErrorToAllLNClients(errStr, clWsClt.selectedNode); clWsClt.webSocketClient.close();
clWsClt.webSocketClient.close(); if (clWsClt.reConnect) { this.reconnet(clWsClt); }
if (clWsClt.reConnect) { this.reconnet(clWsClt); }
} else {
clWsClt.reConnect = false;
}
}; };
}; };

@ -58,7 +58,7 @@
</ng-container> </ng-container>
<ng-container matColumnDef="msatoshi"> <ng-container matColumnDef="msatoshi">
<th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Amount (Sats)</th> <th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Amount (Sats)</th>
<td *matCellDef="let hop" mat-cell><span fxLayoutAlign="end center">{{((hop?.msatoshi/1000) || hop?.amount_msat/1000) | number}}</span></td> <td *matCellDef="let hop" mat-cell><span fxLayoutAlign="end center">{{hop?.amount_msat/1000 | number}}</span></td>
</ng-container> </ng-container>
<ng-container matColumnDef="actions"> <ng-container matColumnDef="actions">
<th *matHeaderCellDef mat-header-cell> <th *matHeaderCellDef mat-header-cell>

@ -90,7 +90,7 @@ export class CLNQueryRoutesComponent implements OnInit, OnDestroy {
[{ key: 'id', value: selHop.id, title: 'ID', width: 100, type: DataTypeEnum.STRING }], [{ key: 'id', value: selHop.id, title: 'ID', width: 100, type: DataTypeEnum.STRING }],
[{ key: 'channel', value: selHop.channel, title: 'Channel', width: 50, type: DataTypeEnum.STRING }, [{ key: 'channel', value: selHop.channel, title: 'Channel', width: 50, type: DataTypeEnum.STRING },
{ key: 'alias', value: selHop.alias, title: 'Peer Alias', width: 50, type: DataTypeEnum.STRING }], { key: 'alias', value: selHop.alias, title: 'Peer Alias', width: 50, type: DataTypeEnum.STRING }],
[{ key: 'amount_msat', value: (selHop.msatoshi || selHop.amount_msat), title: 'Amount (mSat)', width: 34, type: selHop.msatoshi ? DataTypeEnum.STRING : DataTypeEnum.NUMBER }, [{ key: 'amount_msat', value: selHop.amount_msat, title: 'Amount (mSat)', width: 34, type: DataTypeEnum.NUMBER },
{ key: 'direction', value: selHop.direction, title: 'Direction', width: 33, type: DataTypeEnum.STRING }, { key: 'direction', value: selHop.direction, title: 'Direction', width: 33, type: DataTypeEnum.STRING },
{ key: 'delay', value: selHop.delay, title: 'Delay', width: 33, type: DataTypeEnum.NUMBER }] { key: 'delay', value: selHop.delay, title: 'Delay', width: 33, type: DataTypeEnum.NUMBER }]
]; ];

@ -51,7 +51,6 @@
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
<div *ngIf="isCompatibleVersion" fxLayout="column" fxLayoutAlign="space-between stretch" fxLayoutAlign.gt-sm="space-between center" fxLayout.gt-sm="row wrap">
<mat-expansion-panel fxLayout="column" fxFlex="100" class="flat-expansion-panel mt-2" expanded="false" (closed)="onAdvancedPanelToggle(true)" (opened)="onAdvancedPanelToggle(false)"> <mat-expansion-panel fxLayout="column" fxFlex="100" class="flat-expansion-panel mt-2" expanded="false" (closed)="onAdvancedPanelToggle(true)" (opened)="onAdvancedPanelToggle(false)">
<mat-expansion-panel-header> <mat-expansion-panel-header>
<mat-panel-title> <mat-panel-title>
@ -76,7 +75,6 @@
</div> </div>
</div> </div>
</mat-expansion-panel> </mat-expansion-panel>
</div>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="start stretch"></div> <div fxLayout="column" fxFlex="100" fxLayoutAlign="start stretch"></div>
<div *ngIf="sendFundError !== ''" fxFlex="100" class="alert alert-danger mt-1"> <div *ngIf="sendFundError !== ''" fxFlex="100" class="alert alert-danger mt-1">
<fa-icon class="mr-1 alert-icon" [icon]="faExclamationTriangle"></fa-icon> <fa-icon class="mr-1 alert-icon" [icon]="faExclamationTriangle"></fa-icon>

@ -48,7 +48,6 @@ export class CLNOnChainSendModalComponent implements OnInit, OnDestroy {
public selectedAddress = ADDRESS_TYPES[1]; public selectedAddress = ADDRESS_TYPES[1];
public blockchainBalance: Balance = {}; public blockchainBalance: Balance = {};
public information: GetInfo = {}; public information: GetInfo = {};
public isCompatibleVersion = false;
public newAddress = ''; public newAddress = '';
public transaction: OnChain | any = {}; public transaction: OnChain | any = {};
public feeRateTypes = FEE_RATE_TYPES; public feeRateTypes = FEE_RATE_TYPES;
@ -140,9 +139,6 @@ export class CLNOnChainSendModalComponent implements OnInit, OnDestroy {
this.store.select(clnNodeInformation).pipe(takeUntil(this.unSubs[2])). this.store.select(clnNodeInformation).pipe(takeUntil(this.unSubs[2])).
subscribe((nodeInfo: GetInfo) => { subscribe((nodeInfo: GetInfo) => {
this.information = nodeInfo; this.information = nodeInfo;
this.isCompatibleVersion =
this.commonService.isVersionCompatible(this.information.version, '0.9.0') &&
this.commonService.isVersionCompatible(this.information.api_version, '0.4.0');
}); });
this.store.select(utxos).pipe(takeUntil(this.unSubs[3])). this.store.select(utxos).pipe(takeUntil(this.unSubs[3])).
subscribe((utxosSeletor: { utxos: UTXO[], apiCallStatus: ApiCallStatusPayload }) => { subscribe((utxosSeletor: { utxos: UTXO[], apiCallStatus: ApiCallStatusPayload }) => {

@ -164,7 +164,7 @@ export class CLNOnChainUtxosComponent implements OnInit, AfterViewInit, OnDestro
break; break;
case 'value': case 'value':
rowToFilter = (rowData?.value || ((rowData?.amount_msat || 0) / 1000)).toString(); rowToFilter = ((rowData?.amount_msat || 0) / 1000).toString();
break; break;
default: default:
@ -180,8 +180,8 @@ export class CLNOnChainUtxosComponent implements OnInit, AfterViewInit, OnDestro
this.listUTXOs.sort = this.sort; this.listUTXOs.sort = this.sort;
this.listUTXOs.sortingDataAccessor = (data: UTXO, sortHeaderId: string) => { this.listUTXOs.sortingDataAccessor = (data: UTXO, sortHeaderId: string) => {
switch (sortHeaderId) { switch (sortHeaderId) {
case 'is_dust': return (+(data.amount_msat || 0) / 1000) < this.dustAmount; case 'is_dust': return ((data.amount_msat || 0) / 1000) < this.dustAmount;
case 'value': return data.value || (+(data.amount_msat || 0) / 1000); case 'value': return ((data.amount_msat || 0) / 1000);
default: return (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null; default: return (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null;
} }
}; };

@ -71,12 +71,12 @@
<ng-container matColumnDef="our_channel_reserve_satoshis"> <ng-container matColumnDef="our_channel_reserve_satoshis">
<th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Local Reserve (Sats)</th> <th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Local Reserve (Sats)</th>
<td *matCellDef="let channel" mat-cell><span fxLayoutAlign="end center"> <td *matCellDef="let channel" mat-cell><span fxLayoutAlign="end center">
{{channel?.our_reserve_msat | number:'1.0-0'}} </span></td> {{channel?.our_reserve_msat / 1000 | number:'1.0-0'}} </span></td>
</ng-container> </ng-container>
<ng-container matColumnDef="their_channel_reserve_satoshis"> <ng-container matColumnDef="their_channel_reserve_satoshis">
<th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Remote Reserve (Sats)</th> <th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Remote Reserve (Sats)</th>
<td *matCellDef="let channel" mat-cell><span fxLayoutAlign="end center"> <td *matCellDef="let channel" mat-cell><span fxLayoutAlign="end center">
{{channel?.their_reserve_msat | number:'1.0-0'}} </span></td> {{channel?.their_reserve_msat / 1000 | number:'1.0-0'}} </span></td>
</ng-container> </ng-container>
<ng-container matColumnDef="msatoshi_total"> <ng-container matColumnDef="msatoshi_total">
<th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Total (Sats)</th> <th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Total (Sats)</th>

@ -286,10 +286,10 @@ export class CLNChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe
rowToFilter = ((rowData.peer_connected) ? 'connected' : 'disconnected') + (rowData.channel_id ? rowData.channel_id.toLowerCase() : '') + rowToFilter = ((rowData.peer_connected) ? 'connected' : 'disconnected') + (rowData.channel_id ? rowData.channel_id.toLowerCase() : '') +
(rowData.short_channel_id ? rowData.short_channel_id.toLowerCase() : '') + (rowData.id ? rowData.id.toLowerCase() : '') + (rowData.alias ? rowData.alias.toLowerCase() : '') + (rowData.short_channel_id ? rowData.short_channel_id.toLowerCase() : '') + (rowData.id ? rowData.id.toLowerCase() : '') + (rowData.alias ? rowData.alias.toLowerCase() : '') +
(rowData.private ? 'private' : 'public') + (rowData.state ? rowData.state.toLowerCase() : '') + (rowData.private ? 'private' : 'public') + (rowData.state ? rowData.state.toLowerCase() : '') +
(rowData.funding_txid ? rowData.funding_txid.toLowerCase() : '') + (rowData.to_them_msat ? rowData.to_them_msat : '') + (rowData.funding_txid ? rowData.funding_txid.toLowerCase() : '') + (rowData.to_them_msat ? rowData.to_them_msat / 1000 : '') +
(rowData.to_us_msat ? rowData.to_us_msat : '') + (rowData.total_msat ? rowData.total_msat : '') + (rowData.to_us_msat ? rowData.to_us_msat / 1000 : '') + (rowData.total_msat ? rowData.total_msat / 1000 : '') +
(rowData.their_reserve_msat ? rowData.their_reserve_msat : '') + (rowData.our_reserve_msat ? rowData.our_reserve_msat : '') + (rowData.their_reserve_msat ? rowData.their_reserve_msat / 1000 : '') + (rowData.our_reserve_msat ? rowData.our_reserve_msat / 1000 : '') +
(rowData.spendable_msat ? rowData.spendable_msat : ''); (rowData.spendable_msat ? rowData.spendable_msat / 1000 : '');
break; break;
case 'private': case 'private':
@ -301,19 +301,27 @@ export class CLNChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe
break; break;
case 'msatoshi_total': case 'msatoshi_total':
rowToFilter = ((+(rowData[this.selFilterBy] || rowData['total_msat'] || 0)) / 1000)?.toString() || ''; rowToFilter = ((rowData['total_msat'] || 0) / 1000)?.toString() || '';
break; break;
case 'spendable_msatoshi': case 'spendable_msatoshi':
rowToFilter = ((+(rowData[this.selFilterBy] || rowData['spendable_msat'] || 0)) / 1000)?.toString() || ''; rowToFilter = ((rowData['spendable_msat'] || 0) / 1000)?.toString() || '';
break; break;
case 'msatoshi_to_us': case 'msatoshi_to_us':
rowToFilter = ((+(rowData[this.selFilterBy] || rowData['to_us_msat'] || 0)) / 1000)?.toString() || ''; rowToFilter = ((rowData['to_us_msat'] || 0) / 1000)?.toString() || '';
break; break;
case 'msatoshi_to_them': case 'msatoshi_to_them':
rowToFilter = ((+(rowData[this.selFilterBy] || rowData['to_them_msat'] || 0)) / 1000)?.toString() || ''; rowToFilter = ((rowData['to_them_msat'] || 0) / 1000)?.toString() || '';
break;
case 'our_channel_reserve_satoshis':
rowToFilter = ((rowData['our_reserve_msat'] || 0) / 1000)?.toString() || '';
break;
case 'their_channel_reserve_satoshis':
rowToFilter = ((rowData['their_reserve_msat'] || 0) / 1000)?.toString() || '';
break; break;
default: default:
@ -330,16 +338,22 @@ export class CLNChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe
this.channels.sortingDataAccessor = (data: any, sortHeaderId: string) => { this.channels.sortingDataAccessor = (data: any, sortHeaderId: string) => {
switch (sortHeaderId) { switch (sortHeaderId) {
case 'msatoshi_total': case 'msatoshi_total':
return data['msatoshi_total'] || data['total_msat']; return data['total_msat'];
case 'spendable_msatoshi': case 'spendable_msatoshi':
return data['spendable_msatoshi'] || data['spendable_msat']; return data['spendable_msat'];
case 'msatoshi_to_us': case 'msatoshi_to_us':
return data['msatoshi_to_us'] || data['to_us_msat']; return data['to_us_msat'];
case 'msatoshi_to_them': case 'msatoshi_to_them':
return data['msatoshi_to_them'] || data['to_them_msat']; return data['to_them_msat'];
case 'our_channel_reserve_satoshis':
return data['our_reserve_msat'];
case 'their_channel_reserve_satoshis':
return data['their_reserve_msat'];
default: default:
return (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null; return (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null;

@ -67,12 +67,12 @@
<ng-container matColumnDef="our_channel_reserve_satoshis"> <ng-container matColumnDef="our_channel_reserve_satoshis">
<th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Local Reserve (Sats)</th> <th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Local Reserve (Sats)</th>
<td *matCellDef="let channel" mat-cell><span fxLayoutAlign="end center"> <td *matCellDef="let channel" mat-cell><span fxLayoutAlign="end center">
{{channel?.our_reserve_msat | number:'1.0-0'}} </span></td> {{channel?.our_reserve_msat/1000 | number:'1.0-0'}} </span></td>
</ng-container> </ng-container>
<ng-container matColumnDef="their_channel_reserve_satoshis"> <ng-container matColumnDef="their_channel_reserve_satoshis">
<th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Remote Reserve (Sats)</th> <th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Remote Reserve (Sats)</th>
<td *matCellDef="let channel" mat-cell><span fxLayoutAlign="end center"> <td *matCellDef="let channel" mat-cell><span fxLayoutAlign="end center">
{{channel?.their_reserve_msat | number:'1.0-0'}} </span></td> {{channel?.their_reserve_msat/1000 | number:'1.0-0'}} </span></td>
</ng-container> </ng-container>
<ng-container matColumnDef="msatoshi_total"> <ng-container matColumnDef="msatoshi_total">
<th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Total (Sats)</th> <th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Total (Sats)</th>
@ -108,7 +108,7 @@
<mat-select placeholder="Actions" tabindex="4" class="mr-0"> <mat-select placeholder="Actions" tabindex="4" class="mr-0">
<mat-select-trigger></mat-select-trigger> <mat-select-trigger></mat-select-trigger>
<mat-option (click)="onChannelClick(channel, $event)">View Info</mat-option> <mat-option (click)="onChannelClick(channel, $event)">View Info</mat-option>
<mat-option *ngIf="isCompatibleVersion && (channel.state === 'CHANNELD_SHUTTING_DOWN' || channel.state === 'CLOSINGD_SIGEXCHANGE' || (!channel.connected && channel.state === 'CHANNELD_NORMAL'))" (click)="onChannelClose(channel)">Close Channel</mat-option> <mat-option *ngIf="(channel.state === 'CHANNELD_SHUTTING_DOWN' || channel.state === 'CLOSINGD_SIGEXCHANGE' || (!channel.connected && channel.state === 'CHANNELD_NORMAL'))" (click)="onChannelClose(channel)">Close Channel</mat-option>
<mat-option *ngIf="channel.state === 'CHANNELD_AWAITING_LOCKIN'" (click)="onBumpFee(channel)">Bump Fee</mat-option> <mat-option *ngIf="channel.state === 'CHANNELD_AWAITING_LOCKIN'" (click)="onBumpFee(channel)">Bump Fee</mat-option>
</mat-select> </mat-select>
</div> </div>

@ -44,7 +44,6 @@ export class CLNChannelPendingTableComponent implements OnInit, AfterViewInit, O
public colWidth = '20rem'; public colWidth = '20rem';
public PAGE_ID = 'peers_channels'; public PAGE_ID = 'peers_channels';
public tableSetting: TableSetting = { tableId: 'pending_inactive_channels', recordsPerPage: PAGE_SIZE, sortBy: 'alias', sortOrder: SortOrderEnum.DESCENDING }; public tableSetting: TableSetting = { tableId: 'pending_inactive_channels', recordsPerPage: PAGE_SIZE, sortBy: 'alias', sortOrder: SortOrderEnum.DESCENDING };
public isCompatibleVersion = false;
public totalBalance = 0; public totalBalance = 0;
public displayedColumns: any[] = []; public displayedColumns: any[] = [];
public channelsData: Channel[] = []; public channelsData: Channel[] = [];
@ -72,9 +71,6 @@ export class CLNChannelPendingTableComponent implements OnInit, AfterViewInit, O
this.store.select(nodeInfoAndBalanceAndNumPeers).pipe(takeUntil(this.unSubs[0])). this.store.select(nodeInfoAndBalanceAndNumPeers).pipe(takeUntil(this.unSubs[0])).
subscribe((infoBalNumpeersSelector: { information: GetInfo, balance: Balance, numPeers: number }) => { subscribe((infoBalNumpeersSelector: { information: GetInfo, balance: Balance, numPeers: number }) => {
this.information = infoBalNumpeersSelector.information; this.information = infoBalNumpeersSelector.information;
if (this.information.api_version) {
this.isCompatibleVersion = this.commonService.isVersionCompatible(this.information.api_version, '0.4.2');
}
this.numPeers = infoBalNumpeersSelector.numPeers; this.numPeers = infoBalNumpeersSelector.numPeers;
this.totalBalance = infoBalNumpeersSelector.balance.totalBalance || 0; this.totalBalance = infoBalNumpeersSelector.balance.totalBalance || 0;
this.logger.info(infoBalNumpeersSelector); this.logger.info(infoBalNumpeersSelector);
@ -183,9 +179,9 @@ export class CLNChannelPendingTableComponent implements OnInit, AfterViewInit, O
rowToFilter = ((rowData.peer_connected) ? 'connected' : 'disconnected') + (rowData.channel_id ? rowData.channel_id.toLowerCase() : '') + rowToFilter = ((rowData.peer_connected) ? 'connected' : 'disconnected') + (rowData.channel_id ? rowData.channel_id.toLowerCase() : '') +
(rowData.short_channel_id ? rowData.short_channel_id.toLowerCase() : '') + (rowData.id ? rowData.id.toLowerCase() : '') + (rowData.alias ? rowData.alias.toLowerCase() : '') + (rowData.short_channel_id ? rowData.short_channel_id.toLowerCase() : '') + (rowData.id ? rowData.id.toLowerCase() : '') + (rowData.alias ? rowData.alias.toLowerCase() : '') +
(rowData.private ? 'private' : 'public') + ((rowData.state && this.CLNChannelPendingState[rowData.state]) ? this.CLNChannelPendingState[rowData.state].toLowerCase() : '') + (rowData.private ? 'private' : 'public') + ((rowData.state && this.CLNChannelPendingState[rowData.state]) ? this.CLNChannelPendingState[rowData.state].toLowerCase() : '') +
(rowData.funding_txid ? rowData.funding_txid.toLowerCase() : '') + (rowData.to_us_msat ? rowData.to_us_msat : '') + (rowData.to_them_msat ? rowData.to_them_msat : '') + (rowData.funding_txid ? rowData.funding_txid.toLowerCase() : '') + (rowData.to_us_msat ? rowData.to_us_msat : '') + (rowData.to_them_msat ? rowData.to_them_msat / 1000 : '') +
(rowData.total_msat ? rowData.total_msat : '') + (rowData.their_reserve_msat ? rowData.their_reserve_msat : '') + (rowData.total_msat ? rowData.total_msat / 1000 : '') + (rowData.their_reserve_msat ? rowData.their_reserve_msat / 1000 : '') +
(rowData.our_reserve_msat ? rowData.our_reserve_msat : '') + (rowData.spendable_msat ? rowData.spendable_msat : ''); (rowData.our_reserve_msat ? rowData.our_reserve_msat / 1000 : '') + (rowData.spendable_msat ? rowData.spendable_msat / 1000 : '');
break; break;
case 'private': case 'private':
@ -197,19 +193,27 @@ export class CLNChannelPendingTableComponent implements OnInit, AfterViewInit, O
break; break;
case 'msatoshi_total': case 'msatoshi_total':
rowToFilter = ((+(rowData[this.selFilterBy] || rowData['total_msat'] || 0)) / 1000)?.toString() || ''; rowToFilter = ((rowData['total_msat'] || 0) / 1000)?.toString() || '';
break; break;
case 'spendable_msatoshi': case 'spendable_msatoshi':
rowToFilter = ((+(rowData[this.selFilterBy] || rowData['spendable_msat'] || 0)) / 1000)?.toString() || ''; rowToFilter = ((rowData['spendable_msat'] || 0) / 1000)?.toString() || '';
break; break;
case 'msatoshi_to_us': case 'msatoshi_to_us':
rowToFilter = ((+(rowData[this.selFilterBy] || rowData['to_us_msat'] || 0)) / 1000)?.toString() || ''; rowToFilter = ((rowData['to_us_msat'] || 0) / 1000)?.toString() || '';
break; break;
case 'msatoshi_to_them': case 'msatoshi_to_them':
rowToFilter = ((+(rowData[this.selFilterBy] || rowData['to_them_msat'] || 0)) / 1000)?.toString() || ''; rowToFilter = ((rowData['to_them_msat'] || 0) / 1000)?.toString() || '';
break;
case 'our_channel_reserve_satoshis':
rowToFilter = ((rowData['our_reserve_msat'] || 0) / 1000)?.toString() || '';
break;
case 'their_channel_reserve_satoshis':
rowToFilter = ((rowData['their_reserve_msat'] || 0) / 1000)?.toString() || '';
break; break;
case 'state': case 'state':
@ -230,16 +234,22 @@ export class CLNChannelPendingTableComponent implements OnInit, AfterViewInit, O
this.channels.sortingDataAccessor = (data: any, sortHeaderId: string) => { this.channels.sortingDataAccessor = (data: any, sortHeaderId: string) => {
switch (sortHeaderId) { switch (sortHeaderId) {
case 'msatoshi_total': case 'msatoshi_total':
return data['msatoshi_total'] || data['total_msat']; return data['total_msat'];
case 'spendable_msatoshi': case 'spendable_msatoshi':
return data['spendable_msatoshi'] || data['spendable_msat']; return data['spendable_msat'];
case 'msatoshi_to_us': case 'msatoshi_to_us':
return data['msatoshi_to_us'] || data['to_us_msat']; return data['to_us_msat'];
case 'msatoshi_to_them': case 'msatoshi_to_them':
return data['msatoshi_to_them'] || data['to_them_msat']; return data['to_them_msat'];
case 'our_channel_reserve_satoshis':
return data['our_reserve_msat'];
case 'their_channel_reserve_satoshis':
return data['their_reserve_msat'];
case 'state': case 'state':
return this.CLNChannelPendingState[data.state]; return this.CLNChannelPendingState[data.state];

@ -74,9 +74,7 @@ export class CLNChannelsTablesComponent implements OnInit, OnDestroy {
peers: this.peers, peers: this.peers,
information: this.information, information: this.information,
balance: this.totalBalance, balance: this.totalBalance,
utxos: this.utxos, utxos: this.utxos
isCompatibleVersion: this.commonService.isVersionCompatible(this.information.version, '0.9.0') &&
this.commonService.isVersionCompatible(this.information.api_version, '0.4.0')
}; };
this.store.dispatch(openAlert({ this.store.dispatch(openAlert({
payload: { payload: {

@ -66,20 +66,18 @@
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
<div *ngIf="isCompatibleVersion" fxLayout="column" fxLayoutAlign="space-between stretch" fxLayoutAlign.gt-sm="space-between center" fxLayout.gt-sm="row wrap"> <mat-form-field fxLayout="column" fxFlex="54" fxLayoutAlign="start end">
<mat-form-field fxLayout="column" fxFlex="54" fxLayoutAlign="start end"> <mat-label>Coin Selection</mat-label>
<mat-label>Coin Selection</mat-label> <mat-select tabindex="6" multiple [(value)]="selUTXOs" (selectionChange)="onUTXOSelectionChange($event)">
<mat-select tabindex="6" multiple [(value)]="selUTXOs" (selectionChange)="onUTXOSelectionChange($event)"> <mat-select-trigger>{{totalSelectedUTXOAmount | number}} Sats ({{selUTXOs.length > 1 ? selUTXOs.length + ' UTXOs' : '1 UTXO'}})</mat-select-trigger>
<mat-select-trigger>{{totalSelectedUTXOAmount | number}} Sats ({{selUTXOs.length > 1 ? selUTXOs.length + ' UTXOs' : '1 UTXO'}})</mat-select-trigger> <mat-option *ngFor="let utxo of utxos" [value]="utxo">{{(utxo.amount_msat) / 1000 | number:'1.0-0'}} Sats</mat-option>
<mat-option *ngFor="let utxo of utxos" [value]="utxo">{{(utxo.value || utxo.amount_msat) / 1000 | number:'1.0-0'}} Sats</mat-option> </mat-select>
</mat-select> </mat-form-field>
</mat-form-field> <div fxFlex="41" fxLayout="row" fxLayoutAlign="start center">
<div fxFlex="41" fxLayout="row" fxLayoutAlign="start center"> <mat-slide-toggle tabindex="7" color="primary" name="flgUseAllBalance" [disabled]="selUTXOs.length < 1" [(ngModel)]="flgUseAllBalance" (change)="onUTXOAllBalanceChange()">
<mat-slide-toggle tabindex="7" color="primary" name="flgUseAllBalance" [disabled]="selUTXOs.length < 1" [(ngModel)]="flgUseAllBalance" (change)="onUTXOAllBalanceChange()"> Use selected UTXOs balance
Use selected UTXOs balance </mat-slide-toggle>
</mat-slide-toggle> <mat-icon matTooltip="Use selected UTXOs balance as the amount to be sent. Final amount sent will be less the mining fee." matTooltipPosition="before" class="info-icon">info_outline</mat-icon>
<mat-icon matTooltip="Use selected UTXOs balance as the amount to be sent. Final amount sent will be less the mining fee." matTooltipPosition="before" class="info-icon">info_outline</mat-icon>
</div>
</div> </div>
</div> </div>
</mat-expansion-panel> </mat-expansion-panel>

@ -29,7 +29,6 @@ export class CLNOpenChannelComponent implements OnInit, OnDestroy {
public selectedPeer = new UntypedFormControl(); public selectedPeer = new UntypedFormControl();
public faExclamationTriangle = faExclamationTriangle; public faExclamationTriangle = faExclamationTriangle;
public alertTitle: string; public alertTitle: string;
public isCompatibleVersion = false;
public selNode: SelNodeChild | null = {}; public selNode: SelNodeChild | null = {};
public peer: Peer | null; public peer: Peer | null;
public peers: Peer[]; public peers: Peer[];
@ -61,14 +60,12 @@ export class CLNOpenChannelComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
if (this.data.message) { if (this.data.message) {
this.isCompatibleVersion = this.data.message.isCompatibleVersion;
this.information = this.data.message.information; this.information = this.data.message.information;
this.totalBalance = this.data.message.balance; this.totalBalance = this.data.message.balance;
this.utxos = this.data.message.utxos; this.utxos = this.data.message.utxos;
this.peer = this.data.message.peer || null; this.peer = this.data.message.peer || null;
this.peers = this.data.message.peers || []; this.peers = this.data.message.peers || [];
} else { } else {
this.isCompatibleVersion = false;
this.information = {}; this.information = {};
this.totalBalance = 0; this.totalBalance = 0;
this.utxos = []; this.utxos = [];
@ -168,7 +165,7 @@ export class CLNOpenChannelComponent implements OnInit, OnDestroy {
onUTXOSelectionChange(event: any) { onUTXOSelectionChange(event: any) {
if (this.selUTXOs.length && this.selUTXOs.length > 0) { if (this.selUTXOs.length && this.selUTXOs.length > 0) {
this.totalSelectedUTXOAmount = this.selUTXOs?.reduce((acc, curr: UTXO) => acc + ((curr.value || curr.amount_msat || 0) / 1000), 0); this.totalSelectedUTXOAmount = this.selUTXOs?.reduce((acc, curr: UTXO) => acc + ((curr.amount_msat || 0) / 1000), 0);
if (this.flgUseAllBalance) { if (this.flgUseAllBalance) {
this.onUTXOAllBalanceChange(); this.onUTXOAllBalanceChange();
} }

@ -133,8 +133,8 @@ export class CLNRoutingReportComponent implements OnInit, OnDestroy {
this.filteredEventsBySelectedPeriod?.map((event) => { this.filteredEventsBySelectedPeriod?.map((event) => {
const monthNumber = event.received_time ? new Date((+event.received_time) * 1000).getMonth() : 12; const monthNumber = event.received_time ? new Date((+event.received_time) * 1000).getMonth() : 12;
feeReport[monthNumber].extra.totalEvents = feeReport[monthNumber].extra.totalEvents + 1; feeReport[monthNumber].extra.totalEvents = feeReport[monthNumber].extra.totalEvents + 1;
feeReport[monthNumber].value = feeReport[monthNumber].value + (+(event.fee || event.fee_msat || 0) / 1000); feeReport[monthNumber].value = feeReport[monthNumber].value + (+(event.fee_msat || 0) / 1000);
this.totalFeeMsat = (this.totalFeeMsat || 0) + +(event.fee || event.fee_msat || 0); this.totalFeeMsat = (this.totalFeeMsat || 0) + +(event.fee_msat || 0);
return this.filteredEventsBySelectedPeriod; return this.filteredEventsBySelectedPeriod;
}); });
} else { } else {
@ -144,8 +144,8 @@ export class CLNRoutingReportComponent implements OnInit, OnDestroy {
this.filteredEventsBySelectedPeriod?.map((event) => { this.filteredEventsBySelectedPeriod?.map((event) => {
const dateNumber = event.received_time ? Math.floor((+event.received_time - startDateInSeconds) / this.secondsInADay) : 0; const dateNumber = event.received_time ? Math.floor((+event.received_time - startDateInSeconds) / this.secondsInADay) : 0;
feeReport[dateNumber].extra.totalEvents = feeReport[dateNumber].extra.totalEvents + 1; feeReport[dateNumber].extra.totalEvents = feeReport[dateNumber].extra.totalEvents + 1;
feeReport[dateNumber].value = feeReport[dateNumber].value + (+(event.fee || event.fee_msat || 0) / 1000); feeReport[dateNumber].value = feeReport[dateNumber].value + (+(event.fee_msat || 0) / 1000);
this.totalFeeMsat = (this.totalFeeMsat || 0) + +(event.fee || event.fee_msat || 0); this.totalFeeMsat = (this.totalFeeMsat || 0) + +(event.fee_msat || 0);
return this.filteredEventsBySelectedPeriod; return this.filteredEventsBySelectedPeriod;
}); });
} }
@ -163,8 +163,8 @@ export class CLNRoutingReportComponent implements OnInit, OnDestroy {
this.filteredEventsBySelectedPeriod?.map((event) => { this.filteredEventsBySelectedPeriod?.map((event) => {
const monthNumber = event.received_time ? new Date((+event.received_time) * 1000).getMonth() : 12; const monthNumber = event.received_time ? new Date((+event.received_time) * 1000).getMonth() : 12;
eventsReport[monthNumber].value = eventsReport[monthNumber].value + 1; eventsReport[monthNumber].value = eventsReport[monthNumber].value + 1;
eventsReport[monthNumber].extra.totalFees = eventsReport[monthNumber].extra.totalFees + (+(event.fee || event.fee_msat || 0) / 1000); eventsReport[monthNumber].extra.totalFees = eventsReport[monthNumber].extra.totalFees + (+(event.fee_msat || 0) / 1000);
this.totalFeeMsat = (this.totalFeeMsat || 0) + +(event.fee || event.fee_msat || 0); this.totalFeeMsat = (this.totalFeeMsat || 0) + +(event.fee_msat || 0);
return this.filteredEventsBySelectedPeriod; return this.filteredEventsBySelectedPeriod;
}); });
} else { } else {
@ -174,8 +174,8 @@ export class CLNRoutingReportComponent implements OnInit, OnDestroy {
this.filteredEventsBySelectedPeriod?.map((event) => { this.filteredEventsBySelectedPeriod?.map((event) => {
const dateNumber = event.received_time ? Math.floor((+event.received_time - startDateInSeconds) / this.secondsInADay) : 0; const dateNumber = event.received_time ? Math.floor((+event.received_time - startDateInSeconds) / this.secondsInADay) : 0;
eventsReport[dateNumber].value = eventsReport[dateNumber].value + 1; eventsReport[dateNumber].value = eventsReport[dateNumber].value + 1;
eventsReport[dateNumber].extra.totalFees = eventsReport[dateNumber].extra.totalFees + (+(event.fee || event.fee_msat || 0) / 1000); eventsReport[dateNumber].extra.totalFees = eventsReport[dateNumber].extra.totalFees + (+(event.fee_msat || 0) / 1000);
this.totalFeeMsat = (this.totalFeeMsat || 0) + +(event.fee || event.fee_msat || 0); this.totalFeeMsat = (this.totalFeeMsat || 0) + +(event.fee_msat || 0);
return this.filteredEventsBySelectedPeriod; return this.filteredEventsBySelectedPeriod;
}); });
} }

@ -122,15 +122,15 @@ export class CLNTransactionsReportComponent implements OnInit, OnDestroy {
} }
filteredPayments?.map((payment) => { filteredPayments?.map((payment) => {
const monthNumber = new Date((payment.created_at || 0) * 1000).getMonth(); const monthNumber = new Date((payment.created_at || 0) * 1000).getMonth();
this.transactionsReportSummary.amountPaidSelectedPeriod = this.transactionsReportSummary.amountPaidSelectedPeriod + (payment.msatoshi_sent || payment.amount_sent_msat || 0); this.transactionsReportSummary.amountPaidSelectedPeriod = this.transactionsReportSummary.amountPaidSelectedPeriod + (payment.amount_sent_msat || 0);
transactionsReport[monthNumber].series[0].value = transactionsReport[monthNumber].series[0].value + ((payment.msatoshi_sent || payment.amount_sent_msat || 0) / 1000); transactionsReport[monthNumber].series[0].value = transactionsReport[monthNumber].series[0].value + ((payment.amount_sent_msat || 0) / 1000);
transactionsReport[monthNumber].series[0].extra.total = transactionsReport[monthNumber].series[0].extra.total + 1; transactionsReport[monthNumber].series[0].extra.total = transactionsReport[monthNumber].series[0].extra.total + 1;
return this.transactionsReportSummary; return this.transactionsReportSummary;
}); });
filteredInvoices?.map((invoice) => { filteredInvoices?.map((invoice) => {
const monthNumber = new Date(+(invoice.paid_at || 0) * 1000).getMonth(); const monthNumber = new Date(+(invoice.paid_at || 0) * 1000).getMonth();
this.transactionsReportSummary.amountReceivedSelectedPeriod = this.transactionsReportSummary.amountReceivedSelectedPeriod + (invoice.msatoshi_received || invoice.amount_received_msat || 0); this.transactionsReportSummary.amountReceivedSelectedPeriod = this.transactionsReportSummary.amountReceivedSelectedPeriod + (invoice.amount_received_msat || 0);
transactionsReport[monthNumber].series[1].value = transactionsReport[monthNumber].series[1].value + ((invoice.msatoshi_received || invoice.amount_received_msat || 0) / 1000); transactionsReport[monthNumber].series[1].value = transactionsReport[monthNumber].series[1].value + ((invoice.amount_received_msat || 0) / 1000);
transactionsReport[monthNumber].series[1].extra.total = transactionsReport[monthNumber].series[1].extra.total + 1; transactionsReport[monthNumber].series[1].extra.total = transactionsReport[monthNumber].series[1].extra.total + 1;
return this.transactionsReportSummary; return this.transactionsReportSummary;
}); });
@ -140,15 +140,15 @@ export class CLNTransactionsReportComponent implements OnInit, OnDestroy {
} }
filteredPayments?.map((payment) => { filteredPayments?.map((payment) => {
const dateNumber = Math.floor((+(payment.created_at || 0) - startDateInSeconds) / this.secondsInADay); const dateNumber = Math.floor((+(payment.created_at || 0) - startDateInSeconds) / this.secondsInADay);
this.transactionsReportSummary.amountPaidSelectedPeriod = this.transactionsReportSummary.amountPaidSelectedPeriod + (payment.msatoshi_sent || payment.amount_sent_msat || 0); this.transactionsReportSummary.amountPaidSelectedPeriod = this.transactionsReportSummary.amountPaidSelectedPeriod + (payment.amount_sent_msat || 0);
transactionsReport[dateNumber].series[0].value = transactionsReport[dateNumber].series[0].value + ((payment.msatoshi_sent || payment.amount_sent_msat || 0) / 1000); transactionsReport[dateNumber].series[0].value = transactionsReport[dateNumber].series[0].value + ((payment.amount_sent_msat || 0) / 1000);
transactionsReport[dateNumber].series[0].extra.total = transactionsReport[dateNumber].series[0].extra.total + 1; transactionsReport[dateNumber].series[0].extra.total = transactionsReport[dateNumber].series[0].extra.total + 1;
return this.transactionsReportSummary; return this.transactionsReportSummary;
}); });
filteredInvoices?.map((invoice) => { filteredInvoices?.map((invoice) => {
const dateNumber = Math.floor((+(invoice.paid_at || 0) - startDateInSeconds) / this.secondsInADay); const dateNumber = Math.floor((+(invoice.paid_at || 0) - startDateInSeconds) / this.secondsInADay);
this.transactionsReportSummary.amountReceivedSelectedPeriod = this.transactionsReportSummary.amountReceivedSelectedPeriod + (invoice.msatoshi_received || invoice.amount_received_msat || 0); this.transactionsReportSummary.amountReceivedSelectedPeriod = this.transactionsReportSummary.amountReceivedSelectedPeriod + (invoice.amount_received_msat || 0);
transactionsReport[dateNumber].series[1].value = transactionsReport[dateNumber].series[1].value + ((invoice.msatoshi_received || invoice.amount_received_msat || 0) / 1000); transactionsReport[dateNumber].series[1].value = transactionsReport[dateNumber].series[1].value + ((invoice.amount_received_msat || 0) / 1000);
transactionsReport[dateNumber].series[1].extra.total = transactionsReport[dateNumber].series[1].extra.total + 1; transactionsReport[dateNumber].series[1].extra.total = transactionsReport[dateNumber].series[1].extra.total + 1;
return this.transactionsReportSummary; return this.transactionsReportSummary;
}); });

@ -59,10 +59,7 @@
<ng-container matColumnDef="in_msatoshi"> <ng-container matColumnDef="in_msatoshi">
<th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Amount In (Sats)</th> <th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Amount In (Sats)</th>
<td *matCellDef="let fhEvent" mat-cell> <td *matCellDef="let fhEvent" mat-cell>
<span *ngIf="fhEvent?.in_msatoshi" fxLayoutAlign="end center"> <span fxLayoutAlign="end center">
{{fhEvent?.in_msatoshi/1000 | number:fhEvent?.in_msatoshi < 1000 ? '1.0-4' : '1.0-0'}}
</span>
<span *ngIf="!fhEvent?.in_msatoshi && fhEvent?.in_msat" fxLayoutAlign="end center">
{{fhEvent?.in_msat/1000 | number:fhEvent?.in_msat < 1000 ? '1.0-4' : '1.0-0'}} {{fhEvent?.in_msat/1000 | number:fhEvent?.in_msat < 1000 ? '1.0-4' : '1.0-0'}}
</span> </span>
</td> </td>
@ -70,10 +67,7 @@
<ng-container matColumnDef="out_msatoshi"> <ng-container matColumnDef="out_msatoshi">
<th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Amount Out (Sats)</th> <th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Amount Out (Sats)</th>
<td *matCellDef="let fhEvent" mat-cell> <td *matCellDef="let fhEvent" mat-cell>
<span *ngIf="fhEvent?.out_msatoshi" fxLayoutAlign="end center"> <span fxLayoutAlign="end center">
{{fhEvent?.out_msatoshi/1000 | number:fhEvent?.out_msatoshi < 1000 ? '1.0-4' : '1.0-0'}}
</span>
<span *ngIf="!fhEvent?.out_msatoshi && fhEvent?.out_msat" fxLayoutAlign="end center">
{{fhEvent?.out_msat/1000 | number:fhEvent?.out_msat < 1000 ? '1.0-4' : '1.0-0'}} {{fhEvent?.out_msat/1000 | number:fhEvent?.out_msat < 1000 ? '1.0-4' : '1.0-0'}}
</span> </span>
</td> </td>

@ -107,9 +107,9 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
{ key: 'resolved_time', value: selFEvent.resolved_time, title: 'Resolved Time', width: 50, type: DataTypeEnum.DATE_TIME }], { key: 'resolved_time', value: selFEvent.resolved_time, title: 'Resolved Time', width: 50, type: DataTypeEnum.DATE_TIME }],
[{ key: 'in_channel_alias', value: selFEvent.in_channel_alias, title: 'Inbound Channel', width: 50, type: DataTypeEnum.STRING }, [{ key: 'in_channel_alias', value: selFEvent.in_channel_alias, title: 'Inbound Channel', width: 50, type: DataTypeEnum.STRING },
{ key: 'out_channel_alias', value: selFEvent.out_channel_alias, title: 'Outbound Channel', width: 50, type: DataTypeEnum.STRING }], { key: 'out_channel_alias', value: selFEvent.out_channel_alias, title: 'Outbound Channel', width: 50, type: DataTypeEnum.STRING }],
[{ key: 'in_msatoshi', value: (selFEvent.in_msatoshi || selFEvent.in_msat), title: 'Amount In (mSats)', width: 33, type: DataTypeEnum.NUMBER }, [{ key: 'in_msatoshi', value: selFEvent.in_msat, title: 'Amount In (mSats)', width: 33, type: DataTypeEnum.NUMBER },
{ key: 'out_msatoshi', value: (selFEvent.out_msatoshi || selFEvent.out_msat), title: 'Amount Out (mSats)', width: 33, type: DataTypeEnum.NUMBER }, { key: 'out_msatoshi', value: selFEvent.out_msat, title: 'Amount Out (mSats)', width: 33, type: DataTypeEnum.NUMBER },
{ key: 'fee', value: (selFEvent.fee || selFEvent.fee_msat), title: 'Fee (mSats)', width: 34, type: DataTypeEnum.NUMBER }] { key: 'fee', value: selFEvent.fee_msat, title: 'Fee (mSats)', width: 34, type: DataTypeEnum.NUMBER }]
]; ];
if (selFEvent.payment_hash) { if (selFEvent.payment_hash) {
reorderedFHEvent?.unshift([{ key: 'payment_hash', value: selFEvent.payment_hash, title: 'Payment Hash', width: 100, type: DataTypeEnum.STRING }]); reorderedFHEvent?.unshift([{ key: 'payment_hash', value: selFEvent.payment_hash, title: 'Payment Hash', width: 100, type: DataTypeEnum.STRING }]);
@ -143,8 +143,7 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
(rowData.resolved_time ? this.datePipe.transform(new Date(rowData.resolved_time * 1000), 'dd/MMM/y HH:mm')?.toLowerCase() + ' ' : '') + (rowData.resolved_time ? this.datePipe.transform(new Date(rowData.resolved_time * 1000), 'dd/MMM/y HH:mm')?.toLowerCase() + ' ' : '') +
(rowData.in_channel ? rowData.in_channel.toLowerCase() + ' ' : '') + (rowData.out_channel ? rowData.out_channel.toLowerCase() + ' ' : '') + (rowData.in_channel ? rowData.in_channel.toLowerCase() + ' ' : '') + (rowData.out_channel ? rowData.out_channel.toLowerCase() + ' ' : '') +
(rowData.in_channel_alias ? rowData.in_channel_alias.toLowerCase() + ' ' : '') + (rowData.out_channel_alias ? rowData.out_channel_alias.toLowerCase() + ' ' : '') + (rowData.in_channel_alias ? rowData.in_channel_alias.toLowerCase() + ' ' : '') + (rowData.out_channel_alias ? rowData.out_channel_alias.toLowerCase() + ' ' : '') +
(rowData.in_msatoshi ? (rowData.in_msatoshi / 1000) + ' ' : '') + (rowData.out_msatoshi ? (rowData.out_msatoshi / 1000) + ' ' : '') + (rowData.fee ? rowData.fee + ' ' : '') + (rowData.fee_msat ? rowData.fee_msat + ' ' : '') + (rowData.in_msat ? (+rowData.in_msat / 1000) + ' ' : '') + (rowData.out_msat ? (+rowData.out_msat / 1000) + ' ' : '') + (rowData.fee_msat ? rowData.fee_msat + ' ' : '');
(rowData.in_msat ? (+rowData.in_msat / 1000) + ' ' : '') + (rowData.out_msat ? (+rowData.out_msat / 1000) + ' ' : '') + (rowData.fee_msat ? rowData.fee_msat + ' ' : '');
break; break;
case 'received_time': case 'received_time':
@ -153,15 +152,15 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
break; break;
case 'fee': case 'fee':
rowToFilter = ((+(rowData[this.selFilterBy] || rowData['fee_msat'] || 0)))?.toString() || ''; rowToFilter = ((rowData['fee_msat'] || 0))?.toString() || '';
break; break;
case 'in_msatoshi': case 'in_msatoshi':
rowToFilter = ((+(rowData[this.selFilterBy] || rowData['in_msat'] || 0)) / 1000)?.toString() || ''; rowToFilter = (+(rowData['in_msat'] || 0) / 1000)?.toString() || '';
break; break;
case 'out_msatoshi': case 'out_msatoshi':
rowToFilter = ((+(rowData[this.selFilterBy] || rowData['out_msat'] || 0)) / 1000)?.toString() || ''; rowToFilter = (+(rowData['out_msat'] || 0) / 1000)?.toString() || '';
break; break;
default: default:
@ -178,13 +177,13 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On
this.failedForwardingEvents.sortingDataAccessor = (data: any, sortHeaderId: string) => { this.failedForwardingEvents.sortingDataAccessor = (data: any, sortHeaderId: string) => {
switch (sortHeaderId) { switch (sortHeaderId) {
case 'in_msatoshi': case 'in_msatoshi':
return data['in_msatoshi'] || data['in_msat']; return data['in_msat'];
case 'out_msatoshi': case 'out_msatoshi':
return data['out_msatoshi'] || data['out_msat']; return data['out_msat'];
case 'fee': case 'fee':
return data['fee'] || data['fee_msat']; return data['fee_msat'];
default: default:
return (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null; return (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null;

@ -61,10 +61,7 @@
<ng-container matColumnDef="in_msatoshi"> <ng-container matColumnDef="in_msatoshi">
<th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Amount In (Sats)</th> <th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Amount In (Sats)</th>
<td *matCellDef="let fhEvent" mat-cell> <td *matCellDef="let fhEvent" mat-cell>
<span *ngIf="fhEvent?.in_msatoshi" fxLayoutAlign="end center"> <span fxLayoutAlign="end center">
{{fhEvent?.in_msatoshi/1000 | number:fhEvent?.in_msatoshi < 1000 ? '1.0-4' : '1.0-0'}}
</span>
<span *ngIf="!fhEvent?.in_msatoshi && fhEvent?.in_msat" fxLayoutAlign="end center">
{{fhEvent?.in_msat/1000 | number:fhEvent?.in_msat < 1000 ? '1.0-4' : '1.0-0'}} {{fhEvent?.in_msat/1000 | number:fhEvent?.in_msat < 1000 ? '1.0-4' : '1.0-0'}}
</span> </span>
</td> </td>
@ -72,10 +69,7 @@
<ng-container matColumnDef="out_msatoshi"> <ng-container matColumnDef="out_msatoshi">
<th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Amount Out (Sats)</th> <th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Amount Out (Sats)</th>
<td *matCellDef="let fhEvent" mat-cell> <td *matCellDef="let fhEvent" mat-cell>
<span *ngIf="fhEvent?.out_msatoshi" fxLayoutAlign="end center"> <span fxLayoutAlign="end center">
{{fhEvent?.out_msatoshi/1000 | number:fhEvent?.out_msatoshi < 1000 ? '1.0-4' : '1.0-0'}}
</span>
<span *ngIf="!fhEvent?.out_msatoshi && fhEvent?.out_msat" fxLayoutAlign="end center">
{{fhEvent?.out_msat/1000 | number:fhEvent?.out_msat < 1000 ? '1.0-4' : '1.0-0'}} {{fhEvent?.out_msat/1000 | number:fhEvent?.out_msat < 1000 ? '1.0-4' : '1.0-0'}}
</span> </span>
</td> </td>

@ -130,13 +130,13 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
onForwardingEventClick(selFEvent: ForwardingEvent, event: any) { onForwardingEventClick(selFEvent: ForwardingEvent, event: any) {
const reorderedFHEvent = [ const reorderedFHEvent = [
[{ key: 'status', value: 'Settled', title: 'Status', width: 50, type: DataTypeEnum.STRING }, [{ key: 'status', value: 'Settled', title: 'Status', width: 50, type: DataTypeEnum.STRING },
{ key: 'fee', value: (selFEvent.fee || selFEvent.fee_msat), title: 'Fee (mSats)', width: 50, type: DataTypeEnum.NUMBER }], { key: 'fee', value: selFEvent.fee_msat, title: 'Fee (mSats)', width: 50, type: DataTypeEnum.NUMBER }],
[{ key: 'received_time', value: selFEvent.received_time, title: 'Received Time', width: 50, type: DataTypeEnum.DATE_TIME }, [{ key: 'received_time', value: selFEvent.received_time, title: 'Received Time', width: 50, type: DataTypeEnum.DATE_TIME },
{ key: 'resolved_time', value: selFEvent.resolved_time, title: 'Resolved Time', width: 50, type: DataTypeEnum.DATE_TIME }], { key: 'resolved_time', value: selFEvent.resolved_time, title: 'Resolved Time', width: 50, type: DataTypeEnum.DATE_TIME }],
[{ key: 'in_channel', value: selFEvent.in_channel_alias, title: 'Inbound Channel', width: 50, type: DataTypeEnum.STRING }, [{ key: 'in_channel', value: selFEvent.in_channel_alias, title: 'Inbound Channel', width: 50, type: DataTypeEnum.STRING },
{ key: 'out_channel', value: selFEvent.out_channel_alias, title: 'Outbound Channel', width: 50, type: DataTypeEnum.STRING }], { key: 'out_channel', value: selFEvent.out_channel_alias, title: 'Outbound Channel', width: 50, type: DataTypeEnum.STRING }],
[{ key: 'in_msatoshi', value: (selFEvent.in_msatoshi || selFEvent.in_msat), title: 'In (mSats)', width: 50, type: DataTypeEnum.NUMBER }, [{ key: 'in_msatoshi', value: selFEvent.in_msat, title: 'In (mSats)', width: 50, type: DataTypeEnum.NUMBER },
{ key: 'out_msatoshi', value: (selFEvent.out_msatoshi || selFEvent.out_msat), title: 'Out (mSats)', width: 50, type: DataTypeEnum.NUMBER }] { key: 'out_msatoshi', value: selFEvent.out_msat, title: 'Out (mSats)', width: 50, type: DataTypeEnum.NUMBER }]
]; ];
if (selFEvent.payment_hash) { if (selFEvent.payment_hash) {
reorderedFHEvent.unshift([{ key: 'payment_hash', value: selFEvent.payment_hash, title: 'Payment Hash', width: 100, type: DataTypeEnum.STRING }]); reorderedFHEvent.unshift([{ key: 'payment_hash', value: selFEvent.payment_hash, title: 'Payment Hash', width: 100, type: DataTypeEnum.STRING }]);
@ -172,7 +172,6 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
(rowData.resolved_time ? this.datePipe.transform(new Date(rowData.resolved_time * 1000), 'dd/MMM/y HH:mm')?.toLowerCase() + ' ' : '') + (rowData.resolved_time ? this.datePipe.transform(new Date(rowData.resolved_time * 1000), 'dd/MMM/y HH:mm')?.toLowerCase() + ' ' : '') +
(rowData.in_channel ? rowData.in_channel.toLowerCase() + ' ' : '') + (rowData.out_channel ? rowData.out_channel.toLowerCase() + ' ' : '') + (rowData.in_channel ? rowData.in_channel.toLowerCase() + ' ' : '') + (rowData.out_channel ? rowData.out_channel.toLowerCase() + ' ' : '') +
(rowData.in_channel_alias ? rowData.in_channel_alias.toLowerCase() + ' ' : '') + (rowData.out_channel_alias ? rowData.out_channel_alias.toLowerCase() + ' ' : '') + (rowData.in_channel_alias ? rowData.in_channel_alias.toLowerCase() + ' ' : '') + (rowData.out_channel_alias ? rowData.out_channel_alias.toLowerCase() + ' ' : '') +
(rowData.in_msatoshi ? (rowData.in_msatoshi / 1000) + ' ' : '') + (rowData.out_msatoshi ? (rowData.out_msatoshi / 1000) + ' ' : '') + (rowData.fee ? rowData.fee + ' ' : '') +
(rowData.in_msat ? (+rowData.in_msat / 1000) + ' ' : '') + (rowData.out_msat ? (+rowData.out_msat / 1000) + ' ' : '') + (rowData.fee_msat ? rowData.fee_msat + ' ' : ''); (rowData.in_msat ? (+rowData.in_msat / 1000) + ' ' : '') + (rowData.out_msat ? (+rowData.out_msat / 1000) + ' ' : '') + (rowData.fee_msat ? rowData.fee_msat + ' ' : '');
break; break;
@ -182,15 +181,15 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
break; break;
case 'fee': case 'fee':
rowToFilter = ((+(rowData[this.selFilterBy] || rowData['fee_msat'] || 0)))?.toString() || ''; rowToFilter = ((+(rowData['fee_msat'] || 0)))?.toString() || '';
break; break;
case 'in_msatoshi': case 'in_msatoshi':
rowToFilter = ((+(rowData[this.selFilterBy] || rowData['in_msat'] || 0)) / 1000)?.toString() || ''; rowToFilter = ((+(rowData['in_msat'] || 0)) / 1000)?.toString() || '';
break; break;
case 'out_msatoshi': case 'out_msatoshi':
rowToFilter = ((+(rowData[this.selFilterBy] || rowData['out_msat'] || 0)) / 1000)?.toString() || ''; rowToFilter = ((+(rowData['out_msat'] || 0)) / 1000)?.toString() || '';
break; break;
default: default:
@ -207,13 +206,13 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi
this.forwardingHistoryEvents.sortingDataAccessor = (data: any, sortHeaderId: string) => { this.forwardingHistoryEvents.sortingDataAccessor = (data: any, sortHeaderId: string) => {
switch (sortHeaderId) { switch (sortHeaderId) {
case 'in_msatoshi': case 'in_msatoshi':
return data['in_msatoshi'] || data['in_msat']; return data['in_msat'];
case 'out_msatoshi': case 'out_msatoshi':
return data['out_msatoshi'] || data['out_msat']; return data['out_msat'];
case 'fee': case 'fee':
return data['fee'] || data['fee_msat']; return data['fee_msat'];
default: default:
return (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null; return (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null;

@ -55,10 +55,7 @@
<ng-container matColumnDef="in_msatoshi"> <ng-container matColumnDef="in_msatoshi">
<th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Amount In (Sats)</th> <th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Amount In (Sats)</th>
<td *matCellDef="let fhEvent" mat-cell> <td *matCellDef="let fhEvent" mat-cell>
<span *ngIf="fhEvent?.in_msatoshi" fxLayoutAlign="end center"> <span fxLayoutAlign="end center">
{{fhEvent?.in_msatoshi/1000 | number:fhEvent?.in_msatoshi < 1000 ? '1.0-4' : '1.0-0'}}
</span>
<span *ngIf="!fhEvent?.in_msatoshi && fhEvent?.in_msat" fxLayoutAlign="end center">
{{fhEvent?.in_msat/1000 | number:fhEvent?.in_msat < 1000 ? '1.0-4' : '1.0-0'}} {{fhEvent?.in_msat/1000 | number:fhEvent?.in_msat < 1000 ? '1.0-4' : '1.0-0'}}
</span> </span>
</td> </td>

@ -106,7 +106,7 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
const reorderedFHEvent = [ const reorderedFHEvent = [
[{ key: 'received_time', value: selFEvent.received_time, title: 'Received Time', width: 50, type: DataTypeEnum.DATE_TIME }, [{ key: 'received_time', value: selFEvent.received_time, title: 'Received Time', width: 50, type: DataTypeEnum.DATE_TIME },
{ key: 'in_channel_alias', value: selFEvent.in_channel_alias, title: 'Inbound Channel', width: 50, type: DataTypeEnum.STRING }], { key: 'in_channel_alias', value: selFEvent.in_channel_alias, title: 'Inbound Channel', width: 50, type: DataTypeEnum.STRING }],
[{ key: 'in_msatoshi', value: (selFEvent.in_msatoshi || selFEvent.in_msat), title: 'Amount In (mSats)', width: 100, type: DataTypeEnum.NUMBER }], [{ key: 'in_msatoshi', value: selFEvent.in_msat, title: 'Amount In (mSats)', width: 100, type: DataTypeEnum.NUMBER }],
[{ key: 'failreason', value: selFEvent.failreason ? this.CLNFailReason[selFEvent.failreason] : '', title: 'Reason for Failure', width: 100, type: DataTypeEnum.STRING }] [{ key: 'failreason', value: selFEvent.failreason ? this.CLNFailReason[selFEvent.failreason] : '', title: 'Reason for Failure', width: 100, type: DataTypeEnum.STRING }]
]; ];
this.store.dispatch(openAlert({ this.store.dispatch(openAlert({
@ -137,7 +137,7 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
rowToFilter = (rowData.received_time ? this.datePipe.transform(new Date(rowData.received_time * 1000), 'dd/MMM/y HH:mm')?.toLowerCase() : '') + rowToFilter = (rowData.received_time ? this.datePipe.transform(new Date(rowData.received_time * 1000), 'dd/MMM/y HH:mm')?.toLowerCase() : '') +
(rowData.in_channel_alias ? rowData.in_channel_alias.toLowerCase() : '') + (rowData.in_channel_alias ? rowData.in_channel_alias.toLowerCase() : '') +
((rowData.failreason && this.CLNFailReason[rowData.failreason]) ? this.CLNFailReason[rowData.failreason].toLowerCase() : '') + ((rowData.failreason && this.CLNFailReason[rowData.failreason]) ? this.CLNFailReason[rowData.failreason].toLowerCase() : '') +
(rowData.in_msatoshi ? (rowData.in_msatoshi / 1000) : '') + (rowData.in_msat ? rowData.in_msat : ''); (rowData.in_msat ? rowData.in_msat : '');
break; break;
case 'received_time': case 'received_time':
@ -145,7 +145,7 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
break; break;
case 'in_msatoshi': case 'in_msatoshi':
rowToFilter = ((rowData['in_msatoshi'] || +(rowData['in_msat'] || 0)) / 1000)?.toString() || ''; rowToFilter = ((+(rowData['in_msat'] || 0)) / 1000)?.toString() || '';
break; break;
case 'failreason': case 'failreason':
@ -166,7 +166,7 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni
this.failedLocalForwardingEvents.sortingDataAccessor = (data: LocalFailedEvent, sortHeaderId: string) => { this.failedLocalForwardingEvents.sortingDataAccessor = (data: LocalFailedEvent, sortHeaderId: string) => {
switch (sortHeaderId) { switch (sortHeaderId) {
case 'in_msatoshi': case 'in_msatoshi':
return data['in_msatoshi'] || data['in_msat']; return data['in_msat'];
case 'failreason': case 'failreason':
return data.failreason ? this.CLNFailReason[data.failreason] : ''; return data.failreason ? this.CLNFailReason[data.failreason] : '';

@ -164,18 +164,18 @@ export class CLNRoutingPeersComponent implements OnInit, OnChanges, AfterViewIni
const incoming: any = incomingResults?.find((result) => result.channel_id === event.in_channel); const incoming: any = incomingResults?.find((result) => result.channel_id === event.in_channel);
const outgoing: any = outgoingResults?.find((result) => result.channel_id === event.out_channel); const outgoing: any = outgoingResults?.find((result) => result.channel_id === event.out_channel);
if (!incoming) { if (!incoming) {
incomingResults.push({ channel_id: event.in_channel, alias: event.in_channel_alias, events: 1, total_amount: (event.in_msatoshi || +(event.in_msat || 0)), total_fee: ((event.in_msatoshi || +(event.in_msat || 0)) - (event.out_msatoshi || +(event.out_msat || 0))) }); incomingResults.push({ channel_id: event.in_channel, alias: event.in_channel_alias, events: 1, total_amount: (+(event.in_msat || 0)), total_fee: ((+(event.in_msat || 0)) - (+(event.out_msat || 0))) });
} else { } else {
incoming.events++; incoming.events++;
incoming.total_amount = +incoming.total_amount + +(event.in_msatoshi || event.in_msat || 0); incoming.total_amount = +incoming.total_amount + +(event.in_msat || 0);
incoming.total_fee = +incoming.total_fee + ((event.in_msatoshi || +(event.in_msat || 0)) - (event.out_msatoshi || +(event.out_msat || 0))); incoming.total_fee = +incoming.total_fee + ((+(event.in_msat || 0)) - (+(event.out_msat || 0)));
} }
if (!outgoing) { if (!outgoing) {
outgoingResults.push({ channel_id: event.out_channel, alias: event.out_channel_alias, events: 1, total_amount: (event.out_msatoshi || +(event.out_msat || 0)), total_fee: ((event.in_msatoshi || +(event.in_msat || 0)) - (event.out_msatoshi || +(event.out_msat || 0))) }); outgoingResults.push({ channel_id: event.out_channel, alias: event.out_channel_alias, events: 1, total_amount: (+(event.out_msat || 0)), total_fee: ((+(event.in_msat || 0)) - (+(event.out_msat || 0))) });
} else { } else {
outgoing.events++; outgoing.events++;
outgoing.total_amount = +outgoing.total_amount + +(event.out_msatoshi || event.out_msat || 0); outgoing.total_amount = +outgoing.total_amount + +(event.out_msat || 0);
outgoing.total_fee = +outgoing.total_fee + ((event.in_msatoshi || +(event.in_msat || 0)) - (event.out_msatoshi || +(event.out_msat || 0))); outgoing.total_fee = +outgoing.total_fee + ((+(event.in_msat || 0)) - (+(event.out_msat || 0)));
} }
}); });
return [this.commonService.sortDescByKey(incomingResults, 'total_fee'), this.commonService.sortDescByKey(outgoingResults, 'total_fee')]; return [this.commonService.sortDescByKey(incomingResults, 'total_fee'), this.commonService.sortDescByKey(outgoingResults, 'total_fee')];

@ -113,7 +113,7 @@ export const fetchUTXOs = createAction(CLNActions.FETCH_UTXOS_CLN);
export const setUTXOs = createAction(CLNActions.SET_UTXOS_CLN, props<{ payload: UTXO[] }>()); export const setUTXOs = createAction(CLNActions.SET_UTXOS_CLN, props<{ payload: UTXO[] }>());
export const fetchOfferInvoice = createAction(CLNActions.FETCH_OFFER_INVOICE_CLN, props<{ payload: { offer: string, msatoshi?: number } }>()); export const fetchOfferInvoice = createAction(CLNActions.FETCH_OFFER_INVOICE_CLN, props<{ payload: { offer: string, amount_msat?: number } }>());
export const setOfferInvoice = createAction(CLNActions.SET_OFFER_INVOICE_CLN, props<{ payload: OfferInvoice }>()); export const setOfferInvoice = createAction(CLNActions.SET_OFFER_INVOICE_CLN, props<{ payload: OfferInvoice }>());

@ -343,12 +343,6 @@ export class CLNEffects implements OnDestroy {
channels.forEach((channel) => { channels.forEach((channel) => {
if (channel.id) { channel.peer_id = channel.id; } if (channel.id) { channel.peer_id = channel.id; }
if (channel.connected) { channel.peer_connected = channel.connected; } if (channel.connected) { channel.peer_connected = channel.connected; }
if (channel.msatoshi_to_us) { channel.to_us_msat = channel.msatoshi_to_us; }
if (channel.msatoshi_to_them) { channel.to_them_msat = channel.msatoshi_to_them; }
if (channel.msatoshi_total) { channel.total_msat = channel.msatoshi_total; }
if (channel.their_channel_reserve_satoshis) { channel.their_reserve_msat = +channel.their_channel_reserve_satoshis; }
if (channel.our_channel_reserve_satoshis) { channel.our_reserve_msat = +channel.our_channel_reserve_satoshis; }
if (channel.spendable_msatoshi) { channel.spendable_msat = +channel.spendable_msatoshi; }
if (channel.state === 'CHANNELD_NORMAL') { if (channel.state === 'CHANNELD_NORMAL') {
if (channel.peer_connected) { if (channel.peer_connected) {
sortedChannels.activeChannels.push(channel); sortedChannels.activeChannels.push(channel);
@ -476,7 +470,7 @@ export class CLNEffects implements OnDestroy {
fetchOfferInvoiceCL = createEffect( fetchOfferInvoiceCL = createEffect(
() => this.actions.pipe( () => this.actions.pipe(
ofType(CLNActions.FETCH_OFFER_INVOICE_CLN), ofType(CLNActions.FETCH_OFFER_INVOICE_CLN),
mergeMap((action: { type: string, payload: { offer: string, msatoshi?: string } }) => { mergeMap((action: { type: string, payload: { offer: string, amount_msat?: string } }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.FETCH_INVOICE })); this.store.dispatch(openSpinner({ payload: UI_MESSAGES.FETCH_INVOICE }));
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchOfferInvoice', status: APICallStatusEnum.INITIATED } })); this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchOfferInvoice', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.OFFERS_API + '/fetchOfferInvoice', action.payload). return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.OFFERS_API + '/fetchOfferInvoice', action.payload).
@ -736,7 +730,6 @@ export class CLNEffects implements OnDestroy {
this.logger.info(postRes); this.logger.info(postRes);
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'SaveNewInvoice', status: APICallStatusEnum.COMPLETED } })); this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'SaveNewInvoice', status: APICallStatusEnum.COMPLETED } }));
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.ADD_INVOICE })); this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.ADD_INVOICE }));
postRes.msatoshi = action.payload.amount;
postRes.amount_msat = action.payload.amount; postRes.amount_msat = action.payload.amount;
postRes.label = action.payload.label; postRes.label = action.payload.label;
postRes.expires_at = Math.round((new Date().getTime() / 1000) + action.payload.expiry); postRes.expires_at = Math.round((new Date().getTime() / 1000) + action.payload.expiry);

@ -32,7 +32,6 @@ export class CLNInvoiceInformationComponent implements OnInit, OnDestroy {
public screenSize = ''; public screenSize = '';
public screenSizeEnum = ScreenSizeEnum; public screenSizeEnum = ScreenSizeEnum;
public flgInvoicePaid = false; public flgInvoicePaid = false;
public flgVersionCompatible = true;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()]; private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(public dialogRef: MatDialogRef<CLNInvoiceInformationComponent>, @Inject(MAT_DIALOG_DATA) public data: CLNInvoiceInformation, private logger: LoggerService, private commonService: CommonService, private snackBar: MatSnackBar, private store: Store<RTLState>) { } constructor(public dialogRef: MatDialogRef<CLNInvoiceInformationComponent>, @Inject(MAT_DIALOG_DATA) public data: CLNInvoiceInformation, private logger: LoggerService, private commonService: CommonService, private snackBar: MatSnackBar, private store: Store<RTLState>) { }
@ -44,10 +43,6 @@ export class CLNInvoiceInformationComponent implements OnInit, OnDestroy {
if (this.screenSize === ScreenSizeEnum.XS) { if (this.screenSize === ScreenSizeEnum.XS) {
this.qrWidth = 220; this.qrWidth = 220;
} }
this.store.select(clnNodeInformation).pipe(takeUntil(this.unSubs[0])).
subscribe((nodeInfo: GetInfo) => {
this.flgVersionCompatible = this.commonService.isVersionCompatible(nodeInfo.api_version, '0.6.0');
});
this.store.select(listInvoices).pipe(takeUntil(this.unSubs[1])). this.store.select(listInvoices).pipe(takeUntil(this.unSubs[1])).
subscribe((invoicesSelector: { listInvoices: ListInvoices, apiCallStatus: ApiCallStatusPayload }) => { subscribe((invoicesSelector: { listInvoices: ListInvoices, apiCallStatus: ApiCallStatusPayload }) => {
const invoiceStatus = this.invoice.status; const invoiceStatus = this.invoice.status;

@ -237,11 +237,11 @@ export class CLNLightningInvoicesTableComponent implements OnInit, AfterViewInit
break; break;
case 'msatoshi': case 'msatoshi':
rowToFilter = ((rowData['msatoshi'] || rowData['amount_msat'] || 0) / 1000)?.toString() || ''; rowToFilter = ((rowData['amount_msat'] || 0) / 1000)?.toString() || '';
break; break;
case 'msatoshi_received': case 'msatoshi_received':
rowToFilter = ((rowData['msatoshi_received'] || rowData['amount_received_msat'] || 0) / 1000)?.toString() || ''; rowToFilter = ((rowData['amount_received_msat'] || 0) / 1000)?.toString() || '';
break; break;
default: default:
@ -281,10 +281,10 @@ export class CLNLightningInvoicesTableComponent implements OnInit, AfterViewInit
this.invoices.sortingDataAccessor = (data: any, sortHeaderId: string) => { this.invoices.sortingDataAccessor = (data: any, sortHeaderId: string) => {
switch (sortHeaderId) { switch (sortHeaderId) {
case 'msatoshi': case 'msatoshi':
return data['msatoshi'] || data['amount_msat']; return data['amount_msat'];
case 'msatoshi_received': case 'msatoshi_received':
return data['msatoshi_received'] || data['amount_received_msat']; return data['amount_received_msat'];
default: default:
return (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null; return (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null;

@ -22,7 +22,7 @@
<div fxFlex="50"> <div fxFlex="50">
<h4 fxLayoutAlign="start" class="font-bold-500">Amount Requested (Sats)</h4> <h4 fxLayoutAlign="start" class="font-bold-500">Amount Requested (Sats)</h4>
<span class="foreground-secondary-text"> <span class="foreground-secondary-text">
{{ !offerDecoded?.offer_amount_msat || offerDecoded?.offer_amount_msat === 0 ? 'Open Offer' : (((offerDecoded?.offer_amount || offerDecoded?.offer_amount_msat) / 1000) | number) }} {{ !offerDecoded?.offer_amount_msat || offerDecoded?.offer_amount_msat === 0 ? 'Open Offer' : ((offerDecoded?.offer_amount_msat / 1000) | number) }}
</span> </span>
</div> </div>
<div fxFlex="50"> <div fxFlex="50">

@ -13,7 +13,6 @@ import { CLNOfferInformation } from '../../../../shared/models/alertData';
import { ScreenSizeEnum } from '../../../../shared/services/consts-enums-functions'; import { ScreenSizeEnum } from '../../../../shared/services/consts-enums-functions';
import { Offer, OfferRequest } from '../../../../shared/models/clnModels'; import { Offer, OfferRequest } from '../../../../shared/models/clnModels';
import { RTLState } from '../../../../store/rtl.state';
@Component({ @Component({
selector: 'rtl-cln-offer-information', selector: 'rtl-cln-offer-information',
@ -34,7 +33,7 @@ export class CLNOfferInformationComponent implements OnInit, OnDestroy {
public flgOfferPaid = false; public flgOfferPaid = false;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()]; private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(public dialogRef: MatDialogRef<CLNOfferInformationComponent>, @Inject(MAT_DIALOG_DATA) public data: CLNOfferInformation, private logger: LoggerService, private commonService: CommonService, private snackBar: MatSnackBar, private store: Store<RTLState>, private dataService: DataService) { } constructor(public dialogRef: MatDialogRef<CLNOfferInformationComponent>, @Inject(MAT_DIALOG_DATA) public data: CLNOfferInformation, private logger: LoggerService, private commonService: CommonService, private snackBar: MatSnackBar, private dataService: DataService) { }
ngOnInit() { ngOnInit() {
this.offer = this.data.offer; this.offer = this.data.offer;
@ -48,9 +47,6 @@ export class CLNOfferInformationComponent implements OnInit, OnDestroy {
this.offerDecoded = decodedOffer; this.offerDecoded = decodedOffer;
if (this.offerDecoded.offer_id && !this.offerDecoded.offer_amount_msat) { if (this.offerDecoded.offer_id && !this.offerDecoded.offer_amount_msat) {
this.offerDecoded.offer_amount_msat = 0; this.offerDecoded.offer_amount_msat = 0;
this.offerDecoded.offer_amount = 0;
} else {
this.offerDecoded.offer_amount = this.offerDecoded.offer_amount || this.offerDecoded.offer_amount_msat || null;
} }
}); });
} }

@ -181,9 +181,6 @@ export class CLNOffersTableComponent implements OnInit, AfterViewInit, OnDestroy
pipe(take(1)).subscribe((offerDecoded: OfferRequest) => { pipe(take(1)).subscribe((offerDecoded: OfferRequest) => {
if (offerDecoded.offer_id && !offerDecoded.offer_amount_msat) { if (offerDecoded.offer_id && !offerDecoded.offer_amount_msat) {
offerDecoded.offer_amount_msat = 0; offerDecoded.offer_amount_msat = 0;
offerDecoded.offer_amount = 0;
} else {
offerDecoded.offer_amount = offerDecoded.offer_amount || offerDecoded.offer_amount_msat || null;
} }
const documentDefinition = { const documentDefinition = {
pageSize: 'A5', pageSize: 'A5',
@ -211,7 +208,7 @@ export class CLNOffersTableComponent implements OnInit, AfterViewInit, OnDestroy
}, },
{ text: offerDecoded.offer_description ? offerDecoded.offer_description.substring(0, 160) : '', alignment: 'center', fontSize: 16, color: '#5C5C5C' }, { text: offerDecoded.offer_description ? offerDecoded.offer_description.substring(0, 160) : '', alignment: 'center', fontSize: 16, color: '#5C5C5C' },
{ qr: selOffer.bolt12, eccLevel: 'M', fit: '227', alignment: 'center', absolutePosition: { x: 7, y: 205 } }, { qr: selOffer.bolt12, eccLevel: 'M', fit: '227', alignment: 'center', absolutePosition: { x: 7, y: 205 } },
{ text: (!offerDecoded?.offer_amount_msat || offerDecoded?.offer_amount === 0 ? 'Open amount' : (this.decimalPipe.transform((offerDecoded.offer_amount || 0) / 1000) + ' SATS')), fontSize: 20, bold: false, color: 'white', alignment: 'center', absolutePosition: { x: 0, y: 430 } }, { text: (!offerDecoded?.offer_amount_msat || offerDecoded?.offer_amount_msat === 0 ? 'Open amount' : (this.decimalPipe.transform((offerDecoded.offer_amount_msat || 0) / 1000) + ' SATS')), fontSize: 20, bold: false, color: 'white', alignment: 'center', absolutePosition: { x: 0, y: 430 } },
{ text: 'SCAN TO PAY', fontSize: 22, bold: true, color: 'white', alignment: 'center', absolutePosition: { x: 0, y: 455 } } { text: 'SCAN TO PAY', fontSize: 22, bold: true, color: 'white', alignment: 'center', absolutePosition: { x: 0, y: 455 } }
], ],
footer: { footer: {

@ -96,11 +96,11 @@
</ng-container> </ng-container>
<ng-container matColumnDef="msatoshi_sent"> <ng-container matColumnDef="msatoshi_sent">
<th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Sats Sent</th> <th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Sats Sent</th>
<td *matCellDef="let payment" mat-cell><span fxLayoutAlign="end center">{{payment?.amount_sent_msat/1000 | number:payment?.amount_sent_msat < 1000 ? '1.0-4' : '1.0-0'}}</span></td> <td *matCellDef="let payment" mat-cell><span fxLayoutAlign="end center">{{payment?.amount_sent_msat/1000 | number:'1.0-4'}}</span></td>
</ng-container> </ng-container>
<ng-container matColumnDef="msatoshi"> <ng-container matColumnDef="msatoshi">
<th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Sats Received</th> <th *matHeaderCellDef mat-header-cell mat-sort-header arrowPosition="before">Sats Received</th>
<td *matCellDef="let payment" mat-cell><span fxLayoutAlign="end center">{{payment?.amount_msat/1000 | number:payment?.amount_msat < 1000 ? '1.0-4' : '1.0-0'}}</span></td> <td *matCellDef="let payment" mat-cell><span fxLayoutAlign="end center">{{payment?.amount_msat/1000 | number:'1.0-4'}}</span></td>
</ng-container> </ng-container>
<ng-container matColumnDef="actions"> <ng-container matColumnDef="actions">
<th *matHeaderCellDef mat-header-cell> <th *matHeaderCellDef mat-header-cell>

@ -236,12 +236,12 @@ export class CLNLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
this.paymentDecoded = decodedPayment; this.paymentDecoded = decodedPayment;
if (this.paymentDecoded.amount_msat) { if (this.paymentDecoded.amount_msat) {
if (this.selNode?.fiatConversion) { if (this.selNode?.fiatConversion) {
this.commonService.convertCurrency(this.paymentDecoded.amount_msat ? this.paymentDecoded.amount_msat / 1000 : 0, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion). this.commonService.convertCurrency(this.paymentDecoded.amount_msat / 1000 || 0, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion).
pipe(takeUntil(this.unSubs[6])). pipe(takeUntil(this.unSubs[6])).
subscribe({ subscribe({
next: (data) => { next: (data) => {
this.paymentDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.paymentDecoded.amount_msat ? this.paymentDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.paymentDecoded.amount_msat ?
this.paymentDecoded.amount_msat / 1000 : 0) + ' Sats (' + this.decimalPipe.transform((data.OTHER ? data.OTHER : 0), (this.paymentDecoded.amount_msat / 1000) : 0) + ' Sats (' + this.decimalPipe.transform((data.OTHER ? data.OTHER : 0),
CURRENCY_UNIT_FORMATS.OTHER) + ' ' + data.unit + ') | Memo: ' + this.paymentDecoded.description; CURRENCY_UNIT_FORMATS.OTHER) + ' ' + data.unit + ') | Memo: ' + this.paymentDecoded.description;
}, error: (error) => { }, error: (error) => {
this.paymentDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.paymentDecoded.amount_msat ? this.paymentDecoded.amount_msat / 1000 : 0) + this.paymentDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.paymentDecoded.amount_msat ? this.paymentDecoded.amount_msat / 1000 : 0) +
@ -337,11 +337,11 @@ export class CLNLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
break; break;
case 'msatoshi_sent': case 'msatoshi_sent':
rowToFilter = ((rowData['msatoshi_sent'] || rowData['amount_sent_msat'] || 0) / 1000)?.toString() || ''; rowToFilter = ((rowData['amount_sent_msat'] || 0) / 1000)?.toString() || '';
break; break;
case 'msatoshi': case 'msatoshi':
rowToFilter = ((rowData['msatoshi'] || rowData['amount_msat'] || 0) / 1000)?.toString() || ''; rowToFilter = ((rowData['amount_msat'] || 0) / 1000)?.toString() || '';
break; break;
case 'type': case 'type':
@ -362,10 +362,10 @@ export class CLNLightningPaymentsComponent implements OnInit, AfterViewInit, OnD
this.payments.sortingDataAccessor = (data: any, sortHeaderId: string) => { this.payments.sortingDataAccessor = (data: any, sortHeaderId: string) => {
switch (sortHeaderId) { switch (sortHeaderId) {
case 'msatoshi_sent': case 'msatoshi_sent':
return data['msatoshi_sent'] || data['amount_sent_msat']; return data['amount_sent_msat'];
case 'msatoshi': case 'msatoshi':
return data['msatoshi'] || data['amount_msat']; return data['amount_msat'];
default: default:
return (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null; return (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null;

@ -7,7 +7,7 @@
<button tabindex="12" fxLayoutAlign="center center" class="btn-close-x p-0" default mat-button [mat-dialog-close]="false">X</button> <button tabindex="12" fxLayoutAlign="center center" class="btn-close-x p-0" default mat-button [mat-dialog-close]="false">X</button>
</mat-card-header> </mat-card-header>
<mat-card-content class="padding-gap-x-large" fxLayout="column" fxLayoutAlign="start stretch"> <mat-card-content class="padding-gap-x-large" fxLayout="column" fxLayoutAlign="start stretch">
<mat-radio-group *ngIf="isCompatibleVersion" class="my-1" color="primary" name="paymentType" fxFlex="100" fxLayoutAlign="start start" [(ngModel)]="paymentType" (change)="onPaymentTypeChange()"> <mat-radio-group class="my-1" color="primary" name="paymentType" fxFlex="100" fxLayoutAlign="start start" [(ngModel)]="paymentType" (change)="onPaymentTypeChange()">
<mat-radio-button fxFlex="20" tabindex="1" value="{{paymentTypes.INVOICE}}">Invoice</mat-radio-button> <mat-radio-button fxFlex="20" tabindex="1" value="{{paymentTypes.INVOICE}}">Invoice</mat-radio-button>
<mat-radio-button fxFlex="20" tabindex="2" value="{{paymentTypes.KEYSEND}}">Keysend</mat-radio-button> <mat-radio-button fxFlex="20" tabindex="2" value="{{paymentTypes.KEYSEND}}">Keysend</mat-radio-button>
<mat-radio-button *ngIf="selNode.enableOffers" fxFlex="20" tabindex="3" value="{{paymentTypes.OFFER}}">Offer</mat-radio-button> <mat-radio-button *ngIf="selNode.enableOffers" fxFlex="20" tabindex="3" value="{{paymentTypes.OFFER}}">Offer</mat-radio-button>

@ -74,7 +74,6 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
public selFeeLimitType = FEE_LIMIT_TYPES[0]; public selFeeLimitType = FEE_LIMIT_TYPES[0];
public feeLimitTypes = FEE_LIMIT_TYPES; public feeLimitTypes = FEE_LIMIT_TYPES;
public paymentError = ''; public paymentError = '';
public isCompatibleVersion = false;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()]; private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor( constructor(
@ -109,11 +108,6 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
this.store.select(clnNodeSettings).pipe(takeUntil(this.unSubs[0])).subscribe((nodeSettings: SelNodeChild | null) => { this.store.select(clnNodeSettings).pipe(takeUntil(this.unSubs[0])).subscribe((nodeSettings: SelNodeChild | null) => {
this.selNode = nodeSettings; this.selNode = nodeSettings;
}); });
this.store.select(clnNodeInformation).pipe(takeUntil(this.unSubs[1])).subscribe((nodeInfo: GetInfo) => {
this.isCompatibleVersion =
this.commonService.isVersionCompatible(nodeInfo.version, '0.9.0') &&
this.commonService.isVersionCompatible(nodeInfo.api_version, '0.4.0');
});
this.store.select(channels).pipe(takeUntil(this.unSubs[2])). this.store.select(channels).pipe(takeUntil(this.unSubs[2])).
subscribe((channelsSeletor: { activeChannels: Channel[], pendingChannels: Channel[], inactiveChannels: Channel[], apiCallStatus: ApiCallStatusPayload }) => { subscribe((channelsSeletor: { activeChannels: Channel[], pendingChannels: Channel[], inactiveChannels: Channel[], apiCallStatus: ApiCallStatusPayload }) => {
this.activeChannels = channelsSeletor.activeChannels; this.activeChannels = channelsSeletor.activeChannels;
@ -227,7 +221,7 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
} else if (this.paymentType === PaymentTypes.OFFER) { } else if (this.paymentType === PaymentTypes.OFFER) {
if (!this.offerInvoice) { if (!this.offerInvoice) {
if (this.zeroAmtOffer && this.offerAmount) { if (this.zeroAmtOffer && this.offerAmount) {
this.store.dispatch(fetchOfferInvoice({ payload: { offer: this.offerRequest, msatoshi: this.offerAmount * 1000 } })); this.store.dispatch(fetchOfferInvoice({ payload: { offer: this.offerRequest, amount_msat: this.offerAmount * 1000 } }));
} else { } else {
this.store.dispatch(fetchOfferInvoice({ payload: { offer: this.offerRequest } })); this.store.dispatch(fetchOfferInvoice({ payload: { offer: this.offerRequest } }));
} }
@ -296,9 +290,7 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
this.paymentDecoded.amount_msat = +event.target.value; this.paymentDecoded.amount_msat = +event.target.value;
} }
if (this.paymentType === PaymentTypes.OFFER) { if (this.paymentType === PaymentTypes.OFFER) {
delete this.offerDecoded.offer_amount;
delete this.offerDecoded.offer_amount_msat; delete this.offerDecoded.offer_amount_msat;
this.offerDecoded.offer_amount = +event.target.value * 1000;
this.offerDecoded.offer_amount_msat = event.target.value; this.offerDecoded.offer_amount_msat = event.target.value;
} }
} }
@ -313,15 +305,13 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
setOfferDecodedDetails() { setOfferDecodedDetails() {
if (this.offerDecoded.offer_id && !this.offerDecoded.offer_amount_msat) { if (this.offerDecoded.offer_id && !this.offerDecoded.offer_amount_msat) {
this.offerDecoded.offer_amount_msat = 0; this.offerDecoded.offer_amount_msat = 0;
this.offerDecoded.offer_amount = 0;
this.zeroAmtOffer = true; this.zeroAmtOffer = true;
this.offerDescription = this.offerDecoded.offer_description || ''; this.offerDescription = this.offerDecoded.offer_description || '';
this.offerIssuer = this.offerDecoded.offer_issuer ? this.offerDecoded.offer_issuer : ''; this.offerIssuer = this.offerDecoded.offer_issuer ? this.offerDecoded.offer_issuer : '';
this.offerDecodedHint = 'Zero Amount Offer | Description: ' + this.offerDecoded.offer_description; this.offerDecodedHint = 'Zero Amount Offer | Description: ' + this.offerDecoded.offer_description;
} else { } else {
this.zeroAmtOffer = false; this.zeroAmtOffer = false;
this.offerDecoded.offer_amount = this.offerDecoded.offer_amount || this.offerDecoded.offer_amount_msat || null; this.offerAmount = this.offerDecoded.offer_amount_msat ? this.offerDecoded.offer_amount_msat / 1000 : 0;
this.offerAmount = this.offerDecoded.offer_amount ? this.offerDecoded.offer_amount / 1000 : 0;
this.offerDescription = this.offerDecoded.offer_description || ''; this.offerDescription = this.offerDecoded.offer_description || '';
this.offerIssuer = this.offerDecoded.offer_issuer ? this.offerDecoded.offer_issuer : ''; this.offerIssuer = this.offerDecoded.offer_issuer ? this.offerDecoded.offer_issuer : '';
if (this.selNode && this.selNode.fiatConversion) { if (this.selNode && this.selNode.fiatConversion) {

@ -7,7 +7,7 @@
<mat-icon *ngIf="value.tooltip" matTooltipPosition="below" class="info-icon" [matTooltip]="value.tooltip">info_outline</mat-icon> <mat-icon *ngIf="value.tooltip" matTooltipPosition="below" class="info-icon" [matTooltip]="value.tooltip">info_outline</mat-icon>
</div> </div>
<span *ngIf="currencyUnit === currencyUnitEnum.SATS" class="cc-data-value"> <span *ngIf="currencyUnit === currencyUnitEnum.SATS" class="cc-data-value">
{{value.dataValue | number}} {{value.dataValue | number:'1.0-0'}}
</span> </span>
<span *ngIf="currencyUnit === currencyUnitEnum.BTC" class="cc-data-value"> <span *ngIf="currencyUnit === currencyUnitEnum.BTC" class="cc-data-value">
{{value[currencyUnitEnum.BTC] | number:currencyUnitFormats.BTC}} {{value[currencyUnitEnum.BTC] | number:currencyUnitFormats.BTC}}

@ -72,7 +72,7 @@ export interface OpenChannelAlert {
export interface CLNOpenChannelAlert { export interface CLNOpenChannelAlert {
alertTitle?: string; alertTitle?: string;
titleMessage?: string; titleMessage?: string;
message?: { information: GetInfoCLN, balance: number, utxos: UTXOCLN[], peer?: PeerCLN, peers?: PeerCLN[], isCompatibleVersion: boolean }; message?: { information: GetInfoCLN, balance: number, utxos: UTXOCLN[], peer?: PeerCLN, peers?: PeerCLN[] };
newlyAdded?: boolean; newlyAdded?: boolean;
component?: any; component?: any;
} }

@ -42,8 +42,7 @@ export interface GetInfo {
blockheight?: number; blockheight?: number;
network?: string; network?: string;
chains?: GetInfoChain[]; chains?: GetInfoChain[];
msatoshi_fees_collected?: number; fees_collected_msat?: number;
fees_collected_msat?: string;
lnImplementation?: string; lnImplementation?: string;
} }
@ -77,11 +76,9 @@ export interface Invoice {
bolt11?: string; bolt11?: string;
bolt12?: string; bolt12?: string;
payment_hash?: string; payment_hash?: string;
msatoshi?: number; // For backward compatibility
amount_msat?: number; amount_msat?: number;
status?: string; status?: string;
pay_index?: number; pay_index?: number;
msatoshi_received?: number; // For backward compatibility
amount_received_msat?: number; amount_received_msat?: number;
paid_at?: number; paid_at?: number;
payment_preimage?: string; payment_preimage?: string;
@ -142,9 +139,7 @@ export interface MPP {
created_at?: number; created_at?: number;
destination?: string; destination?: string;
id?: number; id?: number;
msatoshi?: number; // For Backward compatibility
amount_msat?: number; amount_msat?: number;
msatoshi_sent?: number; // For Backward compatibility
amount_sent_msat?: number; amount_sent_msat?: number;
payment_hash?: string; payment_hash?: string;
payment_preimage?: string; payment_preimage?: string;
@ -158,9 +153,7 @@ export interface Payment {
created_at?: number; created_at?: number;
destination?: string; destination?: string;
id?: number; id?: number;
msatoshi?: number; // For Backward compatibility
amount_msat?: number; amount_msat?: number;
msatoshi_sent?: number; // For Backward compatibility
amount_sent_msat?: number; amount_sent_msat?: number;
payment_hash?: string; payment_hash?: string;
payment_preimage?: string; payment_preimage?: string;
@ -179,7 +172,6 @@ export interface PayRequest {
created_at?: number; created_at?: number;
expiry?: number; expiry?: number;
payee?: string; payee?: string;
msatoshi?: number;
amount_msat?: number; amount_msat?: number;
description?: string; description?: string;
min_final_cltv_expiry?: number; min_final_cltv_expiry?: number;
@ -212,7 +204,6 @@ interface Recurrence {
export interface OfferRequest { export interface OfferRequest {
offer_id?: string; offer_id?: string;
offer_amount?: number | null; // For Backward compatibility
offer_amount_msat?: number; offer_amount_msat?: number;
type?: string; type?: string;
valid?: boolean; valid?: boolean;
@ -252,12 +243,9 @@ export interface ForwardingEvent {
out_channel?: string; out_channel?: string;
in_channel_alias?: string; in_channel_alias?: string;
out_channel_alias?: string; out_channel_alias?: string;
in_msatoshi?: number; in_msat?: number;
in_msat?: string | number; out_msat?: number;
out_msatoshi?: number; fee_msat?: number;
out_msat?: string | number;
fee?: number;
fee_msat?: string | number;
status?: string; status?: string;
received_time?: number; received_time?: number;
resolved_time?: number; resolved_time?: number;
@ -266,8 +254,7 @@ export interface ForwardingEvent {
export interface LocalFailedEvent { export interface LocalFailedEvent {
in_channel?: string; in_channel?: string;
in_channel_alias?: string; in_channel_alias?: string;
in_msatoshi?: number; in_msat?: number;
in_msat?: string;
out_channel?: string; out_channel?: string;
out_channel_alias?: string; out_channel_alias?: string;
status?: string; status?: string;
@ -287,7 +274,6 @@ export interface Routes {
id?: string; id?: string;
channel?: string; channel?: string;
direction?: number; direction?: number;
msatoshi?: number;
amount_msat?: number; amount_msat?: number;
delay?: number; delay?: number;
alias?: string; alias?: string;
@ -318,17 +304,11 @@ export interface Channel {
channel_id?: string; channel_id?: string;
funding_txid?: string; funding_txid?: string;
private?: boolean; private?: boolean;
msatoshi_to_us?: number; // For Backward compatibility
to_us_msat?: number; to_us_msat?: number;
msatoshi_to_them?: number; // For Backward compatibility
to_them_msat?: number; to_them_msat?: number;
msatoshi_total?: number; // For Backward compatibility
total_msat?: number; total_msat?: number;
their_channel_reserve_satoshis?: string; // For Backward compatibility
their_reserve_msat?: number; their_reserve_msat?: number;
our_channel_reserve_satoshis?: string; // For Backward compatibility
our_reserve_msat?: number; our_reserve_msat?: number;
spendable_msatoshi?: string; // For Backward compatibility
spendable_msat?: number; spendable_msat?: number;
direction?: number; direction?: number;
htlcs?: ChannelHTLC[]; htlcs?: ChannelHTLC[];
@ -414,7 +394,6 @@ export interface FeeRates {
export interface UTXO { export interface UTXO {
txid?: string; txid?: string;
output?: number; output?: number;
value?: number; // For Backward compatibility
amount_msat?: number; amount_msat?: number;
status?: string; status?: string;
blockheight?: string; blockheight?: string;

@ -137,8 +137,8 @@ export class CLNPageDefinitions {
graph_lookup: { graph_lookup: {
query_routes: TableDefinition; query_routes: TableDefinition;
}; };
peerswap: { // peerswap: {
swaps: TableDefinition; // swaps: TableDefinition;
}; // };
}; };

@ -12,7 +12,7 @@ export const HOUR_SECONDS = 3600;
export const DEFAULT_INVOICE_EXPIRY = HOUR_SECONDS * 24 * 7; export const DEFAULT_INVOICE_EXPIRY = HOUR_SECONDS * 24 * 7;
export const VERSION = '0.13.7-beta'; export const VERSION = '0.14.0-beta';
export const API_URL = isDevMode() ? 'http://localhost:3000/rtl/api' : './api'; export const API_URL = isDevMode() ? 'http://localhost:3000/rtl/api' : './api';
@ -789,11 +789,11 @@ export const CLN_DEFAULT_PAGE_SETTINGS: PageSettings[] = [
{ tableId: 'query_routes', recordsPerPage: PAGE_SIZE, sortBy: 'msatoshi', sortOrder: SortOrderEnum.DESCENDING, { tableId: 'query_routes', recordsPerPage: PAGE_SIZE, sortBy: 'msatoshi', sortOrder: SortOrderEnum.DESCENDING,
columnSelectionSM: ['alias', 'direction', 'msatoshi'], columnSelectionSM: ['alias', 'direction', 'msatoshi'],
columnSelection: ['alias', 'channel', 'direction', 'delay', 'msatoshi'] } columnSelection: ['alias', 'channel', 'direction', 'delay', 'msatoshi'] }
] }, // ] },
{ pageId: 'peerswap', tables: [ // { pageId: 'peerswap', tables: [
{ tableId: 'swaps', recordsPerPage: PAGE_SIZE, sortBy: 'created_at', sortOrder: SortOrderEnum.DESCENDING, // { tableId: 'swaps', recordsPerPage: PAGE_SIZE, sortBy: 'created_at', sortOrder: SortOrderEnum.DESCENDING,
columnSelectionSM: ['id', 'state', 'amount'], // columnSelectionSM: ['id', 'state', 'amount'],
columnSelection: ['id', 'alias', 'short_channel_id', 'created_at', 'state', 'amount'] } // columnSelection: ['id', 'alias', 'short_channel_id', 'created_at', 'state', 'amount'] }
] } ] }
]; ];
@ -900,12 +900,12 @@ export const CLN_PAGE_DEFS: CLNPageDefinitions = {
maxColumns: 6, maxColumns: 6,
allowedColumns: [{ column:'id' }, { column:'alias' }, { column:'channel' }, { column:'direction' }, { column:'delay' }, { column:'msatoshi', label: 'Amount' }] allowedColumns: [{ column:'id' }, { column:'alias' }, { column:'channel' }, { column:'direction' }, { column:'delay' }, { column:'msatoshi', label: 'Amount' }]
} }
}, // },
peerswap: { // peerswap: {
swaps: { // swaps: {
maxColumns: 6, // maxColumns: 6,
allowedColumns: [{ column:'id' }, { column:'alias' }, { column:'short_channel_id' }, { column:'created_at' }, { column:'state' }, { column:'amount' }] // allowedColumns: [{ column:'id' }, { column:'alias' }, { column:'short_channel_id' }, { column:'created_at' }, { column:'state' }, { column:'amount' }]
} // }
} }
}; };

@ -384,7 +384,6 @@
.material-icons { .material-icons {
&.info-icon { &.info-icon {
font-size: 100%; font-size: 100%;
margin: 0 0.25rem;
color: $primary-darker; color: $primary-darker;
&.info-icon-primary { &.info-icon-primary {
color: $primary-darker; color: $primary-darker;

@ -311,7 +311,6 @@
.material-icons { .material-icons {
&.mat-icon-no-color, &.info-icon { &.mat-icon-no-color, &.info-icon {
font-size: 100%; font-size: 100%;
margin: 0 0.25rem;
color: $foreground-secondary-text; color: $foreground-secondary-text;
&.info-icon-primary { &.info-icon-primary {
color: $primary-color; color: $primary-color;

Loading…
Cancel
Save