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

@@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/breez/breez-sdk-swift",
"state" : {
"revision" : "74402afba8218ff84a0f32d1bc0d4ddc7698f576",
"version" : "0.2.10"
"revision" : "73c7bf88ce51471f4a6313aa583fa1a5394442f7",
"version" : "0.2.15"
}
},
{

View File

@@ -8,7 +8,7 @@ let package = Package(
platforms: [.macOS(.v12)],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.2.3"),
.package(url: "https://github.com/breez/breez-sdk-swift", from:"0.2.10")
.package(url: "https://github.com/breez/breez-sdk-swift", from:"0.2.15")
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.

View File

@@ -16,6 +16,17 @@ func sendSpontaneousPayment(sdk: BlockingBreezServices) -> SendPaymentResponse?
nodeId: "...",
amountMsat: 3_000_000))
// ANCHOR_END: send-spontaneous-payment
return response
return response
}
func sendSpontaneousPaymentWithTlvs(sdk: BlockingBreezServices) -> SendPaymentResponse? {
// ANCHOR: send-spontaneous-payment-with-tlvs
let extraTlvs = [TlvEntry(fieldNumber: 34_349_334, value: Array("Hello world!".utf8))]
let response = try? sdk.sendSpontaneousPayment(
req: SendSpontaneousPaymentRequest(
nodeId: "...",
amountMsat: 3_000_000,
extraTlvs: extraTlvs))
// ANCHOR_END: send-spontaneous-payment-with-tlvs
return response
}