File tree Expand file tree Collapse file tree 7 files changed +42
-11
lines changed Expand file tree Collapse file tree 7 files changed +42
-11
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,10 @@ export default class EmbeddedLND extends LND {
98
98
preimage : data . preimage ,
99
99
route_hints : data . route_hints
100
100
} ) ;
101
- getPayments = async ( ) => await listPayments ( ) ;
101
+ getPayments = async ( params ?: {
102
+ maxPayments ?: number ;
103
+ reversed ?: boolean ;
104
+ } ) => await listPayments ( params ) ;
102
105
getNewAddress = async ( data : any ) =>
103
106
await newAddress ( data . type , data . account ) ;
104
107
getNewChangeAddress = async ( data : any ) =>
Original file line number Diff line number Diff line change @@ -330,7 +330,13 @@ export default class LND {
330
330
: undefined ,
331
331
route_hints : data . route_hints
332
332
} ) ;
333
- getPayments = ( ) => this . getRequest ( '/v1/payments?include_incomplete=true' ) ;
333
+ getPayments = ( params ?: { maxPayments ?: number ; reversed ?: boolean } ) =>
334
+ this . getRequest (
335
+ `/v1/payments?include_incomplete=true${
336
+ params ?. maxPayments ? `&max_payments=${ params . maxPayments } ` : ''
337
+ } ${ params ?. reversed ? `&reversed=${ params . reversed } ` : '' } `
338
+ ) ;
339
+
334
340
getNewAddress = ( data : any ) => this . getRequest ( '/v1/newaddress' , data ) ;
335
341
getNewChangeAddress = ( data : any ) =>
336
342
this . postRequest ( '/v2/wallet/address/next' , data ) ;
Original file line number Diff line number Diff line change @@ -172,10 +172,17 @@ export default class LightningNodeConnect {
172
172
route_hints : data . route_hints
173
173
} )
174
174
. then ( ( data : lnrpc . AddInvoiceResponse ) => snakeize ( data ) ) ;
175
- getPayments = async ( ) =>
175
+ getPayments = async ( params ?: {
176
+ maxPayments ?: number ;
177
+ reversed ?: boolean ;
178
+ } ) =>
176
179
await this . lnc . lnd . lightning
177
180
. listPayments ( {
178
- include_incomplete : true
181
+ include_incomplete : true ,
182
+ ...( params ?. maxPayments && {
183
+ max_payments : params . maxPayments
184
+ } ) ,
185
+ ...( params ?. reversed && { reversed : params . reversed } )
179
186
} )
180
187
. then ( ( data : lnrpc . ListPaymentsResponse ) => snakeize ( data ) ) ;
181
188
getNewAddress = async ( data : any ) =>
Original file line number Diff line number Diff line change @@ -224,7 +224,10 @@ export interface ILndMobileInjections {
224
224
amount ?: Long ,
225
225
routeHints ?: lnrpc . IRouteHint [ ]
226
226
) => Promise < lnrpc . QueryRoutesResponse > ;
227
- listPayments : ( ) => Promise < lnrpc . ListPaymentsResponse > ;
227
+ listPayments : ( params ?: {
228
+ maxPayments ?: number ;
229
+ reversed ?: boolean ;
230
+ } ) => Promise < lnrpc . ListPaymentsResponse > ;
228
231
subscribeChannelGraph : ( ) => Promise < string > ;
229
232
sendKeysendPaymentV2 : ( {
230
233
amt,
Original file line number Diff line number Diff line change @@ -721,7 +721,10 @@ export const listPeers = async (): Promise<lnrpc.ListPeersResponse> => {
721
721
/**
722
722
* @throws
723
723
*/
724
- export const listPayments = async ( ) : Promise < lnrpc . ListPaymentsResponse > => {
724
+ export const listPayments = async ( params ?: {
725
+ maxPayments ?: number ;
726
+ reversed ?: boolean ;
727
+ } ) : Promise < lnrpc . ListPaymentsResponse > => {
725
728
const response = await sendCommand <
726
729
lnrpc . IListPaymentsRequest ,
727
730
lnrpc . ListPaymentsRequest ,
@@ -731,7 +734,11 @@ export const listPayments = async (): Promise<lnrpc.ListPaymentsResponse> => {
731
734
response : lnrpc . ListPaymentsResponse ,
732
735
method : 'ListPayments' ,
733
736
options : {
734
- include_incomplete : true
737
+ include_incomplete : true ,
738
+ ...( params ?. maxPayments && {
739
+ max_payments : Long . fromValue ( params . maxPayments )
740
+ } ) ,
741
+ ...( params ?. reversed && { reversed : params . reversed } )
735
742
}
736
743
} ) ;
737
744
return response ;
Original file line number Diff line number Diff line change @@ -30,10 +30,13 @@ export default class PaymentsStore {
30
30
} ;
31
31
32
32
@action
33
- public getPayments = async ( ) => {
33
+ public getPayments = async ( params ?: {
34
+ maxPayments ?: number ;
35
+ reversed ?: boolean ;
36
+ } ) => {
34
37
this . loading = true ;
35
38
try {
36
- const data = await BackendUtils . getPayments ( ) ;
39
+ const data = await BackendUtils . getPayments ( params ) ;
37
40
const payments = data . payments ;
38
41
this . payments = payments
39
42
. slice ( )
Original file line number Diff line number Diff line change @@ -98,7 +98,10 @@ export default class SendingLightning extends React.Component<
98
98
fetchPayments = async ( ) => {
99
99
const { PaymentsStore, TransactionsStore } = this . props ;
100
100
try {
101
- const payments = await PaymentsStore . getPayments ( ) ;
101
+ const payments = await PaymentsStore . getPayments ( {
102
+ maxPayments : 5 ,
103
+ reversed : true
104
+ } ) ;
102
105
const matchingPayment = payments . find (
103
106
( payment : any ) =>
104
107
payment . payment_preimage ===
@@ -406,7 +409,6 @@ export default class SendingLightning extends React.Component<
406
409
secondary
407
410
buttonStyle = { { height : 40 , width : '100%' } }
408
411
containerStyle = { {
409
- backgroundColor : 'red' ,
410
412
maxWidth : '45%' ,
411
413
margin : 10
412
414
} }
You can’t perform that action at this time.
0 commit comments