[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / ChannelReady.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 [`channel_ready`] message to be sent to or received from a peer.
11  * 
12  * [`channel_ready`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-channel_ready-message
13  */
14 public class ChannelReady : CommonBase {
15         internal ChannelReady(object _dummy, long ptr) : base(ptr) { }
16         ~ChannelReady() {
17                 if (ptr != 0) { bindings.ChannelReady_free(ptr); }
18         }
19
20         /**
21          * The channel ID
22          */
23         public byte[] get_channel_id() {
24                 byte[] ret = bindings.ChannelReady_get_channel_id(this.ptr);
25                 GC.KeepAlive(this);
26                 return ret;
27         }
28
29         /**
30          * The channel ID
31          */
32         public void set_channel_id(byte[] val) {
33                 bindings.ChannelReady_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
34                 GC.KeepAlive(this);
35                 GC.KeepAlive(val);
36         }
37
38         /**
39          * The per-commitment point of the second commitment transaction
40          */
41         public byte[] get_next_per_commitment_point() {
42                 byte[] ret = bindings.ChannelReady_get_next_per_commitment_point(this.ptr);
43                 GC.KeepAlive(this);
44                 return ret;
45         }
46
47         /**
48          * The per-commitment point of the second commitment transaction
49          */
50         public void set_next_per_commitment_point(byte[] val) {
51                 bindings.ChannelReady_set_next_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
52                 GC.KeepAlive(this);
53                 GC.KeepAlive(val);
54         }
55
56         /**
57          * If set, provides a `short_channel_id` alias for this channel.
58          * 
59          * The sender will accept payments to be forwarded over this SCID and forward them to this
60          * messages' recipient.
61          */
62         public Option_u64Z get_short_channel_id_alias() {
63                 long ret = bindings.ChannelReady_get_short_channel_id_alias(this.ptr);
64                 GC.KeepAlive(this);
65                 if (ret >= 0 && ret <= 4096) { return null; }
66                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
67                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
68                 return ret_hu_conv;
69         }
70
71         /**
72          * If set, provides a `short_channel_id` alias for this channel.
73          * 
74          * The sender will accept payments to be forwarded over this SCID and forward them to this
75          * messages' recipient.
76          */
77         public void set_short_channel_id_alias(org.ldk.structs.Option_u64Z val) {
78                 bindings.ChannelReady_set_short_channel_id_alias(this.ptr, val.ptr);
79                 GC.KeepAlive(this);
80                 GC.KeepAlive(val);
81                 if (this != null) { this.ptrs_to.AddLast(val); };
82         }
83
84         /**
85          * Constructs a new ChannelReady given each field
86          */
87         public static ChannelReady of(byte[] channel_id_arg, byte[] next_per_commitment_point_arg, org.ldk.structs.Option_u64Z short_channel_id_alias_arg) {
88                 long ret = bindings.ChannelReady_new(InternalUtils.check_arr_len(channel_id_arg, 32), InternalUtils.check_arr_len(next_per_commitment_point_arg, 33), short_channel_id_alias_arg.ptr);
89                 GC.KeepAlive(channel_id_arg);
90                 GC.KeepAlive(next_per_commitment_point_arg);
91                 GC.KeepAlive(short_channel_id_alias_arg);
92                 if (ret >= 0 && ret <= 4096) { return null; }
93                 org.ldk.structs.ChannelReady ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReady(null, ret); }
94                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
95                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(short_channel_id_alias_arg); };
96                 return ret_hu_conv;
97         }
98
99         internal long clone_ptr() {
100                 long ret = bindings.ChannelReady_clone_ptr(this.ptr);
101                 GC.KeepAlive(this);
102                 return ret;
103         }
104
105         /**
106          * Creates a copy of the ChannelReady
107          */
108         public ChannelReady clone() {
109                 long ret = bindings.ChannelReady_clone(this.ptr);
110                 GC.KeepAlive(this);
111                 if (ret >= 0 && ret <= 4096) { return null; }
112                 org.ldk.structs.ChannelReady ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReady(null, ret); }
113                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
114                 return ret_hu_conv;
115         }
116
117         /**
118          * Checks if two ChannelReadys contain equal inner contents.
119          * This ignores pointers and is_owned flags and looks at the values in fields.
120          * Two objects with NULL inner values will be considered "equal" here.
121          */
122         public bool eq(org.ldk.structs.ChannelReady b) {
123                 bool ret = bindings.ChannelReady_eq(this.ptr, b == null ? 0 : b.ptr);
124                 GC.KeepAlive(this);
125                 GC.KeepAlive(b);
126                 if (this != null) { this.ptrs_to.AddLast(b); };
127                 return ret;
128         }
129
130         public override bool Equals(object o) {
131                 if (!(o is ChannelReady)) return false;
132                 return this.eq((ChannelReady)o);
133         }
134         /**
135          * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read
136          */
137         public byte[] write() {
138                 byte[] ret = bindings.ChannelReady_write(this.ptr);
139                 GC.KeepAlive(this);
140                 return ret;
141         }
142
143         /**
144          * Read a ChannelReady from a byte array, created by ChannelReady_write
145          */
146         public static Result_ChannelReadyDecodeErrorZ read(byte[] ser) {
147                 long ret = bindings.ChannelReady_read(ser);
148                 GC.KeepAlive(ser);
149                 if (ret >= 0 && ret <= 4096) { return null; }
150                 Result_ChannelReadyDecodeErrorZ ret_hu_conv = Result_ChannelReadyDecodeErrorZ.constr_from_ptr(ret);
151                 return ret_hu_conv;
152         }
153
154 }
155 } } }