mirror of
https://github.com/aljazceru/breez-sdk-docs.git
synced 2025-12-17 13:54:20 +01:00
Add examples for adding extra TLVs to a spontaneous payment
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using Breez.Sdk;
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
public class SendSpontaneousPaymentSnippets
|
||||
{
|
||||
@@ -17,5 +19,26 @@ public class SendSpontaneousPaymentSnippets
|
||||
// Handle error
|
||||
}
|
||||
// ANCHOR_END: send-spontaneous-payment
|
||||
}
|
||||
|
||||
public void SendSpontaneousPaymentWithTlvs(BlockingBreezServices sdk)
|
||||
{
|
||||
// ANCHOR: send-spontaneous-payment-with-tlvs
|
||||
var nodeId = "...";
|
||||
ulong amountMsat = 3_000_000;
|
||||
var extraTlvs = new List<TlvEntry>{
|
||||
new TlvEntry(34349334, Encoding.ASCII.GetBytes("Hello world!").ToList())
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
var response = sdk.SendSpontaneousPayment(
|
||||
new SendSpontaneousPaymentRequest(nodeId, amountMsat, extraTlvs));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// Handle error
|
||||
}
|
||||
// ANCHOR_END: send-spontaneous-payment-with-tlvs
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user