@ -19,9 +19,9 @@ import { closeAllDialogs, closeSpinner, logout, openAlert, openSnackBar, openSpi
import { RTLState } from '../../store/rtl.state' ;
import { RTLState } from '../../store/rtl.state' ;
import { addUpdateOfferBookmark , fetchBalance , fetchChannels , fetchFeeRates , fetchFees , fetchInvoices , fetchLocalRemoteBalance ,
import { addUpdateOfferBookmark , fetchBalance , fetchChannels , fetchFeeRates , fetchFees , fetchInvoices , fetchLocalRemoteBalance ,
fetchPayments , fetchPeers , fetchUTXOs , setLookup , setPeers , setQueryRoutes , updateCL APICallStatus, updateInvoice , setOfferInvoice ,
fetchPayments , fetchPeers , fetchUTXOs , setLookup , setPeers , setQueryRoutes , updateCL N APICallStatus, updateInvoice , setOfferInvoice ,
sendPaymentStatus , setForwardingHistory , fetchPageSettings } from './cln.actions' ;
sendPaymentStatus , setForwardingHistory } from './cln.actions' ;
import { allAPIsCallStatus , clnNodeInformation , nodeInfoAndBalance } from './cln.selector' ;
import { allAPIsCallStatus } from './cln.selector' ;
import { ApiCallsListCL } from '../../shared/models/apiCallsPayload' ;
import { ApiCallsListCL } from '../../shared/models/apiCallsPayload' ;
import { CLNOfferInformationComponent } from '../transactions/offers/offer-information-modal/offer-information.component' ;
import { CLNOfferInformationComponent } from '../transactions/offers/offer-information-modal/offer-information.component' ;
@ -30,7 +30,7 @@ export class CLNEffects implements OnDestroy {
CHILD_API_URL = API_URL + '/cln' ;
CHILD_API_URL = API_URL + '/cln' ;
API_VERION = '' ;
API_VERION = '' ;
NODE _VERISON = '' ;
CL N_VERISON = '' ;
private flgInitialized = false ;
private flgInitialized = false ;
private unSubs : Array < Subject < void > > = [ new Subject ( ) , new Subject ( ) , new Subject ( ) ] ;
private unSubs : Array < Subject < void > > = [ new Subject ( ) , new Subject ( ) , new Subject ( ) ] ;
@ -89,7 +89,7 @@ export class CLNEffects implements OnDestroy {
mergeMap ( ( action : { type : string , payload : { loadPage : string } } ) = > {
mergeMap ( ( action : { type : string , payload : { loadPage : string } } ) = > {
this . flgInitialized = false ;
this . flgInitialized = false ;
this . store . dispatch ( setApiUrl ( { payload : this.CHILD_API_URL } ) ) ;
this . store . dispatch ( setApiUrl ( { payload : this.CHILD_API_URL } ) ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchInfo' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchInfo' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.GET_NODE_INFO } ) ) ;
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.GET_NODE_INFO } ) ) ;
return this . httpClient . get < GetInfo > ( this . CHILD_API_URL + API_END_POINTS . GETINFO_API ) .
return this . httpClient . get < GetInfo > ( this . CHILD_API_URL + API_END_POINTS . GETINFO_API ) .
pipe (
pipe (
@ -97,13 +97,13 @@ export class CLNEffects implements OnDestroy {
map ( ( info ) = > {
map ( ( info ) = > {
this . logger . info ( info ) ;
this . logger . info ( info ) ;
this . API_VERION = info . api_version || '' ;
this . API_VERION = info . api_version || '' ;
this . NODE _VERISON = info . version || '' ;
this . CL N_VERISON = info . version || '' ;
if ( info . chains && info . chains . length && info . chains [ 0 ] &&
if ( info . chains && info . chains . length && info . chains [ 0 ] &&
( typeof info . chains [ 0 ] === 'object' && info . chains [ 0 ] . hasOwnProperty ( 'chain' ) && info ? . chains [ 0 ] . chain &&
( typeof info . chains [ 0 ] === 'object' && info . chains [ 0 ] . hasOwnProperty ( 'chain' ) && info ? . chains [ 0 ] . chain &&
( info ? . chains [ 0 ] . chain . toLowerCase ( ) . indexOf ( 'bitcoin' ) < 0 && info ? . chains [ 0 ] . chain . toLowerCase ( ) . indexOf ( 'liquid' ) < 0 )
( info ? . chains [ 0 ] . chain . toLowerCase ( ) . indexOf ( 'bitcoin' ) < 0 && info ? . chains [ 0 ] . chain . toLowerCase ( ) . indexOf ( 'liquid' ) < 0 )
)
)
) {
) {
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchInfo' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchInfo' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.GET_NODE_INFO } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.GET_NODE_INFO } ) ) ;
this . store . dispatch ( closeAllDialogs ( ) ) ;
this . store . dispatch ( closeAllDialogs ( ) ) ;
setTimeout ( ( ) = > {
setTimeout ( ( ) = > {
@ -122,7 +122,7 @@ export class CLNEffects implements OnDestroy {
} ;
} ;
} else {
} else {
this . initializeRemainingData ( info , action . payload . loadPage ) ;
this . initializeRemainingData ( info , action . payload . loadPage ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchInfo' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchInfo' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.GET_NODE_INFO } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.GET_NODE_INFO } ) ) ;
return {
return {
type : CLNActions . SET_INFO_CLN ,
type : CLNActions . SET_INFO_CLN ,
@ -144,12 +144,12 @@ export class CLNEffects implements OnDestroy {
fetchFeesCL = createEffect ( ( ) = > this . actions . pipe (
fetchFeesCL = createEffect ( ( ) = > this . actions . pipe (
ofType ( CLNActions . FETCH_FEES_CLN ) ,
ofType ( CLNActions . FETCH_FEES_CLN ) ,
mergeMap ( ( ) = > {
mergeMap ( ( ) = > {
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchFees' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchFees' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . get < Fees > ( this . CHILD_API_URL + API_END_POINTS . FEES_API ) ;
return this . httpClient . get < Fees > ( this . CHILD_API_URL + API_END_POINTS . FEES_API ) ;
} ) ,
} ) ,
map ( ( fees ) = > {
map ( ( fees ) = > {
this . logger . info ( fees ) ;
this . logger . info ( fees ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchFees' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchFees' , status : APICallStatusEnum.COMPLETED } } ) ) ;
return {
return {
type : CLNActions . SET_FEES_CLN ,
type : CLNActions . SET_FEES_CLN ,
payload : fees ? fees : { }
payload : fees ? fees : { }
@ -164,12 +164,12 @@ export class CLNEffects implements OnDestroy {
fetchFeeRatesCL = createEffect ( ( ) = > this . actions . pipe (
fetchFeeRatesCL = createEffect ( ( ) = > this . actions . pipe (
ofType ( CLNActions . FETCH_FEE_RATES_CLN ) ,
ofType ( CLNActions . FETCH_FEE_RATES_CLN ) ,
mergeMap ( ( action : { type : string , payload : string } ) = > {
mergeMap ( ( action : { type : string , payload : string } ) = > {
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchFeeRates' + action . payload , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchFeeRates' + action . payload , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . get < FeeRates > ( this . CHILD_API_URL + API_END_POINTS . NETWORK_API + '/feeRates/' + action . payload ) .
return this . httpClient . get < FeeRates > ( this . CHILD_API_URL + API_END_POINTS . NETWORK_API + '/feeRates/' + action . payload ) .
pipe (
pipe (
map ( ( feeRates ) = > {
map ( ( feeRates ) = > {
this . logger . info ( feeRates ) ;
this . logger . info ( feeRates ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchFeeRates' + action . payload , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchFeeRates' + action . payload , status : APICallStatusEnum.COMPLETED } } ) ) ;
return {
return {
type : CLNActions . SET_FEE_RATES_CLN ,
type : CLNActions . SET_FEE_RATES_CLN ,
payload : feeRates ? feeRates : { }
payload : feeRates ? feeRates : { }
@ -186,12 +186,12 @@ export class CLNEffects implements OnDestroy {
fetchBalanceCL = createEffect ( ( ) = > this . actions . pipe (
fetchBalanceCL = createEffect ( ( ) = > this . actions . pipe (
ofType ( CLNActions . FETCH_BALANCE_CLN ) ,
ofType ( CLNActions . FETCH_BALANCE_CLN ) ,
mergeMap ( ( ) = > {
mergeMap ( ( ) = > {
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchBalance' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchBalance' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . get < Balance > ( this . CHILD_API_URL + API_END_POINTS . BALANCE_API ) ;
return this . httpClient . get < Balance > ( this . CHILD_API_URL + API_END_POINTS . BALANCE_API ) ;
} ) ,
} ) ,
map ( ( balance ) = > {
map ( ( balance ) = > {
this . logger . info ( balance ) ;
this . logger . info ( balance ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchBalance' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchBalance' , status : APICallStatusEnum.COMPLETED } } ) ) ;
return {
return {
type : CLNActions . SET_BALANCE_CLN ,
type : CLNActions . SET_BALANCE_CLN ,
payload : balance ? balance : { }
payload : balance ? balance : { }
@ -206,12 +206,12 @@ export class CLNEffects implements OnDestroy {
fetchLocalRemoteBalanceCL = createEffect ( ( ) = > this . actions . pipe (
fetchLocalRemoteBalanceCL = createEffect ( ( ) = > this . actions . pipe (
ofType ( CLNActions . FETCH_LOCAL_REMOTE_BALANCE_CLN ) ,
ofType ( CLNActions . FETCH_LOCAL_REMOTE_BALANCE_CLN ) ,
mergeMap ( ( ) = > {
mergeMap ( ( ) = > {
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchLocalRemoteBalance' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchLocalRemoteBalance' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . get < LocalRemoteBalance > ( this . CHILD_API_URL + API_END_POINTS . CHANNELS_API + '/localRemoteBalance' ) ;
return this . httpClient . get < LocalRemoteBalance > ( this . CHILD_API_URL + API_END_POINTS . CHANNELS_API + '/localRemoteBalance' ) ;
} ) ,
} ) ,
map ( ( lrBalance ) = > {
map ( ( lrBalance ) = > {
this . logger . info ( lrBalance ) ;
this . logger . info ( lrBalance ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchLocalRemoteBalance' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchLocalRemoteBalance' , status : APICallStatusEnum.COMPLETED } } ) ) ;
return {
return {
type : CLNActions . SET_LOCAL_REMOTE_BALANCE_CLN ,
type : CLNActions . SET_LOCAL_REMOTE_BALANCE_CLN ,
payload : lrBalance ? lrBalance : { }
payload : lrBalance ? lrBalance : { }
@ -259,12 +259,12 @@ export class CLNEffects implements OnDestroy {
peersFetchCL = createEffect ( ( ) = > this . actions . pipe (
peersFetchCL = createEffect ( ( ) = > this . actions . pipe (
ofType ( CLNActions . FETCH_PEERS_CLN ) ,
ofType ( CLNActions . FETCH_PEERS_CLN ) ,
mergeMap ( ( ) = > {
mergeMap ( ( ) = > {
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchPeers' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchPeers' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . get ( this . CHILD_API_URL + API_END_POINTS . PEERS_API ) .
return this . httpClient . get ( this . CHILD_API_URL + API_END_POINTS . PEERS_API ) .
pipe (
pipe (
map ( ( peers : any ) = > {
map ( ( peers : any ) = > {
this . logger . info ( peers ) ;
this . logger . info ( peers ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchPeers' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchPeers' , status : APICallStatusEnum.COMPLETED } } ) ) ;
return {
return {
type : CLNActions . SET_PEERS_CLN ,
type : CLNActions . SET_PEERS_CLN ,
payload : peers || [ ]
payload : peers || [ ]
@ -282,12 +282,12 @@ export class CLNEffects implements OnDestroy {
ofType ( CLNActions . SAVE_NEW_PEER_CLN ) ,
ofType ( CLNActions . SAVE_NEW_PEER_CLN ) ,
mergeMap ( ( action : { type : string , payload : { id : string } } ) = > {
mergeMap ( ( action : { type : string , payload : { id : string } } ) = > {
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.CONNECT_PEER } ) ) ;
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.CONNECT_PEER } ) ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'SaveNewPeer' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'SaveNewPeer' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . post < Peer [ ] > ( this . CHILD_API_URL + API_END_POINTS . 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 (
pipe (
map ( ( postRes : Peer [ ] ) = > {
map ( ( postRes : Peer [ ] ) = > {
this . logger . info ( postRes ) ;
this . logger . info ( postRes ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'SaveNewPeer' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'SaveNewPeer' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.CONNECT_PEER } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.CONNECT_PEER } ) ) ;
this . store . dispatch ( setPeers ( { payload : ( postRes || [ ] ) } ) ) ;
this . store . dispatch ( setPeers ( { payload : ( postRes || [ ] ) } ) ) ;
return {
return {
@ -329,16 +329,16 @@ export class CLNEffects implements OnDestroy {
channelsFetchCL = createEffect ( ( ) = > this . actions . pipe (
channelsFetchCL = createEffect ( ( ) = > this . actions . pipe (
ofType ( CLNActions . FETCH_CHANNELS_CLN ) ,
ofType ( CLNActions . FETCH_CHANNELS_CLN ) ,
mergeMap ( ( ) = > {
mergeMap ( ( ) = > {
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchChannels' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchChannels' , status : APICallStatusEnum.INITIATED } } ) ) ;
const listChannelsEndpoint =
const listChannelsEndpoint =
this . commonService . isVersionCompatible ( this . NODE _VERISON, '23.02' ) &&
this . commonService . isVersionCompatible ( this . CL N_VERISON, '23.02' ) &&
this . commonService . isVersionCompatible ( this . API_VERION , '0.10.3' ) ?
this . commonService . isVersionCompatible ( this . API_VERION , '0.10.3' ) ?
'/listPeerChannels' : '/listChannels' ;
'/listPeerChannels' : '/listChannels' ;
return this . httpClient . get < Channel [ ] > ( this . CHILD_API_URL + API_END_POINTS . CHANNELS_API + listChannelsEndpoint ) ;
return this . httpClient . get < Channel [ ] > ( this . CHILD_API_URL + API_END_POINTS . CHANNELS_API + listChannelsEndpoint ) ;
} ) ,
} ) ,
map ( ( channels : Channel [ ] ) = > {
map ( ( channels : Channel [ ] ) = > {
this . logger . info ( channels ) ;
this . logger . info ( channels ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchChannels' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchChannels' , status : APICallStatusEnum.COMPLETED } } ) ) ;
const sortedChannels = { activeChannels : < Channel [ ] > [ ] , pendingChannels : < Channel [ ] > [ ] , inactiveChannels : < Channel [ ] > [ ] } ;
const sortedChannels = { activeChannels : < Channel [ ] > [ ] , pendingChannels : < Channel [ ] > [ ] , inactiveChannels : < Channel [ ] > [ ] } ;
channels . forEach ( ( channel ) = > {
channels . forEach ( ( channel ) = > {
if ( channel . id ) { channel . peer_id = channel . id ; }
if ( channel . id ) { channel . peer_id = channel . id ; }
@ -368,7 +368,7 @@ export class CLNEffects implements OnDestroy {
ofType ( CLNActions . SAVE_NEW_CHANNEL_CLN ) ,
ofType ( CLNActions . SAVE_NEW_CHANNEL_CLN ) ,
mergeMap ( ( action : { type : string , payload : SaveChannel } ) = > {
mergeMap ( ( action : { type : string , payload : SaveChannel } ) = > {
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.OPEN_CHANNEL } ) ) ;
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.OPEN_CHANNEL } ) ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'SaveNewChannel' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'SaveNewChannel' , status : APICallStatusEnum.INITIATED } } ) ) ;
const newPayload = { id : action.payload.peerId , satoshis : action.payload.satoshis , feeRate : action.payload.feeRate , announce : action.payload.announce } ;
const newPayload = { id : action.payload.peerId , satoshis : action.payload.satoshis , feeRate : action.payload.feeRate , announce : action.payload.announce } ;
if ( action . payload . minconf ) { newPayload [ 'minconf' ] = action . payload . minconf ; }
if ( action . payload . minconf ) { newPayload [ 'minconf' ] = action . payload . minconf ; }
if ( action . payload . utxos ) { newPayload [ 'utxos' ] = action . payload . utxos ; }
if ( action . payload . utxos ) { newPayload [ 'utxos' ] = action . payload . utxos ; }
@ -378,7 +378,7 @@ export class CLNEffects implements OnDestroy {
pipe (
pipe (
map ( ( postRes : any ) = > {
map ( ( postRes : any ) = > {
this . logger . info ( postRes ) ;
this . logger . info ( postRes ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'SaveNewChannel' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'SaveNewChannel' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.OPEN_CHANNEL } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.OPEN_CHANNEL } ) ) ;
this . store . dispatch ( openSnackBar ( { payload : 'Channel Added Successfully!' } ) ) ;
this . store . dispatch ( openSnackBar ( { payload : 'Channel Added Successfully!' } ) ) ;
this . store . dispatch ( fetchBalance ( ) ) ;
this . store . dispatch ( fetchBalance ( ) ) ;
@ -450,12 +450,12 @@ export class CLNEffects implements OnDestroy {
paymentsFetchCL = createEffect ( ( ) = > this . actions . pipe (
paymentsFetchCL = createEffect ( ( ) = > this . actions . pipe (
ofType ( CLNActions . FETCH_PAYMENTS_CLN ) ,
ofType ( CLNActions . FETCH_PAYMENTS_CLN ) ,
mergeMap ( ( ) = > {
mergeMap ( ( ) = > {
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchPayments' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchPayments' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . get < Payment [ ] > ( this . CHILD_API_URL + API_END_POINTS . PAYMENTS_API ) ;
return this . httpClient . get < Payment [ ] > ( this . CHILD_API_URL + API_END_POINTS . PAYMENTS_API ) ;
} ) ,
} ) ,
map ( ( payments ) = > {
map ( ( payments ) = > {
this . logger . info ( payments ) ;
this . logger . info ( payments ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchPayments' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchPayments' , status : APICallStatusEnum.COMPLETED } } ) ) ;
return {
return {
type : CLNActions . SET_PAYMENTS_CLN ,
type : CLNActions . SET_PAYMENTS_CLN ,
payload : payments || [ ]
payload : payments || [ ]
@ -472,13 +472,13 @@ export class CLNEffects implements OnDestroy {
ofType ( CLNActions . FETCH_OFFER_INVOICE_CLN ) ,
ofType ( CLNActions . FETCH_OFFER_INVOICE_CLN ) ,
mergeMap ( ( action : { type : string , payload : { offer : string , amount_msat? : string } } ) = > {
mergeMap ( ( action : { type : string , payload : { offer : string , amount_msat? : string } } ) = > {
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.FETCH_INVOICE } ) ) ;
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.FETCH_INVOICE } ) ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchOfferInvoice' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchOfferInvoice' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . post ( this . CHILD_API_URL + API_END_POINTS . OFFERS_API + '/fetchOfferInvoice' , action . payload ) .
return this . httpClient . post ( this . CHILD_API_URL + API_END_POINTS . OFFERS_API + '/fetchOfferInvoice' , action . payload ) .
pipe (
pipe (
map ( ( fetchedInvoice : any ) = > {
map ( ( fetchedInvoice : any ) = > {
this . logger . info ( fetchedInvoice ) ;
this . logger . info ( fetchedInvoice ) ;
setTimeout ( ( ) = > {
setTimeout ( ( ) = > {
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchOfferInvoice' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchOfferInvoice' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.FETCH_INVOICE } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.FETCH_INVOICE } ) ) ;
this . store . dispatch ( setOfferInvoice ( { payload : ( fetchedInvoice ? fetchedInvoice : { } ) } ) ) ;
this . store . dispatch ( setOfferInvoice ( { payload : ( fetchedInvoice ? fetchedInvoice : { } ) } ) ) ;
} , 500 ) ;
} , 500 ) ;
@ -507,11 +507,11 @@ export class CLNEffects implements OnDestroy {
ofType ( CLNActions . SEND_PAYMENT_CLN ) ,
ofType ( CLNActions . SEND_PAYMENT_CLN ) ,
mergeMap ( ( action : { type : string , payload : SendPayment } ) = > {
mergeMap ( ( action : { type : string , payload : SendPayment } ) = > {
this . store . dispatch ( openSpinner ( { payload : action.payload.uiMessage } ) ) ;
this . store . dispatch ( openSpinner ( { payload : action.payload.uiMessage } ) ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'SendPayment' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'SendPayment' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . post ( this . CHILD_API_URL + API_END_POINTS . PAYMENTS_API , action . payload ) . pipe (
return this . httpClient . post ( this . CHILD_API_URL + API_END_POINTS . PAYMENTS_API , action . payload ) . pipe (
map ( ( sendRes : any ) = > {
map ( ( sendRes : any ) = > {
this . logger . info ( sendRes ) ;
this . logger . info ( sendRes ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'SendPayment' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'SendPayment' , status : APICallStatusEnum.COMPLETED } } ) ) ;
let snackBarMessageStr = 'Payment Sent Successfully!' ;
let snackBarMessageStr = 'Payment Sent Successfully!' ;
if ( sendRes . saveToDBError ) {
if ( sendRes . saveToDBError ) {
snackBarMessageStr = 'Payment Sent Successfully but Offer Saving to Database Failed.' ;
snackBarMessageStr = 'Payment Sent Successfully but Offer Saving to Database Failed.' ;
@ -546,12 +546,12 @@ export class CLNEffects implements OnDestroy {
queryRoutesFetchCL = createEffect ( ( ) = > this . actions . pipe (
queryRoutesFetchCL = createEffect ( ( ) = > this . actions . pipe (
ofType ( CLNActions . GET_QUERY_ROUTES_CLN ) ,
ofType ( CLNActions . GET_QUERY_ROUTES_CLN ) ,
mergeMap ( ( action : { type : string , payload : GetQueryRoutes } ) = > {
mergeMap ( ( action : { type : string , payload : GetQueryRoutes } ) = > {
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'GetQueryRoutes' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'GetQueryRoutes' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . get ( this . CHILD_API_URL + API_END_POINTS . 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 (
pipe (
map ( ( qrRes : any ) = > {
map ( ( qrRes : any ) = > {
this . logger . info ( qrRes ) ;
this . logger . info ( qrRes ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'GetQueryRoutes' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'GetQueryRoutes' , status : APICallStatusEnum.COMPLETED } } ) ) ;
return {
return {
type : CLNActions . SET_QUERY_ROUTES_CLN ,
type : CLNActions . SET_QUERY_ROUTES_CLN ,
payload : qrRes
payload : qrRes
@ -578,12 +578,12 @@ export class CLNEffects implements OnDestroy {
ofType ( CLNActions . PEER_LOOKUP_CLN ) ,
ofType ( CLNActions . PEER_LOOKUP_CLN ) ,
mergeMap ( ( action : { type : string , payload : string } ) = > {
mergeMap ( ( action : { type : string , payload : string } ) = > {
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.SEARCHING_NODE } ) ) ;
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.SEARCHING_NODE } ) ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'Lookup' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'Lookup' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . get ( this . CHILD_API_URL + API_END_POINTS . NETWORK_API + '/listNode/' + action . payload ) .
return this . httpClient . get ( this . CHILD_API_URL + API_END_POINTS . NETWORK_API + '/listNode/' + action . payload ) .
pipe (
pipe (
map ( ( resPeer ) = > {
map ( ( resPeer ) = > {
this . logger . info ( resPeer ) ;
this . logger . info ( resPeer ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'Lookup' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'Lookup' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.SEARCHING_NODE } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.SEARCHING_NODE } ) ) ;
return {
return {
type : CLNActions . SET_LOOKUP_CLN ,
type : CLNActions . SET_LOOKUP_CLN ,
@ -602,12 +602,12 @@ export class CLNEffects implements OnDestroy {
ofType ( CLNActions . CHANNEL_LOOKUP_CLN ) ,
ofType ( CLNActions . CHANNEL_LOOKUP_CLN ) ,
mergeMap ( ( action : { type : string , payload : ChannelLookup } ) = > {
mergeMap ( ( action : { type : string , payload : ChannelLookup } ) = > {
this . store . dispatch ( openSpinner ( { payload : action.payload.uiMessage } ) ) ;
this . store . dispatch ( openSpinner ( { payload : action.payload.uiMessage } ) ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'Lookup' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'Lookup' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . get ( this . CHILD_API_URL + API_END_POINTS . NETWORK_API + '/listChannel/' + action . payload . shortChannelID ) .
return this . httpClient . get ( this . CHILD_API_URL + API_END_POINTS . NETWORK_API + '/listChannel/' + action . payload . shortChannelID ) .
pipe (
pipe (
map ( ( resChannel ) = > {
map ( ( resChannel ) = > {
this . logger . info ( resChannel ) ;
this . logger . info ( resChannel ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'Lookup' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'Lookup' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : action.payload.uiMessage } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : action.payload.uiMessage } ) ) ;
return {
return {
type : CLNActions . SET_LOOKUP_CLN ,
type : CLNActions . SET_LOOKUP_CLN ,
@ -631,12 +631,12 @@ export class CLNEffects implements OnDestroy {
ofType ( CLNActions . INVOICE_LOOKUP_CLN ) ,
ofType ( CLNActions . INVOICE_LOOKUP_CLN ) ,
mergeMap ( ( action : { type : string , payload : string } ) = > {
mergeMap ( ( action : { type : string , payload : string } ) = > {
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.SEARCHING_INVOICE } ) ) ;
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.SEARCHING_INVOICE } ) ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'Lookup' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'Lookup' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . get ( this . CHILD_API_URL + API_END_POINTS . INVOICES_API + '?label=' + action . payload ) .
return this . httpClient . get ( this . CHILD_API_URL + API_END_POINTS . INVOICES_API + '?label=' + action . payload ) .
pipe (
pipe (
map ( ( resInvoice : any ) = > {
map ( ( resInvoice : any ) = > {
this . logger . info ( resInvoice ) ;
this . logger . info ( resInvoice ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'Lookup' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'Lookup' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.SEARCHING_INVOICE } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.SEARCHING_INVOICE } ) ) ;
if ( resInvoice . invoices && resInvoice . invoices . length && resInvoice . invoices . length > 0 ) {
if ( resInvoice . invoices && resInvoice . invoices . length && resInvoice . invoices . length > 0 ) {
this . store . dispatch ( updateInvoice ( { payload : resInvoice.invoices [ 0 ] } ) ) ;
this . store . dispatch ( updateInvoice ( { payload : resInvoice.invoices [ 0 ] } ) ) ;
@ -670,12 +670,12 @@ export class CLNEffects implements OnDestroy {
ofType ( CLNActions . GET_FORWARDING_HISTORY_CLN ) ,
ofType ( CLNActions . GET_FORWARDING_HISTORY_CLN ) ,
mergeMap ( ( action : { type : string , payload : { status : string } } ) = > {
mergeMap ( ( action : { type : string , payload : { status : string } } ) = > {
const statusInitial = action . payload . status . charAt ( 0 ) . toUpperCase ( ) ;
const statusInitial = action . payload . status . charAt ( 0 ) . toUpperCase ( ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchForwardingHistory' + statusInitial , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchForwardingHistory' + statusInitial , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . get ( this . CHILD_API_URL + API_END_POINTS . 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 (
pipe (
map ( ( fhRes : any ) = > {
map ( ( fhRes : any ) = > {
this . logger . info ( fhRes ) ;
this . logger . info ( fhRes ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchForwardingHistory' + statusInitial , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchForwardingHistory' + statusInitial , status : APICallStatusEnum.COMPLETED } } ) ) ;
if ( action . payload . status === CLNForwardingEventsStatusEnum . FAILED ) {
if ( action . payload . status === CLNForwardingEventsStatusEnum . FAILED ) {
this . store . dispatch ( setForwardingHistory ( { payload : { status : CLNForwardingEventsStatusEnum.FAILED , totalForwards : fhRes.length , listForwards : fhRes } } ) ) ;
this . store . dispatch ( setForwardingHistory ( { payload : { status : CLNForwardingEventsStatusEnum.FAILED , totalForwards : fhRes.length , listForwards : fhRes } } ) ) ;
} else if ( action . payload . status === CLNForwardingEventsStatusEnum . LOCAL_FAILED ) {
} else if ( action . payload . status === CLNForwardingEventsStatusEnum . LOCAL_FAILED ) {
@ -721,14 +721,14 @@ export class CLNEffects implements OnDestroy {
ofType ( CLNActions . SAVE_NEW_INVOICE_CLN ) ,
ofType ( CLNActions . SAVE_NEW_INVOICE_CLN ) ,
mergeMap ( ( action : { type : string , payload : { amount : number , label : string , description : string , expiry : number , private : boolean } } ) = > {
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 ( openSpinner ( { payload : UI_MESSAGES.ADD_INVOICE } ) ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'SaveNewInvoice' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'SaveNewInvoice' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . post ( this . CHILD_API_URL + API_END_POINTS . 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
label : action.payload.label , amount : action.payload.amount , description : action.payload.description , expiry : action.payload.expiry , private : action . payload . private
} ) .
} ) .
pipe (
pipe (
map ( ( postRes : Invoice ) = > {
map ( ( postRes : Invoice ) = > {
this . logger . info ( postRes ) ;
this . logger . info ( postRes ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'SaveNewInvoice' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'SaveNewInvoice' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.ADD_INVOICE } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.ADD_INVOICE } ) ) ;
postRes . amount_msat = action . payload . amount ;
postRes . amount_msat = action . payload . amount ;
postRes . label = action . payload . label ;
postRes . label = action . payload . label ;
@ -763,12 +763,12 @@ export class CLNEffects implements OnDestroy {
ofType ( CLNActions . SAVE_NEW_OFFER_CLN ) ,
ofType ( CLNActions . SAVE_NEW_OFFER_CLN ) ,
mergeMap ( ( action : { type : string , payload : { amount : string , description : string , issuer : string } } ) = > {
mergeMap ( ( action : { type : string , payload : { amount : string , description : string , issuer : string } } ) = > {
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.CREATE_OFFER } ) ) ;
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.CREATE_OFFER } ) ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'SaveNewOffer' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'SaveNewOffer' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . post ( this . CHILD_API_URL + API_END_POINTS . OFFERS_API , {
return this . httpClient . post ( this . CHILD_API_URL + API_END_POINTS . OFFERS_API , {
amount : action.payload.amount , description : action.payload.description , issuer : action.payload.issuer
amount : action.payload.amount , description : action.payload.description , issuer : action.payload.issuer
} ) . pipe ( map ( ( postRes : Offer ) = > {
} ) . pipe ( map ( ( postRes : Offer ) = > {
this . logger . info ( postRes ) ;
this . logger . info ( postRes ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'SaveNewOffer' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'SaveNewOffer' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.CREATE_OFFER } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.CREATE_OFFER } ) ) ;
setTimeout ( ( ) = > {
setTimeout ( ( ) = > {
this . store . dispatch ( openAlert ( {
this . store . dispatch ( openAlert ( {
@ -796,7 +796,7 @@ export class CLNEffects implements OnDestroy {
invoicesFetchCL = createEffect ( ( ) = > this . actions . pipe (
invoicesFetchCL = createEffect ( ( ) = > this . actions . pipe (
ofType ( CLNActions . FETCH_INVOICES_CLN ) ,
ofType ( CLNActions . FETCH_INVOICES_CLN ) ,
mergeMap ( ( action : { type : string , payload : FetchInvoices } ) = > {
mergeMap ( ( action : { type : string , payload : FetchInvoices } ) = > {
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchInvoices' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchInvoices' , status : APICallStatusEnum.INITIATED } } ) ) ;
const num_max_invoices = ( action . payload . num_max_invoices ) ? action.payload.num_max_invoices : 1000000 ;
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 index_offset = ( action . payload . index_offset ) ? action.payload.index_offset : 0 ;
const reversed = ( action . payload . reversed ) ? action.payload.reversed : true ;
const reversed = ( action . payload . reversed ) ? action.payload.reversed : true ;
@ -804,7 +804,7 @@ export class CLNEffects implements OnDestroy {
pipe (
pipe (
map ( ( res : ListInvoices ) = > {
map ( ( res : ListInvoices ) = > {
this . logger . info ( res ) ;
this . logger . info ( res ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchInvoices' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchInvoices' , status : APICallStatusEnum.COMPLETED } } ) ) ;
return {
return {
type : CLNActions . SET_INVOICES_CLN ,
type : CLNActions . SET_INVOICES_CLN ,
payload : res
payload : res
@ -821,11 +821,11 @@ export class CLNEffects implements OnDestroy {
offersFetchCL = createEffect ( ( ) = > this . actions . pipe (
offersFetchCL = createEffect ( ( ) = > this . actions . pipe (
ofType ( CLNActions . FETCH_OFFERS_CLN ) ,
ofType ( CLNActions . FETCH_OFFERS_CLN ) ,
mergeMap ( ( action : { type : string , payload : any } ) = > {
mergeMap ( ( action : { type : string , payload : any } ) = > {
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchOffers' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchOffers' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . get ( this . CHILD_API_URL + API_END_POINTS . OFFERS_API ) .
return this . httpClient . get ( this . CHILD_API_URL + API_END_POINTS . OFFERS_API ) .
pipe ( map ( ( res : any ) = > {
pipe ( map ( ( res : any ) = > {
this . logger . info ( res ) ;
this . logger . info ( res ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchOffers' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchOffers' , status : APICallStatusEnum.COMPLETED } } ) ) ;
return {
return {
type : CLNActions . SET_OFFERS_CLN ,
type : CLNActions . SET_OFFERS_CLN ,
payload : res.offers ? res . offers : [ ]
payload : res.offers ? res . offers : [ ]
@ -841,11 +841,11 @@ export class CLNEffects implements OnDestroy {
ofType ( CLNActions . DISABLE_OFFER_CLN ) ,
ofType ( CLNActions . DISABLE_OFFER_CLN ) ,
mergeMap ( ( action : { type : string , payload : { offer_id : string } } ) = > {
mergeMap ( ( action : { type : string , payload : { offer_id : string } } ) = > {
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.DISABLE_OFFER } ) ) ;
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.DISABLE_OFFER } ) ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'DisableOffer' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'DisableOffer' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . delete ( this . CHILD_API_URL + API_END_POINTS . 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 ) = > {
pipe ( map ( ( postRes : any ) = > {
this . logger . info ( postRes ) ;
this . logger . info ( postRes ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'DisableOffer' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'DisableOffer' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.DISABLE_OFFER } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.DISABLE_OFFER } ) ) ;
this . store . dispatch ( openSnackBar ( { payload : 'Offer Disabled Successfully!' } ) ) ;
this . store . dispatch ( openSnackBar ( { payload : 'Offer Disabled Successfully!' } ) ) ;
return {
return {
@ -862,11 +862,11 @@ export class CLNEffects implements OnDestroy {
offerBookmarksFetchCL = createEffect ( ( ) = > this . actions . pipe (
offerBookmarksFetchCL = createEffect ( ( ) = > this . actions . pipe (
ofType ( CLNActions . FETCH_OFFER_BOOKMARKS_CLN ) ,
ofType ( CLNActions . FETCH_OFFER_BOOKMARKS_CLN ) ,
mergeMap ( ( action : { type : string , payload : any } ) = > {
mergeMap ( ( action : { type : string , payload : any } ) = > {
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchOfferBookmarks' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchOfferBookmarks' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . get ( this . CHILD_API_URL + API_END_POINTS . OFFERS_API + '/offerbookmarks' ) .
return this . httpClient . get ( this . CHILD_API_URL + API_END_POINTS . OFFERS_API + '/offerbookmarks' ) .
pipe ( map ( ( res : any ) = > {
pipe ( map ( ( res : any ) = > {
this . logger . info ( res ) ;
this . logger . info ( res ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchOfferBookmarks' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchOfferBookmarks' , status : APICallStatusEnum.COMPLETED } } ) ) ;
return {
return {
type : CLNActions . SET_OFFER_BOOKMARKS_CLN ,
type : CLNActions . SET_OFFER_BOOKMARKS_CLN ,
payload : res || [ ]
payload : res || [ ]
@ -882,11 +882,11 @@ export class CLNEffects implements OnDestroy {
ofType ( CLNActions . DELETE_OFFER_BOOKMARK_CLN ) ,
ofType ( CLNActions . DELETE_OFFER_BOOKMARK_CLN ) ,
mergeMap ( ( action : { type : string , payload : { bolt12 : string } } ) = > {
mergeMap ( ( action : { type : string , payload : { bolt12 : string } } ) = > {
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.DELETE_OFFER_BOOKMARK } ) ) ;
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.DELETE_OFFER_BOOKMARK } ) ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'DeleteOfferBookmark' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'DeleteOfferBookmark' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . delete ( this . CHILD_API_URL + API_END_POINTS . 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 ) = > {
pipe ( map ( ( postRes : any ) = > {
this . logger . info ( postRes ) ;
this . logger . info ( postRes ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'DeleteOfferBookmark' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'DeleteOfferBookmark' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.DELETE_OFFER_BOOKMARK } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.DELETE_OFFER_BOOKMARK } ) ) ;
this . store . dispatch ( openSnackBar ( { payload : 'Offer Bookmark Deleted Successfully!' } ) ) ;
this . store . dispatch ( openSnackBar ( { payload : 'Offer Bookmark Deleted Successfully!' } ) ) ;
return {
return {
@ -904,12 +904,12 @@ export class CLNEffects implements OnDestroy {
ofType ( CLNActions . SET_CHANNEL_TRANSACTION_CLN ) ,
ofType ( CLNActions . SET_CHANNEL_TRANSACTION_CLN ) ,
mergeMap ( ( action : { type : string , payload : OnChain } ) = > {
mergeMap ( ( action : { type : string , payload : OnChain } ) = > {
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.SEND_FUNDS } ) ) ;
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.SEND_FUNDS } ) ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'SetChannelTransaction' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'SetChannelTransaction' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . post ( this . CHILD_API_URL + API_END_POINTS . ON_CHAIN_API , action . payload ) .
return this . httpClient . post ( this . CHILD_API_URL + API_END_POINTS . ON_CHAIN_API , action . payload ) .
pipe (
pipe (
map ( ( postRes : any ) = > {
map ( ( postRes : any ) = > {
this . logger . info ( postRes ) ;
this . logger . info ( postRes ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'SetChannelTransaction' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'SetChannelTransaction' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.SEND_FUNDS } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.SEND_FUNDS } ) ) ;
this . store . dispatch ( fetchBalance ( ) ) ;
this . store . dispatch ( fetchBalance ( ) ) ;
this . store . dispatch ( fetchUTXOs ( ) ) ;
this . store . dispatch ( fetchUTXOs ( ) ) ;
@ -929,12 +929,12 @@ export class CLNEffects implements OnDestroy {
utxosFetch = createEffect ( ( ) = > this . actions . pipe (
utxosFetch = createEffect ( ( ) = > this . actions . pipe (
ofType ( CLNActions . FETCH_UTXOS_CLN ) ,
ofType ( CLNActions . FETCH_UTXOS_CLN ) ,
mergeMap ( ( ) = > {
mergeMap ( ( ) = > {
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchUTXOs' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchUTXOs' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . get ( this . CHILD_API_URL + API_END_POINTS . ON_CHAIN_API + '/utxos' ) ;
return this . httpClient . get ( this . CHILD_API_URL + API_END_POINTS . ON_CHAIN_API + '/utxos' ) ;
} ) ,
} ) ,
map ( ( utxos : any ) = > {
map ( ( utxos : any ) = > {
this . logger . info ( utxos ) ;
this . logger . info ( utxos ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchUTXOs' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchUTXOs' , status : APICallStatusEnum.COMPLETED } } ) ) ;
utxos . outputs . forEach ( ( output ) = > { // For backward compatibility
utxos . outputs . forEach ( ( output ) = > { // For backward compatibility
if ( output . value ) {
if ( output . value ) {
output . amount_msat = output . value ;
output . amount_msat = output . value ;
@ -954,11 +954,11 @@ export class CLNEffects implements OnDestroy {
pageSettingsFetchCL = createEffect ( ( ) = > this . actions . pipe (
pageSettingsFetchCL = createEffect ( ( ) = > this . actions . pipe (
ofType ( CLNActions . FETCH_PAGE_SETTINGS_CLN ) ,
ofType ( CLNActions . FETCH_PAGE_SETTINGS_CLN ) ,
mergeMap ( ( ) = > {
mergeMap ( ( ) = > {
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchPageSettings' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchPageSettings' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . get ( API_END_POINTS . PAGE_SETTINGS_API ) . pipe (
return this . httpClient . get ( API_END_POINTS . PAGE_SETTINGS_API ) . pipe (
map ( ( pageSettings : any ) = > {
map ( ( pageSettings : any ) = > {
this . logger . info ( pageSettings ) ;
this . logger . info ( pageSettings ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'FetchPageSettings' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'FetchPageSettings' , status : APICallStatusEnum.COMPLETED } } ) ) ;
return {
return {
type : CLNActions . SET_PAGE_SETTINGS_CLN ,
type : CLNActions . SET_PAGE_SETTINGS_CLN ,
payload : pageSettings || [ ]
payload : pageSettings || [ ]
@ -976,12 +976,12 @@ export class CLNEffects implements OnDestroy {
ofType ( CLNActions . SAVE_PAGE_SETTINGS_CLN ) ,
ofType ( CLNActions . SAVE_PAGE_SETTINGS_CLN ) ,
mergeMap ( ( action : { type : string , payload : any } ) = > {
mergeMap ( ( action : { type : string , payload : any } ) = > {
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.UPDATE_PAGE_SETTINGS } ) ) ;
this . store . dispatch ( openSpinner ( { payload : UI_MESSAGES.UPDATE_PAGE_SETTINGS } ) ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'SavePageSettings' , status : APICallStatusEnum.INITIATED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'SavePageSettings' , status : APICallStatusEnum.INITIATED } } ) ) ;
return this . httpClient . post ( API_END_POINTS . PAGE_SETTINGS_API , action . payload ) .
return this . httpClient . post ( API_END_POINTS . PAGE_SETTINGS_API , action . payload ) .
pipe (
pipe (
map ( ( postRes : any ) = > {
map ( ( postRes : any ) = > {
this . logger . info ( postRes ) ;
this . logger . info ( postRes ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : 'SavePageSettings' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : 'SavePageSettings' , status : APICallStatusEnum.COMPLETED } } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.UPDATE_PAGE_SETTINGS } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : UI_MESSAGES.UPDATE_PAGE_SETTINGS } ) ) ;
this . store . dispatch ( openSnackBar ( { payload : 'Page Layout Updated Successfully!' } ) ) ;
this . store . dispatch ( openSnackBar ( { payload : 'Page Layout Updated Successfully!' } ) ) ;
return {
return {
@ -1021,7 +1021,6 @@ export class CLNEffects implements OnDestroy {
newRoute = '/cln/home' ;
newRoute = '/cln/home' ;
}
}
this . router . navigate ( [ newRoute ] ) ;
this . router . navigate ( [ newRoute ] ) ;
this . store . dispatch ( fetchPageSettings ( ) ) ;
this . store . dispatch ( fetchInvoices ( { payload : { num_max_invoices : 1000000 , index_offset : 0 , reversed : true } } ) ) ;
this . store . dispatch ( fetchInvoices ( { payload : { num_max_invoices : 1000000 , index_offset : 0 , reversed : true } } ) ) ;
this . store . dispatch ( fetchFees ( ) ) ;
this . store . dispatch ( fetchFees ( ) ) ;
this . store . dispatch ( fetchChannels ( ) ) ;
this . store . dispatch ( fetchChannels ( ) ) ;
@ -1044,7 +1043,7 @@ export class CLNEffects implements OnDestroy {
} else {
} else {
this . store . dispatch ( closeSpinner ( { payload : uiMessage } ) ) ;
this . store . dispatch ( closeSpinner ( { payload : uiMessage } ) ) ;
const errMsg = this . commonService . extractErrorMessage ( err , genericErrorMessage ) ;
const errMsg = this . commonService . extractErrorMessage ( err , genericErrorMessage ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : actionName , status : APICallStatusEnum.ERROR , statusCode : err.status.toString ( ) , message : errMsg } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : actionName , status : APICallStatusEnum.ERROR , statusCode : err.status.toString ( ) , message : errMsg } } ) ) ;
}
}
}
}
@ -1068,7 +1067,7 @@ export class CLNEffects implements OnDestroy {
}
}
}
}
} ) ) ;
} ) ) ;
this . store . dispatch ( updateCL APICallStatus( { payload : { action : actionName , status : APICallStatusEnum.ERROR , statusCode : err.status.toString ( ) , message : errMsg , URL : errURL } } ) ) ;
this . store . dispatch ( updateCL N APICallStatus( { payload : { action : actionName , status : APICallStatusEnum.ERROR , statusCode : err.status.toString ( ) , message : errMsg , URL : errURL } } ) ) ;
}
}
}
}