[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / Splice.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 splice message to be sent by or received from the stfu initiator (splice initiator).
11  */
12 public class Splice : CommonBase {
13         internal Splice(object _dummy, long ptr) : base(ptr) { }
14         ~Splice() {
15                 if (ptr != 0) { bindings.Splice_free(ptr); }
16         }
17
18         /**
19          * The channel ID where splicing is intended
20          */
21         public byte[] get_channel_id() {
22                 long ret = bindings.Splice_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 where splicing is intended
31          */
32         public void set_channel_id(byte[] val) {
33                 bindings.Splice_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          * The genesis hash of the blockchain where the channel is intended to be spliced
40          */
41         public byte[] get_chain_hash() {
42                 long ret = bindings.Splice_get_chain_hash(this.ptr);
43                 GC.KeepAlive(this);
44                 if (ret >= 0 && ret <= 4096) { return null; }
45                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
46                 return ret_conv;
47         }
48
49         /**
50          * The genesis hash of the blockchain where the channel is intended to be spliced
51          */
52         public void set_chain_hash(byte[] val) {
53                 bindings.Splice_set_chain_hash(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
54                 GC.KeepAlive(this);
55                 GC.KeepAlive(val);
56         }
57
58         /**
59          * The intended change in channel capacity: the amount to be added (positive value)
60          * or removed (negative value) by the sender (splice initiator) by splicing into/from the channel.
61          */
62         public long get_relative_satoshis() {
63                 long ret = bindings.Splice_get_relative_satoshis(this.ptr);
64                 GC.KeepAlive(this);
65                 return ret;
66         }
67
68         /**
69          * The intended change in channel capacity: the amount to be added (positive value)
70          * or removed (negative value) by the sender (splice initiator) by splicing into/from the channel.
71          */
72         public void set_relative_satoshis(long val) {
73                 bindings.Splice_set_relative_satoshis(this.ptr, val);
74                 GC.KeepAlive(this);
75                 GC.KeepAlive(val);
76         }
77
78         /**
79          * The feerate for the new funding transaction, set by the splice initiator
80          */
81         public int get_funding_feerate_perkw() {
82                 int ret = bindings.Splice_get_funding_feerate_perkw(this.ptr);
83                 GC.KeepAlive(this);
84                 return ret;
85         }
86
87         /**
88          * The feerate for the new funding transaction, set by the splice initiator
89          */
90         public void set_funding_feerate_perkw(int val) {
91                 bindings.Splice_set_funding_feerate_perkw(this.ptr, val);
92                 GC.KeepAlive(this);
93                 GC.KeepAlive(val);
94         }
95
96         /**
97          * The locktime for the new funding transaction
98          */
99         public int get_locktime() {
100                 int ret = bindings.Splice_get_locktime(this.ptr);
101                 GC.KeepAlive(this);
102                 return ret;
103         }
104
105         /**
106          * The locktime for the new funding transaction
107          */
108         public void set_locktime(int val) {
109                 bindings.Splice_set_locktime(this.ptr, val);
110                 GC.KeepAlive(this);
111                 GC.KeepAlive(val);
112         }
113
114         /**
115          * The key of the sender (splice initiator) controlling the new funding transaction
116          */
117         public byte[] get_funding_pubkey() {
118                 long ret = bindings.Splice_get_funding_pubkey(this.ptr);
119                 GC.KeepAlive(this);
120                 if (ret >= 0 && ret <= 4096) { return null; }
121                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
122                 return ret_conv;
123         }
124
125         /**
126          * The key of the sender (splice initiator) controlling the new funding transaction
127          */
128         public void set_funding_pubkey(byte[] val) {
129                 bindings.Splice_set_funding_pubkey(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
130                 GC.KeepAlive(this);
131                 GC.KeepAlive(val);
132         }
133
134         /**
135          * Constructs a new Splice given each field
136          */
137         public static Splice of(byte[] channel_id_arg, byte[] chain_hash_arg, long relative_satoshis_arg, int funding_feerate_perkw_arg, int locktime_arg, byte[] funding_pubkey_arg) {
138                 long ret = bindings.Splice_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id_arg, 32)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(chain_hash_arg, 32)), relative_satoshis_arg, funding_feerate_perkw_arg, locktime_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(funding_pubkey_arg, 33)));
139                 GC.KeepAlive(channel_id_arg);
140                 GC.KeepAlive(chain_hash_arg);
141                 GC.KeepAlive(relative_satoshis_arg);
142                 GC.KeepAlive(funding_feerate_perkw_arg);
143                 GC.KeepAlive(locktime_arg);
144                 GC.KeepAlive(funding_pubkey_arg);
145                 if (ret >= 0 && ret <= 4096) { return null; }
146                 org.ldk.structs.Splice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Splice(null, ret); }
147                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
148                 return ret_hu_conv;
149         }
150
151         internal long clone_ptr() {
152                 long ret = bindings.Splice_clone_ptr(this.ptr);
153                 GC.KeepAlive(this);
154                 return ret;
155         }
156
157         /**
158          * Creates a copy of the Splice
159          */
160         public Splice clone() {
161                 long ret = bindings.Splice_clone(this.ptr);
162                 GC.KeepAlive(this);
163                 if (ret >= 0 && ret <= 4096) { return null; }
164                 org.ldk.structs.Splice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Splice(null, ret); }
165                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
166                 return ret_hu_conv;
167         }
168
169         /**
170          * Checks if two Splices contain equal inner contents.
171          * This ignores pointers and is_owned flags and looks at the values in fields.
172          * Two objects with NULL inner values will be considered "equal" here.
173          */
174         public bool eq(org.ldk.structs.Splice b) {
175                 bool ret = bindings.Splice_eq(this.ptr, b == null ? 0 : b.ptr);
176                 GC.KeepAlive(this);
177                 GC.KeepAlive(b);
178                 if (this != null) { this.ptrs_to.AddLast(b); };
179                 return ret;
180         }
181
182         public override bool Equals(object o) {
183                 if (!(o is Splice)) return false;
184                 return this.eq((Splice)o);
185         }
186         /**
187          * Serialize the Splice object into a byte array which can be read by Splice_read
188          */
189         public byte[] write() {
190                 long ret = bindings.Splice_write(this.ptr);
191                 GC.KeepAlive(this);
192                 if (ret >= 0 && ret <= 4096) { return null; }
193                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
194                 return ret_conv;
195         }
196
197         /**
198          * Read a Splice from a byte array, created by Splice_write
199          */
200         public static Result_SpliceDecodeErrorZ read(byte[] ser) {
201                 long ret = bindings.Splice_read(InternalUtils.encodeUint8Array(ser));
202                 GC.KeepAlive(ser);
203                 if (ret >= 0 && ret <= 4096) { return null; }
204                 Result_SpliceDecodeErrorZ ret_hu_conv = Result_SpliceDecodeErrorZ.constr_from_ptr(ret);
205                 return ret_hu_conv;
206         }
207
208 }
209 } } }