[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / UserConfig.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  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
11  * 
12  * Default::default() provides sane defaults for most configurations
13  * (but currently with 0 relay fees!)
14  */
15 public class UserConfig : CommonBase {
16         internal UserConfig(object _dummy, long ptr) : base(ptr) { }
17         ~UserConfig() {
18                 if (ptr != 0) { bindings.UserConfig_free(ptr); }
19         }
20
21         /**
22          * Channel handshake config that we propose to our counterparty.
23          */
24         public ChannelHandshakeConfig get_channel_handshake_config() {
25                 long ret = bindings.UserConfig_get_channel_handshake_config(this.ptr);
26                 GC.KeepAlive(this);
27                 if (ret >= 0 && ret <= 4096) { return null; }
28                 org.ldk.structs.ChannelHandshakeConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelHandshakeConfig(null, ret); }
29                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
30                 return ret_hu_conv;
31         }
32
33         /**
34          * Channel handshake config that we propose to our counterparty.
35          */
36         public void set_channel_handshake_config(org.ldk.structs.ChannelHandshakeConfig val) {
37                 bindings.UserConfig_set_channel_handshake_config(this.ptr, val == null ? 0 : val.ptr);
38                 GC.KeepAlive(this);
39                 GC.KeepAlive(val);
40                 if (this != null) { this.ptrs_to.AddLast(val); };
41         }
42
43         /**
44          * Limits applied to our counterparty's proposed channel handshake config settings.
45          */
46         public ChannelHandshakeLimits get_channel_handshake_limits() {
47                 long ret = bindings.UserConfig_get_channel_handshake_limits(this.ptr);
48                 GC.KeepAlive(this);
49                 if (ret >= 0 && ret <= 4096) { return null; }
50                 org.ldk.structs.ChannelHandshakeLimits ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelHandshakeLimits(null, ret); }
51                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
52                 return ret_hu_conv;
53         }
54
55         /**
56          * Limits applied to our counterparty's proposed channel handshake config settings.
57          */
58         public void set_channel_handshake_limits(org.ldk.structs.ChannelHandshakeLimits val) {
59                 bindings.UserConfig_set_channel_handshake_limits(this.ptr, val == null ? 0 : val.ptr);
60                 GC.KeepAlive(this);
61                 GC.KeepAlive(val);
62                 if (this != null) { this.ptrs_to.AddLast(val); };
63         }
64
65         /**
66          * Channel config which affects behavior during channel lifetime.
67          */
68         public ChannelConfig get_channel_config() {
69                 long ret = bindings.UserConfig_get_channel_config(this.ptr);
70                 GC.KeepAlive(this);
71                 if (ret >= 0 && ret <= 4096) { return null; }
72                 org.ldk.structs.ChannelConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelConfig(null, ret); }
73                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
74                 return ret_hu_conv;
75         }
76
77         /**
78          * Channel config which affects behavior during channel lifetime.
79          */
80         public void set_channel_config(org.ldk.structs.ChannelConfig val) {
81                 bindings.UserConfig_set_channel_config(this.ptr, val == null ? 0 : val.ptr);
82                 GC.KeepAlive(this);
83                 GC.KeepAlive(val);
84                 if (this != null) { this.ptrs_to.AddLast(val); };
85         }
86
87         /**
88          * If this is set to false, we will reject any HTLCs which were to be forwarded over private
89          * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
90          * node which is not online reliably.
91          * 
92          * For nodes which are not online reliably, you should set all channels to *not* be announced
93          * (using [`ChannelHandshakeConfig::announced_channel`] and
94          * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
95          * ensure you are not exposed to any forwarding risk.
96          * 
97          * Note that because you cannot change a channel's announced state after creation, there is no
98          * way to disable forwarding on public channels retroactively. Thus, in order to change a node
99          * from a publicly-announced forwarding node to a private non-forwarding node you must close
100          * all your channels and open new ones. For privacy, you should also change your node_id
101          * (swapping all private and public key material for new ones) at that time.
102          * 
103          * Default value: false.
104          */
105         public bool get_accept_forwards_to_priv_channels() {
106                 bool ret = bindings.UserConfig_get_accept_forwards_to_priv_channels(this.ptr);
107                 GC.KeepAlive(this);
108                 return ret;
109         }
110
111         /**
112          * If this is set to false, we will reject any HTLCs which were to be forwarded over private
113          * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
114          * node which is not online reliably.
115          * 
116          * For nodes which are not online reliably, you should set all channels to *not* be announced
117          * (using [`ChannelHandshakeConfig::announced_channel`] and
118          * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
119          * ensure you are not exposed to any forwarding risk.
120          * 
121          * Note that because you cannot change a channel's announced state after creation, there is no
122          * way to disable forwarding on public channels retroactively. Thus, in order to change a node
123          * from a publicly-announced forwarding node to a private non-forwarding node you must close
124          * all your channels and open new ones. For privacy, you should also change your node_id
125          * (swapping all private and public key material for new ones) at that time.
126          * 
127          * Default value: false.
128          */
129         public void set_accept_forwards_to_priv_channels(bool val) {
130                 bindings.UserConfig_set_accept_forwards_to_priv_channels(this.ptr, val);
131                 GC.KeepAlive(this);
132                 GC.KeepAlive(val);
133         }
134
135         /**
136          * If this is set to false, we do not accept inbound requests to open a new channel.
137          * Default value: true.
138          */
139         public bool get_accept_inbound_channels() {
140                 bool ret = bindings.UserConfig_get_accept_inbound_channels(this.ptr);
141                 GC.KeepAlive(this);
142                 return ret;
143         }
144
145         /**
146          * If this is set to false, we do not accept inbound requests to open a new channel.
147          * Default value: true.
148          */
149         public void set_accept_inbound_channels(bool val) {
150                 bindings.UserConfig_set_accept_inbound_channels(this.ptr, val);
151                 GC.KeepAlive(this);
152                 GC.KeepAlive(val);
153         }
154
155         /**
156          * If this is set to true, the user needs to manually accept inbound requests to open a new
157          * channel.
158          * 
159          * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
160          * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
161          * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
162          * user explicitly chooses to accept the request.
163          * 
164          * Default value: false.
165          * 
166          * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest
167          * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
168          * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
169          */
170         public bool get_manually_accept_inbound_channels() {
171                 bool ret = bindings.UserConfig_get_manually_accept_inbound_channels(this.ptr);
172                 GC.KeepAlive(this);
173                 return ret;
174         }
175
176         /**
177          * If this is set to true, the user needs to manually accept inbound requests to open a new
178          * channel.
179          * 
180          * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
181          * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
182          * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
183          * user explicitly chooses to accept the request.
184          * 
185          * Default value: false.
186          * 
187          * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest
188          * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
189          * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
190          */
191         public void set_manually_accept_inbound_channels(bool val) {
192                 bindings.UserConfig_set_manually_accept_inbound_channels(this.ptr, val);
193                 GC.KeepAlive(this);
194                 GC.KeepAlive(val);
195         }
196
197         /**
198          * If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over
199          * fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC
200          * intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user.
201          * 
202          * Setting this to true may break backwards compatibility with LDK versions < 0.0.113.
203          * 
204          * Default value: false.
205          * 
206          * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
207          * [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
208          */
209         public bool get_accept_intercept_htlcs() {
210                 bool ret = bindings.UserConfig_get_accept_intercept_htlcs(this.ptr);
211                 GC.KeepAlive(this);
212                 return ret;
213         }
214
215         /**
216          * If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over
217          * fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC
218          * intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user.
219          * 
220          * Setting this to true may break backwards compatibility with LDK versions < 0.0.113.
221          * 
222          * Default value: false.
223          * 
224          * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
225          * [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
226          */
227         public void set_accept_intercept_htlcs(bool val) {
228                 bindings.UserConfig_set_accept_intercept_htlcs(this.ptr, val);
229                 GC.KeepAlive(this);
230                 GC.KeepAlive(val);
231         }
232
233         /**
234          * If this is set to false, when receiving a keysend payment we'll fail it if it has multiple
235          * parts. If this is set to true, we'll accept the payment.
236          * 
237          * Setting this to true will break backwards compatibility upon downgrading to an LDK
238          * version < 0.0.116 while receiving an MPP keysend. If we have already received an MPP
239          * keysend, downgrading will cause us to fail to deserialize [`ChannelManager`].
240          * 
241          * Default value: false.
242          * 
243          * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
244          */
245         public bool get_accept_mpp_keysend() {
246                 bool ret = bindings.UserConfig_get_accept_mpp_keysend(this.ptr);
247                 GC.KeepAlive(this);
248                 return ret;
249         }
250
251         /**
252          * If this is set to false, when receiving a keysend payment we'll fail it if it has multiple
253          * parts. If this is set to true, we'll accept the payment.
254          * 
255          * Setting this to true will break backwards compatibility upon downgrading to an LDK
256          * version < 0.0.116 while receiving an MPP keysend. If we have already received an MPP
257          * keysend, downgrading will cause us to fail to deserialize [`ChannelManager`].
258          * 
259          * Default value: false.
260          * 
261          * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
262          */
263         public void set_accept_mpp_keysend(bool val) {
264                 bindings.UserConfig_set_accept_mpp_keysend(this.ptr, val);
265                 GC.KeepAlive(this);
266                 GC.KeepAlive(val);
267         }
268
269         /**
270          * Constructs a new UserConfig given each field
271          */
272         public static UserConfig of(org.ldk.structs.ChannelHandshakeConfig channel_handshake_config_arg, org.ldk.structs.ChannelHandshakeLimits channel_handshake_limits_arg, org.ldk.structs.ChannelConfig channel_config_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg, bool manually_accept_inbound_channels_arg, bool accept_intercept_htlcs_arg, bool accept_mpp_keysend_arg) {
273                 long ret = bindings.UserConfig_new(channel_handshake_config_arg == null ? 0 : channel_handshake_config_arg.ptr, channel_handshake_limits_arg == null ? 0 : channel_handshake_limits_arg.ptr, channel_config_arg == null ? 0 : channel_config_arg.ptr, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg, manually_accept_inbound_channels_arg, accept_intercept_htlcs_arg, accept_mpp_keysend_arg);
274                 GC.KeepAlive(channel_handshake_config_arg);
275                 GC.KeepAlive(channel_handshake_limits_arg);
276                 GC.KeepAlive(channel_config_arg);
277                 GC.KeepAlive(accept_forwards_to_priv_channels_arg);
278                 GC.KeepAlive(accept_inbound_channels_arg);
279                 GC.KeepAlive(manually_accept_inbound_channels_arg);
280                 GC.KeepAlive(accept_intercept_htlcs_arg);
281                 GC.KeepAlive(accept_mpp_keysend_arg);
282                 if (ret >= 0 && ret <= 4096) { return null; }
283                 org.ldk.structs.UserConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UserConfig(null, ret); }
284                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
285                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_handshake_config_arg); };
286                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_handshake_limits_arg); };
287                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_config_arg); };
288                 return ret_hu_conv;
289         }
290
291         internal long clone_ptr() {
292                 long ret = bindings.UserConfig_clone_ptr(this.ptr);
293                 GC.KeepAlive(this);
294                 return ret;
295         }
296
297         /**
298          * Creates a copy of the UserConfig
299          */
300         public UserConfig clone() {
301                 long ret = bindings.UserConfig_clone(this.ptr);
302                 GC.KeepAlive(this);
303                 if (ret >= 0 && ret <= 4096) { return null; }
304                 org.ldk.structs.UserConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UserConfig(null, ret); }
305                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
306                 return ret_hu_conv;
307         }
308
309         /**
310          * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
311          */
312         public static UserConfig with_default() {
313                 long ret = bindings.UserConfig_default();
314                 if (ret >= 0 && ret <= 4096) { return null; }
315                 org.ldk.structs.UserConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UserConfig(null, ret); }
316                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
317                 return ret_hu_conv;
318         }
319
320 }
321 } } }