Add examples for adding extra TLVs to a spontaneous payment

This commit is contained in:
Ross Savage
2024-01-29 17:11:25 +01:00
parent 60552e8b35
commit 37a46fa4d6
23 changed files with 290 additions and 55 deletions

View File

@@ -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
}
}