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