Removed environments

pull/1149/head
ShahanaFarooqui 1 year ago
parent a5079bcd61
commit b1e3af15dd

@ -48,12 +48,6 @@
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"budgets": [
{
"type": "initial",

@ -13,7 +13,7 @@
<style>html{width:100%;height:99%;line-height:1.5;overflow-x:hidden;font-family:Roboto,sans-serif!important;font-size:100%}@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.d234f9197fc381cf.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.d234f9197fc381cf.css"></noscript></head>
<body>
<rtl-app></rtl-app>
<script src="runtime.604114e6d4d7795b.js" type="module"></script><script src="polyfills.08e0233279c8a187.js" type="module"></script><script src="main.8123c909a9b2fcaa.js" type="module"></script>
<script src="runtime.1dbe591aab818307.js" type="module"></script><script src="polyfills.08e0233279c8a187.js" type="module"></script><script src="main.b3654c2d32ddb81c.js" type="module"></script>
<script>window.global = window;</script>
</body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +1 @@
(()=>{"use strict";var e,v={},m={};function r(e){var f=m[e];if(void 0!==f)return f.exports;var t=m[e]={id:e,loaded:!1,exports:{}};return v[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=v,e=[],r.O=(f,t,i,o)=>{if(!t){var a=1/0;for(n=0;n<e.length;n++){for(var[t,i,o]=e[n],s=!0,l=0;l<t.length;l++)(!1&o||a>=o)&&Object.keys(r.O).every(b=>r.O[b](t[l]))?t.splice(l--,1):(s=!1,o<a&&(a=o));if(s){e.splice(n--,1);var d=i();void 0!==d&&(f=d)}}return f}o=o||0;for(var n=e.length;n>0&&e[n-1][2]>o;n--)e[n]=e[n-1];e[n]=[t,i,o]},r.d=(e,f)=>{for(var t in f)r.o(f,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:f[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((f,t)=>(r.f[t](e,f),f),[])),r.u=e=>e+"."+{258:"82f463c92bfb465c",267:"6c439858ec5d06c8",564:"456719c78487c8a1",636:"5b9b8a74b97febb5"}[e]+".js",r.miniCssF=e=>{},r.o=(e,f)=>Object.prototype.hasOwnProperty.call(e,f),(()=>{var e={},f="RTLApp:";r.l=(t,i,o,n)=>{if(e[t])e[t].push(i);else{var a,s;if(void 0!==o)for(var l=document.getElementsByTagName("script"),d=0;d<l.length;d++){var u=l[d];if(u.getAttribute("src")==t||u.getAttribute("data-webpack")==f+o){a=u;break}}a||(s=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",f+o),a.src=r.tu(t)),e[t]=[i];var c=(g,b)=>{a.onerror=a.onload=null,clearTimeout(p);var h=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),h&&h.forEach(y=>y(b)),g)return g(b)},p=setTimeout(c.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=c.bind(null,a.onerror),a.onload=c.bind(null,a.onload),s&&document.head.appendChild(a)}}})(),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:f=>f},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={666:0};r.f.j=(i,o)=>{var n=r.o(e,i)?e[i]:void 0;if(0!==n)if(n)o.push(n[2]);else if(666!=i){var a=new Promise((u,c)=>n=e[i]=[u,c]);o.push(n[2]=a);var s=r.p+r.u(i),l=new Error;r.l(s,u=>{if(r.o(e,i)&&(0!==(n=e[i])&&(e[i]=void 0),n)){var c=u&&("load"===u.type?"missing":u.type),p=u&&u.target&&u.target.src;l.message="Loading chunk "+i+" failed.\n("+c+": "+p+")",l.name="ChunkLoadError",l.type=c,l.request=p,n[1](l)}},"chunk-"+i,i)}else e[i]=0},r.O.j=i=>0===e[i];var f=(i,o)=>{var l,d,[n,a,s]=o,u=0;if(n.some(p=>0!==e[p])){for(l in a)r.o(a,l)&&(r.m[l]=a[l]);if(s)var c=s(r)}for(i&&i(o);u<n.length;u++)r.o(e,d=n[u])&&e[d]&&e[d][0](),e[d]=0;return r.O(c)},t=self.webpackChunkRTLApp=self.webpackChunkRTLApp||[];t.forEach(f.bind(null,0)),t.push=f.bind(null,t.push.bind(t))})()})();
(()=>{"use strict";var e,v={},m={};function r(e){var f=m[e];if(void 0!==f)return f.exports;var t=m[e]={id:e,loaded:!1,exports:{}};return v[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=v,e=[],r.O=(f,t,i,o)=>{if(!t){var a=1/0;for(n=0;n<e.length;n++){for(var[t,i,o]=e[n],c=!0,l=0;l<t.length;l++)(!1&o||a>=o)&&Object.keys(r.O).every(b=>r.O[b](t[l]))?t.splice(l--,1):(c=!1,o<a&&(a=o));if(c){e.splice(n--,1);var d=i();void 0!==d&&(f=d)}}return f}o=o||0;for(var n=e.length;n>0&&e[n-1][2]>o;n--)e[n]=e[n-1];e[n]=[t,i,o]},r.d=(e,f)=>{for(var t in f)r.o(f,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:f[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((f,t)=>(r.f[t](e,f),f),[])),r.u=e=>e+"."+{258:"82f463c92bfb465c",267:"6c439858ec5d06c8",564:"456719c78487c8a1",636:"5b9b8a74b97febb5"}[e]+".js",r.miniCssF=e=>{},r.o=(e,f)=>Object.prototype.hasOwnProperty.call(e,f),(()=>{var e={},f="RTLApp:";r.l=(t,i,o,n)=>{if(e[t])e[t].push(i);else{var a,c;if(void 0!==o)for(var l=document.getElementsByTagName("script"),d=0;d<l.length;d++){var u=l[d];if(u.getAttribute("src")==t||u.getAttribute("data-webpack")==f+o){a=u;break}}a||(c=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",f+o),a.src=r.tu(t)),e[t]=[i];var s=(g,b)=>{a.onerror=a.onload=null,clearTimeout(p);var h=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),h&&h.forEach(y=>y(b)),g)return g(b)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),c&&document.head.appendChild(a)}}})(),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:f=>f},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={666:0};r.f.j=(i,o)=>{var n=r.o(e,i)?e[i]:void 0;if(0!==n)if(n)o.push(n[2]);else if(666!=i){var a=new Promise((u,s)=>n=e[i]=[u,s]);o.push(n[2]=a);var c=r.p+r.u(i),l=new Error;r.l(c,u=>{if(r.o(e,i)&&(0!==(n=e[i])&&(e[i]=void 0),n)){var s=u&&("load"===u.type?"missing":u.type),p=u&&u.target&&u.target.src;l.message="Loading chunk "+i+" failed.\n("+s+": "+p+")",l.name="ChunkLoadError",l.type=s,l.request=p,n[1](l)}},"chunk-"+i,i)}else e[i]=0},r.O.j=i=>0===e[i];var f=(i,o)=>{var l,d,[n,a,c]=o,u=0;if(n.some(p=>0!==e[p])){for(l in a)r.o(a,l)&&(r.m[l]=a[l]);if(c)var s=c(r)}for(i&&i(o);u<n.length;u++)r.o(e,d=n[u])&&e[d]&&e[d][0](),e[d]=0;return r.O(s)},t=self.webpackChunkRTLApp=self.webpackChunkRTLApp||[];t.forEach(f.bind(null,0)),t.push=f.bind(null,t.push.bind(t))})()})();

@ -1,5 +1,5 @@
import { HammerModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { NgModule, isDevMode } from '@angular/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { LayoutModule } from '@angular/cdk/layout';
@ -13,7 +13,6 @@ import { routing } from './app.routing';
import { SharedModule } from './shared/shared.module';
import { AppComponent } from './app.component';
import { environment } from '../environments/environment';
import { AuthGuard } from './shared/services/auth.guard';
import { AuthInterceptor } from './shared/services/auth.interceptor';
import { SessionService } from './shared/services/session.service';
@ -32,6 +31,9 @@ import { LNDReducer } from './lnd/store/lnd.reducers';
import { CLNReducer } from './cln/store/cln.reducers';
import { ECLReducer } from './eclair/store/ecl.reducers';
let isDevEnvironemt = false;
if (isDevMode()) { isDevEnvironemt = true; }
@NgModule({
imports: [
BrowserAnimationsModule,
@ -49,7 +51,7 @@ import { ECLReducer } from './eclair/store/ecl.reducers';
}
}),
EffectsModule.forRoot([RTLEffects, LNDEffects, CLNEffects, ECLEffects]),
!environment.production ? StoreDevtoolsModule.instrument() : []
isDevEnvironemt ? StoreDevtoolsModule.instrument() : []
],
declarations: [AppComponent],
providers: [

@ -7,7 +7,6 @@ import { Subject, of } from 'rxjs';
import { map, mergeMap, catchError, takeUntil } from 'rxjs/operators';
import { Location } from '@angular/common';
import { environment, API_URL } from '../../../environments/environment';
import { LoggerService } from '../../shared/services/logger.service';
import { CommonService } from '../../shared/services/common.service';
import { SessionService } from '../../shared/services/session.service';
@ -15,7 +14,7 @@ import { WebSocketClientService } from '../../shared/services/web-socket.service
import { ErrorMessageComponent } from '../../shared/components/data-modal/error-message/error-message.component';
import { CLNInvoiceInformationComponent } from '../transactions/invoices/invoice-information-modal/invoice-information.component';
import { GetInfo, Fees, Balance, LocalRemoteBalance, Payment, FeeRates, ListInvoices, Invoice, Peer, OnChain, QueryRoutes, SaveChannel, GetNewAddress, DetachPeer, UpdateChannel, CloseChannel, SendPayment, GetQueryRoutes, ChannelLookup, FetchInvoices, Channel, OfferInvoice, Offer } from '../../shared/models/clnModels';
import { AlertTypeEnum, APICallStatusEnum, UI_MESSAGES, CLNWSEventTypeEnum, CLNActions, RTLActions, CLNForwardingEventsStatusEnum } from '../../shared/services/consts-enums-functions';
import { API_URL, API_END_POINTS, AlertTypeEnum, APICallStatusEnum, UI_MESSAGES, CLNWSEventTypeEnum, CLNActions, RTLActions, CLNForwardingEventsStatusEnum } 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';
@ -90,7 +89,7 @@ export class CLNEffects implements OnDestroy {
this.store.dispatch(setApiUrl({ payload: this.CHILD_API_URL }));
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchInfo', status: APICallStatusEnum.INITIATED } }));
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GET_NODE_INFO }));
return this.httpClient.get<GetInfo>(this.CHILD_API_URL + environment.GETINFO_API).
return this.httpClient.get<GetInfo>(this.CHILD_API_URL + API_END_POINTS.GETINFO_API).
pipe(
takeUntil(this.actions.pipe(ofType(RTLActions.SET_SELECTED_NODE))),
map((info) => {
@ -142,7 +141,7 @@ export class CLNEffects implements OnDestroy {
ofType(CLNActions.FETCH_FEES_CLN),
mergeMap(() => {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchFees', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<Fees>(this.CHILD_API_URL + environment.FEES_API);
return this.httpClient.get<Fees>(this.CHILD_API_URL + API_END_POINTS.FEES_API);
}),
map((fees) => {
this.logger.info(fees);
@ -162,7 +161,7 @@ export class CLNEffects implements OnDestroy {
ofType(CLNActions.FETCH_FEE_RATES_CLN),
mergeMap((action: { type: string, payload: string }) => {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchFeeRates' + action.payload, status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<FeeRates>(this.CHILD_API_URL + environment.NETWORK_API + '/feeRates/' + action.payload).
return this.httpClient.get<FeeRates>(this.CHILD_API_URL + API_END_POINTS.NETWORK_API + '/feeRates/' + action.payload).
pipe(
map((feeRates) => {
this.logger.info(feeRates);
@ -184,7 +183,7 @@ export class CLNEffects implements OnDestroy {
ofType(CLNActions.FETCH_BALANCE_CLN),
mergeMap(() => {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchBalance', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<Balance>(this.CHILD_API_URL + environment.BALANCE_API);
return this.httpClient.get<Balance>(this.CHILD_API_URL + API_END_POINTS.BALANCE_API);
}),
map((balance) => {
this.logger.info(balance);
@ -204,7 +203,7 @@ export class CLNEffects implements OnDestroy {
ofType(CLNActions.FETCH_LOCAL_REMOTE_BALANCE_CLN),
mergeMap(() => {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchLocalRemoteBalance', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<LocalRemoteBalance>(this.CHILD_API_URL + environment.CHANNELS_API + '/localRemoteBalance');
return this.httpClient.get<LocalRemoteBalance>(this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/localRemoteBalance');
}),
map((lrBalance) => {
this.logger.info(lrBalance);
@ -224,7 +223,7 @@ export class CLNEffects implements OnDestroy {
ofType(CLNActions.GET_NEW_ADDRESS_CLN),
mergeMap((action: { type: string, payload: GetNewAddress }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GENERATE_NEW_ADDRESS }));
return this.httpClient.get(this.CHILD_API_URL + environment.ON_CHAIN_API + '?type=' + action.payload.addressCode).
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.ON_CHAIN_API + '?type=' + action.payload.addressCode).
pipe(
map((newAddress: any) => {
this.logger.info(newAddress);
@ -235,7 +234,7 @@ export class CLNEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('GenerateNewAddress', UI_MESSAGES.GENERATE_NEW_ADDRESS, 'Generate New Address Failed', this.CHILD_API_URL + environment.ON_CHAIN_API + '?type=' + action.payload.addressId, err);
this.handleErrorWithAlert('GenerateNewAddress', UI_MESSAGES.GENERATE_NEW_ADDRESS, 'Generate New Address Failed', this.CHILD_API_URL + API_END_POINTS.ON_CHAIN_API + '?type=' + action.payload.addressId, err);
return of({ type: RTLActions.VOID });
})
);
@ -257,7 +256,7 @@ export class CLNEffects implements OnDestroy {
ofType(CLNActions.FETCH_PEERS_CLN),
mergeMap(() => {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchPeers', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.PEERS_API).
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.PEERS_API).
pipe(
map((peers: any) => {
this.logger.info(peers);
@ -280,7 +279,7 @@ export class CLNEffects implements OnDestroy {
mergeMap((action: { type: string, payload: { id: string } }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.CONNECT_PEER }));
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'SaveNewPeer', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post<Peer[]>(this.CHILD_API_URL + environment.PEERS_API, { id: action.payload.id }).
return this.httpClient.post<Peer[]>(this.CHILD_API_URL + API_END_POINTS.PEERS_API, { id: action.payload.id }).
pipe(
map((postRes: Peer[]) => {
this.logger.info(postRes);
@ -304,7 +303,7 @@ export class CLNEffects implements OnDestroy {
ofType(CLNActions.DETACH_PEER_CLN),
mergeMap((action: { type: string, payload: DetachPeer }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.DISCONNECT_PEER }));
return this.httpClient.delete(this.CHILD_API_URL + environment.PEERS_API + '/' + action.payload.id + '?force=' + action.payload.force).
return this.httpClient.delete(this.CHILD_API_URL + API_END_POINTS.PEERS_API + '/' + action.payload.id + '?force=' + action.payload.force).
pipe(
map((postRes: any) => {
this.logger.info(postRes);
@ -316,7 +315,7 @@ export class CLNEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('PeerDisconnect', UI_MESSAGES.DISCONNECT_PEER, 'Unable to Detach Peer. Try again later.', this.CHILD_API_URL + environment.PEERS_API + '/' + action.payload.id, err);
this.handleErrorWithAlert('PeerDisconnect', UI_MESSAGES.DISCONNECT_PEER, 'Unable to Detach Peer. Try again later.', this.CHILD_API_URL + API_END_POINTS.PEERS_API + '/' + action.payload.id, err);
return of({ type: RTLActions.VOID });
})
);
@ -327,7 +326,7 @@ export class CLNEffects implements OnDestroy {
ofType(CLNActions.FETCH_CHANNELS_CLN),
mergeMap(() => {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchChannels', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<Channel[]>(this.CHILD_API_URL + environment.CHANNELS_API + '/listChannels');
return this.httpClient.get<Channel[]>(this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/listChannels');
}),
map((channels: Channel[]) => {
this.logger.info(channels);
@ -366,7 +365,7 @@ export class CLNEffects implements OnDestroy {
if (action.payload.utxos) { newPayload['utxos'] = action.payload.utxos; }
if (action.payload.requestAmount) { newPayload['request_amt'] = action.payload.requestAmount; }
if (action.payload.compactLease) { newPayload['compact_lease'] = action.payload.compactLease; }
return this.httpClient.post(this.CHILD_API_URL + environment.CHANNELS_API, newPayload).
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.CHANNELS_API, newPayload).
pipe(
map((postRes: any) => {
this.logger.info(postRes);
@ -392,7 +391,7 @@ export class CLNEffects implements OnDestroy {
mergeMap((action: { type: string, payload: UpdateChannel }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.UPDATE_CHAN_POLICY }));
return this.httpClient.post(
this.CHILD_API_URL + environment.CHANNELS_API + '/setChannelFee',
this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/setChannelFee',
{ id: action.payload.channelId, base: action.payload.baseFeeMsat, ppm: action.payload.feeRate }
).pipe(map((postRes: any) => {
this.logger.info(postRes);
@ -406,7 +405,7 @@ export class CLNEffects implements OnDestroy {
type: CLNActions.FETCH_CHANNELS_CLN
};
}), catchError((err: any) => {
this.handleErrorWithAlert('UpdateChannel', UI_MESSAGES.UPDATE_CHAN_POLICY, 'Update Channel Failed', this.CHILD_API_URL + environment.CHANNELS_API, err);
this.handleErrorWithAlert('UpdateChannel', UI_MESSAGES.UPDATE_CHAN_POLICY, 'Update Channel Failed', this.CHILD_API_URL + API_END_POINTS.CHANNELS_API, err);
return of({ type: RTLActions.VOID });
})
);
@ -418,7 +417,7 @@ export class CLNEffects implements OnDestroy {
mergeMap((action: { type: string, payload: CloseChannel }) => {
this.store.dispatch(openSpinner({ payload: (action.payload.force ? UI_MESSAGES.FORCE_CLOSE_CHANNEL : UI_MESSAGES.CLOSE_CHANNEL) }));
const queryParam = action.payload.force ? '?force=' + action.payload.force : '';
return this.httpClient.delete(this.CHILD_API_URL + environment.CHANNELS_API + '/' + action.payload.channelId + queryParam).
return this.httpClient.delete(this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/' + action.payload.channelId + queryParam).
pipe(
map((postRes: any) => {
this.logger.info(postRes);
@ -432,7 +431,7 @@ export class CLNEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('CloseChannel', (action.payload.force ? UI_MESSAGES.FORCE_CLOSE_CHANNEL : UI_MESSAGES.CLOSE_CHANNEL), 'Unable to Close Channel. Try again later.', this.CHILD_API_URL + environment.CHANNELS_API, err);
this.handleErrorWithAlert('CloseChannel', (action.payload.force ? UI_MESSAGES.FORCE_CLOSE_CHANNEL : UI_MESSAGES.CLOSE_CHANNEL), 'Unable to Close Channel. Try again later.', this.CHILD_API_URL + API_END_POINTS.CHANNELS_API, err);
return of({ type: RTLActions.VOID });
})
);
@ -443,7 +442,7 @@ export class CLNEffects implements OnDestroy {
ofType(CLNActions.FETCH_PAYMENTS_CLN),
mergeMap(() => {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchPayments', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<Payment[]>(this.CHILD_API_URL + environment.PAYMENTS_API);
return this.httpClient.get<Payment[]>(this.CHILD_API_URL + API_END_POINTS.PAYMENTS_API);
}),
map((payments) => {
this.logger.info(payments);
@ -465,7 +464,7 @@ export class CLNEffects implements OnDestroy {
mergeMap((action: { type: string, payload: { offer: string, msatoshi?: string } }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.FETCH_INVOICE }));
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchOfferInvoice', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(this.CHILD_API_URL + environment.OFFERS_API + '/fetchOfferInvoice', action.payload).
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.OFFERS_API + '/fetchOfferInvoice', action.payload).
pipe(
map((fetchedInvoice: any) => {
this.logger.info(fetchedInvoice);
@ -500,7 +499,7 @@ export class CLNEffects implements OnDestroy {
mergeMap((action: { type: string, payload: SendPayment }) => {
this.store.dispatch(openSpinner({ payload: action.payload.uiMessage }));
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'SendPayment', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(this.CHILD_API_URL + environment.PAYMENTS_API, action.payload).pipe(
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.PAYMENTS_API, action.payload).pipe(
map((sendRes: any) => {
this.logger.info(sendRes);
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'SendPayment', status: APICallStatusEnum.COMPLETED } }));
@ -526,7 +525,7 @@ export class CLNEffects implements OnDestroy {
if (action.payload.fromDialog) {
this.handleErrorWithoutAlert('SendPayment', action.payload.uiMessage, 'Send Payment Failed.', err);
} else {
this.handleErrorWithAlert('SendPayment', action.payload.uiMessage, 'Send Payment Failed', this.CHILD_API_URL + environment.PAYMENTS_API, err);
this.handleErrorWithAlert('SendPayment', action.payload.uiMessage, 'Send Payment Failed', this.CHILD_API_URL + API_END_POINTS.PAYMENTS_API, err);
}
return of({ type: RTLActions.VOID });
})
@ -539,7 +538,7 @@ export class CLNEffects implements OnDestroy {
ofType(CLNActions.GET_QUERY_ROUTES_CLN),
mergeMap((action: { type: string, payload: GetQueryRoutes }) => {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'GetQueryRoutes', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.NETWORK_API + '/getRoute/' + action.payload.destPubkey + '/' + action.payload.amount).
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.NETWORK_API + '/getRoute/' + action.payload.destPubkey + '/' + action.payload.amount).
pipe(
map((qrRes: any) => {
this.logger.info(qrRes);
@ -551,7 +550,7 @@ export class CLNEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(setQueryRoutes({ payload: { routes: [] } }));
this.handleErrorWithAlert('GetQueryRoutes', UI_MESSAGES.NO_SPINNER, 'Get Query Routes Failed', this.CHILD_API_URL + environment.NETWORK_API + '/getRoute/' + action.payload.destPubkey + '/' + action.payload.amount, err);
this.handleErrorWithAlert('GetQueryRoutes', UI_MESSAGES.NO_SPINNER, 'Get Query Routes Failed', this.CHILD_API_URL + API_END_POINTS.NETWORK_API + '/getRoute/' + action.payload.destPubkey + '/' + action.payload.amount, err);
return of({ type: RTLActions.VOID });
})
);
@ -571,7 +570,7 @@ export class CLNEffects implements OnDestroy {
mergeMap((action: { type: string, payload: string }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.SEARCHING_NODE }));
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'Lookup', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.NETWORK_API + '/listNode/' + action.payload).
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.NETWORK_API + '/listNode/' + action.payload).
pipe(
map((resPeer) => {
this.logger.info(resPeer);
@ -583,7 +582,7 @@ export class CLNEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('Lookup', UI_MESSAGES.SEARCHING_NODE, 'Peer Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/listNode/' + action.payload, err);
this.handleErrorWithAlert('Lookup', UI_MESSAGES.SEARCHING_NODE, 'Peer Lookup Failed', this.CHILD_API_URL + API_END_POINTS.NETWORK_API + '/listNode/' + action.payload, err);
return of({ type: RTLActions.VOID });
})
);
@ -595,7 +594,7 @@ export class CLNEffects implements OnDestroy {
mergeMap((action: { type: string, payload: ChannelLookup }) => {
this.store.dispatch(openSpinner({ payload: action.payload.uiMessage }));
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'Lookup', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.NETWORK_API + '/listChannel/' + action.payload.shortChannelID).
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.NETWORK_API + '/listChannel/' + action.payload.shortChannelID).
pipe(
map((resChannel) => {
this.logger.info(resChannel);
@ -608,7 +607,7 @@ export class CLNEffects implements OnDestroy {
}),
catchError((err: any) => {
if (action.payload.showError) {
this.handleErrorWithAlert('Lookup', action.payload.uiMessage, 'Channel Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/listChannel/' + action.payload.shortChannelID, err);
this.handleErrorWithAlert('Lookup', action.payload.uiMessage, 'Channel Lookup Failed', this.CHILD_API_URL + API_END_POINTS.NETWORK_API + '/listChannel/' + action.payload.shortChannelID, err);
} else {
this.store.dispatch(closeSpinner({ payload: action.payload.uiMessage }));
}
@ -624,7 +623,7 @@ export class CLNEffects implements OnDestroy {
mergeMap((action: { type: string, payload: string }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.SEARCHING_INVOICE }));
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'Lookup', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.INVOICES_API + '?label=' + action.payload).
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.INVOICES_API + '?label=' + action.payload).
pipe(
map((resInvoice: any) => {
this.logger.info(resInvoice);
@ -663,7 +662,7 @@ export class CLNEffects implements OnDestroy {
mergeMap((action: { type: string, payload: { status: string } }) => {
const statusInitial = action.payload.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 + '/listForwards?status=' + action.payload.status).
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/listForwards?status=' + action.payload.status).
pipe(
map((fhRes: any) => {
this.logger.info(fhRes);
@ -678,7 +677,7 @@ export class CLNEffects implements OnDestroy {
return { type: RTLActions.VOID };
}),
catchError((err: any) => {
this.handleErrorWithAlert('FetchForwardingHistory' + statusInitial, UI_MESSAGES.NO_SPINNER, 'Get ' + action.payload.status + ' Forwarding History Failed', this.CHILD_API_URL + environment.CHANNELS_API + '/listForwards?status=' + action.payload.status, err);
this.handleErrorWithAlert('FetchForwardingHistory' + statusInitial, UI_MESSAGES.NO_SPINNER, 'Get ' + action.payload.status + ' Forwarding History Failed', this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/listForwards?status=' + action.payload.status, err);
return of({ type: RTLActions.VOID });
})
);
@ -690,7 +689,7 @@ export class CLNEffects implements OnDestroy {
mergeMap((action: { type: string, payload: number }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.DELETE_INVOICE }));
const queryStr = (action.payload) ? '?maxexpiry=' + action.payload : '';
return this.httpClient.delete(this.CHILD_API_URL + environment.INVOICES_API + queryStr).
return this.httpClient.delete(this.CHILD_API_URL + API_END_POINTS.INVOICES_API + queryStr).
pipe(
map((postRes: any) => {
this.logger.info(postRes);
@ -702,7 +701,7 @@ export class CLNEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('DeleteInvoices', UI_MESSAGES.DELETE_INVOICE, 'Delete Invoice Failed', this.CHILD_API_URL + environment.INVOICES_API, err);
this.handleErrorWithAlert('DeleteInvoices', UI_MESSAGES.DELETE_INVOICE, 'Delete Invoice Failed', this.CHILD_API_URL + API_END_POINTS.INVOICES_API, err);
return of({ type: RTLActions.VOID });
})
);
@ -714,7 +713,7 @@ export class CLNEffects implements OnDestroy {
mergeMap((action: { type: string, payload: { amount: number, label: string, description: string, expiry: number, private: boolean } }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.ADD_INVOICE }));
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'SaveNewInvoice', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(this.CHILD_API_URL + environment.INVOICES_API, {
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.INVOICES_API, {
label: action.payload.label, amount: action.payload.amount, description: action.payload.description, expiry: action.payload.expiry, private: action.payload.private
}).
pipe(
@ -756,7 +755,7 @@ export class CLNEffects implements OnDestroy {
mergeMap((action: { type: string, payload: { amount: string, description: string, vendor: string } }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.CREATE_OFFER }));
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'SaveNewOffer', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(this.CHILD_API_URL + environment.OFFERS_API, {
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.OFFERS_API, {
amount: action.payload.amount, description: action.payload.description, vendor: action.payload.vendor
}).pipe(map((postRes: Offer) => {
this.logger.info(postRes);
@ -792,7 +791,7 @@ export class CLNEffects implements OnDestroy {
const num_max_invoices = (action.payload.num_max_invoices) ? action.payload.num_max_invoices : 1000000;
const index_offset = (action.payload.index_offset) ? action.payload.index_offset : 0;
const reversed = (action.payload.reversed) ? action.payload.reversed : true;
return this.httpClient.get<ListInvoices>(this.CHILD_API_URL + environment.INVOICES_API + '?num_max_invoices=' + num_max_invoices + '&index_offset=' + index_offset + '&reversed=' + reversed).
return this.httpClient.get<ListInvoices>(this.CHILD_API_URL + API_END_POINTS.INVOICES_API + '?num_max_invoices=' + num_max_invoices + '&index_offset=' + index_offset + '&reversed=' + reversed).
pipe(
map((res: ListInvoices) => {
this.logger.info(res);
@ -814,7 +813,7 @@ export class CLNEffects implements OnDestroy {
ofType(CLNActions.FETCH_OFFERS_CLN),
mergeMap((action: { type: string, payload: any }) => {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchOffers', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.OFFERS_API).
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.OFFERS_API).
pipe(map((res: any) => {
this.logger.info(res);
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchOffers', status: APICallStatusEnum.COMPLETED } }));
@ -834,7 +833,7 @@ export class CLNEffects implements OnDestroy {
mergeMap((action: { type: string, payload: { offer_id: string } }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.DISABLE_OFFER }));
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'DisableOffer', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.delete(this.CHILD_API_URL + environment.OFFERS_API + '/' + action.payload.offer_id).
return this.httpClient.delete(this.CHILD_API_URL + API_END_POINTS.OFFERS_API + '/' + action.payload.offer_id).
pipe(map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'DisableOffer', status: APICallStatusEnum.COMPLETED } }));
@ -855,7 +854,7 @@ export class CLNEffects implements OnDestroy {
ofType(CLNActions.FETCH_OFFER_BOOKMARKS_CLN),
mergeMap((action: { type: string, payload: any }) => {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchOfferBookmarks', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.OFFERS_API + '/offerbookmarks').
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.OFFERS_API + '/offerbookmarks').
pipe(map((res: any) => {
this.logger.info(res);
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchOfferBookmarks', status: APICallStatusEnum.COMPLETED } }));
@ -875,7 +874,7 @@ export class CLNEffects implements OnDestroy {
mergeMap((action: { type: string, payload: { bolt12: string } }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.DELETE_OFFER_BOOKMARK }));
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'DeleteOfferBookmark', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.delete(this.CHILD_API_URL + environment.OFFERS_API + '/offerbookmark/' + action.payload.bolt12).
return this.httpClient.delete(this.CHILD_API_URL + API_END_POINTS.OFFERS_API + '/offerbookmark/' + action.payload.bolt12).
pipe(map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'DeleteOfferBookmark', status: APICallStatusEnum.COMPLETED } }));
@ -886,7 +885,7 @@ export class CLNEffects implements OnDestroy {
payload: { bolt12: action.payload.bolt12 }
};
}), catchError((err: any) => {
this.handleErrorWithAlert('DeleteOfferBookmark', UI_MESSAGES.DELETE_OFFER_BOOKMARK, 'Deleting Offer Bookmark Failed.', this.CHILD_API_URL + environment.OFFERS_API + '/offerbookmark/' + action.payload.bolt12, err);
this.handleErrorWithAlert('DeleteOfferBookmark', UI_MESSAGES.DELETE_OFFER_BOOKMARK, 'Deleting Offer Bookmark Failed.', this.CHILD_API_URL + API_END_POINTS.OFFERS_API + '/offerbookmark/' + action.payload.bolt12, err);
return of({ type: RTLActions.VOID });
}));
})
@ -897,7 +896,7 @@ export class CLNEffects implements OnDestroy {
mergeMap((action: { type: string, payload: OnChain }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.SEND_FUNDS }));
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'SetChannelTransaction', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(this.CHILD_API_URL + environment.ON_CHAIN_API, action.payload).
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.ON_CHAIN_API, action.payload).
pipe(
map((postRes: any) => {
this.logger.info(postRes);
@ -922,7 +921,7 @@ export class CLNEffects implements OnDestroy {
ofType(CLNActions.FETCH_UTXOS_CLN),
mergeMap(() => {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchUTXOs', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.ON_CHAIN_API + '/utxos');
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.ON_CHAIN_API + '/utxos');
}),
map((utxos: any) => {
this.logger.info(utxos);
@ -942,7 +941,7 @@ export class CLNEffects implements OnDestroy {
ofType(CLNActions.FETCH_PAGE_SETTINGS_CLN),
mergeMap(() => {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchPageSettings', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(environment.PAGE_SETTINGS_API).pipe(
return this.httpClient.get(API_END_POINTS.PAGE_SETTINGS_API).pipe(
map((pageSettings: any) => {
this.logger.info(pageSettings);
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchPageSettings', status: APICallStatusEnum.COMPLETED } }));
@ -964,7 +963,7 @@ export class CLNEffects implements OnDestroy {
mergeMap((action: { type: string, payload: any }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.UPDATE_PAGE_SETTINGS }));
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'SavePageSettings', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(environment.PAGE_SETTINGS_API, action.payload).
return this.httpClient.post(API_END_POINTS.PAGE_SETTINGS_API, action.payload).
pipe(
map((postRes: any) => {
this.logger.info(postRes);
@ -977,7 +976,7 @@ export class CLNEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('SavePageSettings', UI_MESSAGES.UPDATE_PAGE_SETTINGS, 'Page Settings Update Failed.', environment.PAGE_SETTINGS_API, err);
this.handleErrorWithAlert('SavePageSettings', UI_MESSAGES.UPDATE_PAGE_SETTINGS, 'Page Settings Update Failed.', API_END_POINTS.PAGE_SETTINGS_API, err);
return of({ type: RTLActions.VOID });
})
);

@ -7,7 +7,6 @@ import { Subject, of } from 'rxjs';
import { map, mergeMap, catchError, takeUntil } from 'rxjs/operators';
import { Location } from '@angular/common';
import { environment, API_URL } from '../../../environments/environment';
import { LoggerService } from '../../shared/services/logger.service';
import { SessionService } from '../../shared/services/session.service';
import { CommonService } from '../../shared/services/common.service';
@ -15,7 +14,7 @@ import { WebSocketClientService } from '../../shared/services/web-socket.service
import { ErrorMessageComponent } from '../../shared/components/data-modal/error-message/error-message.component';
import { GetInfo, OnChainBalance, Peer, Audit, Transaction, Invoice, Channel, ChannelStateUpdate, SaveChannel, UpdateChannel, CloseChannel,
GetQueryRoutes, QueryRoutes, SendPayment, SendPaymentOnChain, CreateInvoice } from '../../shared/models/eclModels';
import { RTLActions, ECLActions, APICallStatusEnum, UI_MESSAGES, ECLWSEventTypeEnum } from '../../shared/services/consts-enums-functions';
import { API_URL, API_END_POINTS, RTLActions, ECLActions, APICallStatusEnum, UI_MESSAGES, ECLWSEventTypeEnum } from '../../shared/services/consts-enums-functions';
import { closeAllDialogs, closeSpinner, logout, openAlert, openSnackBar, openSpinner, setApiUrl, setNodeData } from '../../store/rtl.actions';
import { ECLInvoiceInformationComponent } from '../transactions/invoice-information-modal/invoice-information.component';
@ -117,7 +116,7 @@ export class ECLEffects implements OnDestroy {
this.store.dispatch(setApiUrl({ payload: this.CHILD_API_URL }));
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GET_NODE_INFO }));
this.store.dispatch(updateECLAPICallStatus({ payload: { action: 'FetchInfo', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<GetInfo>(this.CHILD_API_URL + environment.GETINFO_API).
return this.httpClient.get<GetInfo>(this.CHILD_API_URL + API_END_POINTS.GETINFO_API).
pipe(
takeUntil(this.actions.pipe(ofType(RTLActions.SET_SELECTED_NODE))),
map((info) => {
@ -145,7 +144,7 @@ export class ECLEffects implements OnDestroy {
ofType(ECLActions.FETCH_FEES_ECL),
mergeMap(() => {
this.store.dispatch(updateECLAPICallStatus({ payload: { action: 'FetchFees', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<Audit>(this.CHILD_API_URL + environment.FEES_API + '/fees').
return this.httpClient.get<Audit>(this.CHILD_API_URL + API_END_POINTS.FEES_API + '/fees').
pipe(
map((fees: any) => {
this.logger.info(fees);
@ -167,7 +166,7 @@ export class ECLEffects implements OnDestroy {
ofType(ECLActions.FETCH_PAYMENTS_ECL),
mergeMap(() => {
this.store.dispatch(updateECLAPICallStatus({ payload: { action: 'FetchPayments', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<Audit>(this.CHILD_API_URL + environment.FEES_API + '/payments').
return this.httpClient.get<Audit>(this.CHILD_API_URL + API_END_POINTS.FEES_API + '/payments').
pipe(
map((payments: any) => {
this.logger.info(payments);
@ -189,7 +188,7 @@ export class ECLEffects implements OnDestroy {
ofType(ECLActions.FETCH_CHANNELS_ECL),
mergeMap((action: { type: string, payload: { fetchPayments: boolean } }) => {
this.store.dispatch(updateECLAPICallStatus({ payload: { action: 'FetchChannels', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<Channel[]>(this.CHILD_API_URL + environment.CHANNELS_API).
return this.httpClient.get<Channel[]>(this.CHILD_API_URL + API_END_POINTS.CHANNELS_API).
pipe(
map((channelsRes: Channel[]) => {
this.logger.info(channelsRes);
@ -213,7 +212,7 @@ export class ECLEffects implements OnDestroy {
ofType(ECLActions.FETCH_ONCHAIN_BALANCE_ECL),
mergeMap(() => {
this.store.dispatch(updateECLAPICallStatus({ payload: { action: 'FetchOnchainBalance', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<OnChainBalance>(this.CHILD_API_URL + environment.ON_CHAIN_API + '/balance');
return this.httpClient.get<OnChainBalance>(this.CHILD_API_URL + API_END_POINTS.ON_CHAIN_API + '/balance');
}),
map((balance) => {
this.logger.info(balance);
@ -233,7 +232,7 @@ export class ECLEffects implements OnDestroy {
ofType(ECLActions.FETCH_PEERS_ECL),
mergeMap(() => {
this.store.dispatch(updateECLAPICallStatus({ payload: { action: 'FetchPeers', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<Peer[]>(this.CHILD_API_URL + environment.PEERS_API).
return this.httpClient.get<Peer[]>(this.CHILD_API_URL + API_END_POINTS.PEERS_API).
pipe(
map((peers: Peer[]) => {
this.logger.info(peers);
@ -255,7 +254,7 @@ export class ECLEffects implements OnDestroy {
ofType(ECLActions.GET_NEW_ADDRESS_ECL),
mergeMap(() => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GENERATE_NEW_ADDRESS }));
return this.httpClient.get(this.CHILD_API_URL + environment.ON_CHAIN_API).
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.ON_CHAIN_API).
pipe(
map((newAddress: any) => {
this.logger.info(newAddress);
@ -266,7 +265,7 @@ export class ECLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('GetNewAddress', UI_MESSAGES.GENERATE_NEW_ADDRESS, 'Generate New Address Failed', this.CHILD_API_URL + environment.ON_CHAIN_API, err);
this.handleErrorWithAlert('GetNewAddress', UI_MESSAGES.GENERATE_NEW_ADDRESS, 'Generate New Address Failed', this.CHILD_API_URL + API_END_POINTS.ON_CHAIN_API, err);
return of({ type: RTLActions.VOID });
})
);
@ -288,7 +287,7 @@ export class ECLEffects implements OnDestroy {
mergeMap((action: { type: string, payload: { id: string } }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.CONNECT_PEER }));
this.store.dispatch(updateECLAPICallStatus({ payload: { action: 'SaveNewPeer', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post<Peer[]>(this.CHILD_API_URL + environment.PEERS_API + ((action.payload.id.includes('@') ? '?uri=' : '?nodeId=') + action.payload.id), {}).
return this.httpClient.post<Peer[]>(this.CHILD_API_URL + API_END_POINTS.PEERS_API + ((action.payload.id.includes('@') ? '?uri=' : '?nodeId=') + action.payload.id), {}).
pipe(
map((postRes: Peer[]) => {
this.logger.info(postRes);
@ -313,7 +312,7 @@ export class ECLEffects implements OnDestroy {
ofType(ECLActions.DETACH_PEER_ECL),
mergeMap((action: { type: string, payload: { nodeId: string } }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.DISCONNECT_PEER }));
return this.httpClient.delete(this.CHILD_API_URL + environment.PEERS_API + '/' + action.payload.nodeId).
return this.httpClient.delete(this.CHILD_API_URL + API_END_POINTS.PEERS_API + '/' + action.payload.nodeId).
pipe(
map((postRes: any) => {
this.logger.info(postRes);
@ -325,7 +324,7 @@ export class ECLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('DisconnectPeer', UI_MESSAGES.DISCONNECT_PEER, 'Unable to Detach Peer. Try again later.', this.CHILD_API_URL + environment.PEERS_API + '/' + action.payload.nodeId, err);
this.handleErrorWithAlert('DisconnectPeer', UI_MESSAGES.DISCONNECT_PEER, 'Unable to Detach Peer. Try again later.', this.CHILD_API_URL + API_END_POINTS.PEERS_API + '/' + action.payload.nodeId, err);
return of({ type: RTLActions.VOID });
})
);
@ -341,7 +340,7 @@ export class ECLEffects implements OnDestroy {
if (action.payload.feeRate && action.payload.feeRate > 0) {
reqBody['fundingFeerateSatByte'] = action.payload.feeRate;
}
return this.httpClient.post(this.CHILD_API_URL + environment.CHANNELS_API, reqBody).
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.CHANNELS_API, reqBody).
pipe(
map((postRes: any) => {
this.logger.info(postRes);
@ -377,7 +376,7 @@ export class ECLEffects implements OnDestroy {
} else {
queryParam = queryParam + '&channelId=' + action.payload.channelId;
}
return this.httpClient.post(this.CHILD_API_URL + environment.CHANNELS_API + '/updateRelayFee' + queryParam, {}).
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/updateRelayFee' + queryParam, {}).
pipe(
map((postRes: any) => {
this.logger.info(postRes);
@ -393,7 +392,7 @@ export class ECLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('UpdateChannels', UI_MESSAGES.UPDATE_CHAN_POLICY, 'Update Channel Failed', this.CHILD_API_URL + environment.CHANNELS_API, err);
this.handleErrorWithAlert('UpdateChannels', UI_MESSAGES.UPDATE_CHAN_POLICY, 'Update Channel Failed', this.CHILD_API_URL + API_END_POINTS.CHANNELS_API, err);
return of({ type: RTLActions.VOID });
})
);
@ -404,7 +403,7 @@ export class ECLEffects implements OnDestroy {
ofType(ECLActions.CLOSE_CHANNEL_ECL),
mergeMap((action: { type: string, payload: CloseChannel }) => {
this.store.dispatch(openSpinner({ payload: ((action.payload.force) ? UI_MESSAGES.FORCE_CLOSE_CHANNEL : UI_MESSAGES.CLOSE_CHANNEL) }));
return this.httpClient.delete(this.CHILD_API_URL + environment.CHANNELS_API + '?channelId=' + action.payload.channelId + '&force=' + action.payload.force).
return this.httpClient.delete(this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '?channelId=' + action.payload.channelId + '&force=' + action.payload.force).
pipe(
map((postRes: any) => {
this.logger.info(postRes);
@ -418,7 +417,7 @@ export class ECLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('CloseChannel', ((action.payload.force) ? UI_MESSAGES.FORCE_CLOSE_CHANNEL : UI_MESSAGES.CLOSE_CHANNEL), 'Unable to Close Channel. Try again later.', this.CHILD_API_URL + environment.CHANNELS_API, err);
this.handleErrorWithAlert('CloseChannel', ((action.payload.force) ? UI_MESSAGES.FORCE_CLOSE_CHANNEL : UI_MESSAGES.CLOSE_CHANNEL), 'Unable to Close Channel. Try again later.', this.CHILD_API_URL + API_END_POINTS.CHANNELS_API, err);
return of({ type: RTLActions.VOID });
})
);
@ -427,7 +426,7 @@ export class ECLEffects implements OnDestroy {
queryRoutesFetch = createEffect(() => this.actions.pipe(
ofType(ECLActions.GET_QUERY_ROUTES_ECL),
mergeMap((action: { type: string, payload: GetQueryRoutes }) => this.httpClient.get(this.CHILD_API_URL + environment.PAYMENTS_API + '/route?nodeId=' + action.payload.nodeId + '&amountMsat=' + action.payload.amount).
mergeMap((action: { type: string, payload: GetQueryRoutes }) => this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.PAYMENTS_API + '/route?nodeId=' + action.payload.nodeId + '&amountMsat=' + action.payload.amount).
pipe(
map((qrRes: any) => {
this.logger.info(qrRes);
@ -438,7 +437,7 @@ export class ECLEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(setQueryRoutes({ payload: [] }));
this.handleErrorWithAlert('GetQueryRoutes', UI_MESSAGES.NO_SPINNER, 'Get Query Routes Failed', this.CHILD_API_URL + environment.PAYMENTS_API + '/route?nodeId=' + action.payload.nodeId + '&amountMsat=' + action.payload.amount, err);
this.handleErrorWithAlert('GetQueryRoutes', UI_MESSAGES.NO_SPINNER, 'Get Query Routes Failed', this.CHILD_API_URL + API_END_POINTS.PAYMENTS_API + '/route?nodeId=' + action.payload.nodeId + '&amountMsat=' + action.payload.amount, err);
return of({ type: RTLActions.VOID });
})
))
@ -458,7 +457,7 @@ export class ECLEffects implements OnDestroy {
this.latestPaymentRes = '';
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.SEND_PAYMENT }));
this.store.dispatch(updateECLAPICallStatus({ payload: { action: 'SendPayment', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(this.CHILD_API_URL + environment.PAYMENTS_API, action.payload).
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.PAYMENTS_API, action.payload).
pipe(
map((sendRes: any) => {
this.logger.info(sendRes);
@ -475,7 +474,7 @@ export class ECLEffects implements OnDestroy {
if (action.payload.fromDialog) {
this.handleErrorWithoutAlert('SendPayment', UI_MESSAGES.SEND_PAYMENT, 'Send Payment Failed.', err);
} else {
this.handleErrorWithAlert('SendPayment', UI_MESSAGES.SEND_PAYMENT, 'Send Payment Failed', this.CHILD_API_URL + environment.PAYMENTS_API, err);
this.handleErrorWithAlert('SendPayment', UI_MESSAGES.SEND_PAYMENT, 'Send Payment Failed', this.CHILD_API_URL + API_END_POINTS.PAYMENTS_API, err);
}
return of({ type: RTLActions.VOID });
})
@ -487,7 +486,7 @@ export class ECLEffects implements OnDestroy {
ofType(ECLActions.FETCH_TRANSACTIONS_ECL),
mergeMap(() => {
this.store.dispatch(updateECLAPICallStatus({ payload: { action: 'FetchTransactions', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<Transaction[]>(this.CHILD_API_URL + environment.ON_CHAIN_API + '/transactions?count=1000&skip=0');
return this.httpClient.get<Transaction[]>(this.CHILD_API_URL + API_END_POINTS.ON_CHAIN_API + '/transactions?count=1000&skip=0');
}),
map((transactions) => {
this.logger.info(transactions);
@ -508,7 +507,7 @@ export class ECLEffects implements OnDestroy {
mergeMap((action: { type: string, payload: SendPaymentOnChain }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.SEND_FUNDS }));
this.store.dispatch(updateECLAPICallStatus({ payload: { action: 'SendOnchainFunds', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(this.CHILD_API_URL + environment.ON_CHAIN_API, action.payload).
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.ON_CHAIN_API, action.payload).
pipe(
map((postRes: any) => {
this.logger.info(postRes);
@ -533,7 +532,7 @@ export class ECLEffects implements OnDestroy {
mergeMap((action: { type: string, payload: CreateInvoice }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.CREATE_INVOICE }));
this.store.dispatch(updateECLAPICallStatus({ payload: { action: 'CreateInvoice', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(this.CHILD_API_URL + environment.INVOICES_API, action.payload).
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.INVOICES_API, action.payload).
pipe(
map((postRes: Invoice) => {
this.logger.info(postRes);
@ -571,7 +570,7 @@ export class ECLEffects implements OnDestroy {
ofType(ECLActions.FETCH_INVOICES_ECL),
mergeMap(() => {
this.store.dispatch(updateECLAPICallStatus({ payload: { action: 'FetchInvoices', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<Invoice[]>(this.CHILD_API_URL + environment.INVOICES_API).
return this.httpClient.get<Invoice[]>(this.CHILD_API_URL + API_END_POINTS.INVOICES_API).
pipe(
map((res: Invoice[]) => {
this.logger.info(res);
@ -594,7 +593,7 @@ export class ECLEffects implements OnDestroy {
mergeMap((action: { type: string, payload: string }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.SEARCHING_NODE }));
this.store.dispatch(updateECLAPICallStatus({ payload: { action: 'Lookup', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.NETWORK_API + '/nodes/' + action.payload).
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.NETWORK_API + '/nodes/' + action.payload).
pipe(
map((resPeer) => {
this.logger.info(resPeer);
@ -606,7 +605,7 @@ export class ECLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('Lookup', UI_MESSAGES.SEARCHING_NODE, 'Peer Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/nodes/' + action.payload, err);
this.handleErrorWithAlert('Lookup', UI_MESSAGES.SEARCHING_NODE, 'Peer Lookup Failed', this.CHILD_API_URL + API_END_POINTS.NETWORK_API + '/nodes/' + action.payload, err);
return of({ type: RTLActions.VOID });
})
);
@ -618,7 +617,7 @@ export class ECLEffects implements OnDestroy {
mergeMap((action: { type: string, payload: string }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.SEARCHING_INVOICE }));
this.store.dispatch(updateECLAPICallStatus({ payload: { action: 'Lookup', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.INVOICES_API + '/' + action.payload).
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.INVOICES_API + '/' + action.payload).
pipe(
map((resInvoice) => {
this.logger.info(resInvoice);
@ -653,7 +652,7 @@ export class ECLEffects implements OnDestroy {
ofType(ECLActions.FETCH_PAGE_SETTINGS_ECL),
mergeMap(() => {
this.store.dispatch(updateECLAPICallStatus({ payload: { action: 'FetchPageSettings', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(environment.PAGE_SETTINGS_API).pipe(
return this.httpClient.get(API_END_POINTS.PAGE_SETTINGS_API).pipe(
map((pageSettings: any) => {
this.logger.info(pageSettings);
this.store.dispatch(updateECLAPICallStatus({ payload: { action: 'FetchPageSettings', status: APICallStatusEnum.COMPLETED } }));
@ -675,7 +674,7 @@ export class ECLEffects implements OnDestroy {
mergeMap((action: { type: string, payload: any }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.UPDATE_PAGE_SETTINGS }));
this.store.dispatch(updateECLAPICallStatus({ payload: { action: 'SavePageSettings', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(environment.PAGE_SETTINGS_API, action.payload).
return this.httpClient.post(API_END_POINTS.PAGE_SETTINGS_API, action.payload).
pipe(
map((postRes: any) => {
this.logger.info(postRes);
@ -688,7 +687,7 @@ export class ECLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('SavePageSettings', UI_MESSAGES.UPDATE_PAGE_SETTINGS, 'Page Settings Update Failed.', environment.PAGE_SETTINGS_API, err);
this.handleErrorWithAlert('SavePageSettings', UI_MESSAGES.UPDATE_PAGE_SETTINGS, 'Page Settings Update Failed.', API_END_POINTS.PAGE_SETTINGS_API, err);
return of({ type: RTLActions.VOID });
})
);

@ -9,7 +9,6 @@ import { map, mergeMap, catchError, withLatestFrom, takeUntil } from 'rxjs/opera
import { Location } from '@angular/common';
import { MatDialog } from '@angular/material/dialog';
import { environment, API_URL } from '../../../environments/environment';
import { LoggerService } from '../../shared/services/logger.service';
import { CommonService } from '../../shared/services/common.service';
import { SessionService } from '../../shared/services/session.service';
@ -19,7 +18,7 @@ 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 { 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 } 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';
@ -94,7 +93,7 @@ export class LNDEffects implements OnDestroy {
this.store.dispatch(closeAllDialogs());
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GET_NODE_INFO }));
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchInfo', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<GetInfo>(this.CHILD_API_URL + environment.GETINFO_API).pipe(
return this.httpClient.get<GetInfo>(this.CHILD_API_URL + API_END_POINTS.GETINFO_API).pipe(
takeUntil(this.actions.pipe(ofType(RTLActions.SET_SELECTED_NODE))),
map((info) => {
this.logger.info(info);
@ -166,7 +165,7 @@ export class LNDEffects implements OnDestroy {
ofType(LNDActions.FETCH_PEERS_LND),
mergeMap(() => {
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchPeers', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.PEERS_API).pipe(
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.PEERS_API).pipe(
map((peers: any) => {
this.logger.info(peers);
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchPeers', status: APICallStatusEnum.COMPLETED } }));
@ -188,7 +187,7 @@ export class LNDEffects implements OnDestroy {
mergeMap((action: { type: string, payload: SavePeer }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.CONNECT_PEER }));
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'SaveNewPeer', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(this.CHILD_API_URL + environment.PEERS_API, { pubkey: action.payload.pubkey, host: action.payload.host, perm: action.payload.perm }).pipe(
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.PEERS_API, { pubkey: action.payload.pubkey, host: action.payload.host, perm: action.payload.perm }).pipe(
map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'SaveNewPeer', status: APICallStatusEnum.COMPLETED } }));
@ -211,7 +210,7 @@ export class LNDEffects implements OnDestroy {
ofType(LNDActions.DETACH_PEER_LND),
mergeMap((action: { type: string, payload: { pubkey: string } }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.DISCONNECT_PEER }));
return this.httpClient.delete(this.CHILD_API_URL + environment.PEERS_API + '/' + action.payload.pubkey).pipe(
return this.httpClient.delete(this.CHILD_API_URL + API_END_POINTS.PEERS_API + '/' + action.payload.pubkey).pipe(
map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.DISCONNECT_PEER }));
@ -222,7 +221,7 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('DetachPeer', UI_MESSAGES.DISCONNECT_PEER, 'Unable to Detach Peer. Try again later.', this.CHILD_API_URL + environment.PEERS_API + '/' + action.payload.pubkey, err);
this.handleErrorWithAlert('DetachPeer', UI_MESSAGES.DISCONNECT_PEER, 'Unable to Detach Peer. Try again later.', this.CHILD_API_URL + API_END_POINTS.PEERS_API + '/' + action.payload.pubkey, err);
return of({ type: RTLActions.VOID });
})
);
@ -234,7 +233,7 @@ export class LNDEffects implements OnDestroy {
mergeMap((action: { type: string, payload: SaveInvoice }) => {
this.store.dispatch(openSpinner({ payload: action.payload.uiMessage }));
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'SaveNewInvoice', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(this.CHILD_API_URL + environment.INVOICES_API, {
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.INVOICES_API, {
memo: action.payload.memo, value: action.payload.value, private: action.payload.private, expiry: action.payload.expiry, is_amp: action.payload.is_amp
}).
pipe(
@ -285,7 +284,7 @@ export class LNDEffects implements OnDestroy {
mergeMap((action: { type: string, payload: SaveChannel }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.OPEN_CHANNEL }));
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'SaveNewChannel', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(this.CHILD_API_URL + environment.CHANNELS_API, {
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.CHANNELS_API, {
node_pubkey: action.payload.selectedPeerPubkey, local_funding_amount: action.payload.fundingAmount, private: action.payload.private,
trans_type: action.payload.transType, trans_type_value: action.payload.transTypeValue, spend_unconfirmed: action.payload.spendUnconfirmed
}).pipe(
@ -311,7 +310,7 @@ export class LNDEffects implements OnDestroy {
ofType(LNDActions.UPDATE_CHANNEL_LND),
mergeMap((action: { type: string, payload: any }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.UPDATE_CHAN_POLICY }));
return this.httpClient.post(this.CHILD_API_URL + environment.CHANNELS_API + '/chanPolicy',
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/chanPolicy',
{ baseFeeMsat: action.payload.baseFeeMsat,
feeRate: action.payload.feeRate,
timeLockDelta: action.payload.timeLockDelta,
@ -332,7 +331,7 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('UpdateChannels', UI_MESSAGES.UPDATE_CHAN_POLICY, 'Update Channel Failed', this.CHILD_API_URL + environment.CHANNELS_API + '/chanPolicy', err);
this.handleErrorWithAlert('UpdateChannels', UI_MESSAGES.UPDATE_CHAN_POLICY, 'Update Channel Failed', this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/chanPolicy', err);
return of({ type: RTLActions.VOID });
}));
}))
@ -342,7 +341,7 @@ export class LNDEffects implements OnDestroy {
ofType(LNDActions.CLOSE_CHANNEL_LND),
mergeMap((action: { type: string, payload: CloseChannel }) => {
this.store.dispatch(openSpinner({ payload: (action.payload.forcibly ? UI_MESSAGES.FORCE_CLOSE_CHANNEL : UI_MESSAGES.CLOSE_CHANNEL) }));
let reqUrl = this.CHILD_API_URL + environment.CHANNELS_API + '/' + action.payload.channelPoint + '?force=' + action.payload.forcibly;
let reqUrl = this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/' + action.payload.channelPoint + '?force=' + action.payload.forcibly;
if (action.payload.targetConf) {
reqUrl = reqUrl + '&target_conf=' + action.payload.targetConf;
}
@ -359,7 +358,7 @@ export class LNDEffects implements OnDestroy {
return { type: RTLActions.VOID };
}),
catchError((err: any) => {
this.handleErrorWithAlert('CloseChannel', (action.payload.forcibly ? UI_MESSAGES.FORCE_CLOSE_CHANNEL : UI_MESSAGES.CLOSE_CHANNEL), 'Unable to Close Channel. Try again later.', this.CHILD_API_URL + environment.CHANNELS_API + '/' + action.payload.channelPoint + '?force=' + action.payload.forcibly, err);
this.handleErrorWithAlert('CloseChannel', (action.payload.forcibly ? UI_MESSAGES.FORCE_CLOSE_CHANNEL : UI_MESSAGES.CLOSE_CHANNEL), 'Unable to Close Channel. Try again later.', this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/' + action.payload.channelPoint + '?force=' + action.payload.forcibly, err);
return of({ type: RTLActions.VOID });
})
);
@ -371,7 +370,7 @@ export class LNDEffects implements OnDestroy {
mergeMap((action: { type: string, payload: any }) => {
this.store.dispatch(openSpinner({ payload: action.payload.uiMessage }));
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'BackupChannels', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.CHANNELS_BACKUP_API + '/' + action.payload.channelPoint).pipe(
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.CHANNELS_BACKUP_API + '/' + action.payload.channelPoint).pipe(
map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'BackupChannels', status: APICallStatusEnum.COMPLETED } }));
@ -383,7 +382,7 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('BackupChannels', action.payload.uiMessage, action.payload.showMessage + ' Unable to Backup Channel. Try again later.', this.CHILD_API_URL + environment.CHANNELS_BACKUP_API + '/' + action.payload.channelPoint, err);
this.handleErrorWithAlert('BackupChannels', action.payload.uiMessage, action.payload.showMessage + ' Unable to Backup Channel. Try again later.', this.CHILD_API_URL + API_END_POINTS.CHANNELS_BACKUP_API + '/' + action.payload.channelPoint, err);
return of({ type: RTLActions.VOID });
})
);
@ -395,7 +394,7 @@ export class LNDEffects implements OnDestroy {
mergeMap((action: { type: string, payload: { channelPoint: string } }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.VERIFY_CHANNEL }));
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'VerifyChannel', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(this.CHILD_API_URL + environment.CHANNELS_BACKUP_API + '/verify/' + action.payload.channelPoint, {}).pipe(
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.CHANNELS_BACKUP_API + '/verify/' + action.payload.channelPoint, {}).pipe(
map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'VerifyChannel', status: APICallStatusEnum.COMPLETED } }));
@ -407,7 +406,7 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('VerifyChannel', UI_MESSAGES.VERIFY_CHANNEL, 'Unable to Verify Channel. Try again later.', this.CHILD_API_URL + environment.CHANNELS_BACKUP_API + '/verify/' + action.payload.channelPoint, err);
this.handleErrorWithAlert('VerifyChannel', UI_MESSAGES.VERIFY_CHANNEL, 'Unable to Verify Channel. Try again later.', this.CHILD_API_URL + API_END_POINTS.CHANNELS_BACKUP_API + '/verify/' + action.payload.channelPoint, err);
return of({ type: RTLActions.VOID });
})
);
@ -419,7 +418,7 @@ export class LNDEffects implements OnDestroy {
mergeMap((action: { type: string, payload: { channelPoint: string } }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.RESTORE_CHANNEL }));
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'RestoreChannels', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(this.CHILD_API_URL + environment.CHANNELS_BACKUP_API + '/restore/' + action.payload.channelPoint, {}).pipe(
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.CHANNELS_BACKUP_API + '/restore/' + action.payload.channelPoint, {}).pipe(
map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'RestoreChannels', status: APICallStatusEnum.COMPLETED } }));
@ -432,7 +431,7 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('RestoreChannels', UI_MESSAGES.RESTORE_CHANNEL, 'Unable to Restore Channel. Try again later.', this.CHILD_API_URL + environment.CHANNELS_BACKUP_API + '/restore/' + action.payload.channelPoint, err);
this.handleErrorWithAlert('RestoreChannels', UI_MESSAGES.RESTORE_CHANNEL, 'Unable to Restore Channel. Try again later.', this.CHILD_API_URL + API_END_POINTS.CHANNELS_BACKUP_API + '/restore/' + action.payload.channelPoint, err);
return of({ type: RTLActions.VOID });
}));
}))
@ -442,7 +441,7 @@ export class LNDEffects implements OnDestroy {
ofType(LNDActions.FETCH_FEES_LND),
mergeMap(() => {
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchFees', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<Fees>(this.CHILD_API_URL + environment.FEES_API);
return this.httpClient.get<Fees>(this.CHILD_API_URL + API_END_POINTS.FEES_API);
}),
map((fees) => {
this.logger.info(fees);
@ -466,7 +465,7 @@ export class LNDEffects implements OnDestroy {
ofType(LNDActions.FETCH_BLOCKCHAIN_BALANCE_LND),
mergeMap(() => {
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchBalance', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<BlockchainBalance>(this.CHILD_API_URL + environment.BALANCE_API);
return this.httpClient.get<BlockchainBalance>(this.CHILD_API_URL + API_END_POINTS.BALANCE_API);
}),
map((res: any) => {
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchBalance', status: APICallStatusEnum.COMPLETED } }));
@ -486,7 +485,7 @@ export class LNDEffects implements OnDestroy {
ofType(LNDActions.FETCH_NETWORK_LND),
mergeMap(() => {
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchNetwork', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<NetworkInfo>(this.CHILD_API_URL + environment.NETWORK_API + '/info');
return this.httpClient.get<NetworkInfo>(this.CHILD_API_URL + API_END_POINTS.NETWORK_API + '/info');
}),
map((networkInfo) => {
this.logger.info(networkInfo);
@ -506,7 +505,7 @@ export class LNDEffects implements OnDestroy {
ofType(LNDActions.FETCH_CHANNELS_LND),
mergeMap(() => {
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchChannels', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.CHANNELS_API).pipe(
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.CHANNELS_API).pipe(
map((channels: any) => {
this.logger.info(channels);
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchChannels', status: APICallStatusEnum.COMPLETED } }));
@ -526,7 +525,7 @@ export class LNDEffects implements OnDestroy {
ofType(LNDActions.FETCH_PENDING_CHANNELS_LND),
mergeMap(() => {
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchPendingChannels', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.CHANNELS_API + '/pending').pipe(
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/pending').pipe(
map((pendingChannels: any) => {
this.logger.info(pendingChannels);
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchPendingChannels', status: APICallStatusEnum.COMPLETED } }));
@ -578,7 +577,7 @@ export class LNDEffects implements OnDestroy {
ofType(LNDActions.FETCH_CLOSED_CHANNELS_LND),
mergeMap(() => {
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchClosedChannels', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.CHANNELS_API + '/closed').pipe(
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/closed').pipe(
map((channels: any) => {
this.logger.info(channels);
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchClosedChannels', status: APICallStatusEnum.COMPLETED } }));
@ -601,7 +600,7 @@ export class LNDEffects implements OnDestroy {
const num_max_invoices = (action.payload.num_max_invoices) ? action.payload.num_max_invoices : 100;
const index_offset = (action.payload.index_offset) ? action.payload.index_offset : 0;
const reversed = (action.payload.reversed) ? action.payload.reversed : false;
return this.httpClient.get<ListInvoices>(this.CHILD_API_URL + environment.INVOICES_API + '?num_max_invoices=' + num_max_invoices + '&index_offset=' + index_offset + '&reversed=' + reversed).pipe(
return this.httpClient.get<ListInvoices>(this.CHILD_API_URL + API_END_POINTS.INVOICES_API + '?num_max_invoices=' + num_max_invoices + '&index_offset=' + index_offset + '&reversed=' + reversed).pipe(
map((res: ListInvoices) => {
this.logger.info(res);
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchInvoices', status: APICallStatusEnum.COMPLETED } }));
@ -624,7 +623,7 @@ export class LNDEffects implements OnDestroy {
ofType(LNDActions.FETCH_TRANSACTIONS_LND),
mergeMap(() => {
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchTransactions', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<Transaction[]>(this.CHILD_API_URL + environment.TRANSACTIONS_API);
return this.httpClient.get<Transaction[]>(this.CHILD_API_URL + API_END_POINTS.TRANSACTIONS_API);
}),
map((transactions) => {
this.logger.info(transactions);
@ -645,7 +644,7 @@ export class LNDEffects implements OnDestroy {
withLatestFrom(this.store.select(lndNodeInformation)),
mergeMap(([action, nodeInfo]: [{ type: string, payload: any }, GetInfo]) => {
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchUTXOs', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<UTXO[]>(this.CHILD_API_URL + environment.WALLET_API + '/getUTXOs?max_confs=' + (nodeInfo && nodeInfo.block_height ? nodeInfo.block_height : 1000000000));
return this.httpClient.get<UTXO[]>(this.CHILD_API_URL + API_END_POINTS.WALLET_API + '/getUTXOs?max_confs=' + (nodeInfo && nodeInfo.block_height ? nodeInfo.block_height : 1000000000));
}),
map((utxos) => {
this.logger.info(utxos);
@ -668,7 +667,7 @@ export class LNDEffects implements OnDestroy {
const max_payments = (action.payload.max_payments) ? action.payload.max_payments : 100;
const index_offset = (action.payload.index_offset) ? action.payload.index_offset : 0;
const reversed = (action.payload.reversed) ? action.payload.reversed : false;
return this.httpClient.get<ListPayments>(this.CHILD_API_URL + environment.PAYMENTS_API + '?max_payments=' + max_payments + '&index_offset=' + index_offset + '&reversed=' + reversed).
return this.httpClient.get<ListPayments>(this.CHILD_API_URL + API_END_POINTS.PAYMENTS_API + '?max_payments=' + max_payments + '&index_offset=' + index_offset + '&reversed=' + reversed).
pipe(map((res: ListPayments) => {
this.logger.info(res);
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchPayments', status: APICallStatusEnum.COMPLETED } }));
@ -709,7 +708,7 @@ export class LNDEffects implements OnDestroy {
queryHeaders['feeLimit'] = {};
queryHeaders['feeLimit'][action.payload.feeLimitType] = action.payload.feeLimit;
}
return this.httpClient.post(this.CHILD_API_URL + environment.CHANNELS_API + '/transactions', queryHeaders).pipe(
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/transactions', queryHeaders).pipe(
map((sendRes: any) => {
this.logger.info(sendRes);
this.store.dispatch(closeSpinner({ payload: action.payload.uiMessage }));
@ -725,7 +724,7 @@ export class LNDEffects implements OnDestroy {
if (action.payload.fromDialog) {
this.handleErrorWithoutAlert('SendPayment', action.payload.uiMessage, 'Send Payment Failed.', sendRes.payment_error);
} else {
this.handleErrorWithAlert('SendPayment', action.payload.uiMessage, 'Send Payment Failed', this.CHILD_API_URL + environment.CHANNELS_API + '/transactions', sendRes.payment_error);
this.handleErrorWithAlert('SendPayment', action.payload.uiMessage, 'Send Payment Failed', this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/transactions', sendRes.payment_error);
}
return { type: RTLActions.VOID };
}
@ -762,7 +761,7 @@ export class LNDEffects implements OnDestroy {
if (action.payload.fromDialog) {
this.handleErrorWithoutAlert('SendPayment', action.payload.uiMessage, 'Send Payment Failed.', err);
} else {
this.handleErrorWithAlert('SendPayment', action.payload.uiMessage, 'Send Payment Failed', this.CHILD_API_URL + environment.CHANNELS_API + '/transactions', err);
this.handleErrorWithAlert('SendPayment', action.payload.uiMessage, 'Send Payment Failed', this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/transactions', err);
}
return of({ type: RTLActions.VOID });
}
@ -775,7 +774,7 @@ export class LNDEffects implements OnDestroy {
mergeMap((action: { type: string, payload: { pubkey: string } }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GET_NODE_ADDRESS }));
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchGraphNode', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get<GraphNode>(this.CHILD_API_URL + environment.NETWORK_API + '/node/' + action.payload.pubkey).pipe(
return this.httpClient.get<GraphNode>(this.CHILD_API_URL + API_END_POINTS.NETWORK_API + '/node/' + action.payload.pubkey).pipe(
map((graphNode: any) => {
this.logger.info(graphNode);
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.GET_NODE_ADDRESS }));
@ -807,7 +806,7 @@ export class LNDEffects implements OnDestroy {
ofType(LNDActions.GET_NEW_ADDRESS_LND),
mergeMap((action: { type: string, payload: GetNewAddress }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GENERATE_NEW_ADDRESS }));
return this.httpClient.get(this.CHILD_API_URL + environment.NEW_ADDRESS_API + '?type=' + action.payload.addressId).pipe(
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.NEW_ADDRESS_API + '?type=' + action.payload.addressId).pipe(
map((newAddress: any) => {
this.logger.info(newAddress);
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.GENERATE_NEW_ADDRESS }));
@ -817,7 +816,7 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('GetNewAddress', UI_MESSAGES.GENERATE_NEW_ADDRESS, 'Generate New Address Failed', this.CHILD_API_URL + environment.NEW_ADDRESS_API + '?type=' + action.payload.addressId, err);
this.handleErrorWithAlert('GetNewAddress', UI_MESSAGES.GENERATE_NEW_ADDRESS, 'Generate New Address Failed', this.CHILD_API_URL + API_END_POINTS.NEW_ADDRESS_API + '?type=' + action.payload.addressId, err);
return of({ type: RTLActions.VOID });
}));
}))
@ -839,7 +838,7 @@ export class LNDEffects implements OnDestroy {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.SEND_FUNDS }));
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'SetChannelTransaction', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(
this.CHILD_API_URL + environment.TRANSACTIONS_API,
this.CHILD_API_URL + API_END_POINTS.TRANSACTIONS_API,
{ amount: action.payload.amount, address: action.payload.address, sendAll: action.payload.sendAll, fees: action.payload.fees, blocks: action.payload.blocks }
).pipe(
map((postRes: any) => {
@ -869,7 +868,7 @@ export class LNDEffects implements OnDestroy {
const queryHeaders: SwitchReq = {
num_max_events: action.payload.num_max_events, index_offset: action.payload.index_offset, end_time: action.payload.end_time, start_time: action.payload.start_time
};
return this.httpClient.post(this.CHILD_API_URL + environment.SWITCH_API, queryHeaders).pipe(
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.SWITCH_API, queryHeaders).pipe(
map((fhRes: any) => {
this.logger.info(fhRes);
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchForwardingHistory', status: APICallStatusEnum.COMPLETED } }));
@ -879,7 +878,7 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('FetchForwardingHistory', UI_MESSAGES.NO_SPINNER, 'Get Forwarding History Failed', this.CHILD_API_URL + environment.SWITCH_API, err);
this.handleErrorWithAlert('FetchForwardingHistory', UI_MESSAGES.NO_SPINNER, 'Get Forwarding History Failed', this.CHILD_API_URL + API_END_POINTS.SWITCH_API, err);
return of({ type: RTLActions.VOID });
})
);
@ -889,7 +888,7 @@ export class LNDEffects implements OnDestroy {
queryRoutesFetch = createEffect(() => this.actions.pipe(
ofType(LNDActions.GET_QUERY_ROUTES_LND),
mergeMap((action: { type: string, payload: GetQueryRoutes }) => {
let url = this.CHILD_API_URL + environment.NETWORK_API + '/routes/' + action.payload.destPubkey + '/' + action.payload.amount;
let url = this.CHILD_API_URL + API_END_POINTS.NETWORK_API + '/routes/' + action.payload.destPubkey + '/' + action.payload.amount;
if (action.payload.outgoingChanId) {
url = url + '?outgoing_chan_id=' + action.payload.outgoingChanId;
}
@ -903,7 +902,7 @@ export class LNDEffects implements OnDestroy {
}),
catchError((err: any) => {
this.store.dispatch(setQueryRoutes({ payload: { routes: [] } }));
this.handleErrorWithAlert('GetQueryRoutes', UI_MESSAGES.NO_SPINNER, 'Get Query Routes Failed', this.CHILD_API_URL + environment.NETWORK_API, err);
this.handleErrorWithAlert('GetQueryRoutes', UI_MESSAGES.NO_SPINNER, 'Get Query Routes Failed', this.CHILD_API_URL + API_END_POINTS.NETWORK_API, err);
return of({ type: RTLActions.VOID });
})
);
@ -921,7 +920,7 @@ export class LNDEffects implements OnDestroy {
ofType(LNDActions.GEN_SEED_LND),
mergeMap((action: { type: string, payload: string }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GEN_SEED }));
return this.httpClient.get(this.CHILD_API_URL + environment.WALLET_API + '/genseed/' + action.payload).pipe(
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.WALLET_API + '/genseed/' + action.payload).pipe(
map((postRes: any) => {
this.logger.info('Generated GenSeed!');
this.logger.info(postRes);
@ -932,7 +931,7 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err) => {
this.handleErrorWithAlert('GenSeed', UI_MESSAGES.GEN_SEED, 'Genseed Generation Failed', this.CHILD_API_URL + environment.WALLET_API + '/genseed/' + action.payload, err);
this.handleErrorWithAlert('GenSeed', UI_MESSAGES.GEN_SEED, 'Genseed Generation Failed', this.CHILD_API_URL + API_END_POINTS.WALLET_API + '/genseed/' + action.payload, err);
return of({ type: RTLActions.VOID });
})
);
@ -941,7 +940,7 @@ export class LNDEffects implements OnDestroy {
updateSelNodeOptions = createEffect(() => this.actions.pipe(
ofType(RTLActions.UPDATE_SELECTED_NODE_OPTIONS),
mergeMap(() => this.httpClient.get(this.CHILD_API_URL + environment.WALLET_API + '/updateSelNodeOptions').pipe(
mergeMap(() => this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.WALLET_API + '/updateSelNodeOptions').pipe(
map((postRes: any) => {
this.logger.info('Update Sel Node Successfull');
this.logger.info(postRes);
@ -975,7 +974,7 @@ export class LNDEffects implements OnDestroy {
mergeMap((action: { type: string, payload: InitWallet }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.INITIALIZE_WALLET }));
return this.httpClient.post(
this.CHILD_API_URL + environment.WALLET_API + '/wallet/initwallet',
this.CHILD_API_URL + API_END_POINTS.WALLET_API + '/wallet/initwallet',
{
wallet_password: action.payload.pwd,
cipher_seed_mnemonic: action.payload.cipher ? action.payload.cipher : '',
@ -991,7 +990,7 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err) => {
this.handleErrorWithAlert('InitWallet', UI_MESSAGES.INITIALIZE_WALLET, 'Wallet Initialization Failed', this.CHILD_API_URL + environment.WALLET_API + '/initwallet', err);
this.handleErrorWithAlert('InitWallet', UI_MESSAGES.INITIALIZE_WALLET, 'Wallet Initialization Failed', this.CHILD_API_URL + API_END_POINTS.WALLET_API + '/initwallet', err);
return of({ type: RTLActions.VOID });
})
);
@ -1003,7 +1002,7 @@ export class LNDEffects implements OnDestroy {
ofType(LNDActions.UNLOCK_WALLET_LND),
mergeMap((action: { type: string, payload: { pwd: string } }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.UNLOCK_WALLET }));
return this.httpClient.post(this.CHILD_API_URL + environment.WALLET_API + '/wallet/unlockwallet', { wallet_password: action.payload.pwd }).pipe(
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.WALLET_API + '/wallet/unlockwallet', { wallet_password: action.payload.pwd }).pipe(
map((postRes) => {
this.logger.info(postRes);
this.logger.info('Successfully Unlocked!');
@ -1017,7 +1016,7 @@ export class LNDEffects implements OnDestroy {
return { type: RTLActions.VOID };
}),
catchError((err) => {
this.handleErrorWithAlert('UnlockWallet', UI_MESSAGES.UNLOCK_WALLET, 'Unlock Wallet Failed', this.CHILD_API_URL + environment.WALLET_API + '/unlockwallet', err);
this.handleErrorWithAlert('UnlockWallet', UI_MESSAGES.UNLOCK_WALLET, 'Unlock Wallet Failed', this.CHILD_API_URL + API_END_POINTS.WALLET_API + '/unlockwallet', err);
return of({ type: RTLActions.VOID });
})
);
@ -1030,7 +1029,7 @@ export class LNDEffects implements OnDestroy {
mergeMap((action: { type: string, payload: string }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.SEARCHING_NODE }));
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'Lookup', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.NETWORK_API + '/node/' + action.payload).pipe(
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.NETWORK_API + '/node/' + action.payload).pipe(
map((resPeer) => {
this.logger.info(resPeer);
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.SEARCHING_NODE }));
@ -1041,7 +1040,7 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('Lookup', UI_MESSAGES.SEARCHING_NODE, 'Peer Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/node/' + action.payload, err);
this.handleErrorWithAlert('Lookup', UI_MESSAGES.SEARCHING_NODE, 'Peer Lookup Failed', this.CHILD_API_URL + API_END_POINTS.NETWORK_API + '/node/' + action.payload, err);
return of({ type: RTLActions.VOID });
})
);
@ -1053,7 +1052,7 @@ export class LNDEffects implements OnDestroy {
mergeMap((action: { type: string, payload: ChannelLookup }) => {
this.store.dispatch(openSpinner({ payload: action.payload.uiMessage }));
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'Lookup', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.NETWORK_API + '/edge/' + action.payload.channelID).pipe(
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.NETWORK_API + '/edge/' + action.payload.channelID).pipe(
map((resChannel) => {
this.logger.info(resChannel);
this.store.dispatch(closeSpinner({ payload: action.payload.uiMessage }));
@ -1064,7 +1063,7 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('Lookup', action.payload.uiMessage, 'Channel Lookup Failed', this.CHILD_API_URL + environment.NETWORK_API + '/edge/' + action.payload.channelID, err);
this.handleErrorWithAlert('Lookup', action.payload.uiMessage, 'Channel Lookup Failed', this.CHILD_API_URL + API_END_POINTS.NETWORK_API + '/edge/' + action.payload.channelID, err);
return of({ type: RTLActions.VOID });
})
);
@ -1076,7 +1075,7 @@ export class LNDEffects implements OnDestroy {
mergeMap((action: { type: string, payload: { openSnackBar: boolean, paymentHash?: string, paymentAddress?: string } }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.SEARCHING_INVOICE }));
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'Lookup', status: APICallStatusEnum.INITIATED } }));
let lookupUrl = this.CHILD_API_URL + environment.INVOICES_API + '/lookup';
let lookupUrl = this.CHILD_API_URL + API_END_POINTS.INVOICES_API + '/lookup';
if (action.payload.paymentAddress && action.payload.paymentAddress !== '') {
lookupUrl = lookupUrl + '?payment_addr=' + action.payload.paymentAddress;
} else {
@ -1113,7 +1112,7 @@ export class LNDEffects implements OnDestroy {
mergeMap((action: { type: string, payload: string }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.SEARCHING_PAYMENT }));
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'Lookup', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.PAYMENTS_API + '/lookup/' + action.payload).pipe(
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.PAYMENTS_API + '/lookup/' + action.payload).pipe(
map((resPayment: any) => {
this.logger.info(resPayment);
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.SEARCHING_PAYMENT }));
@ -1150,7 +1149,7 @@ export class LNDEffects implements OnDestroy {
ofType(LNDActions.RESTORE_CHANNELS_LIST_LND),
mergeMap(() => {
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'RestoreChannelsList', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.CHANNELS_BACKUP_API + '/restore/list').pipe(
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.CHANNELS_BACKUP_API + '/restore/list').pipe(
map((resRestoreList) => {
this.logger.info(resRestoreList);
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'RestoreChannelsList', status: APICallStatusEnum.COMPLETED } }));
@ -1160,7 +1159,7 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('RestoreChannelsList', UI_MESSAGES.NO_SPINNER, 'Restore Channels List Failed', this.CHILD_API_URL + environment.CHANNELS_BACKUP_API, err);
this.handleErrorWithAlert('RestoreChannelsList', UI_MESSAGES.NO_SPINNER, 'Restore Channels List Failed', this.CHILD_API_URL + API_END_POINTS.CHANNELS_BACKUP_API, err);
return of({ type: RTLActions.VOID });
})
);
@ -1181,7 +1180,7 @@ export class LNDEffects implements OnDestroy {
ofType(LNDActions.GET_ALL_LIGHTNING_TRANSATIONS_LND),
mergeMap(() => {
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchLightningTransactions', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.PAYMENTS_API + '/alltransactions').pipe(
return this.httpClient.get(this.CHILD_API_URL + API_END_POINTS.PAYMENTS_API + '/alltransactions').pipe(
map((response: any) => {
this.logger.info(response);
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchLightningTransactions', status: APICallStatusEnum.COMPLETED } }));
@ -1202,7 +1201,7 @@ export class LNDEffects implements OnDestroy {
ofType(LNDActions.FETCH_PAGE_SETTINGS_LND),
mergeMap(() => {
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchPageSettings', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(environment.PAGE_SETTINGS_API).pipe(
return this.httpClient.get(API_END_POINTS.PAGE_SETTINGS_API).pipe(
map((settings: any) => {
this.logger.info(settings);
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'FetchPageSettings', status: APICallStatusEnum.COMPLETED } }));
@ -1230,7 +1229,7 @@ export class LNDEffects implements OnDestroy {
mergeMap((action: { type: string, payload: any }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.UPDATE_PAGE_SETTINGS }));
this.store.dispatch(updateLNDAPICallStatus({ payload: { action: 'SavePageSettings', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(environment.PAGE_SETTINGS_API, action.payload).
return this.httpClient.post(API_END_POINTS.PAGE_SETTINGS_API, action.payload).
pipe(
map((postRes: any) => {
this.logger.info(postRes);
@ -1253,7 +1252,7 @@ export class LNDEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('SavePageSettings', UI_MESSAGES.UPDATE_PAGE_SETTINGS, 'Page Settings Update Failed.', environment.PAGE_SETTINGS_API, err);
this.handleErrorWithAlert('SavePageSettings', UI_MESSAGES.UPDATE_PAGE_SETTINGS, 'Page Settings Update Failed.', API_END_POINTS.PAGE_SETTINGS_API, err);
return of({ type: RTLActions.VOID });
})
);

@ -3,7 +3,6 @@ import { Subject } from 'rxjs';
import { takeUntil, filter } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { Actions } from '@ngrx/effects';
import { VERSION } from '../../../../../environments/environment';
import { NestedTreeControl } from '@angular/cdk/tree';
import { MatTreeNestedDataSource, MatTree } from '@angular/material/tree';
@ -17,7 +16,7 @@ import { MenuChildNode, MENU_DATA } from '../../../models/navMenu';
import { RTLEffects } from '../../../../store/rtl.effects';
import { RTLState } from '../../../../store/rtl.state';
import { AlertTypeEnum, RTLActions, UI_MESSAGES, UserPersonaEnum } from '../../../services/consts-enums-functions';
import { VERSION, AlertTypeEnum, RTLActions, UI_MESSAGES, UserPersonaEnum } from '../../../services/consts-enums-functions';
import { CommonService } from '../../../services/common.service';
import { logout, openConfirmation, setSelectedNode, showPubkey } from '../../../../store/rtl.actions';
import { rootAppConfig, rootSelNodeAndNodeData } from '../../../../store/rtl.selector';

@ -9,8 +9,7 @@ import { GetInfoRoot } from '../../../models/RTLconfig';
import { LoggerService } from '../../../services/logger.service';
import { SessionService } from '../../../services/session.service';
import { GetInfoChain } from '../../../models/lndModels';
import { VERSION } from '../../../../../environments/environment';
import { AlertTypeEnum, RTLActions } from '../../../services/consts-enums-functions';
import { VERSION, AlertTypeEnum, RTLActions } from '../../../services/consts-enums-functions';
import { RTLEffects } from '../../../../store/rtl.effects';
import { RTLState } from '../../../../store/rtl.state';

@ -4,11 +4,10 @@ import { BehaviorSubject, Subject, throwError, of } from 'rxjs';
import { catchError, takeUntil, map } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { environment, API_URL } from '../../../environments/environment';
import { ErrorMessageComponent } from '../components/data-modal/error-message/error-message.component';
import { CommonService } from './common.service';
import { LoggerService } from './logger.service';
import { AlertTypeEnum, UI_MESSAGES } from './consts-enums-functions';
import { API_URL, API_END_POINTS, AlertTypeEnum, UI_MESSAGES } from './consts-enums-functions';
import { ListSwaps } from '../models/boltzModels';
import { closeSpinner, logout, openAlert, openSpinner } from '../../store/rtl.actions';
@ -30,7 +29,7 @@ export class BoltzService implements OnDestroy {
listSwaps() {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GET_BOLTZ_SWAPS }));
this.swapUrl = API_URL + environment.BOLTZ_API + '/listSwaps';
this.swapUrl = API_URL + API_END_POINTS.BOLTZ_API + '/listSwaps';
this.httpClient.get(this.swapUrl).
pipe(takeUntil(this.unSubs[0])).
subscribe({
@ -43,13 +42,13 @@ export class BoltzService implements OnDestroy {
}
swapInfo(id: string) {
this.swapUrl = API_URL + environment.BOLTZ_API + '/swapInfo/' + id;
this.swapUrl = API_URL + API_END_POINTS.BOLTZ_API + '/swapInfo/' + id;
return this.httpClient.get(this.swapUrl).pipe(catchError((err) => of(this.handleErrorWithAlert(UI_MESSAGES.NO_SPINNER, this.swapUrl, err))));
}
serviceInfo() {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GET_SERVICE_INFO }));
this.swapUrl = API_URL + environment.BOLTZ_API + '/serviceInfo';
this.swapUrl = API_URL + API_END_POINTS.BOLTZ_API + '/serviceInfo';
return this.httpClient.get(this.swapUrl).pipe(
takeUntil(this.unSubs[1]),
map((res) => {
@ -62,13 +61,13 @@ export class BoltzService implements OnDestroy {
swapOut(amount: number, address: string) {
const requestBody = { amount: amount, address: address };
this.swapUrl = API_URL + environment.BOLTZ_API + '/createreverseswap';
this.swapUrl = API_URL + API_END_POINTS.BOLTZ_API + '/createreverseswap';
return this.httpClient.post(this.swapUrl, requestBody).pipe(catchError((err) => this.handleErrorWithoutAlert('Swap Out for Address: ' + address, UI_MESSAGES.NO_SPINNER, err)));
}
swapIn(amount: number) {
const requestBody = { amount: amount };
this.swapUrl = API_URL + environment.BOLTZ_API + '/createswap';
this.swapUrl = API_URL + API_END_POINTS.BOLTZ_API + '/createswap';
return this.httpClient.post(this.swapUrl, requestBody).pipe(catchError((err) => this.handleErrorWithoutAlert('Swap In for Amount: ' + amount, UI_MESSAGES.NO_SPINNER, err)));
}

@ -1,3 +1,4 @@
import { isDevMode } from '@angular/core';
import { MatPaginatorIntl } from '@angular/material/paginator';
import { CLNPageDefinitions, ECLPageDefinitions, LNDPageDefinitions, PageSettings } from '../models/pageSettings';
@ -7,6 +8,36 @@ export function getPaginatorLabel(field: string) {
return appPaginator;
}
export const VERSION = '0.13.3-beta';
export const API_URL = isDevMode() ? 'http://localhost:3000/rtl/api' : './api';
export const API_END_POINTS = {
AUTHENTICATE_API: API_URL + '/authenticate',
CONF_API: API_URL + '/conf',
PAGE_SETTINGS_API: API_URL + '/pagesettings',
BALANCE_API: '/balance',
FEES_API: '/fees',
PEERS_API: '/peers',
CHANNELS_API: '/channels',
CHANNELS_BACKUP_API: '/channels/backup',
GETINFO_API: '/getinfo',
WALLET_API: '/wallet',
NETWORK_API: '/network',
NEW_ADDRESS_API: '/newaddress',
TRANSACTIONS_API: '/transactions',
PAYMENTS_API: '/payments',
INVOICES_API: '/invoices',
SWITCH_API: '/switch',
ON_CHAIN_API: '/onchain',
MESSAGE_API: '/message',
OFFERS_API: '/offers',
UTILITY_API: '/utility',
LOOP_API: '/loop',
BOLTZ_API: '/boltz',
Web_SOCKET_API: '/ws'
};
export const CURRENCY_UNITS = ['Sats', 'BTC'];
export const CURRENCY_UNIT_FORMATS = { Sats: '1.0-0', BTC: '1.6-6', OTHER: '1.2-2' };
export const FIAT_CURRENCY_UNITS = [

@ -7,8 +7,7 @@ import { Store } from '@ngrx/store';
import { MatSnackBar } from '@angular/material/snack-bar';
import { LoggerService } from '../../shared/services/logger.service';
import { environment, API_URL } from '../../../environments/environment';
import { APICallStatusEnum, UI_MESSAGES } from './consts-enums-functions';
import { API_URL, API_END_POINTS, APICallStatusEnum, UI_MESSAGES } from './consts-enums-functions';
import { Channel, ClosedChannel, PendingChannels, SwitchReq } from '../models/lndModels';
import { ErrorMessageComponent } from '../components/data-modal/error-message/error-message.component';
import { closeAllDialogs, closeSpinner, logout, openAlert, openSnackBar, openSpinner, updateRootAPICallStatus } from '../../store/rtl.actions';
@ -36,14 +35,14 @@ export class DataService implements OnDestroy {
}
getFiatRates() {
return this.httpClient.get(environment.CONF_API + '/rates');
return this.httpClient.get(API_END_POINTS.CONF_API + '/rates');
}
decodePayment(payment: string, fromDialog: boolean) {
return this.lnImplementationUpdated.pipe(first((val) => val !== null), mergeMap((updatedLnImplementation) => {
let url = this.APIUrl + '/' + updatedLnImplementation + environment.PAYMENTS_API + '/decode/' + payment;
let url = this.APIUrl + '/' + updatedLnImplementation + API_END_POINTS.PAYMENTS_API + '/decode/' + payment;
if (updatedLnImplementation === 'cln') {
url = this.APIUrl + '/' + updatedLnImplementation + environment.UTILITY_API + '/decode/' + payment;
url = this.APIUrl + '/' + updatedLnImplementation + API_END_POINTS.UTILITY_API + '/decode/' + payment;
}
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.DECODE_PAYMENT }));
return this.httpClient.get(url).pipe(
@ -69,13 +68,13 @@ export class DataService implements OnDestroy {
let url = '';
let msg = '';
if (updatedLnImplementation === 'ecl') {
url = this.APIUrl + '/' + updatedLnImplementation + environment.PAYMENTS_API + '/getsentinfos';
url = this.APIUrl + '/' + updatedLnImplementation + API_END_POINTS.PAYMENTS_API + '/getsentinfos';
msg = UI_MESSAGES.GET_SENT_PAYMENTS;
} else if (updatedLnImplementation === 'cln') {
url = this.APIUrl + '/' + updatedLnImplementation + environment.UTILITY_API;
url = this.APIUrl + '/' + updatedLnImplementation + API_END_POINTS.UTILITY_API;
msg = UI_MESSAGES.DECODE_PAYMENTS;
} else {
url = this.APIUrl + '/' + updatedLnImplementation + environment.PAYMENTS_API;
url = this.APIUrl + '/' + updatedLnImplementation + API_END_POINTS.PAYMENTS_API;
msg = UI_MESSAGES.DECODE_PAYMENTS;
}
this.store.dispatch(openSpinner({ payload: msg }));
@ -97,18 +96,18 @@ export class DataService implements OnDestroy {
return this.lnImplementationUpdated.pipe(first((val) => val !== null), mergeMap((updatedLnImplementation) => {
if (multiple) {
const pubkey_params = new HttpParams().set('pubkeys', pubkey);
return this.httpClient.get(this.APIUrl + '/' + updatedLnImplementation + environment.NETWORK_API + '/nodes', { params: pubkey_params });
return this.httpClient.get(this.APIUrl + '/' + updatedLnImplementation + API_END_POINTS.NETWORK_API + '/nodes', { params: pubkey_params });
} else {
return this.httpClient.get(this.APIUrl + '/' + updatedLnImplementation + environment.NETWORK_API + '/node/' + pubkey);
return this.httpClient.get(this.APIUrl + '/' + updatedLnImplementation + API_END_POINTS.NETWORK_API + '/node/' + pubkey);
}
}));
}
signMessage(msg: string) {
return this.lnImplementationUpdated.pipe(first((val) => val !== null), mergeMap((updatedLnImplementation) => {
let url = this.APIUrl + '/' + updatedLnImplementation + environment.MESSAGE_API + '/sign';
let url = this.APIUrl + '/' + updatedLnImplementation + API_END_POINTS.MESSAGE_API + '/sign';
if (updatedLnImplementation === 'cln') {
url = this.APIUrl + '/' + updatedLnImplementation + environment.UTILITY_API + '/sign';
url = this.APIUrl + '/' + updatedLnImplementation + API_END_POINTS.UTILITY_API + '/sign';
}
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.SIGN_MESSAGE }));
return this.httpClient.post(url, { message: msg }).pipe(
@ -127,9 +126,9 @@ export class DataService implements OnDestroy {
verifyMessage(msg: string, sign: string) {
return this.lnImplementationUpdated.pipe(first((val) => val !== null), mergeMap((updatedLnImplementation) => {
let url = this.APIUrl + '/' + updatedLnImplementation + environment.MESSAGE_API + '/verify';
let url = this.APIUrl + '/' + updatedLnImplementation + API_END_POINTS.MESSAGE_API + '/verify';
if (updatedLnImplementation === 'cln') {
url = this.APIUrl + '/' + updatedLnImplementation + environment.UTILITY_API + '/verify';
url = this.APIUrl + '/' + updatedLnImplementation + API_END_POINTS.UTILITY_API + '/verify';
}
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.VERIFY_MESSAGE }));
return this.httpClient.post(url, { message: msg, signature: sign }).pipe(
@ -156,7 +155,7 @@ export class DataService implements OnDestroy {
bumpFeeBody.satPerByte = satPerByte;
}
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.BUMP_FEE }));
return this.httpClient.post(this.APIUrl + '/' + updatedLnImplementation + environment.WALLET_API + '/bumpfee', bumpFeeBody).pipe(
return this.httpClient.post(this.APIUrl + '/' + updatedLnImplementation + API_END_POINTS.WALLET_API + '/bumpfee', bumpFeeBody).pipe(
takeUntil(this.unSubs[4]),
map((res: any) => {
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.BUMP_FEE }));
@ -175,7 +174,7 @@ export class DataService implements OnDestroy {
return this.lnImplementationUpdated.pipe(first((val) => val !== null), mergeMap((updatedLnImplementation) => {
const labelBody = { txid: txid, label: label, overwrite: overwrite };
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.LABEL_UTXO }));
return this.httpClient.post(this.APIUrl + '/' + updatedLnImplementation + environment.WALLET_API + '/label', labelBody).pipe(
return this.httpClient.post(this.APIUrl + '/' + updatedLnImplementation + API_END_POINTS.WALLET_API + '/label', labelBody).pipe(
takeUntil(this.unSubs[5]),
map((res) => {
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.LABEL_UTXO }));
@ -192,7 +191,7 @@ export class DataService implements OnDestroy {
return this.lnImplementationUpdated.pipe(first((val) => val !== null), mergeMap((updatedLnImplementation) => {
const leaseBody: any = { txid: txid, outputIndex: output_index };
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.LEASE_UTXO }));
return this.httpClient.post(this.APIUrl + '/' + updatedLnImplementation + environment.WALLET_API + '/lease', leaseBody).pipe(
return this.httpClient.post(this.APIUrl + '/' + updatedLnImplementation + API_END_POINTS.WALLET_API + '/lease', leaseBody).pipe(
takeUntil(this.unSubs[6]),
map((res: any) => {
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.LEASE_UTXO }));
@ -217,7 +216,7 @@ export class DataService implements OnDestroy {
if (implementation === 'LND') {
const queryHeaders: SwitchReq = { end_time: end, start_time: start };
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GET_FORWARDING_HISTORY }));
return this.httpClient.post(this.APIUrl + '/lnd' + environment.SWITCH_API, queryHeaders).pipe(
return this.httpClient.post(this.APIUrl + '/lnd' + API_END_POINTS.SWITCH_API, queryHeaders).pipe(
takeUntil(this.unSubs[7]),
withLatestFrom(this.store.select(allChannels)),
mergeMap(([res, allChannelsSelector]: [any, { channels: Channel[], pendingChannels: PendingChannels, closedChannels: ClosedChannel[] }]) => {
@ -259,12 +258,12 @@ export class DataService implements OnDestroy {
return of(res);
}),
catchError((err) => {
this.handleErrorWithAlert('getForwardingHistoryData', UI_MESSAGES.GET_FORWARDING_HISTORY, 'Forwarding History Failed', this.APIUrl + '/lnd' + environment.SWITCH_API, err);
this.handleErrorWithAlert('getForwardingHistoryData', UI_MESSAGES.GET_FORWARDING_HISTORY, 'Forwarding History Failed', this.APIUrl + '/lnd' + API_END_POINTS.SWITCH_API, err);
return throwError(() => new Error(this.extractErrorMessage(err)));
}));
} else if (implementation === 'CLN') {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GET_FORWARDING_HISTORY }));
return this.httpClient.get(this.APIUrl + '/cln' + environment.CHANNELS_API + '/listForwards?status=' + status).pipe(
return this.httpClient.get(this.APIUrl + '/cln' + API_END_POINTS.CHANNELS_API + '/listForwards?status=' + status).pipe(
takeUntil(this.unSubs[8]),
withLatestFrom(this.store.select(channels)),
mergeMap(([res, channelsSelector]: [any, { activeChannels: ChannelCLN[], pendingChannels: ChannelCLN[], inactiveChannels: ChannelCLN[], apiCallStatus: ApiCallStatusPayload }]) => {
@ -273,7 +272,7 @@ export class DataService implements OnDestroy {
return of(forwardsWithAlias);
}),
catchError((err) => {
this.handleErrorWithAlert('getForwardingHistoryData', UI_MESSAGES.GET_FORWARDING_HISTORY, 'Forwarding History Failed', this.APIUrl + '/cln' + environment.CHANNELS_API + '/listForwards?status=' + status + '&start=' + start + '&end=' + end, err);
this.handleErrorWithAlert('getForwardingHistoryData', UI_MESSAGES.GET_FORWARDING_HISTORY, 'Forwarding History Failed', this.APIUrl + '/cln' + API_END_POINTS.CHANNELS_API + '/listForwards?status=' + status + '&start=' + start + '&end=' + end, err);
return throwError(() => new Error(this.extractErrorMessage(err)));
}));
} else {
@ -284,7 +283,7 @@ export class DataService implements OnDestroy {
listNetworkNodes(queryParams: string = '') {
return this.lnImplementationUpdated.pipe(first((val) => val !== null), mergeMap((updatedLnImplementation) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.LIST_NETWORK_NODES }));
return this.httpClient.get(this.APIUrl + '/' + updatedLnImplementation + environment.NETWORK_API + '/listNodes' + queryParams).pipe(
return this.httpClient.get(this.APIUrl + '/' + updatedLnImplementation + API_END_POINTS.NETWORK_API + '/listNodes' + queryParams).pipe(
takeUntil(this.unSubs[9]),
mergeMap((res) => {
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.LIST_NETWORK_NODES }));
@ -300,7 +299,7 @@ export class DataService implements OnDestroy {
listConfigs() {
return this.lnImplementationUpdated.pipe(first((val) => val !== null), mergeMap((updatedLnImplementation) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GET_LIST_CONFIGS }));
return this.httpClient.get(this.APIUrl + '/' + updatedLnImplementation + environment.UTILITY_API + '/listConfigs').pipe(
return this.httpClient.get(this.APIUrl + '/' + updatedLnImplementation + API_END_POINTS.UTILITY_API + '/listConfigs').pipe(
takeUntil(this.unSubs[10]),
mergeMap((res) => {
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.GET_LIST_CONFIGS }));
@ -317,7 +316,7 @@ export class DataService implements OnDestroy {
return this.lnImplementationUpdated.pipe(first((val) => val !== null), mergeMap((updatedLnImplementation) => {
const postParams = policy ? { policy: policy, policy_mod: policyMod, lease_fee_base_msat: lease_feeBaseMsat, lease_fee_basis: lease_fee_basis, channel_fee_max_base_msat: channelFeeMaxBaseMsat, channel_fee_max_proportional_thousandths: channelFeeMaxProportional } : null;
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GET_FUNDER_POLICY }));
return this.httpClient.post(this.APIUrl + '/' + updatedLnImplementation + environment.CHANNELS_API + '/funderUpdate', postParams).pipe(
return this.httpClient.post(this.APIUrl + '/' + updatedLnImplementation + API_END_POINTS.CHANNELS_API + '/funderUpdate', postParams).pipe(
takeUntil(this.unSubs[11]),
map((res: any) => {
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.GET_FUNDER_POLICY }));

@ -1,7 +1,7 @@
/* eslint-disable no-console */
import { Injectable } from '@angular/core';
import { environment } from '../../../environments/environment';
export const { isDebugMode } = environment;
import { Injectable, isDevMode } from '@angular/core';
const isDebugMode = isDevMode();
const noop = (): any => null;
export abstract class Logger {

@ -4,8 +4,7 @@ import { BehaviorSubject, Subject, throwError, of } from 'rxjs';
import { catchError, takeUntil, map } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { environment, API_URL } from '../../../environments/environment';
import { AlertTypeEnum, UI_MESSAGES } from '../../shared/services/consts-enums-functions';
import { API_URL, API_END_POINTS, AlertTypeEnum, UI_MESSAGES } from '../../shared/services/consts-enums-functions';
import { LoopSwapStatus } from '../models/loopModels';
import { CommonService } from './common.service';
import { LoggerService } from '../../shared/services/logger.service';
@ -30,7 +29,7 @@ export class LoopService implements OnDestroy {
listSwaps() {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GET_LOOP_SWAPS }));
this.loopUrl = API_URL + environment.LOOP_API + '/swaps';
this.loopUrl = API_URL + API_END_POINTS.LOOP_API + '/swaps';
this.httpClient.get<LoopSwapStatus[]>(this.loopUrl).pipe(takeUntil(this.unSubs[0])).
subscribe({
next: (swapResponse: LoopSwapStatus[]) => {
@ -47,12 +46,12 @@ export class LoopService implements OnDestroy {
if (chanId !== '') {
requestBody['chanId'] = chanId;
}
this.loopUrl = API_URL + environment.LOOP_API + '/out';
this.loopUrl = API_URL + API_END_POINTS.LOOP_API + '/out';
return this.httpClient.post(this.loopUrl, requestBody).pipe(catchError((err) => this.handleErrorWithoutAlert('Loop Out for Channel: ' + chanId, UI_MESSAGES.NO_SPINNER, err)));
}
getLoopOutTerms() {
this.loopUrl = API_URL + environment.LOOP_API + '/out/terms';
this.loopUrl = API_URL + API_END_POINTS.LOOP_API + '/out/terms';
return this.httpClient.get(this.loopUrl).pipe(catchError((err) => this.handleErrorWithoutAlert('Loop Out Terms', UI_MESSAGES.NO_SPINNER, err)));
}
@ -60,7 +59,7 @@ export class LoopService implements OnDestroy {
let params = new HttpParams();
params = params.append('targetConf', targetConf.toString());
params = params.append('swapPublicationDeadline', swapPublicationDeadline.toString());
this.loopUrl = API_URL + environment.LOOP_API + '/out/quote/' + amount;
this.loopUrl = API_URL + API_END_POINTS.LOOP_API + '/out/quote/' + amount;
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GET_QUOTE }));
return this.httpClient.get(this.loopUrl, { params: params }).pipe(
takeUntil(this.unSubs[1]),
@ -76,7 +75,7 @@ export class LoopService implements OnDestroy {
let params = new HttpParams();
params = params.append('targetConf', targetConf.toString());
params = params.append('swapPublicationDeadline', (new Date().getTime() + (30 * 60000)).toString());
this.loopUrl = API_URL + environment.LOOP_API + '/out/termsAndQuotes';
this.loopUrl = API_URL + API_END_POINTS.LOOP_API + '/out/termsAndQuotes';
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GET_TERMS_QUOTES }));
return this.httpClient.get(this.loopUrl, { params: params }).pipe(
takeUntil(this.unSubs[2]),
@ -89,12 +88,12 @@ export class LoopService implements OnDestroy {
loopIn(amount: number, swapFee: number, minerFee: number, lastHop: string, externalHtlc: boolean) {
const requestBody = { amount: amount, swapFee: swapFee, minerFee: minerFee, lastHop: lastHop, externalHtlc: externalHtlc };
this.loopUrl = API_URL + environment.LOOP_API + '/in';
this.loopUrl = API_URL + API_END_POINTS.LOOP_API + '/in';
return this.httpClient.post(this.loopUrl, requestBody).pipe(catchError((err) => this.handleErrorWithoutAlert('Loop In', UI_MESSAGES.NO_SPINNER, err)));
}
getLoopInTerms() {
this.loopUrl = API_URL + environment.LOOP_API + '/in/terms';
this.loopUrl = API_URL + API_END_POINTS.LOOP_API + '/in/terms';
return this.httpClient.get(this.loopUrl).pipe(catchError((err) => this.handleErrorWithoutAlert('Loop In Terms', UI_MESSAGES.NO_SPINNER, err)));
}
@ -102,7 +101,7 @@ export class LoopService implements OnDestroy {
let params = new HttpParams();
params = params.append('targetConf', targetConf.toString());
params = params.append('swapPublicationDeadline', swapPublicationDeadline.toString());
this.loopUrl = API_URL + environment.LOOP_API + '/in/quote/' + amount;
this.loopUrl = API_URL + API_END_POINTS.LOOP_API + '/in/quote/' + amount;
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GET_QUOTE }));
return this.httpClient.get(this.loopUrl, { params: params }).pipe(
takeUntil(this.unSubs[3]),
@ -118,7 +117,7 @@ export class LoopService implements OnDestroy {
let params = new HttpParams();
params = params.append('targetConf', targetConf.toString());
params = params.append('swapPublicationDeadline', (new Date().getTime() + (30 * 60000)).toString());
this.loopUrl = API_URL + environment.LOOP_API + '/in/termsAndQuotes';
this.loopUrl = API_URL + API_END_POINTS.LOOP_API + '/in/termsAndQuotes';
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GET_TERMS_QUOTES }));
return this.httpClient.get(this.loopUrl, { params: params }).pipe(
takeUntil(this.unSubs[4]),
@ -130,7 +129,7 @@ export class LoopService implements OnDestroy {
}
getSwap(id: string) {
this.loopUrl = API_URL + environment.LOOP_API + '/swap/' + id;
this.loopUrl = API_URL + API_END_POINTS.LOOP_API + '/swap/' + id;
return this.httpClient.get(this.loopUrl).pipe(catchError((err) => this.handleErrorWithoutAlert('Loop Get Swap for ID: ' + id, UI_MESSAGES.NO_SPINNER, err)));
}

@ -1,8 +1,7 @@
import { HttpResponse } from '@angular/common/http';
import { BehaviorSubject, of, throwError } from 'rxjs';
import { API_URL } from '../../../environments/environment';
import { CLNActions } from '../services/consts-enums-functions';
import { API_URL, CLNActions } from '../services/consts-enums-functions';
import { mockResponseData } from './test-data';
export class mockMatDialogRef {

@ -21,8 +21,7 @@ import { LoggerService } from '../shared/services/logger.service';
import { DataService } from '../shared/services/data.service';
import { WebSocketClientService } from '../shared/services/web-socket.service';
import { ErrorMessageComponent } from '../shared/components/data-modal/error-message/error-message.component';
import { APICallStatusEnum, RTLActions, UI_MESSAGES } from '../shared/services/consts-enums-functions';
import { environment } from '../../environments/environment';
import { API_END_POINTS, APICallStatusEnum, RTLActions, UI_MESSAGES } from '../shared/services/consts-enums-functions';
import { RTLEffects } from './rtl.effects';
import { RTLState } from './rtl.state';
@ -97,7 +96,7 @@ describe('RTL Root Effects', () => {
done();
setTimeout(() => sub.unsubscribe());
});
const req = httpTestingController.expectOne(environment.CONF_API + '/updateSelNode/1/-1');
const req = httpTestingController.expectOne(API_END_POINTS.CONF_API + '/updateSelNode/1/-1');
const expectedResponse = mockResponseData.setSelectedNodeSuccess;
req.flush(expectedResponse);
expect(req.request.method).toEqual('GET');
@ -117,8 +116,8 @@ describe('RTL Root Effects', () => {
expect(storeDispatchSpy.calls.all()[0].args[0]).toEqual(openSpinner({ payload: UI_MESSAGES.UPDATE_SELECTED_NODE }));
expect(storeDispatchSpy.calls.all()[1].args[0]).toEqual(updateRootAPICallStatus({ payload: { action: 'UpdateSelNode', status: APICallStatusEnum.INITIATED } }));
expect(storeDispatchSpy.calls.all()[2].args[0]).toEqual(closeSpinner({ payload: UI_MESSAGES.UPDATE_SELECTED_NODE }));
expect(storeDispatchSpy.calls.all()[3].args[0]).toEqual(openAlert({ payload: { data: { type: 'ERROR', alertTitle: 'Update Selected Node Failed!', message: { code: '500', message: 'Request Failed. ', URL: environment.CONF_API + '/updateSelNode' }, component: ErrorMessageComponent } } }));
expect(storeDispatchSpy.calls.all()[4].args[0]).toEqual(updateRootAPICallStatus({ payload: { action: 'UpdateSelNode', status: APICallStatusEnum.ERROR, statusCode: '500', message: 'Request Failed. ', URL: environment.CONF_API + '/updateSelNode' } }));
expect(storeDispatchSpy.calls.all()[3].args[0]).toEqual(openAlert({ payload: { data: { type: 'ERROR', alertTitle: 'Update Selected Node Failed!', message: { code: '500', message: 'Request Failed. ', URL: API_END_POINTS.CONF_API + '/updateSelNode' }, component: ErrorMessageComponent } } }));
expect(storeDispatchSpy.calls.all()[4].args[0]).toEqual(updateRootAPICallStatus({ payload: { action: 'UpdateSelNode', status: APICallStatusEnum.ERROR, statusCode: '500', message: 'Request Failed. ', URL: API_END_POINTS.CONF_API + '/updateSelNode' } }));
expect(storeDispatchSpy).toHaveBeenCalledTimes(5);
done();
setTimeout(() => sub.unsubscribe());

@ -1,4 +1,4 @@
import { Injectable, OnDestroy } from '@angular/core';
import { Injectable, OnDestroy, isDevMode } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Router } from '@angular/router';
import { Store } from '@ngrx/store';
@ -9,14 +9,13 @@ import { map, mergeMap, catchError, take, withLatestFrom, takeUntil } from 'rxjs
import { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar';
import { environment, API_URL } from '../../environments/environment';
import { WebSocketClientService } from '../shared/services/web-socket.service';
import { LoggerService } from '../shared/services/logger.service';
import { SessionService } from '../shared/services/session.service';
import { CommonService } from '../shared/services/common.service';
import { DataService } from '../shared/services/data.service';
import { RTLConfiguration, Settings, ConfigSettingsNode, GetInfoRoot } from '../shared/models/RTLconfig';
import { RTLActions, APICallStatusEnum, AuthenticateWith, CURRENCY_UNITS, ScreenSizeEnum, UI_MESSAGES } from '../shared/services/consts-enums-functions';
import { API_URL, API_END_POINTS, RTLActions, APICallStatusEnum, AuthenticateWith, CURRENCY_UNITS, ScreenSizeEnum, UI_MESSAGES } from '../shared/services/consts-enums-functions';
import { DialogConfig } from '../shared/models/alertData';
import { FetchFile, Login, OpenSnackBar, ResetPassword, SaveSettings, SetSelectedNode, UpdateServiceSetting, VerifyTwoFA } from '../shared/models/rtlModels';
@ -214,9 +213,9 @@ export class RTLEffects implements OnDestroy {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.GET_RTL_CONFIG }));
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'FetchRTLConfig', status: APICallStatusEnum.INITIATED } }));
if (this.sessionService.getItem('token')) {
return this.httpClient.get<RTLConfiguration>(environment.CONF_API + '/rtlconf');
return this.httpClient.get<RTLConfiguration>(API_END_POINTS.CONF_API + '/rtlconf');
} else {
return this.httpClient.get<RTLConfiguration>(environment.CONF_API + '/rtlconfinit');
return this.httpClient.get<RTLConfiguration>(API_END_POINTS.CONF_API + '/rtlconfinit');
}
}),
map((rtlConfig: RTLConfiguration) => {
@ -243,7 +242,7 @@ export class RTLEffects implements OnDestroy {
}
}),
catchError((err) => {
this.handleErrorWithAlert('FetchRTLConfig', UI_MESSAGES.GET_RTL_CONFIG, 'Fetch RTL Config Failed!', environment.CONF_API, err);
this.handleErrorWithAlert('FetchRTLConfig', UI_MESSAGES.GET_RTL_CONFIG, 'Fetch RTL Config Failed!', API_END_POINTS.CONF_API, err);
return of({ type: RTLActions.VOID });
}))
);
@ -256,13 +255,13 @@ export class RTLEffects implements OnDestroy {
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'UpdateSettings', status: APICallStatusEnum.INITIATED } }));
let updateSettingReq = new Observable();
if (action.payload.settings && action.payload.defaultNodeIndex) {
const settingsRes = this.httpClient.post<Settings>(environment.CONF_API, { updatedSettings: action.payload.settings });
const defaultNodeRes = this.httpClient.post(environment.CONF_API + '/updateDefaultNode', { defaultNodeIndex: action.payload.defaultNodeIndex });
const settingsRes = this.httpClient.post<Settings>(API_END_POINTS.CONF_API, { updatedSettings: action.payload.settings });
const defaultNodeRes = this.httpClient.post(API_END_POINTS.CONF_API + '/updateDefaultNode', { defaultNodeIndex: action.payload.defaultNodeIndex });
updateSettingReq = forkJoin([settingsRes, defaultNodeRes]);
} else if (action.payload.settings && !action.payload.defaultNodeIndex) {
updateSettingReq = this.httpClient.post(environment.CONF_API, { updatedSettings: action.payload.settings });
updateSettingReq = this.httpClient.post(API_END_POINTS.CONF_API, { updatedSettings: action.payload.settings });
} else if (!action.payload.settings && action.payload.defaultNodeIndex) {
updateSettingReq = this.httpClient.post(environment.CONF_API + '/updateDefaultNode', { defaultNodeIndex: action.payload.defaultNodeIndex });
updateSettingReq = this.httpClient.post(API_END_POINTS.CONF_API + '/updateDefaultNode', { defaultNodeIndex: action.payload.defaultNodeIndex });
}
return updateSettingReq.pipe(map((updateStatus: any) => {
this.logger.info(updateStatus);
@ -273,7 +272,7 @@ export class RTLEffects implements OnDestroy {
payload: (!updateStatus.length) ? updateStatus.message + '.' : updateStatus[0].message + '.'
};
}), catchError((err) => {
this.handleErrorWithAlert('UpdateSettings', action.payload.uiMessage, 'Update Settings Failed!', environment.CONF_API, (!err.length) ? err : err[0]);
this.handleErrorWithAlert('UpdateSettings', action.payload.uiMessage, 'Update Settings Failed!', API_END_POINTS.CONF_API, (!err.length) ? err : err[0]);
return of({ type: RTLActions.VOID });
}));
}))
@ -285,7 +284,7 @@ export class RTLEffects implements OnDestroy {
mergeMap((action: { type: string, payload: UpdateServiceSetting }) => {
this.store.dispatch(openSpinner({ payload: action.payload.uiMessage }));
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'UpdateServiceSettings', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(environment.CONF_API + '/updateServiceSettings', action.payload).pipe(
return this.httpClient.post(API_END_POINTS.CONF_API + '/updateServiceSettings', action.payload).pipe(
map((updateStatus: any) => {
this.logger.info(updateStatus);
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'UpdateServiceSettings', status: APICallStatusEnum.COMPLETED } }));
@ -297,7 +296,7 @@ export class RTLEffects implements OnDestroy {
};
}),
catchError((err) => {
this.handleErrorWithAlert('UpdateServiceSettings', action.payload.uiMessage, 'Update Service Settings Failed!', environment.CONF_API, err);
this.handleErrorWithAlert('UpdateServiceSettings', action.payload.uiMessage, 'Update Service Settings Failed!', API_END_POINTS.CONF_API, err);
return of({ type: RTLActions.VOID });
})
);
@ -310,7 +309,7 @@ export class RTLEffects implements OnDestroy {
mergeMap((action: { type: string, payload: { secret2fa: string } }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.UPDATE_UI_SETTINGS }));
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'Update2FASettings', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(environment.CONF_API + '/update2FA', { secret2fa: action.payload.secret2fa });
return this.httpClient.post(API_END_POINTS.CONF_API + '/update2FA', { secret2fa: action.payload.secret2fa });
}),
withLatestFrom(this.store.select(rootAppConfig)),
map(([updateStatus, appConfig]: [any, RTLConfiguration]) => {
@ -321,7 +320,7 @@ export class RTLEffects implements OnDestroy {
this.store.dispatch(setRTLConfig({ payload: appConfig }));
}),
catchError((err) => {
this.handleErrorWithAlert('Update2FASettings', UI_MESSAGES.UPDATE_UI_SETTINGS, 'Update 2FA Settings Failed!', environment.CONF_API, err);
this.handleErrorWithAlert('Update2FASettings', UI_MESSAGES.UPDATE_UI_SETTINGS, 'Update 2FA Settings Failed!', API_END_POINTS.CONF_API, err);
return of({ type: RTLActions.VOID });
})),
{ dispatch: false }
@ -333,7 +332,7 @@ export class RTLEffects implements OnDestroy {
mergeMap((action: { type: string, payload: string }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.OPEN_CONFIG_FILE }));
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'fetchConfig', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(environment.CONF_API + '/config/' + action.payload).
return this.httpClient.get(API_END_POINTS.CONF_API + '/config/' + action.payload).
pipe(map((configFile: any) => {
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'fetchConfig', status: APICallStatusEnum.COMPLETED } }));
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.OPEN_CONFIG_FILE }));
@ -342,7 +341,7 @@ export class RTLEffects implements OnDestroy {
payload: configFile
};
}), catchError((err: any) => {
this.handleErrorWithAlert('fetchConfig', UI_MESSAGES.OPEN_CONFIG_FILE, 'Fetch Config Failed!', environment.CONF_API + '/config/' + action.payload, err);
this.handleErrorWithAlert('fetchConfig', UI_MESSAGES.OPEN_CONFIG_FILE, 'Fetch Config Failed!', API_END_POINTS.CONF_API + '/config/' + action.payload, err);
return of({ type: RTLActions.VOID });
}));
}))
@ -360,7 +359,7 @@ export class RTLEffects implements OnDestroy {
ofType(RTLActions.IS_AUTHORIZED),
mergeMap((action: { type: string, payload: string }) => {
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'IsAuthorized', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(environment.AUTHENTICATE_API, {
return this.httpClient.post(API_END_POINTS.AUTHENTICATE_API, {
authenticateWith: (!action.payload || action.payload.trim() === '') ? AuthenticateWith.JWT : AuthenticateWith.PASSWORD,
authenticationValue: (!action.payload || action.payload.trim() === '') ? (this.sessionService.getItem('token') ? this.sessionService.getItem('token') : '') : action.payload
}).pipe(map((postRes: any) => {
@ -372,7 +371,7 @@ export class RTLEffects implements OnDestroy {
payload: postRes
};
}), catchError((err) => {
this.handleErrorWithAlert('IsAuthorized', UI_MESSAGES.NO_SPINNER, 'Authorization Failed', environment.AUTHENTICATE_API, err);
this.handleErrorWithAlert('IsAuthorized', UI_MESSAGES.NO_SPINNER, 'Authorization Failed', API_END_POINTS.AUTHENTICATE_API, err);
return of({
type: RTLActions.IS_AUTHORIZED_RES,
payload: 'ERROR'
@ -397,7 +396,7 @@ export class RTLEffects implements OnDestroy {
this.store.dispatch(resetCLStore({ payload: null }));
this.store.dispatch(resetECLStore({ payload: null }));
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'Login', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(environment.AUTHENTICATE_API, {
return this.httpClient.post(API_END_POINTS.AUTHENTICATE_API, {
authenticateWith: (!action.payload.password) ? AuthenticateWith.JWT : AuthenticateWith.PASSWORD,
authenticationValue: (!action.payload.password) ? (this.sessionService.getItem('token') ? this.sessionService.getItem('token') : '') : action.payload.password,
twoFAToken: (action.payload.twoFAToken) ? action.payload.twoFAToken : ''
@ -427,7 +426,7 @@ export class RTLEffects implements OnDestroy {
mergeMap((action: { type: string, payload: VerifyTwoFA }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.VERIFY_TOKEN }));
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'VerifyToken', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(environment.AUTHENTICATE_API + '/token', { authentication2FA: action.payload.token }).
return this.httpClient.post(API_END_POINTS.AUTHENTICATE_API + '/token', { authentication2FA: action.payload.token }).
pipe(
map((postRes: any) => {
this.logger.info(postRes);
@ -437,7 +436,7 @@ export class RTLEffects implements OnDestroy {
this.setLoggedInDetails(false, action.payload.authResponse);
}),
catchError((err) => {
this.handleErrorWithAlert('VerifyToken', UI_MESSAGES.VERIFY_TOKEN, 'Authorization Failed!', environment.AUTHENTICATE_API + '/token', err);
this.handleErrorWithAlert('VerifyToken', UI_MESSAGES.VERIFY_TOKEN, 'Authorization Failed!', API_END_POINTS.AUTHENTICATE_API + '/token', err);
return of({ type: RTLActions.VOID });
})
);
@ -459,7 +458,7 @@ export class RTLEffects implements OnDestroy {
this.store.dispatch(setNodeData({ payload: {} }));
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.LOG_OUT }));
this.logger.info('Logged out from browser');
return this.httpClient.get(environment.AUTHENTICATE_API + '/logout').
return this.httpClient.get(API_END_POINTS.AUTHENTICATE_API + '/logout').
pipe(map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.LOG_OUT }));
@ -474,7 +473,7 @@ export class RTLEffects implements OnDestroy {
ofType(RTLActions.RESET_PASSWORD),
mergeMap((action: { type: string, payload: ResetPassword }) => {
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'ResetPassword', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.post(environment.AUTHENTICATE_API + '/reset', { currPassword: action.payload.currPassword, newPassword: action.payload.newPassword }).pipe(
return this.httpClient.post(API_END_POINTS.AUTHENTICATE_API + '/reset', { currPassword: action.payload.currPassword, newPassword: action.payload.newPassword }).pipe(
takeUntil(this.unSubs[0]),
map((postRes: any) => {
this.logger.info(postRes);
@ -489,7 +488,7 @@ export class RTLEffects implements OnDestroy {
};
}),
catchError((err) => {
this.handleErrorWithAlert('ResetPassword', UI_MESSAGES.NO_SPINNER, 'Password Reset Failed!', environment.AUTHENTICATE_API + '/reset', err);
this.handleErrorWithAlert('ResetPassword', UI_MESSAGES.NO_SPINNER, 'Password Reset Failed!', API_END_POINTS.AUTHENTICATE_API + '/reset', err);
return of({ type: RTLActions.VOID });
}));
}))
@ -501,7 +500,7 @@ export class RTLEffects implements OnDestroy {
mergeMap((action: { type: string, payload: SetSelectedNode }) => {
this.store.dispatch(openSpinner({ payload: action.payload.uiMessage }));
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'UpdateSelNode', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(environment.CONF_API + '/updateSelNode/' + action.payload.currentLnNode?.index + '/' + action.payload.prevLnNodeIndex).pipe(
return this.httpClient.get(API_END_POINTS.CONF_API + '/updateSelNode/' + action.payload.currentLnNode?.index + '/' + action.payload.prevLnNodeIndex).pipe(
map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'UpdateSelNode', status: APICallStatusEnum.COMPLETED } }));
@ -510,7 +509,7 @@ export class RTLEffects implements OnDestroy {
return { type: RTLActions.VOID };
}),
catchError((err: any) => {
this.handleErrorWithAlert('UpdateSelNode', action.payload.uiMessage, 'Update Selected Node Failed!', environment.CONF_API + '/updateSelNode', err);
this.handleErrorWithAlert('UpdateSelNode', action.payload.uiMessage, 'Update Selected Node Failed!', API_END_POINTS.CONF_API + '/updateSelNode', err);
return of({ type: RTLActions.VOID });
})
);
@ -524,7 +523,7 @@ export class RTLEffects implements OnDestroy {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.DOWNLOAD_BACKUP_FILE }));
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'FetchFile', status: APICallStatusEnum.INITIATED } }));
const query = '?channel=' + action.payload.channelPoint + (action.payload.path ? '&path=' + action.payload.path : '');
return this.httpClient.get(environment.CONF_API + '/file' + query).pipe(
return this.httpClient.get(API_END_POINTS.CONF_API + '/file' + query).pipe(
map((fetchedFile: any) => {
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'FetchFile', status: APICallStatusEnum.COMPLETED } }));
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.DOWNLOAD_BACKUP_FILE }));
@ -534,7 +533,7 @@ export class RTLEffects implements OnDestroy {
};
}),
catchError((err: any) => {
this.handleErrorWithAlert('fetchFile', UI_MESSAGES.DOWNLOAD_BACKUP_FILE, 'Download Backup File Failed!', environment.CONF_API + '/file' + query, { status: this.commonService.extractErrorNumber(err), error: { error: this.commonService.extractErrorCode(err) } });
this.handleErrorWithAlert('fetchFile', UI_MESSAGES.DOWNLOAD_BACKUP_FILE, 'Download Backup File Failed!', API_END_POINTS.CONF_API + '/file' + query, { status: this.commonService.extractErrorNumber(err), error: { error: this.commonService.extractErrorCode(err) } });
return of({ type: RTLActions.VOID });
})
);
@ -567,8 +566,8 @@ export class RTLEffects implements OnDestroy {
if (this.sessionService.getItem('token')) {
const nodeLnImplementation = node.lnImplementation ? node.lnImplementation.toUpperCase() : 'LND';
this.dataService.setLnImplementation(nodeLnImplementation);
const apiUrl = (environment.production && window.location.origin) ? (window.location.origin + '/rtl/api') : API_URL;
this.wsService.connectWebSocket(apiUrl?.replace(/^http/, 'ws') + environment.Web_SOCKET_API, (node.index ? node.index.toString() : '-1'));
const apiUrl = (!isDevMode() && window.location.origin) ? (window.location.origin + '/rtl/api') : API_URL;
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 } }));

@ -1,31 +0,0 @@
export const API_URL = './api';
export const environment = {
production: true,
isDebugMode: false,
AUTHENTICATE_API: API_URL + '/authenticate',
CONF_API: API_URL + '/conf',
PAGE_SETTINGS_API: API_URL + '/pagesettings',
BALANCE_API: '/balance',
FEES_API: '/fees',
PEERS_API: '/peers',
CHANNELS_API: '/channels',
CHANNELS_BACKUP_API: '/channels/backup',
GETINFO_API: '/getinfo',
WALLET_API: '/wallet',
NETWORK_API: '/network',
NEW_ADDRESS_API: '/newaddress',
TRANSACTIONS_API: '/transactions',
PAYMENTS_API: '/payments',
INVOICES_API: '/invoices',
SWITCH_API: '/switch',
ON_CHAIN_API: '/onchain',
MESSAGE_API: '/message',
OFFERS_API: '/offers',
UTILITY_API: '/utility',
LOOP_API: '/loop',
BOLTZ_API: '/boltz',
Web_SOCKET_API: '/ws'
};
export const VERSION = '0.13.3-beta';

@ -1,31 +0,0 @@
export const API_URL = 'http://localhost:3000/rtl/api';
export const environment = {
production: false,
isDebugMode: true,
AUTHENTICATE_API: API_URL + '/authenticate',
CONF_API: API_URL + '/conf',
PAGE_SETTINGS_API: API_URL + '/pagesettings',
BALANCE_API: '/balance',
FEES_API: '/fees',
PEERS_API: '/peers',
CHANNELS_API: '/channels',
CHANNELS_BACKUP_API: '/channels/backup',
GETINFO_API: '/getinfo',
WALLET_API: '/wallet',
NETWORK_API: '/network',
NEW_ADDRESS_API: '/newaddress',
TRANSACTIONS_API: '/transactions',
PAYMENTS_API: '/payments',
INVOICES_API: '/invoices',
SWITCH_API: '/switch',
ON_CHAIN_API: '/onchain',
MESSAGE_API: '/message',
OFFERS_API: '/offers',
UTILITY_API: '/utility',
LOOP_API: '/loop',
BOLTZ_API: '/boltz',
Web_SOCKET_API: '/ws'
};
export const VERSION = '0.13.3-beta';

@ -1,13 +1,4 @@
/* eslint-disable no-console */
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule).
catch((err) => console.log(err));
platformBrowserDynamic().bootstrapModule(AppModule).catch((err) => console.error(err));

@ -8,23 +8,14 @@ module.exports = function () {
try {
var versionStr = 'export const VERSION = \'' + appVersion + '\';';
console.log('\n========================================================================');
console.log('Updating application version to ' + appVersion + ' in dev environment file.');
console.log('Updating application version constant to ' + appVersion + '.');
console.log('========================================================================');
var versionFilePath = path.join(__dirname + '/environments/environment.ts');
var versionFilePath = path.join(__dirname + '/app/shared/services/consts-enums-functions.ts');
var envFileData = fs.readFileSync(versionFilePath, 'utf-8');
var envFileDataLined = envFileData.split(os.EOL);
var versionLineIndex = envFileDataLined.findIndex(function(lineItem) { return lineItem.includes('export const VERSION = ') || lineItem.includes('export const VERSION=') });
envFileDataLined[versionLineIndex] = versionStr;
fs.writeFileSync(versionFilePath, envFileDataLined.join(os.EOL), 'utf-8');
console.log('\n========================================================================');
console.log('Updating application version to ' + appVersion + ' in prod environment file.');
console.log('========================================================================');
var versionProdFilePath = path.join(__dirname + '/environments/environment.prod.ts');
var envProdFileData = fs.readFileSync(versionProdFilePath, 'utf-8');
var envProdFileDataLined = envProdFileData.split(os.EOL);
var versionProdLineIndex = envProdFileDataLined.findIndex(function(lineItem) { return lineItem.includes('export const VERSION = ') || lineItem.includes('export const VERSION=') });
envProdFileDataLined[versionProdLineIndex] = versionStr;
fs.writeFileSync(versionProdFilePath, envProdFileDataLined.join(os.EOL), 'utf-8');
} catch (err) {
console.error(err);
}

Loading…
Cancel
Save