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 ({
|
export default function Invoice ({
|
||||||
id, query = INVOICE, modal, onPayment, onExpired, onCanceled, info, successVerb = 'deposited',
|
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
|
const { data, error } = useQuery(query, SSR
|
||||||
? {}
|
? {}
|
||||||
@ -79,15 +79,12 @@ export default function Invoice ({
|
|||||||
{invoice.forwardedSats && <Badge className={styles.badge} bg={null}>p2p</Badge>}
|
{invoice.forwardedSats && <Badge className={styles.badge} bg={null}>p2p</Badge>}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
useWallet = false
|
|
||||||
} else if (expired) {
|
} else if (expired) {
|
||||||
variant = 'failed'
|
variant = 'failed'
|
||||||
status = 'expired'
|
status = 'expired'
|
||||||
useWallet = false
|
|
||||||
} else if (invoice.cancelled) {
|
} else if (invoice.cancelled) {
|
||||||
variant = 'failed'
|
variant = 'failed'
|
||||||
status = 'cancelled'
|
status = 'cancelled'
|
||||||
useWallet = false
|
|
||||||
} else if (invoice.isHeld) {
|
} else if (invoice.isHeld) {
|
||||||
variant = 'pending'
|
variant = 'pending'
|
||||||
status = (
|
status = (
|
||||||
@ -95,7 +92,6 @@ export default function Invoice ({
|
|||||||
<Moon className='spin fill-grey me-2' /> {heldVerb}
|
<Moon className='spin fill-grey me-2' /> {heldVerb}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
useWallet = false
|
|
||||||
} else {
|
} else {
|
||||||
variant = 'pending'
|
variant = 'pending'
|
||||||
status = (
|
status = (
|
||||||
@ -113,7 +109,7 @@ export default function Invoice ({
|
|||||||
<code> {walletError.message}</code>
|
<code> {walletError.message}</code>
|
||||||
</div>}
|
</div>}
|
||||||
<Qr
|
<Qr
|
||||||
useWallet={useWallet} value={invoice.bolt11}
|
value={invoice.bolt11}
|
||||||
description={numWithUnits(invoice.satsRequested, { abbreviate: false })}
|
description={numWithUnits(invoice.satsRequested, { abbreviate: false })}
|
||||||
statusVariant={variant} status={status}
|
statusVariant={variant} status={status}
|
||||||
/>
|
/>
|
||||||
|
@ -150,7 +150,6 @@ export const useQrPayment = () => {
|
|||||||
description
|
description
|
||||||
status='loading'
|
status='loading'
|
||||||
successVerb='received'
|
successVerb='received'
|
||||||
useWallet={false}
|
|
||||||
walletError={walletError}
|
walletError={walletError}
|
||||||
waitFor={waitFor}
|
waitFor={waitFor}
|
||||||
onExpired={inv => reject(new InvoiceExpiredError(inv?.hash))}
|
onExpired={inv => reject(new InvoiceExpiredError(inv?.hash))}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import { QRCodeSVG } from 'qrcode.react'
|
import { QRCodeSVG } from 'qrcode.react'
|
||||||
import { CopyInput, InputSkeleton } from './form'
|
import { CopyInput, InputSkeleton } from './form'
|
||||||
import InvoiceStatus from './invoice-status'
|
import InvoiceStatus from './invoice-status'
|
||||||
import { useEffect } from 'react'
|
|
||||||
import { useWallet } from '@/wallets/index'
|
|
||||||
import Bolt11Info from './bolt11-info'
|
import Bolt11Info from './bolt11-info'
|
||||||
|
|
||||||
export const qrImageSettings = {
|
export const qrImageSettings = {
|
||||||
@ -14,22 +12,8 @@ export const qrImageSettings = {
|
|||||||
excavate: true
|
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 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 (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -12,7 +12,7 @@ export default function FullInvoice () {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<CenterLayout>
|
<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>
|
</CenterLayout>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user