6 namespace org { namespace ldk { namespace structs {
10 * Fields sent in an [`InvoiceRequest`] message to include in [`PaymentContext::Bolt12Offer`].
12 * [`PaymentContext::Bolt12Offer`]: crate::blinded_path::payment::PaymentContext::Bolt12Offer
14 public class InvoiceRequestFields : CommonBase {
15 internal InvoiceRequestFields(object _dummy, long ptr) : base(ptr) { }
16 ~InvoiceRequestFields() {
17 if (ptr != 0) { bindings.InvoiceRequestFields_free(ptr); }
21 * A possibly transient pubkey used to sign the invoice request.
23 public byte[] get_payer_id() {
24 long ret = bindings.InvoiceRequestFields_get_payer_id(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
32 * A possibly transient pubkey used to sign the invoice request.
34 public void set_payer_id(byte[] val) {
35 bindings.InvoiceRequestFields_set_payer_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
41 * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
43 public Option_u64Z get_quantity() {
44 long ret = bindings.InvoiceRequestFields_get_quantity(this.ptr);
46 if (ret >= 0 && ret <= 4096) { return null; }
47 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
48 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
53 * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
55 public void set_quantity(org.ldk.structs.Option_u64Z val) {
56 bindings.InvoiceRequestFields_set_quantity(this.ptr, val.ptr);
59 if (this != null) { this.ptrs_to.AddLast(val); };
63 * A payer-provided note which will be seen by the recipient and reflected back in the invoice
64 * response. Truncated to [`PAYER_NOTE_LIMIT`] characters.
66 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
68 public UntrustedString get_payer_note_truncated() {
69 long ret = bindings.InvoiceRequestFields_get_payer_note_truncated(this.ptr);
71 if (ret >= 0 && ret <= 4096) { return null; }
72 org.ldk.structs.UntrustedString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UntrustedString(null, ret); }
73 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
78 * A payer-provided note which will be seen by the recipient and reflected back in the invoice
79 * response. Truncated to [`PAYER_NOTE_LIMIT`] characters.
81 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
83 public void set_payer_note_truncated(org.ldk.structs.UntrustedString val) {
84 bindings.InvoiceRequestFields_set_payer_note_truncated(this.ptr, val == null ? 0 : val.ptr);
87 if (this != null) { this.ptrs_to.AddLast(val); };
91 * Constructs a new InvoiceRequestFields given each field
93 * Note that payer_note_truncated_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
95 public static InvoiceRequestFields of(byte[] payer_id_arg, org.ldk.structs.Option_u64Z quantity_arg, org.ldk.structs.UntrustedString payer_note_truncated_arg) {
96 long ret = bindings.InvoiceRequestFields_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payer_id_arg, 33)), quantity_arg.ptr, payer_note_truncated_arg == null ? 0 : payer_note_truncated_arg.ptr);
97 GC.KeepAlive(payer_id_arg);
98 GC.KeepAlive(quantity_arg);
99 GC.KeepAlive(payer_note_truncated_arg);
100 if (ret >= 0 && ret <= 4096) { return null; }
101 org.ldk.structs.InvoiceRequestFields ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceRequestFields(null, ret); }
102 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
103 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(quantity_arg); };
104 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(payer_note_truncated_arg); };
108 internal long clone_ptr() {
109 long ret = bindings.InvoiceRequestFields_clone_ptr(this.ptr);
115 * Creates a copy of the InvoiceRequestFields
117 public InvoiceRequestFields clone() {
118 long ret = bindings.InvoiceRequestFields_clone(this.ptr);
120 if (ret >= 0 && ret <= 4096) { return null; }
121 org.ldk.structs.InvoiceRequestFields ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceRequestFields(null, ret); }
122 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
127 * Checks if two InvoiceRequestFieldss contain equal inner contents.
128 * This ignores pointers and is_owned flags and looks at the values in fields.
129 * Two objects with NULL inner values will be considered "equal" here.
131 public bool eq(org.ldk.structs.InvoiceRequestFields b) {
132 bool ret = bindings.InvoiceRequestFields_eq(this.ptr, b.ptr);
135 if (this != null) { this.ptrs_to.AddLast(b); };
139 public override bool Equals(object o) {
140 if (!(o is InvoiceRequestFields)) return false;
141 return this.eq((InvoiceRequestFields)o);
144 * Serialize the InvoiceRequestFields object into a byte array which can be read by InvoiceRequestFields_read
146 public byte[] write() {
147 long ret = bindings.InvoiceRequestFields_write(this.ptr);
149 if (ret >= 0 && ret <= 4096) { return null; }
150 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
155 * Read a InvoiceRequestFields from a byte array, created by InvoiceRequestFields_write
157 public static Result_InvoiceRequestFieldsDecodeErrorZ read(byte[] ser) {
158 long ret = bindings.InvoiceRequestFields_read(InternalUtils.encodeUint8Array(ser));
160 if (ret >= 0 && ret <= 4096) { return null; }
161 Result_InvoiceRequestFieldsDecodeErrorZ ret_hu_conv = Result_InvoiceRequestFieldsDecodeErrorZ.constr_from_ptr(ret);