Files
breez-sdk-docs/snippets/react-native/lnurl_withdraw.ts
2023-10-24 22:38:52 +02:00

25 lines
860 B
TypeScript

import {
InputTypeVariant,
parseInput,
withdrawLnurl
} from "@breeztech/react-native-breez-sdk"
const exampleLnurlWithdraw = async () => {
// ANCHOR: lnurl-withdraw
// Endpoint can also be of the form:
// lnurlw://domain.com/lnurl-withdraw?key=val
const lnurlWithdrawUrl =
"lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4exctthd96xserjv9mn7um9wdekjmmw843xxwpexdnxzen9vgunsvfexq6rvdecx93rgdmyxcuxverrvcursenpxvukzv3c8qunsdecx33nzwpnvg6ryc3hv93nzvecxgcxgwp3h33lxk"
const input = await parseInput(lnurlWithdrawUrl)
if (input.type === InputTypeVariant.LN_URL_WITHDRAW) {
const amountMsat = input.data.minWithdrawable
const lnUrlWithdrawResult = await withdrawLnurl({
data: input.data,
amountMsat,
description: "comment"
})
}
// ANCHOR_END: lnurl-withdraw
}