add sat amounts to invoices

This commit is contained in:
keyan 2023-08-10 18:33:57 -05:00
parent e668b1f7f3
commit ea9c405dfa
5 changed files with 7 additions and 3 deletions

View File

@ -296,7 +296,8 @@ export default {
}, },
Invoice: { Invoice: {
satsReceived: i => msatsToSats(i.msatsReceived) satsReceived: i => msatsToSats(i.msatsReceived),
satsRequested: i => msatsToSats(i.msatsRequested)
}, },
Fact: { Fact: {

View File

@ -23,6 +23,7 @@ export default gql`
cancelled: Boolean! cancelled: Boolean!
confirmedAt: Date confirmedAt: Date
satsReceived: Int satsReceived: Int
satsRequested: Int!
nostr: JSONObject nostr: JSONObject
hmac: String hmac: String
} }

View File

@ -41,7 +41,7 @@ export function Invoice ({ invoice, onConfirmation, successVerb }) {
return ( return (
<> <>
<Qr webLn={webLn} value={invoice.bolt11} statusVariant={variant} status={status} /> <Qr webLn={webLn} value={invoice.bolt11} description={numWithUnits(invoice.satsRequested)} statusVariant={variant} status={status} />
<div className='w-100'> <div className='w-100'>
{nostr {nostr
? <AccordianItem ? <AccordianItem

View File

@ -4,7 +4,7 @@ import InvoiceStatus from './invoice-status'
import { requestProvider } from 'webln' import { requestProvider } from 'webln'
import { useEffect } from 'react' import { useEffect } from 'react'
export default function Qr ({ asIs, value, webLn, statusVariant, status }) { export default function Qr ({ asIs, value, webLn, statusVariant, description, status }) {
const qrValue = asIs ? value : 'lightning:' + value.toUpperCase() const qrValue = asIs ? value : 'lightning:' + value.toUpperCase()
useEffect(() => { useEffect(() => {
@ -28,6 +28,7 @@ export default function Qr ({ asIs, value, webLn, statusVariant, status }) {
className='h-auto mw-100' value={qrValue} renderAs='svg' size={300} className='h-auto mw-100' value={qrValue} renderAs='svg' size={300}
/> />
</a> </a>
{description && <div className='mt-1 fst-italic text-center text-muted'>{description}</div>}
<div className='mt-3 w-100'> <div className='mt-3 w-100'>
<CopyInput type='text' placeholder={value} readOnly noForm /> <CopyInput type='text' placeholder={value} readOnly noForm />
</div> </div>

View File

@ -7,6 +7,7 @@ export const INVOICE = gql`
id id
hash hash
bolt11 bolt11
satsRequested
satsReceived satsReceived
cancelled cancelled
confirmedAt confirmedAt