X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FBolt12Invoice.cs;h=e498a962a10bf29f8dd5a2aeda3d8dcd6d79e846;hb=152d721883552dd92925833d15687d7d64d01c35;hp=35f4e6517d0c9b8d1ea0ec7506d032aeb8ceb499;hpb=afb5ef3730c7175ccdd22a20ea4e071c663cb709;p=ldk-java diff --git a/c_sharp/src/org/ldk/structs/Bolt12Invoice.cs b/c_sharp/src/org/ldk/structs/Bolt12Invoice.cs index 35f4e651..e498a962 100644 --- a/c_sharp/src/org/ldk/structs/Bolt12Invoice.cs +++ b/c_sharp/src/org/ldk/structs/Bolt12Invoice.cs @@ -99,14 +99,12 @@ public class Bolt12Invoice : CommonBase { * * [`Offer`]: crate::offers::offer::Offer * [`Offer::amount`]: crate::offers::offer::Offer::amount - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public Amount amount() { + public Option_AmountZ amount() { long ret = bindings.Bolt12Invoice_amount(this.ptr); GC.KeepAlive(this); if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.Amount ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Amount(null, ret); } + org.ldk.structs.Option_AmountZ ret_hu_conv = org.ldk.structs.Option_AmountZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); }; return ret_hu_conv; } @@ -137,6 +135,8 @@ public class Bolt12Invoice : CommonBase { * From [`Offer::description`] or [`Refund::description`]. * * [`Offer::description`]: crate::offers::offer::Offer::description + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ public PrintableString description() { long ret = bindings.Bolt12Invoice_description(this.ptr); @@ -211,14 +211,12 @@ public class Bolt12Invoice : CommonBase { * [`Refund`]. * * [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public Quantity supported_quantity() { + public Option_QuantityZ supported_quantity() { long ret = bindings.Bolt12Invoice_supported_quantity(this.ptr); GC.KeepAlive(this); if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.Quantity ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Quantity(null, ret); } + org.ldk.structs.Option_QuantityZ ret_hu_conv = org.ldk.structs.Option_QuantityZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); }; return ret_hu_conv; } @@ -392,7 +390,7 @@ public class Bolt12Invoice : CommonBase { * the associated [`PaymentId`] to use when sending the payment. */ public Result_ThirtyTwoBytesNoneZ verify(org.ldk.structs.ExpandedKey key) { - long ret = bindings.Bolt12Invoice_verify(this.ptr, key == null ? 0 : key.ptr); + long ret = bindings.Bolt12Invoice_verify(this.ptr, key.ptr); GC.KeepAlive(this); GC.KeepAlive(key); if (ret >= 0 && ret <= 4096) { return null; } @@ -401,6 +399,18 @@ public class Bolt12Invoice : CommonBase { return ret_hu_conv; } + /** + * Generates a non-cryptographic 64-bit hash of the Bolt12Invoice. + */ + public long hash() { + long ret = bindings.Bolt12Invoice_hash(this.ptr); + GC.KeepAlive(this); + return ret; + } + + public override int GetHashCode() { + return (int)this.hash(); + } /** * Serialize the Bolt12Invoice object into a byte array which can be read by Bolt12Invoice_read */