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 * Checks if two TransactionU16LenLimiteds contain equal inner contents.
41 * This ignores pointers and is_owned flags and looks at the values in fields.
42 * Two objects with NULL inner values will be considered "equal" here.
44 public bool eq(org.ldk.structs.TransactionU16LenLimited b) {
45 bool ret = bindings.TransactionU16LenLimited_eq(this.ptr, b == null ? 0 : b.ptr);
48 if (this != null) { this.ptrs_to.AddLast(b); };
52 public override bool Equals(object o) {
53 if (!(o is TransactionU16LenLimited)) return false;
54 return this.eq((TransactionU16LenLimited)o);
57 * Constructs a new `TransactionU16LenLimited` from a `Transaction` only if it's consensus-
58 * serialized length is <= u16::MAX.
60 public static Result_TransactionU16LenLimitedNoneZ of(byte[] transaction) {
61 long ret = bindings.TransactionU16LenLimited_new(transaction);
62 GC.KeepAlive(transaction);
63 if (ret >= 0 && ret <= 4096) { return null; }
64 Result_TransactionU16LenLimitedNoneZ ret_hu_conv = Result_TransactionU16LenLimitedNoneZ.constr_from_ptr(ret);
69 * Consumes this `TransactionU16LenLimited` and returns its contained `Transaction`.
71 public byte[] into_transaction() {
72 byte[] ret = bindings.TransactionU16LenLimited_into_transaction(this.ptr);
74 if (this != null) { this.ptrs_to.AddLast(this); };
79 * Serialize the TransactionU16LenLimited object into a byte array which can be read by TransactionU16LenLimited_read
81 public byte[] write() {
82 byte[] ret = bindings.TransactionU16LenLimited_write(this.ptr);
88 * Read a TransactionU16LenLimited from a byte array, created by TransactionU16LenLimited_write
90 public static Result_TransactionU16LenLimitedDecodeErrorZ read(byte[] ser) {
91 long ret = bindings.TransactionU16LenLimited_read(ser);
93 if (ret >= 0 && ret <= 4096) { return null; }
94 Result_TransactionU16LenLimitedDecodeErrorZ ret_hu_conv = Result_TransactionU16LenLimitedDecodeErrorZ.constr_from_ptr(ret);