feat: display invoice memo in Lightning invoice cards (#643)
Co-authored-by: The Daniel <dmnyc@users.noreply.github.com>
This commit is contained in:
parent
0eb0be4780
commit
b0b9a391a4
2 changed files with 14 additions and 3 deletions
|
|
@ -7,6 +7,14 @@ export function getAmountFromInvoice(invoice: string): number {
|
|||
return _invoice.satoshi
|
||||
}
|
||||
|
||||
export function getInvoiceDetails(invoice: string): { amount: number; description: string | null } {
|
||||
const _invoice = new Invoice({ pr: invoice }) // TODO: need to validate
|
||||
return {
|
||||
amount: _invoice.satoshi,
|
||||
description: _invoice.description,
|
||||
}
|
||||
}
|
||||
|
||||
export function formatAmount(amount: number) {
|
||||
if (amount < 1000) return amount
|
||||
if (amount < 1000000) return `${Math.round(amount / 100) / 10}k`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue