diff --git a/backends/EmbeddedLND.ts b/backends/EmbeddedLND.ts index 6734ade67..7504b12b9 100644 --- a/backends/EmbeddedLND.ts +++ b/backends/EmbeddedLND.ts @@ -98,7 +98,10 @@ export default class EmbeddedLND extends LND { preimage: data.preimage, route_hints: data.route_hints }); - getPayments = async () => await listPayments(); + getPayments = async (params?: { + maxPayments?: number; + reversed?: boolean; + }) => await listPayments(params); getNewAddress = async (data: any) => await newAddress(data.type, data.account); getNewChangeAddress = async (data: any) => diff --git a/lndmobile/LndMobileInjection.ts b/lndmobile/LndMobileInjection.ts index 17bbd7c4f..25b28eb1f 100644 --- a/lndmobile/LndMobileInjection.ts +++ b/lndmobile/LndMobileInjection.ts @@ -224,7 +224,10 @@ export interface ILndMobileInjections { amount?: Long, routeHints?: lnrpc.IRouteHint[] ) => Promise; - listPayments: () => Promise; + listPayments: (params?: { + maxPayments?: number; + reversed?: boolean; + }) => Promise; subscribeChannelGraph: () => Promise; sendKeysendPaymentV2: ({ amt, diff --git a/lndmobile/index.ts b/lndmobile/index.ts index 61c1d90f1..b585213ab 100644 --- a/lndmobile/index.ts +++ b/lndmobile/index.ts @@ -721,7 +721,10 @@ export const listPeers = async (): Promise => { /** * @throws */ -export const listPayments = async (): Promise => { +export const listPayments = async (params?: { + maxPayments?: number; + reversed?: boolean; +}): Promise => { const response = await sendCommand< lnrpc.IListPaymentsRequest, lnrpc.ListPaymentsRequest, @@ -731,7 +734,11 @@ export const listPayments = async (): Promise => { response: lnrpc.ListPaymentsResponse, method: 'ListPayments', options: { - include_incomplete: true + include_incomplete: true, + ...(params?.maxPayments && { + max_payments: Long.fromValue(params.maxPayments) + }), + ...(params?.reversed && { reversed: params.reversed }) } }); return response;