stacker.news/components/bolt11-info.js
SatsAllDay 56111efd6a
SN wallet transaction details (#550)
* display bolt11 info and preimage for invoices

* Remove preimage attempt for wdrwl, since it doesn't make sense

Other various code cleanup

* Only include preimage for confirmed paid and settled invoices
2023-10-20 19:25:22 -05:00

50 lines
1.2 KiB
JavaScript

import { decode } from 'bolt11'
import AccordianItem from './accordian-item'
import { CopyInput } from './form'
export default ({ bolt11, preimage }) => {
const { tagsObject: { description, payment_hash: paymentHash } } = decode(bolt11)
if (!description && !paymentHash && !preimage) {
return null
}
return (
<div className='w-100'>
<AccordianItem
header='BOLT11 information'
body={
<>
{description &&
<CopyInput
label='description'
size='sm'
groupClassName='w-100'
readOnly
noForm
placeholder={description}
/>}
{paymentHash &&
<CopyInput
label='payment hash'
size='sm'
groupClassName='w-100'
readOnly
noForm
placeholder={paymentHash}
/>}
{preimage &&
<CopyInput
label='preimage'
size='sm'
groupClassName='w-100'
readOnly
noForm
placeholder={preimage}
/>}
</>
}
/>
</div>
)
}