Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] CLNRest Backend Fix for paid invoices #2295

Merged
merged 3 commits into from
Jul 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion backends/CLNRest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,30 @@ export default class CLNRest {
};
getMyNodeInfo = () => this.postRequest('/v1/getinfo');
getInvoices = () =>
this.postRequest('/v1/listinvoices', { limit: 150, index: 'created' });
this.postRequest('/v1/sql', {
query: "SELECT label, bolt11, bolt12, payment_hash, amount_msat, status, amount_received_msat, paid_at, payment_preimage, description, expires_at FROM invoices WHERE status = 'paid' ORDER BY created_index DESC LIMIT 150;"
}).then((data: any) => {
const invoiceList: any[] = [];
data.rows.forEach((invoice: any) => {
invoiceList.push({
label: invoice[0],
bolt11: invoice[1],
bolt12: invoice[2],
payment_hash: invoice[3],
amount_msat: invoice[4],
status: invoice[5],
amount_received_msat: invoice[6],
paid_at: invoice[7],
payment_preimage: invoice[8],
description: invoice[9],
expires_at: invoice[10]
});
});

return {
invoices: invoiceList
};
});
createInvoice = (data: any) =>
this.postRequest('/v1/invoice', {
description: data.memo,
Expand Down
Loading