[C#] Update auto-generated C# bindings
[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                 long ret = bindings.ChannelReady_get_channel_id(this.ptr);
25                 GC.KeepAlive(this);
26                 if (ret >= 0 && ret <= 4096) { return null; }
27                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
28                 return ret_conv;
29         }
30
31         /**
32          * The channel ID
33          */
34         public void set_channel_id(byte[] val) {
35                 bindings.ChannelReady_set_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
36                 GC.KeepAlive(this);
37                 GC.KeepAlive(val);
38         }
39
40         /**
41          * The per-commitment point of the second commitment transaction
42          */
43         public byte[] get_next_per_commitment_point() {
44                 long ret = bindings.ChannelReady_get_next_per_commitment_point(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 per-commitment point of the second commitment transaction
53          */
54         public void set_next_per_commitment_point(byte[] val) {
55                 bindings.ChannelReady_set_next_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
56                 GC.KeepAlive(this);
57                 GC.KeepAlive(val);
58         }
59
60         /**
61          * If set, provides a `short_channel_id` alias for this channel.
62          * 
63          * The sender will accept payments to be forwarded over this SCID and forward them to this
64          * messages' recipient.
65          */
66         public Option_u64Z get_short_channel_id_alias() {
67                 long ret = bindings.ChannelReady_get_short_channel_id_alias(this.ptr);
68                 GC.KeepAlive(this);
69                 if (ret >= 0 && ret <= 4096) { return null; }
70                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
71                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
72                 return ret_hu_conv;
73         }
74
75         /**
76          * If set, provides a `short_channel_id` alias for this channel.
77          * 
78          * The sender will accept payments to be forwarded over this SCID and forward them to this
79          * messages' recipient.
80          */
81         public void set_short_channel_id_alias(org.ldk.structs.Option_u64Z val) {
82                 bindings.ChannelReady_set_short_channel_id_alias(this.ptr, val.ptr);
83                 GC.KeepAlive(this);
84                 GC.KeepAlive(val);
85                 if (this != null) { this.ptrs_to.AddLast(val); };
86         }
87
88         /**
89          * Constructs a new ChannelReady given each field
90          */
91         public static ChannelReady of(byte[] channel_id_arg, byte[] next_per_commitment_point_arg, org.ldk.structs.Option_u64Z short_channel_id_alias_arg) {
92                 long ret = bindings.ChannelReady_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id_arg, 32)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(next_per_commitment_point_arg, 33)), short_channel_id_alias_arg.ptr);
93                 GC.KeepAlive(channel_id_arg);
94                 GC.KeepAlive(next_per_commitment_point_arg);
95                 GC.KeepAlive(short_channel_id_alias_arg);
96                 if (ret >= 0 && ret <= 4096) { return null; }
97                 org.ldk.structs.ChannelReady ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReady(null, ret); }
98                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
99                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(short_channel_id_alias_arg); };
100                 return ret_hu_conv;
101         }
102
103         internal long clone_ptr() {
104                 long ret = bindings.ChannelReady_clone_ptr(this.ptr);
105                 GC.KeepAlive(this);
106                 return ret;
107         }
108
109         /**
110          * Creates a copy of the ChannelReady
111          */
112         public ChannelReady clone() {
113                 long ret = bindings.ChannelReady_clone(this.ptr);
114                 GC.KeepAlive(this);
115                 if (ret >= 0 && ret <= 4096) { return null; }
116                 org.ldk.structs.ChannelReady ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReady(null, ret); }
117                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
118                 return ret_hu_conv;
119         }
120
121         /**
122          * Generates a non-cryptographic 64-bit hash of the ChannelReady.
123          */
124         public long hash() {
125                 long ret = bindings.ChannelReady_hash(this.ptr);
126                 GC.KeepAlive(this);
127                 return ret;
128         }
129
130         public override int GetHashCode() {
131                 return (int)this.hash();
132         }
133         /**
134          * Checks if two ChannelReadys contain equal inner contents.
135          * This ignores pointers and is_owned flags and looks at the values in fields.
136          * Two objects with NULL inner values will be considered "equal" here.
137          */
138         public bool eq(org.ldk.structs.ChannelReady b) {
139                 bool ret = bindings.ChannelReady_eq(this.ptr, b == null ? 0 : b.ptr);
140                 GC.KeepAlive(this);
141                 GC.KeepAlive(b);
142                 if (this != null) { this.ptrs_to.AddLast(b); };
143                 return ret;
144         }
145
146         public override bool Equals(object o) {
147                 if (!(o is ChannelReady)) return false;
148                 return this.eq((ChannelReady)o);
149         }
150         /**
151          * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read
152          */
153         public byte[] write() {
154                 long ret = bindings.ChannelReady_write(this.ptr);
155                 GC.KeepAlive(this);
156                 if (ret >= 0 && ret <= 4096) { return null; }
157                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
158                 return ret_conv;
159         }
160
161         /**
162          * Read a ChannelReady from a byte array, created by ChannelReady_write
163          */
164         public static Result_ChannelReadyDecodeErrorZ read(byte[] ser) {
165                 long ret = bindings.ChannelReady_read(InternalUtils.encodeUint8Array(ser));
166                 GC.KeepAlive(ser);
167                 if (ret >= 0 && ret <= 4096) { return null; }
168                 Result_ChannelReadyDecodeErrorZ ret_hu_conv = Result_ChannelReadyDecodeErrorZ.constr_from_ptr(ret);
169                 return ret_hu_conv;
170         }
171
172 }
173 } } }