[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / TxAddOutput.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_output message for adding an output during interactive transaction construction.
11  */
12 public class TxAddOutput : CommonBase {
13         internal TxAddOutput(object _dummy, long ptr) : base(ptr) { }
14         ~TxAddOutput() {
15                 if (ptr != 0) { bindings.TxAddOutput_free(ptr); }
16         }
17
18         /**
19          * The channel ID
20          */
21         public byte[] get_channel_id() {
22                 long ret = bindings.TxAddOutput_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.TxAddOutput_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 output, which is even for initiators and odd for
40          * non-initiators.
41          */
42         public long get_serial_id() {
43                 long ret = bindings.TxAddOutput_get_serial_id(this.ptr);
44                 GC.KeepAlive(this);
45                 return ret;
46         }
47
48         /**
49          * A randomly chosen unique identifier for this output, which is even for initiators and odd for
50          * non-initiators.
51          */
52         public void set_serial_id(long val) {
53                 bindings.TxAddOutput_set_serial_id(this.ptr, val);
54                 GC.KeepAlive(this);
55                 GC.KeepAlive(val);
56         }
57
58         /**
59          * The satoshi value of the output
60          */
61         public long get_sats() {
62                 long ret = bindings.TxAddOutput_get_sats(this.ptr);
63                 GC.KeepAlive(this);
64                 return ret;
65         }
66
67         /**
68          * The satoshi value of the output
69          */
70         public void set_sats(long val) {
71                 bindings.TxAddOutput_set_sats(this.ptr, val);
72                 GC.KeepAlive(this);
73                 GC.KeepAlive(val);
74         }
75
76         /**
77          * The scriptPubKey for the output
78          */
79         public byte[] get_script() {
80                 long ret = bindings.TxAddOutput_get_script(this.ptr);
81                 GC.KeepAlive(this);
82                 if (ret >= 0 && ret <= 4096) { return null; }
83                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
84                 return ret_conv;
85         }
86
87         /**
88          * The scriptPubKey for the output
89          */
90         public void set_script(byte[] val) {
91                 bindings.TxAddOutput_set_script(this.ptr, InternalUtils.encodeUint8Array(val));
92                 GC.KeepAlive(this);
93                 GC.KeepAlive(val);
94         }
95
96         /**
97          * Constructs a new TxAddOutput given each field
98          */
99         public static TxAddOutput of(byte[] channel_id_arg, long serial_id_arg, long sats_arg, byte[] script_arg) {
100                 long ret = bindings.TxAddOutput_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id_arg, 32)), serial_id_arg, sats_arg, InternalUtils.encodeUint8Array(script_arg));
101                 GC.KeepAlive(channel_id_arg);
102                 GC.KeepAlive(serial_id_arg);
103                 GC.KeepAlive(sats_arg);
104                 GC.KeepAlive(script_arg);
105                 if (ret >= 0 && ret <= 4096) { return null; }
106                 org.ldk.structs.TxAddOutput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAddOutput(null, ret); }
107                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
108                 return ret_hu_conv;
109         }
110
111         internal long clone_ptr() {
112                 long ret = bindings.TxAddOutput_clone_ptr(this.ptr);
113                 GC.KeepAlive(this);
114                 return ret;
115         }
116
117         /**
118          * Creates a copy of the TxAddOutput
119          */
120         public TxAddOutput clone() {
121                 long ret = bindings.TxAddOutput_clone(this.ptr);
122                 GC.KeepAlive(this);
123                 if (ret >= 0 && ret <= 4096) { return null; }
124                 org.ldk.structs.TxAddOutput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAddOutput(null, ret); }
125                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
126                 return ret_hu_conv;
127         }
128
129         /**
130          * Generates a non-cryptographic 64-bit hash of the TxAddOutput.
131          */
132         public long hash() {
133                 long ret = bindings.TxAddOutput_hash(this.ptr);
134                 GC.KeepAlive(this);
135                 return ret;
136         }
137
138         public override int GetHashCode() {
139                 return (int)this.hash();
140         }
141         /**
142          * Checks if two TxAddOutputs contain equal inner contents.
143          * This ignores pointers and is_owned flags and looks at the values in fields.
144          * Two objects with NULL inner values will be considered "equal" here.
145          */
146         public bool eq(org.ldk.structs.TxAddOutput b) {
147                 bool ret = bindings.TxAddOutput_eq(this.ptr, b == null ? 0 : b.ptr);
148                 GC.KeepAlive(this);
149                 GC.KeepAlive(b);
150                 if (this != null) { this.ptrs_to.AddLast(b); };
151                 return ret;
152         }
153
154         public override bool Equals(object o) {
155                 if (!(o is TxAddOutput)) return false;
156                 return this.eq((TxAddOutput)o);
157         }
158         /**
159          * Serialize the TxAddOutput object into a byte array which can be read by TxAddOutput_read
160          */
161         public byte[] write() {
162                 long ret = bindings.TxAddOutput_write(this.ptr);
163                 GC.KeepAlive(this);
164                 if (ret >= 0 && ret <= 4096) { return null; }
165                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
166                 return ret_conv;
167         }
168
169         /**
170          * Read a TxAddOutput from a byte array, created by TxAddOutput_write
171          */
172         public static Result_TxAddOutputDecodeErrorZ read(byte[] ser) {
173                 long ret = bindings.TxAddOutput_read(InternalUtils.encodeUint8Array(ser));
174                 GC.KeepAlive(ser);
175                 if (ret >= 0 && ret <= 4096) { return null; }
176                 Result_TxAddOutputDecodeErrorZ ret_hu_conv = Result_TxAddOutputDecodeErrorZ.constr_from_ptr(ret);
177                 return ret_hu_conv;
178         }
179
180 }
181 } } }