6 namespace org { namespace ldk { namespace structs {
10 * A wrapper for a `Transaction` which can only be constructed with [`TransactionU16LenLimited::new`]
11 * if the `Transaction`'s consensus-serialized length is <= u16::MAX.
13 * Use [`TransactionU16LenLimited::into_transaction`] to convert into the contained `Transaction`.
15 public class TransactionU16LenLimited : CommonBase {
16 internal TransactionU16LenLimited(object _dummy, long ptr) : base(ptr) { }
17 ~TransactionU16LenLimited() {
18 if (ptr != 0) { bindings.TransactionU16LenLimited_free(ptr); }
21 internal long clone_ptr() {
22 long ret = bindings.TransactionU16LenLimited_clone_ptr(this.ptr);
28 * Creates a copy of the TransactionU16LenLimited
30 public TransactionU16LenLimited clone() {
31 long ret = bindings.TransactionU16LenLimited_clone(this.ptr);
33 if (ret >= 0 && ret <= 4096) { return null; }
34 org.ldk.structs.TransactionU16LenLimited ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TransactionU16LenLimited(null, ret); }
35 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
40 * Generates a non-cryptographic 64-bit hash of the TransactionU16LenLimited.
43 long ret = bindings.TransactionU16LenLimited_hash(this.ptr);
48 public override int GetHashCode() {
49 return (int)this.hash();
52 * Checks if two TransactionU16LenLimiteds contain equal inner contents.
53 * This ignores pointers and is_owned flags and looks at the values in fields.
54 * Two objects with NULL inner values will be considered "equal" here.
56 public bool eq(org.ldk.structs.TransactionU16LenLimited b) {
57 bool ret = bindings.TransactionU16LenLimited_eq(this.ptr, b.ptr);
60 if (this != null) { this.ptrs_to.AddLast(b); };
64 public override bool Equals(object o) {
65 if (!(o is TransactionU16LenLimited)) return false;
66 return this.eq((TransactionU16LenLimited)o);
69 * Constructs a new `TransactionU16LenLimited` from a `Transaction` only if it's consensus-
70 * serialized length is <= u16::MAX.
72 public static Result_TransactionU16LenLimitedNoneZ of(byte[] transaction) {
73 long ret = bindings.TransactionU16LenLimited_new(InternalUtils.encodeUint8Array(transaction));
74 GC.KeepAlive(transaction);
75 if (ret >= 0 && ret <= 4096) { return null; }
76 Result_TransactionU16LenLimitedNoneZ ret_hu_conv = Result_TransactionU16LenLimitedNoneZ.constr_from_ptr(ret);
81 * Consumes this `TransactionU16LenLimited` and returns its contained `Transaction`.
83 public byte[] into_transaction() {
84 long ret = bindings.TransactionU16LenLimited_into_transaction(this.ptr);
86 if (ret >= 0 && ret <= 4096) { return null; }
87 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
88 if (this != null) { this.ptrs_to.AddLast(this); };
93 * Returns a reference to the contained `Transaction`
95 public byte[] as_transaction() {
96 long ret = bindings.TransactionU16LenLimited_as_transaction(this.ptr);
98 if (ret >= 0 && ret <= 4096) { return null; }
99 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
104 * Serialize the TransactionU16LenLimited object into a byte array which can be read by TransactionU16LenLimited_read
106 public byte[] write() {
107 long ret = bindings.TransactionU16LenLimited_write(this.ptr);
109 if (ret >= 0 && ret <= 4096) { return null; }
110 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
115 * Read a TransactionU16LenLimited from a byte array, created by TransactionU16LenLimited_write
117 public static Result_TransactionU16LenLimitedDecodeErrorZ read(byte[] ser) {
118 long ret = bindings.TransactionU16LenLimited_read(InternalUtils.encodeUint8Array(ser));
120 if (ret >= 0 && ret <= 4096) { return null; }
121 Result_TransactionU16LenLimitedDecodeErrorZ ret_hu_conv = Result_TransactionU16LenLimitedDecodeErrorZ.constr_from_ptr(ret);