Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ default = []
#lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main" }
#lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "main" }

lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4", features = ["std"] }
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4" }
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4", features = ["std"] }
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4" }
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4" }
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4" }
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4" }
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4", features = ["rest-client", "rpc-client", "tokio"] }
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4", features = ["esplora-async-https", "electrum-rustls-ring", "time"] }
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4" }
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4" }
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0", features = ["std"] }
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0" }
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0", features = ["std"] }
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0" }
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0" }
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0" }
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0" }
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0", features = ["rest-client", "rpc-client", "tokio"] }
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0", features = ["esplora-async-https", "electrum-rustls-ring", "time"] }
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0" }
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0" }

#lightning = { path = "../rust-lightning/lightning", features = ["std"] }
#lightning-types = { path = "../rust-lightning/lightning-types" }
Expand Down Expand Up @@ -109,7 +109,7 @@ winapi = { version = "0.3", features = ["winbase"] }
[dev-dependencies]
#lightning = { version = "0.1.0", features = ["std", "_test_utils"] }
#lightning = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main", features = ["std", "_test_utils"] }
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "b002e43ec5f9c1cbdcd1ac8588402c5a65ecd2e4", features = ["std", "_test_utils"] }
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "1ed6c4b29abea431ac9296669c4ee0d093f0f7f0", features = ["std", "_test_utils"] }
#lightning = { path = "../rust-lightning/lightning", features = ["std", "_test_utils"] }
proptest = "1.0.0"
regex = "1.5.6"
Expand Down
12 changes: 6 additions & 6 deletions bindings/ldk_node.udl
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,17 @@ interface Bolt11Payment {

interface Bolt12Payment {
[Throws=NodeError]
PaymentId send([ByRef]Offer offer, u64? quantity, string? payer_note);
PaymentId send([ByRef]Offer offer, string? payer_note);
[Throws=NodeError]
PaymentId send_using_amount([ByRef]Offer offer, u64 amount_msat, u64? quantity, string? payer_note);
PaymentId send_using_amount([ByRef]Offer offer, u64 amount_msat, string? payer_note);
[Throws=NodeError]
Offer receive(u64 amount_msat, [ByRef]string description, u32? expiry_secs, u64? quantity);
Offer receive(u64 amount_msat, [ByRef]string description, u32? expiry_secs);
[Throws=NodeError]
Offer receive_variable_amount([ByRef]string description, u32? expiry_secs);
[Throws=NodeError]
Bolt12Invoice request_refund_payment([ByRef]Refund refund);
[Throws=NodeError]
Refund initiate_refund(u64 amount_msat, u32 expiry_secs, u64? quantity, string? payer_note);
Refund initiate_refund(u64 amount_msat, u32 expiry_secs, string? payer_note);
[Throws=NodeError]
Offer receive_async();
[Throws=NodeError]
Expand Down Expand Up @@ -422,8 +422,8 @@ interface PaymentKind {
Onchain(Txid txid, ConfirmationStatus status);
Bolt11(PaymentHash hash, PaymentPreimage? preimage, PaymentSecret? secret);
Bolt11Jit(PaymentHash hash, PaymentPreimage? preimage, PaymentSecret? secret, u64? counterparty_skimmed_fee_msat, LSPFeeLimits lsp_fee_limits);
Bolt12Offer(PaymentHash? hash, PaymentPreimage? preimage, PaymentSecret? secret, OfferId offer_id, UntrustedString? payer_note, u64? quantity);
Bolt12Refund(PaymentHash? hash, PaymentPreimage? preimage, PaymentSecret? secret, UntrustedString? payer_note, u64? quantity);
Bolt12Offer(PaymentHash? hash, PaymentPreimage? preimage, PaymentSecret? secret, OfferId offer_id, UntrustedString? payer_note);
Bolt12Refund(PaymentHash? hash, PaymentPreimage? preimage, PaymentSecret? secret, UntrustedString? payer_note);
Spontaneous(PaymentHash hash, PaymentPreimage? preimage);
};

Expand Down
38 changes: 16 additions & 22 deletions bindings/swift/Sources/LDKNode/LDKNode.swift
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please drop these changes to the static Swift files. These will only be updated/regenerated during release (though here on develop it doesn't matter as much as on main, which are actually part of the SwiftPM dependency).

Original file line number Diff line number Diff line change
Expand Up @@ -1015,17 +1015,17 @@ public func FfiConverterTypeBolt11Payment_lower(_ value: Bolt11Payment) -> Unsaf

public protocol Bolt12PaymentProtocol : AnyObject {

func initiateRefund(amountMsat: UInt64, expirySecs: UInt32, quantity: UInt64?, payerNote: String?) throws -> Refund
func initiateRefund(amountMsat: UInt64, expirySecs: UInt32, payerNote: String?) throws -> Refund

func receive(amountMsat: UInt64, description: String, expirySecs: UInt32?, quantity: UInt64?) throws -> Offer
func receive(amountMsat: UInt64, description: String, expirySecs: UInt32?) throws -> Offer

func receiveVariableAmount(description: String, expirySecs: UInt32?) throws -> Offer

func requestRefundPayment(refund: Refund) throws -> Bolt12Invoice

func send(offer: Offer, quantity: UInt64?, payerNote: String?) throws -> PaymentId
func send(offer: Offer, payerNote: String?) throws -> PaymentId

func sendUsingAmount(offer: Offer, amountMsat: UInt64, quantity: UInt64?, payerNote: String?) throws -> PaymentId
func sendUsingAmount(offer: Offer, amountMsat: UInt64, payerNote: String?) throws -> PaymentId

}

Expand Down Expand Up @@ -1070,24 +1070,22 @@ open class Bolt12Payment:



open func initiateRefund(amountMsat: UInt64, expirySecs: UInt32, quantity: UInt64?, payerNote: String?)throws -> Refund {
open func initiateRefund(amountMsat: UInt64, expirySecs: UInt32, payerNote: String?)throws -> Refund {
return try FfiConverterTypeRefund.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) {
uniffi_ldk_node_fn_method_bolt12payment_initiate_refund(self.uniffiClonePointer(),
FfiConverterUInt64.lower(amountMsat),
FfiConverterUInt32.lower(expirySecs),
FfiConverterOptionUInt64.lower(quantity),
FfiConverterOptionString.lower(payerNote),$0
)
})
}

open func receive(amountMsat: UInt64, description: String, expirySecs: UInt32?, quantity: UInt64?)throws -> Offer {
open func receive(amountMsat: UInt64, description: String, expirySecs: UInt32?)throws -> Offer {
return try FfiConverterTypeOffer.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) {
uniffi_ldk_node_fn_method_bolt12payment_receive(self.uniffiClonePointer(),
FfiConverterUInt64.lower(amountMsat),
FfiConverterString.lower(description),
FfiConverterOptionUInt32.lower(expirySecs),
FfiConverterOptionUInt64.lower(quantity),$0
FfiConverterOptionUInt32.lower(expirySecs),$0
)
})
}
Expand All @@ -1109,22 +1107,20 @@ open func requestRefundPayment(refund: Refund)throws -> Bolt12Invoice {
})
}

open func send(offer: Offer, quantity: UInt64?, payerNote: String?)throws -> PaymentId {
open func send(offer: Offer, payerNote: String?)throws -> PaymentId {
return try FfiConverterTypePaymentId.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) {
uniffi_ldk_node_fn_method_bolt12payment_send(self.uniffiClonePointer(),
FfiConverterTypeOffer.lower(offer),
FfiConverterOptionUInt64.lower(quantity),
FfiConverterOptionString.lower(payerNote),$0
)
})
}

open func sendUsingAmount(offer: Offer, amountMsat: UInt64, quantity: UInt64?, payerNote: String?)throws -> PaymentId {
open func sendUsingAmount(offer: Offer, amountMsat: UInt64, payerNote: String?)throws -> PaymentId {
return try FfiConverterTypePaymentId.lift(try rustCallWithError(FfiConverterTypeNodeError.lift) {
uniffi_ldk_node_fn_method_bolt12payment_send_using_amount(self.uniffiClonePointer(),
FfiConverterTypeOffer.lower(offer),
FfiConverterUInt64.lower(amountMsat),
FfiConverterOptionUInt64.lower(quantity),
FfiConverterOptionString.lower(payerNote),$0
)
})
Expand Down Expand Up @@ -7098,9 +7094,9 @@ public enum PaymentKind {
)
case bolt11Jit(hash: PaymentHash, preimage: PaymentPreimage?, secret: PaymentSecret?, counterpartySkimmedFeeMsat: UInt64?, lspFeeLimits: LspFeeLimits
)
case bolt12Offer(hash: PaymentHash?, preimage: PaymentPreimage?, secret: PaymentSecret?, offerId: OfferId, payerNote: UntrustedString?, quantity: UInt64?
case bolt12Offer(hash: PaymentHash?, preimage: PaymentPreimage?, secret: PaymentSecret?, offerId: OfferId, payerNote: UntrustedString?
)
case bolt12Refund(hash: PaymentHash?, preimage: PaymentPreimage?, secret: PaymentSecret?, payerNote: UntrustedString?, quantity: UInt64?
case bolt12Refund(hash: PaymentHash?, preimage: PaymentPreimage?, secret: PaymentSecret?, payerNote: UntrustedString?
)
case spontaneous(hash: PaymentHash, preimage: PaymentPreimage?
)
Expand All @@ -7123,10 +7119,10 @@ public struct FfiConverterTypePaymentKind: FfiConverterRustBuffer {
case 3: return .bolt11Jit(hash: try FfiConverterTypePaymentHash.read(from: &buf), preimage: try FfiConverterOptionTypePaymentPreimage.read(from: &buf), secret: try FfiConverterOptionTypePaymentSecret.read(from: &buf), counterpartySkimmedFeeMsat: try FfiConverterOptionUInt64.read(from: &buf), lspFeeLimits: try FfiConverterTypeLSPFeeLimits.read(from: &buf)
)

case 4: return .bolt12Offer(hash: try FfiConverterOptionTypePaymentHash.read(from: &buf), preimage: try FfiConverterOptionTypePaymentPreimage.read(from: &buf), secret: try FfiConverterOptionTypePaymentSecret.read(from: &buf), offerId: try FfiConverterTypeOfferId.read(from: &buf), payerNote: try FfiConverterOptionTypeUntrustedString.read(from: &buf), quantity: try FfiConverterOptionUInt64.read(from: &buf)
case 4: return .bolt12Offer(hash: try FfiConverterOptionTypePaymentHash.read(from: &buf), preimage: try FfiConverterOptionTypePaymentPreimage.read(from: &buf), secret: try FfiConverterOptionTypePaymentSecret.read(from: &buf), offerId: try FfiConverterTypeOfferId.read(from: &buf), payerNote: try FfiConverterOptionTypeUntrustedString.read(from: &buf)
)

case 5: return .bolt12Refund(hash: try FfiConverterOptionTypePaymentHash.read(from: &buf), preimage: try FfiConverterOptionTypePaymentPreimage.read(from: &buf), secret: try FfiConverterOptionTypePaymentSecret.read(from: &buf), payerNote: try FfiConverterOptionTypeUntrustedString.read(from: &buf), quantity: try FfiConverterOptionUInt64.read(from: &buf)
case 5: return .bolt12Refund(hash: try FfiConverterOptionTypePaymentHash.read(from: &buf), preimage: try FfiConverterOptionTypePaymentPreimage.read(from: &buf), secret: try FfiConverterOptionTypePaymentSecret.read(from: &buf), payerNote: try FfiConverterOptionTypeUntrustedString.read(from: &buf)
)

case 6: return .spontaneous(hash: try FfiConverterTypePaymentHash.read(from: &buf), preimage: try FfiConverterOptionTypePaymentPreimage.read(from: &buf)
Expand Down Expand Up @@ -7162,23 +7158,21 @@ public struct FfiConverterTypePaymentKind: FfiConverterRustBuffer {
FfiConverterTypeLSPFeeLimits.write(lspFeeLimits, into: &buf)


case let .bolt12Offer(hash,preimage,secret,offerId,payerNote,quantity):
case let .bolt12Offer(hash,preimage,secret,offerId,payerNote):
writeInt(&buf, Int32(4))
FfiConverterOptionTypePaymentHash.write(hash, into: &buf)
FfiConverterOptionTypePaymentPreimage.write(preimage, into: &buf)
FfiConverterOptionTypePaymentSecret.write(secret, into: &buf)
FfiConverterTypeOfferId.write(offerId, into: &buf)
FfiConverterOptionTypeUntrustedString.write(payerNote, into: &buf)
FfiConverterOptionUInt64.write(quantity, into: &buf)


case let .bolt12Refund(hash,preimage,secret,payerNote,quantity):
case let .bolt12Refund(hash,preimage,secret,payerNote):
writeInt(&buf, Int32(5))
FfiConverterOptionTypePaymentHash.write(hash, into: &buf)
FfiConverterOptionTypePaymentPreimage.write(preimage, into: &buf)
FfiConverterOptionTypePaymentSecret.write(secret, into: &buf)
FfiConverterOptionTypeUntrustedString.write(payerNote, into: &buf)
FfiConverterOptionUInt64.write(quantity, into: &buf)


case let .spontaneous(hash,preimage):
Expand Down Expand Up @@ -9840,4 +9834,4 @@ private func uniffiEnsureInitialized() {
}
}

// swiftlint:enable all
// swiftlint:enable all
2 changes: 0 additions & 2 deletions src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -742,14 +742,12 @@ where
} => {
let payer_note = payment_context.invoice_request.payer_note_truncated;
let offer_id = payment_context.offer_id;
let quantity = payment_context.invoice_request.quantity;
let kind = PaymentKind::Bolt12Offer {
hash: Some(payment_hash),
preimage: payment_preimage,
secret: Some(payment_secret),
offer_id,
payer_note,
quantity,
};

let payment = PaymentDetails::new(
Expand Down
Loading
Loading