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