Skip to content

Commit

Permalink
update listPayment in EmbeddedLND
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamkmr04 committed Dec 17, 2024
1 parent d922eb5 commit bba70b5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
5 changes: 4 additions & 1 deletion backends/EmbeddedLND.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down
5 changes: 4 additions & 1 deletion lndmobile/LndMobileInjection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,10 @@ export interface ILndMobileInjections {
amount?: Long,
routeHints?: lnrpc.IRouteHint[]
) => Promise<lnrpc.QueryRoutesResponse>;
listPayments: () => Promise<lnrpc.ListPaymentsResponse>;
listPayments: (params?: {
maxPayments?: number;
reversed?: boolean;
}) => Promise<lnrpc.ListPaymentsResponse>;
subscribeChannelGraph: () => Promise<string>;
sendKeysendPaymentV2: ({
amt,
Expand Down
11 changes: 9 additions & 2 deletions lndmobile/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,10 @@ export const listPeers = async (): Promise<lnrpc.ListPeersResponse> => {
/**
* @throws
*/
export const listPayments = async (): Promise<lnrpc.ListPaymentsResponse> => {
export const listPayments = async (params?: {
maxPayments?: number;
reversed?: boolean;
}): Promise<lnrpc.ListPaymentsResponse> => {
const response = await sendCommand<
lnrpc.IListPaymentsRequest,
lnrpc.ListPaymentsRequest,
Expand All @@ -731,7 +734,11 @@ export const listPayments = async (): Promise<lnrpc.ListPaymentsResponse> => {
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;
Expand Down

0 comments on commit bba70b5

Please sign in to comment.