Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / MessageSendEvent.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 import javax.annotation.Nullable;
8
9
10 /**
11  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
12  * broadcast to most peers).
13  * These events are handled by PeerManager::process_events if you are using a PeerManager.
14  */
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class MessageSendEvent extends CommonBase {
17         private MessageSendEvent(Object _dummy, long ptr) { super(ptr); }
18         @Override @SuppressWarnings("deprecation")
19         protected void finalize() throws Throwable {
20                 super.finalize();
21                 if (ptr != 0) { bindings.MessageSendEvent_free(ptr); }
22         }
23         static MessageSendEvent constr_from_ptr(long ptr) {
24                 bindings.LDKMessageSendEvent raw_val = bindings.LDKMessageSendEvent_ref_from_ptr(ptr);
25                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendAcceptChannel.class) {
26                         return new SendAcceptChannel(ptr, (bindings.LDKMessageSendEvent.SendAcceptChannel)raw_val);
27                 }
28                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendOpenChannel.class) {
29                         return new SendOpenChannel(ptr, (bindings.LDKMessageSendEvent.SendOpenChannel)raw_val);
30                 }
31                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendFundingCreated.class) {
32                         return new SendFundingCreated(ptr, (bindings.LDKMessageSendEvent.SendFundingCreated)raw_val);
33                 }
34                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendFundingSigned.class) {
35                         return new SendFundingSigned(ptr, (bindings.LDKMessageSendEvent.SendFundingSigned)raw_val);
36                 }
37                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendFundingLocked.class) {
38                         return new SendFundingLocked(ptr, (bindings.LDKMessageSendEvent.SendFundingLocked)raw_val);
39                 }
40                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendAnnouncementSignatures.class) {
41                         return new SendAnnouncementSignatures(ptr, (bindings.LDKMessageSendEvent.SendAnnouncementSignatures)raw_val);
42                 }
43                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.UpdateHTLCs.class) {
44                         return new UpdateHTLCs(ptr, (bindings.LDKMessageSendEvent.UpdateHTLCs)raw_val);
45                 }
46                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendRevokeAndACK.class) {
47                         return new SendRevokeAndACK(ptr, (bindings.LDKMessageSendEvent.SendRevokeAndACK)raw_val);
48                 }
49                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendClosingSigned.class) {
50                         return new SendClosingSigned(ptr, (bindings.LDKMessageSendEvent.SendClosingSigned)raw_val);
51                 }
52                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendShutdown.class) {
53                         return new SendShutdown(ptr, (bindings.LDKMessageSendEvent.SendShutdown)raw_val);
54                 }
55                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendChannelReestablish.class) {
56                         return new SendChannelReestablish(ptr, (bindings.LDKMessageSendEvent.SendChannelReestablish)raw_val);
57                 }
58                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement.class) {
59                         return new BroadcastChannelAnnouncement(ptr, (bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement)raw_val);
60                 }
61                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement.class) {
62                         return new BroadcastNodeAnnouncement(ptr, (bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement)raw_val);
63                 }
64                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.BroadcastChannelUpdate.class) {
65                         return new BroadcastChannelUpdate(ptr, (bindings.LDKMessageSendEvent.BroadcastChannelUpdate)raw_val);
66                 }
67                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendChannelUpdate.class) {
68                         return new SendChannelUpdate(ptr, (bindings.LDKMessageSendEvent.SendChannelUpdate)raw_val);
69                 }
70                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.HandleError.class) {
71                         return new HandleError(ptr, (bindings.LDKMessageSendEvent.HandleError)raw_val);
72                 }
73                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendChannelRangeQuery.class) {
74                         return new SendChannelRangeQuery(ptr, (bindings.LDKMessageSendEvent.SendChannelRangeQuery)raw_val);
75                 }
76                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendShortIdsQuery.class) {
77                         return new SendShortIdsQuery(ptr, (bindings.LDKMessageSendEvent.SendShortIdsQuery)raw_val);
78                 }
79                 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendReplyChannelRange.class) {
80                         return new SendReplyChannelRange(ptr, (bindings.LDKMessageSendEvent.SendReplyChannelRange)raw_val);
81                 }
82                 assert false; return null; // Unreachable without extending the (internal) bindings interface
83         }
84
85         /**
86          * Used to indicate that we've accepted a channel open and should send the accept_channel
87          * message provided to the given peer.
88          */
89         public final static class SendAcceptChannel extends MessageSendEvent {
90                 /**
91                  * The node_id of the node which should receive this message
92                 */
93                 public final byte[] node_id;
94                 /**
95                  * The message which should be sent.
96                 */
97                 public final AcceptChannel msg;
98                 private SendAcceptChannel(long ptr, bindings.LDKMessageSendEvent.SendAcceptChannel obj) {
99                         super(null, ptr);
100                         this.node_id = obj.node_id;
101                         long msg = obj.msg;
102                         AcceptChannel msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new AcceptChannel(null, msg); }
103                         msg_hu_conv.ptrs_to.add(this);
104                         this.msg = msg_hu_conv;
105                 }
106         }
107         /**
108          * Used to indicate that we've initiated a channel open and should send the open_channel
109          * message provided to the given peer.
110          */
111         public final static class SendOpenChannel extends MessageSendEvent {
112                 /**
113                  * The node_id of the node which should receive this message
114                 */
115                 public final byte[] node_id;
116                 /**
117                  * The message which should be sent.
118                 */
119                 public final OpenChannel msg;
120                 private SendOpenChannel(long ptr, bindings.LDKMessageSendEvent.SendOpenChannel obj) {
121                         super(null, ptr);
122                         this.node_id = obj.node_id;
123                         long msg = obj.msg;
124                         OpenChannel msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new OpenChannel(null, msg); }
125                         msg_hu_conv.ptrs_to.add(this);
126                         this.msg = msg_hu_conv;
127                 }
128         }
129         /**
130          * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
131          */
132         public final static class SendFundingCreated extends MessageSendEvent {
133                 /**
134                  * The node_id of the node which should receive this message
135                 */
136                 public final byte[] node_id;
137                 /**
138                  * The message which should be sent.
139                 */
140                 public final FundingCreated msg;
141                 private SendFundingCreated(long ptr, bindings.LDKMessageSendEvent.SendFundingCreated obj) {
142                         super(null, ptr);
143                         this.node_id = obj.node_id;
144                         long msg = obj.msg;
145                         FundingCreated msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new FundingCreated(null, msg); }
146                         msg_hu_conv.ptrs_to.add(this);
147                         this.msg = msg_hu_conv;
148                 }
149         }
150         /**
151          * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
152          */
153         public final static class SendFundingSigned extends MessageSendEvent {
154                 /**
155                  * The node_id of the node which should receive this message
156                 */
157                 public final byte[] node_id;
158                 /**
159                  * The message which should be sent.
160                 */
161                 public final FundingSigned msg;
162                 private SendFundingSigned(long ptr, bindings.LDKMessageSendEvent.SendFundingSigned obj) {
163                         super(null, ptr);
164                         this.node_id = obj.node_id;
165                         long msg = obj.msg;
166                         FundingSigned msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new FundingSigned(null, msg); }
167                         msg_hu_conv.ptrs_to.add(this);
168                         this.msg = msg_hu_conv;
169                 }
170         }
171         /**
172          * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
173          */
174         public final static class SendFundingLocked extends MessageSendEvent {
175                 /**
176                  * The node_id of the node which should receive these message(s)
177                 */
178                 public final byte[] node_id;
179                 /**
180                  * The funding_locked message which should be sent.
181                 */
182                 public final FundingLocked msg;
183                 private SendFundingLocked(long ptr, bindings.LDKMessageSendEvent.SendFundingLocked obj) {
184                         super(null, ptr);
185                         this.node_id = obj.node_id;
186                         long msg = obj.msg;
187                         FundingLocked msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new FundingLocked(null, msg); }
188                         msg_hu_conv.ptrs_to.add(this);
189                         this.msg = msg_hu_conv;
190                 }
191         }
192         /**
193          * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
194          */
195         public final static class SendAnnouncementSignatures extends MessageSendEvent {
196                 /**
197                  * The node_id of the node which should receive these message(s)
198                 */
199                 public final byte[] node_id;
200                 /**
201                  * The announcement_signatures message which should be sent.
202                 */
203                 public final AnnouncementSignatures msg;
204                 private SendAnnouncementSignatures(long ptr, bindings.LDKMessageSendEvent.SendAnnouncementSignatures obj) {
205                         super(null, ptr);
206                         this.node_id = obj.node_id;
207                         long msg = obj.msg;
208                         AnnouncementSignatures msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new AnnouncementSignatures(null, msg); }
209                         msg_hu_conv.ptrs_to.add(this);
210                         this.msg = msg_hu_conv;
211                 }
212         }
213         /**
214          * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
215          * message should be sent to the peer with the given node_id.
216          */
217         public final static class UpdateHTLCs extends MessageSendEvent {
218                 /**
219                  * The node_id of the node which should receive these message(s)
220                 */
221                 public final byte[] node_id;
222                 /**
223                  * The update messages which should be sent. ALL messages in the struct should be sent!
224                 */
225                 public final CommitmentUpdate updates;
226                 private UpdateHTLCs(long ptr, bindings.LDKMessageSendEvent.UpdateHTLCs obj) {
227                         super(null, ptr);
228                         this.node_id = obj.node_id;
229                         long updates = obj.updates;
230                         CommitmentUpdate updates_hu_conv = null; if (updates < 0 || updates > 4096) { updates_hu_conv = new CommitmentUpdate(null, updates); }
231                         updates_hu_conv.ptrs_to.add(this);
232                         this.updates = updates_hu_conv;
233                 }
234         }
235         /**
236          * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
237          */
238         public final static class SendRevokeAndACK extends MessageSendEvent {
239                 /**
240                  * The node_id of the node which should receive this message
241                 */
242                 public final byte[] node_id;
243                 /**
244                  * The message which should be sent.
245                 */
246                 public final RevokeAndACK msg;
247                 private SendRevokeAndACK(long ptr, bindings.LDKMessageSendEvent.SendRevokeAndACK obj) {
248                         super(null, ptr);
249                         this.node_id = obj.node_id;
250                         long msg = obj.msg;
251                         RevokeAndACK msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new RevokeAndACK(null, msg); }
252                         msg_hu_conv.ptrs_to.add(this);
253                         this.msg = msg_hu_conv;
254                 }
255         }
256         /**
257          * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
258          */
259         public final static class SendClosingSigned extends MessageSendEvent {
260                 /**
261                  * The node_id of the node which should receive this message
262                 */
263                 public final byte[] node_id;
264                 /**
265                  * The message which should be sent.
266                 */
267                 public final ClosingSigned msg;
268                 private SendClosingSigned(long ptr, bindings.LDKMessageSendEvent.SendClosingSigned obj) {
269                         super(null, ptr);
270                         this.node_id = obj.node_id;
271                         long msg = obj.msg;
272                         ClosingSigned msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ClosingSigned(null, msg); }
273                         msg_hu_conv.ptrs_to.add(this);
274                         this.msg = msg_hu_conv;
275                 }
276         }
277         /**
278          * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
279          */
280         public final static class SendShutdown extends MessageSendEvent {
281                 /**
282                  * The node_id of the node which should receive this message
283                 */
284                 public final byte[] node_id;
285                 /**
286                  * The message which should be sent.
287                 */
288                 public final Shutdown msg;
289                 private SendShutdown(long ptr, bindings.LDKMessageSendEvent.SendShutdown obj) {
290                         super(null, ptr);
291                         this.node_id = obj.node_id;
292                         long msg = obj.msg;
293                         Shutdown msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new Shutdown(null, msg); }
294                         msg_hu_conv.ptrs_to.add(this);
295                         this.msg = msg_hu_conv;
296                 }
297         }
298         /**
299          * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
300          */
301         public final static class SendChannelReestablish extends MessageSendEvent {
302                 /**
303                  * The node_id of the node which should receive this message
304                 */
305                 public final byte[] node_id;
306                 /**
307                  * The message which should be sent.
308                 */
309                 public final ChannelReestablish msg;
310                 private SendChannelReestablish(long ptr, bindings.LDKMessageSendEvent.SendChannelReestablish obj) {
311                         super(null, ptr);
312                         this.node_id = obj.node_id;
313                         long msg = obj.msg;
314                         ChannelReestablish msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelReestablish(null, msg); }
315                         msg_hu_conv.ptrs_to.add(this);
316                         this.msg = msg_hu_conv;
317                 }
318         }
319         /**
320          * Used to indicate that a channel_announcement and channel_update should be broadcast to all
321          * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
322          * 
323          * Note that after doing so, you very likely (unless you did so very recently) want to call
324          * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
325          * This ensures that any nodes which see our channel_announcement also have a relevant
326          * node_announcement, including relevant feature flags which may be important for routing
327          * through or to us.
328          */
329         public final static class BroadcastChannelAnnouncement extends MessageSendEvent {
330                 /**
331                  * The channel_announcement which should be sent.
332                 */
333                 public final ChannelAnnouncement msg;
334                 /**
335                  * The followup channel_update which should be sent.
336                 */
337                 public final ChannelUpdate update_msg;
338                 private BroadcastChannelAnnouncement(long ptr, bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement obj) {
339                         super(null, ptr);
340                         long msg = obj.msg;
341                         ChannelAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelAnnouncement(null, msg); }
342                         msg_hu_conv.ptrs_to.add(this);
343                         this.msg = msg_hu_conv;
344                         long update_msg = obj.update_msg;
345                         ChannelUpdate update_msg_hu_conv = null; if (update_msg < 0 || update_msg > 4096) { update_msg_hu_conv = new ChannelUpdate(null, update_msg); }
346                         update_msg_hu_conv.ptrs_to.add(this);
347                         this.update_msg = update_msg_hu_conv;
348                 }
349         }
350         /**
351          * Used to indicate that a node_announcement should be broadcast to all peers.
352          */
353         public final static class BroadcastNodeAnnouncement extends MessageSendEvent {
354                 /**
355                  * The node_announcement which should be sent.
356                 */
357                 public final NodeAnnouncement msg;
358                 private BroadcastNodeAnnouncement(long ptr, bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement obj) {
359                         super(null, ptr);
360                         long msg = obj.msg;
361                         NodeAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new NodeAnnouncement(null, msg); }
362                         msg_hu_conv.ptrs_to.add(this);
363                         this.msg = msg_hu_conv;
364                 }
365         }
366         /**
367          * Used to indicate that a channel_update should be broadcast to all peers.
368          */
369         public final static class BroadcastChannelUpdate extends MessageSendEvent {
370                 /**
371                  * The channel_update which should be sent.
372                 */
373                 public final ChannelUpdate msg;
374                 private BroadcastChannelUpdate(long ptr, bindings.LDKMessageSendEvent.BroadcastChannelUpdate obj) {
375                         super(null, ptr);
376                         long msg = obj.msg;
377                         ChannelUpdate msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelUpdate(null, msg); }
378                         msg_hu_conv.ptrs_to.add(this);
379                         this.msg = msg_hu_conv;
380                 }
381         }
382         /**
383          * Used to indicate that a channel_update should be sent to a single peer.
384          * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
385          * private channel and we shouldn't be informing all of our peers of channel parameters.
386          */
387         public final static class SendChannelUpdate extends MessageSendEvent {
388                 /**
389                  * The node_id of the node which should receive this message
390                 */
391                 public final byte[] node_id;
392                 /**
393                  * The channel_update which should be sent.
394                 */
395                 public final ChannelUpdate msg;
396                 private SendChannelUpdate(long ptr, bindings.LDKMessageSendEvent.SendChannelUpdate obj) {
397                         super(null, ptr);
398                         this.node_id = obj.node_id;
399                         long msg = obj.msg;
400                         ChannelUpdate msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelUpdate(null, msg); }
401                         msg_hu_conv.ptrs_to.add(this);
402                         this.msg = msg_hu_conv;
403                 }
404         }
405         /**
406          * Broadcast an error downstream to be handled
407          */
408         public final static class HandleError extends MessageSendEvent {
409                 /**
410                  * The node_id of the node which should receive this message
411                 */
412                 public final byte[] node_id;
413                 /**
414                  * The action which should be taken.
415                 */
416                 public final ErrorAction action;
417                 private HandleError(long ptr, bindings.LDKMessageSendEvent.HandleError obj) {
418                         super(null, ptr);
419                         this.node_id = obj.node_id;
420                         long action = obj.action;
421                         ErrorAction action_hu_conv = ErrorAction.constr_from_ptr(action);
422                         action_hu_conv.ptrs_to.add(this);
423                         this.action = action_hu_conv;
424                 }
425         }
426         /**
427          * Query a peer for channels with funding transaction UTXOs in a block range.
428          */
429         public final static class SendChannelRangeQuery extends MessageSendEvent {
430                 /**
431                  * The node_id of this message recipient
432                 */
433                 public final byte[] node_id;
434                 /**
435                  * The query_channel_range which should be sent.
436                 */
437                 public final QueryChannelRange msg;
438                 private SendChannelRangeQuery(long ptr, bindings.LDKMessageSendEvent.SendChannelRangeQuery obj) {
439                         super(null, ptr);
440                         this.node_id = obj.node_id;
441                         long msg = obj.msg;
442                         QueryChannelRange msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new QueryChannelRange(null, msg); }
443                         msg_hu_conv.ptrs_to.add(this);
444                         this.msg = msg_hu_conv;
445                 }
446         }
447         /**
448          * Request routing gossip messages from a peer for a list of channels identified by
449          * their short_channel_ids.
450          */
451         public final static class SendShortIdsQuery extends MessageSendEvent {
452                 /**
453                  * The node_id of this message recipient
454                 */
455                 public final byte[] node_id;
456                 /**
457                  * The query_short_channel_ids which should be sent.
458                 */
459                 public final QueryShortChannelIds msg;
460                 private SendShortIdsQuery(long ptr, bindings.LDKMessageSendEvent.SendShortIdsQuery obj) {
461                         super(null, ptr);
462                         this.node_id = obj.node_id;
463                         long msg = obj.msg;
464                         QueryShortChannelIds msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new QueryShortChannelIds(null, msg); }
465                         msg_hu_conv.ptrs_to.add(this);
466                         this.msg = msg_hu_conv;
467                 }
468         }
469         /**
470          * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
471          * emitted during processing of the query.
472          */
473         public final static class SendReplyChannelRange extends MessageSendEvent {
474                 /**
475                  * The node_id of this message recipient
476                 */
477                 public final byte[] node_id;
478                 /**
479                  * The reply_channel_range which should be sent.
480                 */
481                 public final ReplyChannelRange msg;
482                 private SendReplyChannelRange(long ptr, bindings.LDKMessageSendEvent.SendReplyChannelRange obj) {
483                         super(null, ptr);
484                         this.node_id = obj.node_id;
485                         long msg = obj.msg;
486                         ReplyChannelRange msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ReplyChannelRange(null, msg); }
487                         msg_hu_conv.ptrs_to.add(this);
488                         this.msg = msg_hu_conv;
489                 }
490         }
491         long clone_ptr() {
492                 long ret = bindings.MessageSendEvent_clone_ptr(this.ptr);
493                 return ret;
494         }
495
496         /**
497          * Creates a copy of the MessageSendEvent
498          */
499         public MessageSendEvent clone() {
500                 long ret = bindings.MessageSendEvent_clone(this.ptr);
501                 if (ret >= 0 && ret <= 4096) { return null; }
502                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
503                 ret_hu_conv.ptrs_to.add(this);
504                 return ret_hu_conv;
505         }
506
507         /**
508          * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
509          */
510         public static MessageSendEvent send_accept_channel(byte[] node_id, AcceptChannel msg) {
511                 long ret = bindings.MessageSendEvent_send_accept_channel(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
512                 if (ret >= 0 && ret <= 4096) { return null; }
513                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
514                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
515                 return ret_hu_conv;
516         }
517
518         /**
519          * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
520          */
521         public static MessageSendEvent send_open_channel(byte[] node_id, OpenChannel msg) {
522                 long ret = bindings.MessageSendEvent_send_open_channel(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
523                 if (ret >= 0 && ret <= 4096) { return null; }
524                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
525                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
526                 return ret_hu_conv;
527         }
528
529         /**
530          * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
531          */
532         public static MessageSendEvent send_funding_created(byte[] node_id, FundingCreated msg) {
533                 long ret = bindings.MessageSendEvent_send_funding_created(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
534                 if (ret >= 0 && ret <= 4096) { return null; }
535                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
536                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
537                 return ret_hu_conv;
538         }
539
540         /**
541          * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
542          */
543         public static MessageSendEvent send_funding_signed(byte[] node_id, FundingSigned msg) {
544                 long ret = bindings.MessageSendEvent_send_funding_signed(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
545                 if (ret >= 0 && ret <= 4096) { return null; }
546                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
547                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
548                 return ret_hu_conv;
549         }
550
551         /**
552          * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
553          */
554         public static MessageSendEvent send_funding_locked(byte[] node_id, FundingLocked msg) {
555                 long ret = bindings.MessageSendEvent_send_funding_locked(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
556                 if (ret >= 0 && ret <= 4096) { return null; }
557                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
558                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
559                 return ret_hu_conv;
560         }
561
562         /**
563          * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
564          */
565         public static MessageSendEvent send_announcement_signatures(byte[] node_id, AnnouncementSignatures msg) {
566                 long ret = bindings.MessageSendEvent_send_announcement_signatures(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
567                 if (ret >= 0 && ret <= 4096) { return null; }
568                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
569                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
570                 return ret_hu_conv;
571         }
572
573         /**
574          * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
575          */
576         public static MessageSendEvent update_htlcs(byte[] node_id, CommitmentUpdate updates) {
577                 long ret = bindings.MessageSendEvent_update_htlcs(InternalUtils.check_arr_len(node_id, 33), updates == null ? 0 : updates.ptr & ~1);
578                 if (ret >= 0 && ret <= 4096) { return null; }
579                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
580                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
581                 return ret_hu_conv;
582         }
583
584         /**
585          * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
586          */
587         public static MessageSendEvent send_revoke_and_ack(byte[] node_id, RevokeAndACK msg) {
588                 long ret = bindings.MessageSendEvent_send_revoke_and_ack(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
589                 if (ret >= 0 && ret <= 4096) { return null; }
590                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
591                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
592                 return ret_hu_conv;
593         }
594
595         /**
596          * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
597          */
598         public static MessageSendEvent send_closing_signed(byte[] node_id, ClosingSigned msg) {
599                 long ret = bindings.MessageSendEvent_send_closing_signed(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
600                 if (ret >= 0 && ret <= 4096) { return null; }
601                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
602                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
603                 return ret_hu_conv;
604         }
605
606         /**
607          * Utility method to constructs a new SendShutdown-variant MessageSendEvent
608          */
609         public static MessageSendEvent send_shutdown(byte[] node_id, Shutdown msg) {
610                 long ret = bindings.MessageSendEvent_send_shutdown(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
611                 if (ret >= 0 && ret <= 4096) { return null; }
612                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
613                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
614                 return ret_hu_conv;
615         }
616
617         /**
618          * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
619          */
620         public static MessageSendEvent send_channel_reestablish(byte[] node_id, ChannelReestablish msg) {
621                 long ret = bindings.MessageSendEvent_send_channel_reestablish(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
622                 if (ret >= 0 && ret <= 4096) { return null; }
623                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
624                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
625                 return ret_hu_conv;
626         }
627
628         /**
629          * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
630          */
631         public static MessageSendEvent broadcast_channel_announcement(ChannelAnnouncement msg, ChannelUpdate update_msg) {
632                 long ret = bindings.MessageSendEvent_broadcast_channel_announcement(msg == null ? 0 : msg.ptr & ~1, update_msg == null ? 0 : update_msg.ptr & ~1);
633                 if (ret >= 0 && ret <= 4096) { return null; }
634                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
635                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
636                 return ret_hu_conv;
637         }
638
639         /**
640          * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
641          */
642         public static MessageSendEvent broadcast_node_announcement(NodeAnnouncement msg) {
643                 long ret = bindings.MessageSendEvent_broadcast_node_announcement(msg == null ? 0 : msg.ptr & ~1);
644                 if (ret >= 0 && ret <= 4096) { return null; }
645                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
646                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
647                 return ret_hu_conv;
648         }
649
650         /**
651          * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
652          */
653         public static MessageSendEvent broadcast_channel_update(ChannelUpdate msg) {
654                 long ret = bindings.MessageSendEvent_broadcast_channel_update(msg == null ? 0 : msg.ptr & ~1);
655                 if (ret >= 0 && ret <= 4096) { return null; }
656                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
657                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
658                 return ret_hu_conv;
659         }
660
661         /**
662          * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
663          */
664         public static MessageSendEvent send_channel_update(byte[] node_id, ChannelUpdate msg) {
665                 long ret = bindings.MessageSendEvent_send_channel_update(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
666                 if (ret >= 0 && ret <= 4096) { return null; }
667                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
668                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
669                 return ret_hu_conv;
670         }
671
672         /**
673          * Utility method to constructs a new HandleError-variant MessageSendEvent
674          */
675         public static MessageSendEvent handle_error(byte[] node_id, ErrorAction action) {
676                 long ret = bindings.MessageSendEvent_handle_error(InternalUtils.check_arr_len(node_id, 33), action.ptr);
677                 if (ret >= 0 && ret <= 4096) { return null; }
678                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
679                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
680                 return ret_hu_conv;
681         }
682
683         /**
684          * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
685          */
686         public static MessageSendEvent send_channel_range_query(byte[] node_id, QueryChannelRange msg) {
687                 long ret = bindings.MessageSendEvent_send_channel_range_query(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
688                 if (ret >= 0 && ret <= 4096) { return null; }
689                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
690                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
691                 return ret_hu_conv;
692         }
693
694         /**
695          * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
696          */
697         public static MessageSendEvent send_short_ids_query(byte[] node_id, QueryShortChannelIds msg) {
698                 long ret = bindings.MessageSendEvent_send_short_ids_query(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
699                 if (ret >= 0 && ret <= 4096) { return null; }
700                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
701                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
702                 return ret_hu_conv;
703         }
704
705         /**
706          * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
707          */
708         public static MessageSendEvent send_reply_channel_range(byte[] node_id, ReplyChannelRange msg) {
709                 long ret = bindings.MessageSendEvent_send_reply_channel_range(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1);
710                 if (ret >= 0 && ret <= 4096) { return null; }
711                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
712                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
713                 return ret_hu_conv;
714         }
715
716 }