Skip to content

Commit c554a24

Browse files
committed
Avoid collision of description on Offer, Refund, Bolt12Invoice
Swift will auto-generate a `description` accessor. We here avoid any conflicting methods in our API.
1 parent 15a1b90 commit c554a24

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

bindings/ldk_node.udl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ interface Offer {
771771
constructor([ByRef] string offer_str);
772772
OfferId id();
773773
boolean is_expired();
774-
string? description();
774+
string? offer_description();
775775
string? issuer();
776776
OfferAmount? amount();
777777
boolean is_valid_quantity(u64 quantity);
@@ -787,7 +787,7 @@ interface Offer {
787787
interface Refund {
788788
[Throws=NodeError, Name=from_str]
789789
constructor([ByRef] string refund_str);
790-
string description();
790+
string refund_description();
791791
u64? absolute_expiry_seconds();
792792
boolean is_expired();
793793
string? issuer();
@@ -810,7 +810,7 @@ interface Bolt12Invoice {
810810
u64? absolute_expiry_seconds();
811811
u64 relative_expiry();
812812
boolean is_expired();
813-
string? description();
813+
string? invoice_description();
814814
string? issuer();
815815
string? payer_note();
816816
sequence<u8>? metadata();

src/ffi/types.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl Offer {
159159
/// A complete description of the purpose of the payment.
160160
///
161161
/// Intended to be displayed to the user but with the caveat that it has not been verified in any way.
162-
pub fn description(&self) -> Option<String> {
162+
pub fn offer_description(&self) -> Option<String> {
163163
self.inner.description().map(|printable| printable.to_string())
164164
}
165165

@@ -288,7 +288,7 @@ impl Refund {
288288
/// A complete description of the purpose of the refund.
289289
///
290290
/// Intended to be displayed to the user but with the caveat that it has not been verified in any way.
291-
pub fn description(&self) -> String {
291+
pub fn refund_description(&self) -> String {
292292
self.inner.description().to_string()
293293
}
294294

@@ -466,7 +466,7 @@ impl Bolt12Invoice {
466466
///
467467
/// [`Offer::description`]: lightning::offers::offer::Offer::description
468468
/// [`Refund::description`]: lightning::offers::refund::Refund::description
469-
pub fn description(&self) -> Option<String> {
469+
pub fn invoice_description(&self) -> Option<String> {
470470
self.inner.description().map(|printable| printable.to_string())
471471
}
472472

@@ -1359,7 +1359,7 @@ mod tests {
13591359
#[test]
13601360
fn test_offer() {
13611361
let (ldk_offer, wrapped_offer) = create_test_offer();
1362-
match (ldk_offer.description(), wrapped_offer.description()) {
1362+
match (ldk_offer.description(), wrapped_offer.offer_description()) {
13631363
(Some(ldk_desc), Some(wrapped_desc)) => {
13641364
assert_eq!(ldk_desc.to_string(), wrapped_desc);
13651365
},
@@ -1481,7 +1481,7 @@ mod tests {
14811481
fn test_refund_properties() {
14821482
let (ldk_refund, wrapped_refund) = create_test_refund();
14831483

1484-
assert_eq!(ldk_refund.description().to_string(), wrapped_refund.description());
1484+
assert_eq!(ldk_refund.description().to_string(), wrapped_refund.refund_description());
14851485
assert_eq!(ldk_refund.amount_msats(), wrapped_refund.amount_msats());
14861486
assert_eq!(ldk_refund.is_expired(), wrapped_refund.is_expired());
14871487

@@ -1572,7 +1572,7 @@ mod tests {
15721572

15731573
assert_eq!(ldk_invoice.relative_expiry().as_secs(), wrapped_invoice.relative_expiry());
15741574

1575-
match (ldk_invoice.description(), wrapped_invoice.description()) {
1575+
match (ldk_invoice.description(), wrapped_invoice.invoice_description()) {
15761576
(Some(ldk_desc), Some(wrapped_desc)) => {
15771577
assert_eq!(ldk_desc.to_string(), wrapped_desc);
15781578
},

0 commit comments

Comments
 (0)