6 namespace org { namespace ldk { namespace structs {
10 * An identifier for an [`Offer`] built using [`DerivedMetadata`].
12 public class OfferId : CommonBase {
13 internal OfferId(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.OfferId_free(ptr); }
18 public byte[] get_a() {
19 long ret = bindings.OfferId_get_a(this.ptr);
21 if (ret >= 0 && ret <= 4096) { return null; }
22 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
26 public void set_a(byte[] val) {
27 bindings.OfferId_set_a(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
33 * Constructs a new OfferId given each field
35 public static OfferId of(byte[] a_arg) {
36 long ret = bindings.OfferId_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(a_arg, 32)));
38 if (ret >= 0 && ret <= 4096) { return null; }
39 org.ldk.structs.OfferId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OfferId(null, ret); }
40 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
44 internal long clone_ptr() {
45 long ret = bindings.OfferId_clone_ptr(this.ptr);
51 * Creates a copy of the OfferId
53 public OfferId clone() {
54 long ret = bindings.OfferId_clone(this.ptr);
56 if (ret >= 0 && ret <= 4096) { return null; }
57 org.ldk.structs.OfferId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OfferId(null, ret); }
58 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
63 * Checks if two OfferIds contain equal inner contents.
64 * This ignores pointers and is_owned flags and looks at the values in fields.
65 * Two objects with NULL inner values will be considered "equal" here.
67 public bool eq(org.ldk.structs.OfferId b) {
68 bool ret = bindings.OfferId_eq(this.ptr, b.ptr);
71 if (this != null) { this.ptrs_to.AddLast(b); };
75 public override bool Equals(object o) {
76 if (!(o is OfferId)) return false;
77 return this.eq((OfferId)o);
80 * Serialize the OfferId object into a byte array which can be read by OfferId_read
82 public byte[] write() {
83 long ret = bindings.OfferId_write(this.ptr);
85 if (ret >= 0 && ret <= 4096) { return null; }
86 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
91 * Read a OfferId from a byte array, created by OfferId_write
93 public static Result_OfferIdDecodeErrorZ read(byte[] ser) {
94 long ret = bindings.OfferId_read(InternalUtils.encodeUint8Array(ser));
96 if (ret >= 0 && ret <= 4096) { return null; }
97 Result_OfferIdDecodeErrorZ ret_hu_conv = Result_OfferIdDecodeErrorZ.constr_from_ptr(ret);