[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / TransactionU16LenLimited.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
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.
12  * 
13  * Use [`TransactionU16LenLimited::into_transaction`] to convert into the contained `Transaction`.
14  */
15 public class TransactionU16LenLimited : CommonBase {
16         internal TransactionU16LenLimited(object _dummy, long ptr) : base(ptr) { }
17         ~TransactionU16LenLimited() {
18                 if (ptr != 0) { bindings.TransactionU16LenLimited_free(ptr); }
19         }
20
21         internal long clone_ptr() {
22                 long ret = bindings.TransactionU16LenLimited_clone_ptr(this.ptr);
23                 GC.KeepAlive(this);
24                 return ret;
25         }
26
27         /**
28          * Creates a copy of the TransactionU16LenLimited
29          */
30         public TransactionU16LenLimited clone() {
31                 long ret = bindings.TransactionU16LenLimited_clone(this.ptr);
32                 GC.KeepAlive(this);
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); };
36                 return ret_hu_conv;
37         }
38
39         /**
40          * Generates a non-cryptographic 64-bit hash of the TransactionU16LenLimited.
41          */
42         public long hash() {
43                 long ret = bindings.TransactionU16LenLimited_hash(this.ptr);
44                 GC.KeepAlive(this);
45                 return ret;
46         }
47
48         public override int GetHashCode() {
49                 return (int)this.hash();
50         }
51         /**
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.
55          */
56         public bool eq(org.ldk.structs.TransactionU16LenLimited b) {
57                 bool ret = bindings.TransactionU16LenLimited_eq(this.ptr, b == null ? 0 : b.ptr);
58                 GC.KeepAlive(this);
59                 GC.KeepAlive(b);
60                 if (this != null) { this.ptrs_to.AddLast(b); };
61                 return ret;
62         }
63
64         public override bool Equals(object o) {
65                 if (!(o is TransactionU16LenLimited)) return false;
66                 return this.eq((TransactionU16LenLimited)o);
67         }
68         /**
69          * Constructs a new `TransactionU16LenLimited` from a `Transaction` only if it's consensus-
70          * serialized length is <= u16::MAX.
71          */
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);
77                 return ret_hu_conv;
78         }
79
80         /**
81          * Consumes this `TransactionU16LenLimited` and returns its contained `Transaction`.
82          */
83         public byte[] into_transaction() {
84                 long ret = bindings.TransactionU16LenLimited_into_transaction(this.ptr);
85                 GC.KeepAlive(this);
86                 if (ret >= 0 && ret <= 4096) { return null; }
87                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
88                 if (this != null) { this.ptrs_to.AddLast(this); };
89                 return ret_conv;
90         }
91
92         /**
93          * Serialize the TransactionU16LenLimited object into a byte array which can be read by TransactionU16LenLimited_read
94          */
95         public byte[] write() {
96                 long ret = bindings.TransactionU16LenLimited_write(this.ptr);
97                 GC.KeepAlive(this);
98                 if (ret >= 0 && ret <= 4096) { return null; }
99                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
100                 return ret_conv;
101         }
102
103         /**
104          * Read a TransactionU16LenLimited from a byte array, created by TransactionU16LenLimited_write
105          */
106         public static Result_TransactionU16LenLimitedDecodeErrorZ read(byte[] ser) {
107                 long ret = bindings.TransactionU16LenLimited_read(InternalUtils.encodeUint8Array(ser));
108                 GC.KeepAlive(ser);
109                 if (ret >= 0 && ret <= 4096) { return null; }
110                 Result_TransactionU16LenLimitedDecodeErrorZ ret_hu_conv = Result_TransactionU16LenLimitedDecodeErrorZ.constr_from_ptr(ret);
111                 return ret_hu_conv;
112         }
113
114 }
115 } } }