6 namespace org { namespace ldk { namespace structs {
10 * The context of a payment made for an invoice requested from a BOLT 12 [`Offer`].
12 * [`Offer`]: crate::offers::offer::Offer
14 public class Bolt12OfferContext : CommonBase {
15 internal Bolt12OfferContext(object _dummy, long ptr) : base(ptr) { }
16 ~Bolt12OfferContext() {
17 if (ptr != 0) { bindings.Bolt12OfferContext_free(ptr); }
21 * The identifier of the [`Offer`].
23 * [`Offer`]: crate::offers::offer::Offer
25 public OfferId get_offer_id() {
26 long ret = bindings.Bolt12OfferContext_get_offer_id(this.ptr);
28 if (ret >= 0 && ret <= 4096) { return null; }
29 org.ldk.structs.OfferId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OfferId(null, ret); }
30 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
35 * The identifier of the [`Offer`].
37 * [`Offer`]: crate::offers::offer::Offer
39 public void set_offer_id(org.ldk.structs.OfferId val) {
40 bindings.Bolt12OfferContext_set_offer_id(this.ptr, val.ptr);
43 if (this != null) { this.ptrs_to.AddLast(val); };
47 * Fields from an [`InvoiceRequest`] sent for a [`Bolt12Invoice`].
49 * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
50 * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
52 public InvoiceRequestFields get_invoice_request() {
53 long ret = bindings.Bolt12OfferContext_get_invoice_request(this.ptr);
55 if (ret >= 0 && ret <= 4096) { return null; }
56 org.ldk.structs.InvoiceRequestFields ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceRequestFields(null, ret); }
57 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
62 * Fields from an [`InvoiceRequest`] sent for a [`Bolt12Invoice`].
64 * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
65 * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
67 public void set_invoice_request(org.ldk.structs.InvoiceRequestFields val) {
68 bindings.Bolt12OfferContext_set_invoice_request(this.ptr, val.ptr);
71 if (this != null) { this.ptrs_to.AddLast(val); };
75 * Constructs a new Bolt12OfferContext given each field
77 public static Bolt12OfferContext of(org.ldk.structs.OfferId offer_id_arg, org.ldk.structs.InvoiceRequestFields invoice_request_arg) {
78 long ret = bindings.Bolt12OfferContext_new(offer_id_arg.ptr, invoice_request_arg.ptr);
79 GC.KeepAlive(offer_id_arg);
80 GC.KeepAlive(invoice_request_arg);
81 if (ret >= 0 && ret <= 4096) { return null; }
82 org.ldk.structs.Bolt12OfferContext ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt12OfferContext(null, ret); }
83 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
84 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(offer_id_arg); };
85 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(invoice_request_arg); };
89 internal long clone_ptr() {
90 long ret = bindings.Bolt12OfferContext_clone_ptr(this.ptr);
96 * Creates a copy of the Bolt12OfferContext
98 public Bolt12OfferContext clone() {
99 long ret = bindings.Bolt12OfferContext_clone(this.ptr);
101 if (ret >= 0 && ret <= 4096) { return null; }
102 org.ldk.structs.Bolt12OfferContext ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt12OfferContext(null, ret); }
103 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
108 * Checks if two Bolt12OfferContexts contain equal inner contents.
109 * This ignores pointers and is_owned flags and looks at the values in fields.
110 * Two objects with NULL inner values will be considered "equal" here.
112 public bool eq(org.ldk.structs.Bolt12OfferContext b) {
113 bool ret = bindings.Bolt12OfferContext_eq(this.ptr, b.ptr);
116 if (this != null) { this.ptrs_to.AddLast(b); };
120 public override bool Equals(object o) {
121 if (!(o is Bolt12OfferContext)) return false;
122 return this.eq((Bolt12OfferContext)o);
125 * Serialize the Bolt12OfferContext object into a byte array which can be read by Bolt12OfferContext_read
127 public byte[] write() {
128 long ret = bindings.Bolt12OfferContext_write(this.ptr);
130 if (ret >= 0 && ret <= 4096) { return null; }
131 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
136 * Read a Bolt12OfferContext from a byte array, created by Bolt12OfferContext_write
138 public static Result_Bolt12OfferContextDecodeErrorZ read(byte[] ser) {
139 long ret = bindings.Bolt12OfferContext_read(InternalUtils.encodeUint8Array(ser));
141 if (ret >= 0 && ret <= 4096) { return null; }
142 Result_Bolt12OfferContextDecodeErrorZ ret_hu_conv = Result_Bolt12OfferContextDecodeErrorZ.constr_from_ptr(ret);