mirror of
https://github.com/aljazceru/breez-sdk-docs.git
synced 2025-12-17 05:44:20 +01:00
Add examples for adding extra TLVs to a spontaneous payment
This commit is contained in:
@@ -34,7 +34,7 @@ kotlin {
|
||||
}
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
implementation("technology.breez:breez-sdk-kmp:0.2.10")
|
||||
implementation("technology.breez:breez-sdk-kmp:0.2.15")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,4 +14,20 @@ class SendSpontaneousPayment {
|
||||
}
|
||||
// ANCHOR_END: send-spontaneous-payment
|
||||
}
|
||||
|
||||
fun send_spontaneous_payment_with_tlvs(sdk: BlockingBreezServices) {
|
||||
// ANCHOR: send-spontaneous-payment-with-tlvs
|
||||
val nodeId = "..."
|
||||
val amountMsat = 3_000_000.toULong()
|
||||
val extraTlvs = listOf<TlvEntry>(
|
||||
TlvEntry(34_349_334.toULong(), "Hello world!".encodeToByteArray().asUByteArray().toList())
|
||||
)
|
||||
try {
|
||||
val response = sdk.sendSpontaneousPayment(
|
||||
SendSpontaneousPaymentRequest(nodeId, amountMsat, extraTlvs))
|
||||
} catch (e: Exception) {
|
||||
// handle error
|
||||
}
|
||||
// ANCHOR_END: send-spontaneous-payment-with-tlvs
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user