mirror of
https://github.com/aljazceru/breez-sdk-docs.git
synced 2025-12-17 05:44:20 +01:00
add csharp snippets
This commit is contained in:
31
snippets/csharp/LnurlWithdraw.cs
Normal file
31
snippets/csharp/LnurlWithdraw.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Breez.Sdk;
|
||||
|
||||
public class LnurlWithdrawSnippets
|
||||
{
|
||||
public void LnurlWithdraw(BlockingBreezServices sdk)
|
||||
{
|
||||
// ANCHOR: lnurl-withdraw
|
||||
// Endpoint can also be of the form:
|
||||
// lnurlw://domain.com/lnurl-withdraw?key=val
|
||||
var lnurlWithdrawUrl = "lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4exctthd96xserjv9mn7um9wdekjmmw843xxwpexdnxzen9vgunsvfexq6rvdecx93rgdmyxcuxverrvcursenpxvukzv3c8qunsdecx33nzwpnvg6ryc3hv93nzvecxgcxgwp3h33lxk";
|
||||
|
||||
try
|
||||
{
|
||||
var input = BreezSdkMethods.ParseInput(lnurlWithdrawUrl);
|
||||
if (input is InputType.LnUrlWithdraw lnurlw)
|
||||
{
|
||||
var amountMsat = lnurlw.data.minWithdrawable;
|
||||
var result = sdk.WithdrawLnurl(
|
||||
new LnUrlWithdrawRequest(
|
||||
lnurlw.data,
|
||||
amountMsat,
|
||||
"comment"));
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// Handle error
|
||||
}
|
||||
// ANCHOR_END: lnurl-withdraw
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user