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