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