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