mirror of
https://github.com/aljazceru/breez-sdk-docs.git
synced 2025-12-17 13:54:20 +01:00
Wrap promises with try blocks
This commit is contained in:
@@ -9,16 +9,20 @@ const exampleLnurlPay = async () => {
|
||||
// Endpoint can also be of the
|
||||
// lnurlp://domain.com/lnurl-pay?key=val
|
||||
// lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttsv9un7um9wdekjmmw84jxywf5x43rvv35xgmr2enrxanr2cfcvsmnwe3jxcukvde48qukgdec89snwde3vfjxvepjxpjnjvtpxd3kvdnxx5crxwpjvyunsephsz36jf
|
||||
const lnurlPayUrl = 'lightning@address.com'
|
||||
try {
|
||||
const lnurlPayUrl = 'lightning@address.com'
|
||||
|
||||
const input = await parseInput(lnurlPayUrl)
|
||||
if (input.type === InputTypeVariant.LN_URL_PAY) {
|
||||
const amountMsat = input.data.minSendable
|
||||
const lnUrlPayResult = await payLnurl({
|
||||
data: input.data,
|
||||
amountMsat,
|
||||
comment: 'comment'
|
||||
})
|
||||
const input = await parseInput(lnurlPayUrl)
|
||||
if (input.type === InputTypeVariant.LN_URL_PAY) {
|
||||
const amountMsat = input.data.minSendable
|
||||
const lnUrlPayResult = await payLnurl({
|
||||
data: input.data,
|
||||
amountMsat,
|
||||
comment: 'comment'
|
||||
})
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
// ANCHOR_END: lnurl-pay
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user