Update java bindings with new generator and new upstream code
[ldk-java] / src / main / java / org / ldk / structs / ChannelConfig.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7
8
9 /**
10  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
11  * with our counterparty.
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class ChannelConfig extends CommonBase {
15         ChannelConfig(Object _dummy, long ptr) { super(ptr); }
16         @Override @SuppressWarnings("deprecation")
17         protected void finalize() throws Throwable {
18                 super.finalize();
19                 if (ptr != 0) { bindings.ChannelConfig_free(ptr); }
20         }
21
22         /**
23          * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
24          * This may be allowed to change at runtime in a later update, however doing so must result in
25          * update messages sent to notify all nodes of our updated relay fee.
26          * 
27          * Default value: 0.
28          */
29         public int get_fee_proportional_millionths() {
30                 int ret = bindings.ChannelConfig_get_fee_proportional_millionths(this.ptr);
31                 return ret;
32         }
33
34         /**
35          * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
36          * This may be allowed to change at runtime in a later update, however doing so must result in
37          * update messages sent to notify all nodes of our updated relay fee.
38          * 
39          * Default value: 0.
40          */
41         public void set_fee_proportional_millionths(int val) {
42                 bindings.ChannelConfig_set_fee_proportional_millionths(this.ptr, val);
43         }
44
45         /**
46          * Set to announce the channel publicly and notify all nodes that they can route via this
47          * channel.
48          * 
49          * This should only be set to true for nodes which expect to be online reliably.
50          * 
51          * As the node which funds a channel picks this value this will only apply for new outbound
52          * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
53          * 
54          * This cannot be changed after the initial channel handshake.
55          * 
56          * Default value: false.
57          */
58         public boolean get_announced_channel() {
59                 boolean ret = bindings.ChannelConfig_get_announced_channel(this.ptr);
60                 return ret;
61         }
62
63         /**
64          * Set to announce the channel publicly and notify all nodes that they can route via this
65          * channel.
66          * 
67          * This should only be set to true for nodes which expect to be online reliably.
68          * 
69          * As the node which funds a channel picks this value this will only apply for new outbound
70          * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
71          * 
72          * This cannot be changed after the initial channel handshake.
73          * 
74          * Default value: false.
75          */
76         public void set_announced_channel(boolean val) {
77                 bindings.ChannelConfig_set_announced_channel(this.ptr, val);
78         }
79
80         /**
81          * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
82          * supports it, they will then enforce the mutual-close output to us matches what we provided
83          * at intialization, preventing us from closing to an alternate pubkey.
84          * 
85          * This is set to true by default to provide a slight increase in security, though ultimately
86          * any attacker who is able to take control of a channel can just as easily send the funds via
87          * lightning payments, so we never require that our counterparties support this option.
88          * 
89          * This cannot be changed after a channel has been initialized.
90          * 
91          * Default value: true.
92          */
93         public boolean get_commit_upfront_shutdown_pubkey() {
94                 boolean ret = bindings.ChannelConfig_get_commit_upfront_shutdown_pubkey(this.ptr);
95                 return ret;
96         }
97
98         /**
99          * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
100          * supports it, they will then enforce the mutual-close output to us matches what we provided
101          * at intialization, preventing us from closing to an alternate pubkey.
102          * 
103          * This is set to true by default to provide a slight increase in security, though ultimately
104          * any attacker who is able to take control of a channel can just as easily send the funds via
105          * lightning payments, so we never require that our counterparties support this option.
106          * 
107          * This cannot be changed after a channel has been initialized.
108          * 
109          * Default value: true.
110          */
111         public void set_commit_upfront_shutdown_pubkey(boolean val) {
112                 bindings.ChannelConfig_set_commit_upfront_shutdown_pubkey(this.ptr, val);
113         }
114
115         /**
116          * Constructs a new ChannelConfig given each field
117          */
118         public static ChannelConfig constructor_new(int fee_proportional_millionths_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg) {
119                 long ret = bindings.ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
120                 ChannelConfig ret_hu_conv = new ChannelConfig(null, ret);
121                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
122                 return ret_hu_conv;
123         }
124
125         /**
126          * Creates a copy of the ChannelConfig
127          */
128         public ChannelConfig clone() {
129                 long ret = bindings.ChannelConfig_clone(this.ptr);
130                 ChannelConfig ret_hu_conv = new ChannelConfig(null, ret);
131                 ret_hu_conv.ptrs_to.add(this);
132                 return ret_hu_conv;
133         }
134
135         /**
136          * Creates a "default" ChannelConfig. See other documentaiton for details on what this implies.
137          */
138         public static ChannelConfig constructor_default() {
139                 long ret = bindings.ChannelConfig_default();
140                 ChannelConfig ret_hu_conv = new ChannelConfig(null, ret);
141                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
142                 return ret_hu_conv;
143         }
144
145         /**
146          * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
147          */
148         public byte[] write() {
149                 byte[] ret = bindings.ChannelConfig_write(this.ptr);
150                 return ret;
151         }
152
153         /**
154          * Read a ChannelConfig from a byte array, created by ChannelConfig_write
155          */
156         public static Result_ChannelConfigDecodeErrorZ constructor_read(byte[] ser) {
157                 long ret = bindings.ChannelConfig_read(ser);
158                 Result_ChannelConfigDecodeErrorZ ret_hu_conv = Result_ChannelConfigDecodeErrorZ.constr_from_ptr(ret);
159                 return ret_hu_conv;
160         }
161
162 }