Remove unused useWallet from QR code component
This commit is contained in:
parent
707d7bdf8b
commit
35159bf7f3
|
@ -19,7 +19,7 @@ import styles from './invoice.module.css'
|
|||
|
||||
export default function Invoice ({
|
||||
id, query = INVOICE, modal, onPayment, onExpired, onCanceled, info, successVerb = 'deposited',
|
||||
heldVerb = 'settling', useWallet = true, walletError, poll, waitFor, ...props
|
||||
heldVerb = 'settling', walletError, poll, waitFor, ...props
|
||||
}) {
|
||||
const { data, error } = useQuery(query, SSR
|
||||
? {}
|
||||
|
@ -79,15 +79,12 @@ export default function Invoice ({
|
|||
{invoice.forwardedSats && <Badge className={styles.badge} bg={null}>p2p</Badge>}
|
||||
</>
|
||||
)
|
||||
useWallet = false
|
||||
} else if (expired) {
|
||||
variant = 'failed'
|
||||
status = 'expired'
|
||||
useWallet = false
|
||||
} else if (invoice.cancelled) {
|
||||
variant = 'failed'
|
||||
status = 'cancelled'
|
||||
useWallet = false
|
||||
} else if (invoice.isHeld) {
|
||||
variant = 'pending'
|
||||
status = (
|
||||
|
@ -95,7 +92,6 @@ export default function Invoice ({
|
|||
<Moon className='spin fill-grey me-2' /> {heldVerb}
|
||||
</div>
|
||||
)
|
||||
useWallet = false
|
||||
} else {
|
||||
variant = 'pending'
|
||||
status = (
|
||||
|
@ -113,7 +109,7 @@ export default function Invoice ({
|
|||
<code> {walletError.message}</code>
|
||||
</div>}
|
||||
<Qr
|
||||
useWallet={useWallet} value={invoice.bolt11}
|
||||
value={invoice.bolt11}
|
||||
description={numWithUnits(invoice.satsRequested, { abbreviate: false })}
|
||||
statusVariant={variant} status={status}
|
||||
/>
|
||||
|
|
|
@ -150,7 +150,6 @@ export const useQrPayment = () => {
|
|||
description
|
||||
status='loading'
|
||||
successVerb='received'
|
||||
useWallet={false}
|
||||
walletError={walletError}
|
||||
waitFor={waitFor}
|
||||
onExpired={inv => reject(new InvoiceExpiredError(inv?.hash))}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import { QRCodeSVG } from 'qrcode.react'
|
||||
import { CopyInput, InputSkeleton } from './form'
|
||||
import InvoiceStatus from './invoice-status'
|
||||
import { useEffect } from 'react'
|
||||
import { useWallet } from '@/wallets/index'
|
||||
import Bolt11Info from './bolt11-info'
|
||||
|
||||
export const qrImageSettings = {
|
||||
|
@ -14,22 +12,8 @@ export const qrImageSettings = {
|
|||
excavate: true
|
||||
}
|
||||
|
||||
export default function Qr ({ asIs, value, useWallet: automated, statusVariant, description, status }) {
|
||||
export default function Qr ({ asIs, value, statusVariant, description, status }) {
|
||||
const qrValue = asIs ? value : 'lightning:' + value.toUpperCase()
|
||||
const wallet = useWallet()
|
||||
|
||||
useEffect(() => {
|
||||
async function effect () {
|
||||
if (automated && wallet) {
|
||||
try {
|
||||
await wallet.sendPayment(value)
|
||||
} catch (e) {
|
||||
console.log(e?.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
effect()
|
||||
}, [wallet])
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
|
@ -12,7 +12,7 @@ export default function FullInvoice () {
|
|||
|
||||
return (
|
||||
<CenterLayout>
|
||||
<Invoice id={router.query.id} query={INVOICE_FULL} poll description status='loading' bolt11Info useWallet={false} />
|
||||
<Invoice id={router.query.id} query={INVOICE_FULL} poll description status='loading' bolt11Info />
|
||||
</CenterLayout>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue