[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / TxAddInput.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 tx_add_input message for adding an input during interactive transaction construction
11  */
12 public class TxAddInput : CommonBase {
13         internal TxAddInput(object _dummy, long ptr) : base(ptr) { }
14         ~TxAddInput() {
15                 if (ptr != 0) { bindings.TxAddInput_free(ptr); }
16         }
17
18         /**
19          * The channel ID
20          */
21         public byte[] get_channel_id() {
22                 long ret = bindings.TxAddInput_get_channel_id(this.ptr);
23                 GC.KeepAlive(this);
24                 if (ret >= 0 && ret <= 4096) { return null; }
25                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
26                 return ret_conv;
27         }
28
29         /**
30          * The channel ID
31          */
32         public void set_channel_id(byte[] val) {
33                 bindings.TxAddInput_set_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
34                 GC.KeepAlive(this);
35                 GC.KeepAlive(val);
36         }
37
38         /**
39          * A randomly chosen unique identifier for this input, which is even for initiators and odd for
40          * non-initiators.
41          */
42         public long get_serial_id() {
43                 long ret = bindings.TxAddInput_get_serial_id(this.ptr);
44                 GC.KeepAlive(this);
45                 return ret;
46         }
47
48         /**
49          * A randomly chosen unique identifier for this input, which is even for initiators and odd for
50          * non-initiators.
51          */
52         public void set_serial_id(long val) {
53                 bindings.TxAddInput_set_serial_id(this.ptr, val);
54                 GC.KeepAlive(this);
55                 GC.KeepAlive(val);
56         }
57
58         /**
59          * Serialized transaction that contains the output this input spends to verify that it is non
60          * malleable.
61          */
62         public TransactionU16LenLimited get_prevtx() {
63                 long ret = bindings.TxAddInput_get_prevtx(this.ptr);
64                 GC.KeepAlive(this);
65                 if (ret >= 0 && ret <= 4096) { return null; }
66                 org.ldk.structs.TransactionU16LenLimited ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TransactionU16LenLimited(null, ret); }
67                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
68                 return ret_hu_conv;
69         }
70
71         /**
72          * Serialized transaction that contains the output this input spends to verify that it is non
73          * malleable.
74          */
75         public void set_prevtx(org.ldk.structs.TransactionU16LenLimited val) {
76                 bindings.TxAddInput_set_prevtx(this.ptr, val == null ? 0 : val.ptr);
77                 GC.KeepAlive(this);
78                 GC.KeepAlive(val);
79                 if (this != null) { this.ptrs_to.AddLast(val); };
80         }
81
82         /**
83          * The index of the output being spent
84          */
85         public int get_prevtx_out() {
86                 int ret = bindings.TxAddInput_get_prevtx_out(this.ptr);
87                 GC.KeepAlive(this);
88                 return ret;
89         }
90
91         /**
92          * The index of the output being spent
93          */
94         public void set_prevtx_out(int val) {
95                 bindings.TxAddInput_set_prevtx_out(this.ptr, val);
96                 GC.KeepAlive(this);
97                 GC.KeepAlive(val);
98         }
99
100         /**
101          * The sequence number of this input
102          */
103         public int get_sequence() {
104                 int ret = bindings.TxAddInput_get_sequence(this.ptr);
105                 GC.KeepAlive(this);
106                 return ret;
107         }
108
109         /**
110          * The sequence number of this input
111          */
112         public void set_sequence(int val) {
113                 bindings.TxAddInput_set_sequence(this.ptr, val);
114                 GC.KeepAlive(this);
115                 GC.KeepAlive(val);
116         }
117
118         /**
119          * Constructs a new TxAddInput given each field
120          */
121         public static TxAddInput of(byte[] channel_id_arg, long serial_id_arg, org.ldk.structs.TransactionU16LenLimited prevtx_arg, int prevtx_out_arg, int sequence_arg) {
122                 long ret = bindings.TxAddInput_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id_arg, 32)), serial_id_arg, prevtx_arg == null ? 0 : prevtx_arg.ptr, prevtx_out_arg, sequence_arg);
123                 GC.KeepAlive(channel_id_arg);
124                 GC.KeepAlive(serial_id_arg);
125                 GC.KeepAlive(prevtx_arg);
126                 GC.KeepAlive(prevtx_out_arg);
127                 GC.KeepAlive(sequence_arg);
128                 if (ret >= 0 && ret <= 4096) { return null; }
129                 org.ldk.structs.TxAddInput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAddInput(null, ret); }
130                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
131                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(prevtx_arg); };
132                 return ret_hu_conv;
133         }
134
135         internal long clone_ptr() {
136                 long ret = bindings.TxAddInput_clone_ptr(this.ptr);
137                 GC.KeepAlive(this);
138                 return ret;
139         }
140
141         /**
142          * Creates a copy of the TxAddInput
143          */
144         public TxAddInput clone() {
145                 long ret = bindings.TxAddInput_clone(this.ptr);
146                 GC.KeepAlive(this);
147                 if (ret >= 0 && ret <= 4096) { return null; }
148                 org.ldk.structs.TxAddInput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAddInput(null, ret); }
149                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
150                 return ret_hu_conv;
151         }
152
153         /**
154          * Generates a non-cryptographic 64-bit hash of the TxAddInput.
155          */
156         public long hash() {
157                 long ret = bindings.TxAddInput_hash(this.ptr);
158                 GC.KeepAlive(this);
159                 return ret;
160         }
161
162         public override int GetHashCode() {
163                 return (int)this.hash();
164         }
165         /**
166          * Checks if two TxAddInputs contain equal inner contents.
167          * This ignores pointers and is_owned flags and looks at the values in fields.
168          * Two objects with NULL inner values will be considered "equal" here.
169          */
170         public bool eq(org.ldk.structs.TxAddInput b) {
171                 bool ret = bindings.TxAddInput_eq(this.ptr, b == null ? 0 : b.ptr);
172                 GC.KeepAlive(this);
173                 GC.KeepAlive(b);
174                 if (this != null) { this.ptrs_to.AddLast(b); };
175                 return ret;
176         }
177
178         public override bool Equals(object o) {
179                 if (!(o is TxAddInput)) return false;
180                 return this.eq((TxAddInput)o);
181         }
182         /**
183          * Serialize the TxAddInput object into a byte array which can be read by TxAddInput_read
184          */
185         public byte[] write() {
186                 long ret = bindings.TxAddInput_write(this.ptr);
187                 GC.KeepAlive(this);
188                 if (ret >= 0 && ret <= 4096) { return null; }
189                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
190                 return ret_conv;
191         }
192
193         /**
194          * Read a TxAddInput from a byte array, created by TxAddInput_write
195          */
196         public static Result_TxAddInputDecodeErrorZ read(byte[] ser) {
197                 long ret = bindings.TxAddInput_read(InternalUtils.encodeUint8Array(ser));
198                 GC.KeepAlive(ser);
199                 if (ret >= 0 && ret <= 4096) { return null; }
200                 Result_TxAddInputDecodeErrorZ ret_hu_conv = Result_TxAddInputDecodeErrorZ.constr_from_ptr(ret);
201                 return ret_hu_conv;
202         }
203
204 }
205 } } }