diff --git a/.github/docs/Core_lightning_setup.md b/.github/docs/Core_lightning_setup.md index ea1e8c39..9c17281f 100644 --- a/.github/docs/Core_lightning_setup.md +++ b/.github/docs/Core_lightning_setup.md @@ -58,7 +58,9 @@ Ensure that the follow values are correct per your config: ``` { + "multiPass": , "port": "3000", + "defaultNodeIndex": 1, "SSO": { "rtlSSO": 0, "rtlCookiePath": "", @@ -83,8 +85,7 @@ Ensure that the follow values are correct per your config: "lnServerUrl": "https://:3001" } } - ], - "multiPass": + ] } ``` ### Start the server and access the app diff --git a/.github/docs/Eclair_setup.md b/.github/docs/Eclair_setup.md index 11bfc0c8..d72e722a 100644 --- a/.github/docs/Eclair_setup.md +++ b/.github/docs/Eclair_setup.md @@ -53,7 +53,9 @@ Ensure that the follow values are correct per your config: ``` { + "multiPass": , "port": "3000", + "defaultNodeIndex": 1, "SSO": { "rtlSSO": 0, "rtlCookiePath": "", @@ -78,8 +80,7 @@ Ensure that the follow values are correct per your config: "lnServerUrl": "http://:port" } } - ], - "multiPass": "" + ] } ``` ### Start the server and access the app diff --git a/backend/controllers/cln/channels.js b/backend/controllers/cln/channels.js index fb599c44..0d452435 100644 --- a/backend/controllers/cln/channels.js +++ b/backend/controllers/cln/channels.js @@ -155,7 +155,7 @@ export const listForwardsPaginated = (req, res, next) => { queryStr = req.query.reverse ? (queryStr + '&reverse=' + req.query.reverse) : ''; queryStr = queryStr.replace('&', '?'); } - options.url = req.session.selectedNode.ln_server_url + '/v1/channel/listForwardsFilter' + queryStr; + options.url = req.session.selectedNode.ln_server_url + '/v1/channel/listForwardsPaginated' + queryStr; logger.log({ selectedNode: req.session.selectedNode, level: 'DEBUG', fileName: 'Channels', msg: 'Paginated Forwarding History url' + options.url }); request.get(options).then((body) => { logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Channels', msg: 'Paginated Forwarding History Received For Status' + req.query.status, data: body }); diff --git a/server/controllers/cln/channels.ts b/server/controllers/cln/channels.ts index 9aa5d7c0..52b92bae 100644 --- a/server/controllers/cln/channels.ts +++ b/server/controllers/cln/channels.ts @@ -139,7 +139,7 @@ export const listForwardsPaginated = (req, res, next) => { queryStr = req.query.reverse ? (queryStr + '&reverse=' + req.query.reverse) : ''; queryStr = queryStr.replace('&', '?'); } - options.url = req.session.selectedNode.ln_server_url + '/v1/channel/listForwardsFilter' + queryStr; + options.url = req.session.selectedNode.ln_server_url + '/v1/channel/listForwardsPaginated' + queryStr; logger.log({ selectedNode: req.session.selectedNode, level: 'DEBUG', fileName: 'Channels', msg: 'Paginated Forwarding History url' + options.url }); request.get(options).then((body) => { logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Channels', msg: 'Paginated Forwarding History Received For Status' + req.query.status, data: body }); diff --git a/src/app/cln/routing/failed-transactions/failed-transactions.component.ts b/src/app/cln/routing/failed-transactions/failed-transactions.component.ts index c03d5177..73f6ee94 100644 --- a/src/app/cln/routing/failed-transactions/failed-transactions.component.ts +++ b/src/app/cln/routing/failed-transactions/failed-transactions.component.ts @@ -24,7 +24,7 @@ import { failedForwardingHistory } from '../../store/cln.selector'; templateUrl: './failed-transactions.component.html', styleUrls: ['./failed-transactions.component.scss'], providers: [ - { provide: MatPaginatorIntl, useValue: getPaginatorLabel('Failed Events') } + { provide: MatPaginatorIntl, useValue: getPaginatorLabel('Failed events') } ] }) export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, OnDestroy { @@ -118,7 +118,6 @@ export class CLNFailedTransactionsComponent implements OnInit, AfterViewInit, On this.failedForwardingEvents = new MatTableDataSource([...forwardingEvents]); this.failedForwardingEvents.sort = this.sort; this.failedForwardingEvents.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null); - this.failedForwardingEvents.paginator = this.paginator; this.failedForwardingEvents.filterPredicate = (event: ForwardingEvent, fltr: string) => { const newEvent = ((event.received_time ? this.datePipe.transform(new Date(event.received_time * 1000), 'dd/MMM/YYYY HH:mm').toLowerCase() : '') + (event.resolved_time ? this.datePipe.transform(new Date(event.resolved_time * 1000), 'dd/MMM/YYYY HH:mm').toLowerCase() : '') + diff --git a/src/app/cln/routing/forwarding-history/forwarding-history.component.ts b/src/app/cln/routing/forwarding-history/forwarding-history.component.ts index 022de851..18ce3be0 100644 --- a/src/app/cln/routing/forwarding-history/forwarding-history.component.ts +++ b/src/app/cln/routing/forwarding-history/forwarding-history.component.ts @@ -70,7 +70,7 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi if (this.apiCallStatus.status === APICallStatusEnum.ERROR) { this.errorMessage = (typeof (this.apiCallStatus.message) === 'object') ? JSON.stringify(this.apiCallStatus.message) : this.apiCallStatus.message; } - if (this.eventsData.length <= 0) { + if (this.eventsData.length <= 0 && fhSeletor.forwardingHistory.listForwards) { this.totalForwardedTransactions = fhSeletor.forwardingHistory.totalEvents; this.firstOffset = fhSeletor.forwardingHistory.firstIndexOffset; this.lastOffset = fhSeletor.forwardingHistory.lastIndexOffset; @@ -130,7 +130,6 @@ export class CLNForwardingHistoryComponent implements OnInit, OnChanges, AfterVi this.forwardingHistoryEvents = new MatTableDataSource([...forwardingEvents]); this.forwardingHistoryEvents.sort = this.sort; this.forwardingHistoryEvents.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null); - this.forwardingHistoryEvents.paginator = this.paginator; this.forwardingHistoryEvents.filterPredicate = (event: ForwardingEvent, fltr: string) => { const newEvent = (event.received_time ? this.datePipe.transform(new Date(event.received_time * 1000), 'dd/MMM/YYYY HH:mm').toLowerCase() + ' ' : '') + (event.resolved_time ? this.datePipe.transform(new Date(event.resolved_time * 1000), 'dd/MMM/YYYY HH:mm').toLowerCase() + ' ' : '') + diff --git a/src/app/cln/routing/local-failed-transactions/local-failed-transactions.component.ts b/src/app/cln/routing/local-failed-transactions/local-failed-transactions.component.ts index 38706dab..d20fd01a 100644 --- a/src/app/cln/routing/local-failed-transactions/local-failed-transactions.component.ts +++ b/src/app/cln/routing/local-failed-transactions/local-failed-transactions.component.ts @@ -24,7 +24,7 @@ import { localFailedForwardingHistory } from '../../store/cln.selector'; templateUrl: './local-failed-transactions.component.html', styleUrls: ['./local-failed-transactions.component.scss'], providers: [ - { provide: MatPaginatorIntl, useValue: getPaginatorLabel('Local Failed Events') } + { provide: MatPaginatorIntl, useValue: getPaginatorLabel('Local failed events') } ] }) export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewInit, OnDestroy { @@ -128,7 +128,6 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni return (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null; } }; - this.failedLocalForwardingEvents.paginator = this.paginator; this.applyFilter(); this.logger.info(this.failedLocalForwardingEvents); } @@ -151,14 +150,15 @@ export class CLNLocalFailedTransactionsComponent implements OnInit, AfterViewIni reverse = true; index_offset = 0; } else if (event.pageIndex < event.previousPageIndex) { - reverse = false; - index_offset = this.lastOffset; - } else if (event.pageIndex > event.previousPageIndex && (event.length > ((event.pageIndex + 1) * event.pageSize))) { reverse = true; - index_offset = this.firstOffset; - } else if (event.length <= ((event.pageIndex + 1) * event.pageSize)) { - reverse = false; - index_offset = 0; + index_offset = this.lastOffset; + } else if (event.pageIndex > event.previousPageIndex) { + reverse = true; + if (event.length <= (event.pageIndex + 1) * event.pageSize) { + index_offset = this.totalLocalFailedTransactions - (event.pageIndex * event.pageSize); + } else { + index_offset = this.firstOffset; + } } this.store.dispatch(getForwardingHistory({ payload: { status: CLNForwardingEventsStatusEnum.LOCAL_FAILED, maxLen: event.pageSize, offset: index_offset, reverse: reverse } })); } diff --git a/src/app/cln/store/cln.effects.ts b/src/app/cln/store/cln.effects.ts index 7542feed..305b8162 100644 --- a/src/app/cln/store/cln.effects.ts +++ b/src/app/cln/store/cln.effects.ts @@ -659,18 +659,22 @@ export class CLNEffects implements OnDestroy { const maxLen = (action.payload.maxLen) ? action.payload.maxLen : 100; const offset = (action.payload.offset) ? action.payload.offset : 0; const reverse = (action.payload.reverse) ? action.payload.reverse : false; - this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchForwardingHistory' + status, status: APICallStatusEnum.INITIATED } })); + const statusInitial = status.charAt(0).toUpperCase(); + this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchForwardingHistory' + statusInitial, status: APICallStatusEnum.INITIATED } })); return this.httpClient.get(this.CHILD_API_URL + environment.CHANNELS_API + '/listForwardsPaginated?status=' + status + '&maxLen=' + maxLen + '&offset=' + offset + '&reverse=' + reverse).pipe( map((fhRes: ListForwards) => { this.logger.info(fhRes); - this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchForwardingHistory' + status, status: APICallStatusEnum.COMPLETED } })); + this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchForwardingHistory' + statusInitial, status: APICallStatusEnum.COMPLETED } })); + if (reverse && offset === 0) { + fhRes['totalEvents'] = +fhRes.lastIndexOffset | 0; + } return { type: CLNActions.SET_FORWARDING_HISTORY_CLN, payload: { status: status, response: fhRes } }; }), catchError((err: any) => { - this.handleErrorWithAlert('FetchForwardingHistory' + status, UI_MESSAGES.NO_SPINNER, 'Get ' + status + ' Forwarding History Failed', this.CHILD_API_URL + environment.CHANNELS_API + '/listForwardsPaginated?status=' + status, err); + this.handleErrorWithAlert('FetchForwardingHistory' + statusInitial, UI_MESSAGES.NO_SPINNER, 'Get ' + status + ' Forwarding History Failed', this.CHILD_API_URL + environment.CHANNELS_API + '/listForwardsPaginated?status=' + status, err); return of({ type: RTLActions.VOID }); }) ); diff --git a/src/app/cln/store/cln.reducers.ts b/src/app/cln/store/cln.reducers.ts index b80b1101..a01e0c7e 100644 --- a/src/app/cln/store/cln.reducers.ts +++ b/src/app/cln/store/cln.reducers.ts @@ -113,19 +113,28 @@ export const CLNReducer = createReducer(initCLNState, payload.response.listForwards = forwardsWithAlias; switch (payload.status) { case CLNForwardingEventsStatusEnum.SETTLED: + if (!payload.response.totalEvents) { + payload.response.totalEvents = state.forwardingHistory.totalEvents | 0; + } const modifiedFeeWithTxCount = state.fees; modifiedFeeWithTxCount.totalTxCount = payload.response.totalEvents | 0; return { ...state, - fee: modifiedFeeWithTxCount, + fees: modifiedFeeWithTxCount, forwardingHistory: payload.response }; case CLNForwardingEventsStatusEnum.FAILED: + if (!payload.response.totalEvents) { + payload.response.totalEvents = state.failedForwardingHistory.totalEvents; + } return { ...state, failedForwardingHistory: payload.response }; case CLNForwardingEventsStatusEnum.LOCAL_FAILED: + if (!payload.response.totalEvents) { + payload.response.totalEvents = state.localFailedForwardingHistory.totalEvents; + } return { ...state, localFailedForwardingHistory: payload.response diff --git a/src/app/cln/store/cln.selector.ts b/src/app/cln/store/cln.selector.ts index b3a1c75f..e1b9e6d9 100644 --- a/src/app/cln/store/cln.selector.ts +++ b/src/app/cln/store/cln.selector.ts @@ -17,13 +17,13 @@ export const utxos = createSelector(clnState, (state: CLNState) => ({ utxos: sta export const channels = createSelector(clnState, (state: CLNState) => ({ activeChannels: state.activeChannels, pendingChannels: state.pendingChannels, inactiveChannels: state.inactiveChannels, apiCallStatus: state.apisCallStatus.FetchChannels })); export const balance = createSelector(clnState, (state: CLNState) => ({ balance: state.balance, apiCallStatus: state.apisCallStatus.FetchBalance })); export const localRemoteBalance = createSelector(clnState, (state: CLNState) => ({ localRemoteBalance: state.localRemoteBalance, apiCallStatus: state.apisCallStatus.FetchLocalRemoteBalance })); -export const forwardingHistory = createSelector(clnState, (state: CLNState) => ({ forwardingHistory: state.forwardingHistory, apiCallStatus: state.apisCallStatus.FetchForwardingHistory })); -export const failedForwardingHistory = createSelector(clnState, (state: CLNState) => ({ failedForwardingHistory: state.failedForwardingHistory, apiCallStatus: state.apisCallStatus.FetchFailedForwardingHistory })); -export const localFailedForwardingHistory = createSelector(clnState, (state: CLNState) => ({ localFailedForwardingHistory: state.localFailedForwardingHistory, apiCallStatus: state.apisCallStatus.FetchLocalFailedForwardingHistory })); +export const forwardingHistory = createSelector(clnState, (state: CLNState) => ({ forwardingHistory: state.forwardingHistory, apiCallStatus: state.apisCallStatus.FetchForwardingHistoryS })); +export const failedForwardingHistory = createSelector(clnState, (state: CLNState) => ({ failedForwardingHistory: state.failedForwardingHistory, apiCallStatus: state.apisCallStatus.FetchForwardingHistoryF })); +export const localFailedForwardingHistory = createSelector(clnState, (state: CLNState) => ({ localFailedForwardingHistory: state.localFailedForwardingHistory, apiCallStatus: state.apisCallStatus.FetchForwardingHistoryL })); export const nodeInfoAndNodeSettingsAndBalance = createSelector(clnState, (state: CLNState) => ({ information: state.information, nodeSettings: state.nodeSettings, balance: state.balance })); export const nodeInfoAndBalanceAndNumPeers = createSelector(clnState, (state: CLNState) => ({ information: state.information, balance: state.balance, numPeers: state.peers.length })); export const nodeInfoAndBalance = createSelector(clnState, (state: CLNState) => ({ information: state.information, balance: state.balance })); -export const nodeInfoAndNodeSettingsAndAPIsStatus = createSelector(clnState, (state: CLNState) => ({ information: state.information, nodeSettings: state.nodeSettings, apisCallStatus: [state.apisCallStatus.FetchInfo, state.apisCallStatus.FetchForwardingHistory] })); +export const nodeInfoAndNodeSettingsAndAPIsStatus = createSelector(clnState, (state: CLNState) => ({ information: state.information, nodeSettings: state.nodeSettings, apisCallStatus: [state.apisCallStatus.FetchInfo, state.apisCallStatus.FetchForwardingHistoryS] })); export const offers = createSelector(clnState, (state: CLNState) => ({ offers: state.offers, apiCallStatus: state.apisCallStatus.FetchOffers })); export const offerBookmarks = createSelector(clnState, (state: CLNState) => ({ offersBookmarks: state.offersBookmarks, apiCallStatus: state.apisCallStatus.FetchOfferBookmarks })); export const getoffer = (bolt12Str) => createSelector(clnState, (state: CLNState) => (state.offers.find((offer: Offer) => offer.bolt12 === bolt12Str))); diff --git a/src/app/cln/store/cln.state.ts b/src/app/cln/store/cln.state.ts index 51b1e834..f7d5c581 100644 --- a/src/app/cln/store/cln.state.ts +++ b/src/app/cln/store/cln.state.ts @@ -39,9 +39,9 @@ export const initCLNState: CLNState = { FetchPeers: { status: APICallStatusEnum.UN_INITIATED }, FetchUTXOs: { status: APICallStatusEnum.UN_INITIATED }, FetchPayments: { status: APICallStatusEnum.UN_INITIATED }, - FetchForwardingHistory: { status: APICallStatusEnum.UN_INITIATED }, - FetchFailedForwardingHistory: { status: APICallStatusEnum.UN_INITIATED }, - FetchLocalFailedForwardingHistory: { status: APICallStatusEnum.UN_INITIATED }, + FetchForwardingHistoryS: { status: APICallStatusEnum.UN_INITIATED }, + FetchForwardingHistoryF: { status: APICallStatusEnum.UN_INITIATED }, + FetchForwardingHistoryL: { status: APICallStatusEnum.UN_INITIATED }, FetchOffers: { status: APICallStatusEnum.UN_INITIATED }, FetchOfferBookmarks: { status: APICallStatusEnum.UN_INITIATED } }, diff --git a/src/app/cln/transactions/transactions.component.ts b/src/app/cln/transactions/transactions.component.ts index 1f1dfae4..7be6a86b 100644 --- a/src/app/cln/transactions/transactions.component.ts +++ b/src/app/cln/transactions/transactions.component.ts @@ -41,7 +41,6 @@ export class CLNTransactionsComponent implements OnInit, OnDestroy { subscribe({ next: (value: ResolveEnd | Event) => { const linkFound = this.links.find((link) => (value).urlAfterRedirects.includes(link.link)); - this.activeLink = linkFound ? linkFound.link : this.links[0].link; this.routerUrl = (value).urlAfterRedirects; } diff --git a/src/app/shared/models/apiCallsPayload.ts b/src/app/shared/models/apiCallsPayload.ts index 3d1a02ea..8e7156d8 100644 --- a/src/app/shared/models/apiCallsPayload.ts +++ b/src/app/shared/models/apiCallsPayload.ts @@ -54,9 +54,9 @@ export interface ApiCallsListCL { FetchPeers: ApiCallStatusPayload; FetchUTXOs: ApiCallStatusPayload; FetchPayments: ApiCallStatusPayload; - FetchForwardingHistory: ApiCallStatusPayload; - FetchFailedForwardingHistory: ApiCallStatusPayload; - FetchLocalFailedForwardingHistory: ApiCallStatusPayload; + FetchForwardingHistoryS: ApiCallStatusPayload; + FetchForwardingHistoryF: ApiCallStatusPayload; + FetchForwardingHistoryL: ApiCallStatusPayload; FetchOffers: ApiCallStatusPayload; FetchOfferBookmarks: ApiCallStatusPayload; } diff --git a/src/app/shared/services/consts-enums-functions.ts b/src/app/shared/services/consts-enums-functions.ts index cb0defd8..2248512d 100644 --- a/src/app/shared/services/consts-enums-functions.ts +++ b/src/app/shared/services/consts-enums-functions.ts @@ -626,6 +626,7 @@ export const LADS_POLICY = [ ]; export enum CLNForwardingEventsStatusEnum { + OFFERED = 'offered', SETTLED = 'settled', FAILED = 'failed', LOCAL_FAILED = 'local_failed'