Bug fix: LND Payment sort

This commit is contained in:
ShahanaFarooqui 2023-10-03 17:40:01 -07:00
parent 6079faacce
commit f8393d570e
7 changed files with 33 additions and 45 deletions

View File

@ -13,6 +13,6 @@
<style>html{width:100%;height:99%;line-height:1.5;overflow-x:hidden;font-family:Roboto,sans-serif!important;font-size:95%}@media only screen and (max-width: 56.25em){html{font-size:90%}}@media only screen and (max-width: 37.5em){html{font-size:80%}}body{box-sizing:border-box;height:100%;margin:0;overflow:hidden}*{margin:0;padding:0}@font-face{font-family:Roboto;src:url(Roboto-Thin.f7a95c9c5999532c.woff2) format("woff2"),url(Roboto-Thin.c13c157cb81e8ebb.woff) format("woff");font-weight:100;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-ThinItalic.b0e084abf689f393.woff2) format("woff2"),url(Roboto-ThinItalic.1111028df6cea564.woff) format("woff");font-weight:100;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Light.0e01b6cd13b3857f.woff2) format("woff2"),url(Roboto-Light.603ca9a537b88428.woff) format("woff");font-weight:300;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-LightItalic.232ef4b20215f720.woff2) format("woff2"),url(Roboto-LightItalic.1b5e142f787151c8.woff) format("woff");font-weight:300;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Regular.475ba9e4e2d63456.woff2) format("woff2"),url(Roboto-Regular.bcefbfee882bc1cb.woff) format("woff");font-weight:400;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-RegularItalic.e3a9ebdaac06bbc4.woff2) format("woff2"),url(Roboto-RegularItalic.0668fae6af0cf8c2.woff) format("woff");font-weight:400;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Medium.457532032ceb0168.woff2) format("woff2"),url(Roboto-Medium.6e1ae5f0b324a0aa.woff) format("woff");font-weight:500;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-MediumItalic.872f7060602d55d2.woff2) format("woff2"),url(Roboto-MediumItalic.e06fb533801cbb08.woff) format("woff");font-weight:500;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Bold.447291a88c067396.woff2) format("woff2"),url(Roboto-Bold.fc482e6133cf5e26.woff) format("woff");font-weight:700;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BoldItalic.1b15168ef6fa4e16.woff2) format("woff2"),url(Roboto-BoldItalic.e26ba339b06f09f7.woff) format("woff");font-weight:700;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Black.2eaa390d458c877d.woff2) format("woff2"),url(Roboto-Black.b25f67ad8583da68.woff) format("woff");font-weight:900;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BlackItalic.7dc03ee444552bc5.woff2) format("woff2"),url(Roboto-BlackItalic.c8dc642467cb3099.woff) format("woff");font-weight:900;font-style:italic}</style><link rel="stylesheet" href="styles.a04c018645a5044a.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.a04c018645a5044a.css"></noscript></head>
<body>
<rtl-app></rtl-app>
<script src="runtime.c2bb514ce598134b.js" type="module"></script><script src="polyfills.aa01d8f6b94657cb.js" type="module"></script><script src="main.8ef8f2009574bb18.js" type="module"></script>
<script src="runtime.c2bb514ce598134b.js" type="module"></script><script src="polyfills.aa01d8f6b94657cb.js" type="module"></script><script src="main.cfc23a64d6563418.js" type="module"></script>
</body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -21,7 +21,7 @@ import { ECLInvoiceInformationComponent } from '../transactions/invoice-informat
import { RTLState } from '../../store/rtl.state';
import { fetchChannels, fetchFees, fetchInvoices, fetchOnchainBalance, fetchPayments, fetchPeers, sendPaymentStatus, setActiveChannels,
setChannelsStatus, setInactiveChannels, setLightningBalance, setPeers, setPendingChannels, setQueryRoutes, updateECLAPICallStatus,
updateChannelState, updateInvoice, updateRelayedPayment, fetchPageSettings } from './ecl.actions';
updateChannelState, updateInvoice, updateRelayedPayment } from './ecl.actions';
import { allAPIsCallStatus } from './ecl.selector';
import { ApiCallsListECL } from '../../shared/models/apiCallsPayload';
@ -775,7 +775,6 @@ export class ECLEffects implements OnDestroy {
newRoute = '/ecl/home';
}
this.router.navigate([newRoute]);
this.store.dispatch(fetchPageSettings());
this.store.dispatch(fetchInvoices());
this.store.dispatch(fetchChannels({ payload: { fetchPayments: true } }));
this.store.dispatch(fetchFees());

View File

@ -18,25 +18,24 @@ import { GetInfo, Fees, BlockchainBalance, NetworkInfo, GraphNode, Transaction,
SetRestoreChannelsList } from '../../shared/models/lndModels';
import { InvoiceInformationComponent } from '../transactions/invoice-information-modal/invoice-information.component';
import { ErrorMessageComponent } from '../../shared/components/data-modal/error-message/error-message.component';
import { API_URL, API_END_POINTS, RTLActions, LNDActions, AlertTypeEnum, APICallStatusEnum, FEE_LIMIT_TYPES, PAGE_SIZE, UI_MESSAGES, LNDWSEventTypeEnum, LND_DEFAULT_PAGE_SETTINGS } from '../../shared/services/consts-enums-functions';
import { API_URL, API_END_POINTS, RTLActions, LNDActions, AlertTypeEnum, APICallStatusEnum, FEE_LIMIT_TYPES, PAGE_SIZE, UI_MESSAGES, LNDWSEventTypeEnum, LND_DEFAULT_PAGE_SETTINGS, SortOrderEnum } from '../../shared/services/consts-enums-functions';
import { closeAllDialogs, closeSpinner, logout, openAlert, openSnackBar, openSpinner, setApiUrl, setNodeData } from '../../store/rtl.actions';
import { RTLState } from '../../store/rtl.state';
import { backupChannels, fetchBalanceBlockchain, fetchClosedChannels, fetchFees, fetchInfoLND, fetchInvoices, fetchNetwork, fetchPayments,
fetchPeers, fetchPendingChannels, fetchTransactions, setForwardingHistory, setPeers, setQueryRoutes, setRestoreChannelsList,
updateLNDAPICallStatus, updateInvoice, fetchChannels, updatePayment, fetchPageSettings } from './lnd.actions';
import { allAPIsCallStatus, lndNodeInformation, lndPageSettings } from './lnd.selector';
import { ApiCallsListLND, ApiCallStatusPayload } from '../../shared/models/apiCallsPayload';
updateLNDAPICallStatus, updateInvoice, fetchChannels, updatePayment } from './lnd.actions';
import { allAPIsCallStatus, lndNodeInformation } from './lnd.selector';
import { ApiCallsListLND } from '../../shared/models/apiCallsPayload';
import { WebSocketClientService } from '../../shared/services/web-socket.service';
import { PageSettings } from '../../shared/models/pageSettings';
@Injectable()
export class LNDEffects implements OnDestroy {
dialogRef: any;
CHILD_API_URL = API_URL + '/lnd';
private invoicesPageSize = PAGE_SIZE;
private paymentsPageSize = PAGE_SIZE;
private invoicesPageSettings = LND_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === 'transactions')?.tables.find((table) => table.tableId === 'invoices');
private paymentsPageSettings = LND_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === 'transactions')?.tables.find((table) => table.tableId === 'payments');
private flgInitialized = false;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];
@ -671,6 +670,7 @@ export class LNDEffects implements OnDestroy {
pipe(map((res: ListPayments) => {
this.logger.info(res);
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchPayments', status: APICallStatusEnum.COMPLETED } }));
this.commonService.sortByKey(res.payments || [], this.paymentsPageSettings?.sortBy || 'creation_date', 'number', this.paymentsPageSettings?.sortOrder);
return {
type: LNDActions.SET_PAYMENTS_LND,
payload: res
@ -715,7 +715,7 @@ export class LNDEffects implements OnDestroy {
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'SendPayment', status: APICallStatusEnum.COMPLETED } }));
if (sendRes.payment_error) {
if (action.payload.allowSelfPayment) {
this.store.dispatch(fetchInvoices({ payload: { num_max_invoices: this.invoicesPageSize, reversed: true } }));
this.store.dispatch(fetchInvoices({ payload: { num_max_invoices: this.invoicesPageSettings?.recordsPerPage, reversed: true } }));
return {
type: LNDActions.SEND_PAYMENT_STATUS_LND,
payload: sendRes
@ -732,9 +732,9 @@ export class LNDEffects implements OnDestroy {
this.store.dispatch(closeSpinner({ payload: action.payload.uiMessage }));
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'SendPayment', status: APICallStatusEnum.COMPLETED } }));
this.store.dispatch(fetchChannels());
this.store.dispatch(fetchPayments({ payload: { max_payments: this.paymentsPageSize, reversed: true } }));
this.store.dispatch(fetchPayments({ payload: { max_payments: this.paymentsPageSettings?.recordsPerPage, reversed: true } }));
if (action.payload.allowSelfPayment) {
this.store.dispatch(fetchInvoices({ payload: { num_max_invoices: this.invoicesPageSize, reversed: true } }));
this.store.dispatch(fetchInvoices({ payload: { num_max_invoices: this.invoicesPageSettings?.recordsPerPage, reversed: true } }));
} else {
let msg = 'Payment Sent Successfully.';
if (sendRes.payment_route && sendRes.payment_route.total_fees_msat) {
@ -752,7 +752,7 @@ export class LNDEffects implements OnDestroy {
this.logger.error('Error: ' + JSON.stringify(err));
if (action.payload.allowSelfPayment) {
this.handleErrorWithoutAlert('SendPayment', action.payload.uiMessage, 'Send Payment Failed.', err);
this.store.dispatch(fetchInvoices({ payload: { num_max_invoices: this.invoicesPageSize, reversed: true } }));
this.store.dispatch(fetchInvoices({ payload: { num_max_invoices: this.invoicesPageSettings?.recordsPerPage, reversed: true } }));
return of({
type: LNDActions.SEND_PAYMENT_STATUS_LND,
payload: { error: this.commonService.extractErrorMessage(err) }
@ -1205,12 +1205,10 @@ export class LNDEffects implements OnDestroy {
map((settings: any) => {
this.logger.info(settings);
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchPageSettings', status: APICallStatusEnum.COMPLETED } }));
this.invoicesPageSize = (settings && Object.keys(settings).length > 0 ? (settings.find((page) => page.pageId === 'transactions')?.tables.find((table) => table.tableId === 'invoices')) :
LND_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === 'transactions')?.tables.find((table) => table.tableId === 'invoices')).recordsPerPage;
this.paymentsPageSize = (settings && Object.keys(settings).length > 0 ? (settings.find((page) => page.pageId === 'transactions')?.tables.find((table) => table.tableId === 'payments')) :
LND_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === 'transactions')?.tables.find((table) => table.tableId === 'payments')).recordsPerPage;
this.store.dispatch(fetchInvoices({ payload: { num_max_invoices: this.invoicesPageSize, reversed: true } }));
// this.store.dispatch(fetchPayments({ payload: { max_payments: 100000, reversed: true } }));
this.invoicesPageSettings = (settings && Object.keys(settings).length > 0 ? (settings.find((page) => page.pageId === 'transactions')?.tables.find((table) => table.tableId === 'invoices')) :
LND_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === 'transactions')?.tables.find((table) => table.tableId === 'invoices'));
this.paymentsPageSettings = (settings && Object.keys(settings).length > 0 ? (settings.find((page) => page.pageId === 'transactions')?.tables.find((table) => table.tableId === 'payments')) :
LND_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === 'transactions')?.tables.find((table) => table.tableId === 'payments'));
return {
type: LNDActions.SET_PAGE_SETTINGS_LND,
payload: settings || []
@ -1238,13 +1236,12 @@ export class LNDEffects implements OnDestroy {
this.store.dispatch(openSnackBar({ payload: 'Page Layout Updated Successfully!' }));
const invPgSz = (postRes.find((page) => page.pageId === 'transactions')?.tables.find((table) => table.tableId === 'invoices') || LND_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === 'transactions')?.tables.find((table) => table.tableId === 'invoices')).recordsPerPage;
const payPgSz = (postRes.find((page) => page.pageId === 'transactions')?.tables.find((table) => table.tableId === 'payments') || LND_DEFAULT_PAGE_SETTINGS.find((page) => page.pageId === 'transactions')?.tables.find((table) => table.tableId === 'payments')).recordsPerPage;
if (invPgSz !== this.invoicesPageSize) {
this.invoicesPageSize = invPgSz;
this.store.dispatch(fetchInvoices({ payload: { num_max_invoices: this.invoicesPageSize, reversed: true } }));
if (this.invoicesPageSettings && invPgSz !== this.invoicesPageSettings?.recordsPerPage) {
this.invoicesPageSettings.recordsPerPage = invPgSz;
this.store.dispatch(fetchInvoices({ payload: { num_max_invoices: this.invoicesPageSettings?.recordsPerPage, reversed: true } }));
}
if (payPgSz !== this.paymentsPageSize) {
this.paymentsPageSize = payPgSz;
// this.store.dispatch(fetchPayments({ payload: { max_payments: 100000, reversed: true } }));
if (this.paymentsPageSettings && payPgSz !== this.paymentsPageSettings?.recordsPerPage) {
this.paymentsPageSettings.recordsPerPage = payPgSz;
}
return {
type: LNDActions.SET_PAGE_SETTINGS_LND,
@ -1281,7 +1278,6 @@ export class LNDEffects implements OnDestroy {
newRoute = '/lnd/home';
}
this.router.navigate([newRoute]);
this.store.dispatch(fetchPageSettings());
this.store.dispatch(fetchBalanceBlockchain());
this.store.dispatch(fetchChannels());
this.store.dispatch(fetchPendingChannels());
@ -1290,9 +1286,7 @@ export class LNDEffects implements OnDestroy {
this.store.dispatch(fetchNetwork());
this.store.dispatch(fetchFees()); // Fetches monthly forwarding history as well, to count total number of events
this.store.dispatch(fetchPayments({ payload: { max_payments: 100000, reversed: true } }));
// Fetching Invoices in pagesettings to get page size
// this.store.dispatch(fetchPayments({ payload: { max_payments: 10, reversed: true } }));
// this.store.dispatch(getAllLightningTransactions());
this.store.dispatch(fetchInvoices({ payload: { num_max_invoices: this.invoicesPageSettings?.recordsPerPage, reversed: true } }));
}
handleErrorWithoutAlert(actionName: string, uiMessage: string, genericErrorMessage: string, err: { status: number, error: any }) {

View File

@ -191,14 +191,6 @@ export const LNDReducer = createReducer(initLNDState,
utxos: payload
};
}),
// on(setPayments, (state, { payload }) => ({
// ...state,
// listPayments: payload
// })),
// on(setAllLightningTransactions, (state, { payload }) => ({
// ...state,
// allLightningTransactions: payload
// })),
on(setPayments, (state, { payload }) => {
const allLtTrans: SetAllLightningTransactions = { listInvoicesAll: state.allLightningTransactions.listInvoicesAll, listPaymentsAll: payload };
return {

View File

@ -27,9 +27,9 @@ import { ShowPubkeyComponent } from '../shared/components/data-modal/show-pubkey
import { RTLState } from './rtl.state';
import { resetRootStore, setNodeData, setSelectedNode, updateRootAPICallStatus, closeSpinner, openAlert, openSpinner, openSnackBar, fetchRTLConfig, closeAllDialogs, logout, updateRootNodeSettings, setRTLConfig } from './rtl.actions';
import { fetchInfoLND, resetLNDStore } from '../lnd/store/lnd.actions';
import { fetchInfoCL, resetCLStore } from '../cln/store/cln.actions';
import { fetchInfoECL, resetECLStore } from '../eclair/store/ecl.actions';
import { fetchInfoLND, resetLNDStore, fetchPageSettings as fetchPageSettingsLND } from '../lnd/store/lnd.actions';
import { fetchInfoCLN, resetCLNStore, fetchPageSettings as fetchPageSettingsCLN } from '../cln/store/cln.actions';
import { fetchInfoECL, resetECLStore, fetchPageSettings as fetchPageSettingsECL } from '../eclair/store/ecl.actions';
import { rootAppConfig, rootNodeData } from './rtl.selector';
@Injectable()
@ -393,7 +393,7 @@ export class RTLEffects implements OnDestroy {
withLatestFrom(this.store.select(rootAppConfig)),
mergeMap(([action, appConfig]: [{ type: string, payload: Login }, RTLConfiguration]) => {
this.store.dispatch(resetLNDStore({ payload: null }));
this.store.dispatch(resetCLStore({ payload: null }));
this.store.dispatch(resetCLNStore({ payload: null }));
this.store.dispatch(resetECLStore({ payload: null }));
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'Login', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(API_END_POINTS.AUTHENTICATE_API, {
@ -561,7 +561,7 @@ export class RTLEffects implements OnDestroy {
this.sessionService.removeItem('eclUnlocked');
this.store.dispatch(resetRootStore({ payload: node }));
this.store.dispatch(resetLNDStore({ payload: selNode }));
this.store.dispatch(resetCLStore({ payload: selNode }));
this.store.dispatch(resetCLNStore({ payload: selNode }));
this.store.dispatch(resetECLStore({ payload: selNode }));
if (this.sessionService.getItem('token')) {
const nodeLnImplementation = node.lnImplementation ? node.lnImplementation.toUpperCase() : 'LND';
@ -570,14 +570,17 @@ export class RTLEffects implements OnDestroy {
this.wsService.connectWebSocket(apiUrl?.replace(/^http/, 'ws') + API_END_POINTS.Web_SOCKET_API, (node.index ? node.index.toString() : '-1'));
switch (nodeLnImplementation) {
case 'CLN':
this.store.dispatch(fetchInfoCL({ payload: { loadPage: landingPage } }));
this.store.dispatch(fetchPageSettingsCLN());
this.store.dispatch(fetchInfoCLN({ payload: { loadPage: landingPage } }));
break;
case 'ECL':
this.store.dispatch(fetchPageSettingsECL());
this.store.dispatch(fetchInfoECL({ payload: { loadPage: landingPage } }));
break;
default:
this.store.dispatch(fetchPageSettingsLND());
this.store.dispatch(fetchInfoLND({ payload: { loadPage: landingPage } }));
break;
}