Merge pull request #49 from TheBlueMatt/main
[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         public final static class SendAcceptChannel extends MessageSendEvent {
86                 /**
87                  * The node_id of the node which should receive this message
88                 */
89                 public final byte[] node_id;
90                 /**
91                  * The message which should be sent.
92                 */
93                 public final AcceptChannel msg;
94                 private SendAcceptChannel(long ptr, bindings.LDKMessageSendEvent.SendAcceptChannel obj) {
95                         super(null, ptr);
96                         this.node_id = obj.node_id;
97                         long msg = obj.msg;
98                         AcceptChannel msg_hu_conv = new AcceptChannel(null, msg);
99                         msg_hu_conv.ptrs_to.add(this);
100                         this.msg = msg_hu_conv;
101                 }
102         }
103         public final static class SendOpenChannel extends MessageSendEvent {
104                 /**
105                  * The node_id of the node which should receive this message
106                 */
107                 public final byte[] node_id;
108                 /**
109                  * The message which should be sent.
110                 */
111                 public final OpenChannel msg;
112                 private SendOpenChannel(long ptr, bindings.LDKMessageSendEvent.SendOpenChannel obj) {
113                         super(null, ptr);
114                         this.node_id = obj.node_id;
115                         long msg = obj.msg;
116                         OpenChannel msg_hu_conv = new OpenChannel(null, msg);
117                         msg_hu_conv.ptrs_to.add(this);
118                         this.msg = msg_hu_conv;
119                 }
120         }
121         public final static class SendFundingCreated extends MessageSendEvent {
122                 /**
123                  * The node_id of the node which should receive this message
124                 */
125                 public final byte[] node_id;
126                 /**
127                  * The message which should be sent.
128                 */
129                 public final FundingCreated msg;
130                 private SendFundingCreated(long ptr, bindings.LDKMessageSendEvent.SendFundingCreated obj) {
131                         super(null, ptr);
132                         this.node_id = obj.node_id;
133                         long msg = obj.msg;
134                         FundingCreated msg_hu_conv = new FundingCreated(null, msg);
135                         msg_hu_conv.ptrs_to.add(this);
136                         this.msg = msg_hu_conv;
137                 }
138         }
139         public final static class SendFundingSigned extends MessageSendEvent {
140                 /**
141                  * The node_id of the node which should receive this message
142                 */
143                 public final byte[] node_id;
144                 /**
145                  * The message which should be sent.
146                 */
147                 public final FundingSigned msg;
148                 private SendFundingSigned(long ptr, bindings.LDKMessageSendEvent.SendFundingSigned obj) {
149                         super(null, ptr);
150                         this.node_id = obj.node_id;
151                         long msg = obj.msg;
152                         FundingSigned msg_hu_conv = new FundingSigned(null, msg);
153                         msg_hu_conv.ptrs_to.add(this);
154                         this.msg = msg_hu_conv;
155                 }
156         }
157         public final static class SendFundingLocked extends MessageSendEvent {
158                 /**
159                  * The node_id of the node which should receive these message(s)
160                 */
161                 public final byte[] node_id;
162                 /**
163                  * The funding_locked message which should be sent.
164                 */
165                 public final FundingLocked msg;
166                 private SendFundingLocked(long ptr, bindings.LDKMessageSendEvent.SendFundingLocked obj) {
167                         super(null, ptr);
168                         this.node_id = obj.node_id;
169                         long msg = obj.msg;
170                         FundingLocked msg_hu_conv = new FundingLocked(null, msg);
171                         msg_hu_conv.ptrs_to.add(this);
172                         this.msg = msg_hu_conv;
173                 }
174         }
175         public final static class SendAnnouncementSignatures extends MessageSendEvent {
176                 /**
177                  * The node_id of the node which should receive these message(s)
178                 */
179                 public final byte[] node_id;
180                 /**
181                  * The announcement_signatures message which should be sent.
182                 */
183                 public final AnnouncementSignatures msg;
184                 private SendAnnouncementSignatures(long ptr, bindings.LDKMessageSendEvent.SendAnnouncementSignatures obj) {
185                         super(null, ptr);
186                         this.node_id = obj.node_id;
187                         long msg = obj.msg;
188                         AnnouncementSignatures msg_hu_conv = new AnnouncementSignatures(null, msg);
189                         msg_hu_conv.ptrs_to.add(this);
190                         this.msg = msg_hu_conv;
191                 }
192         }
193         public final static class UpdateHTLCs extends MessageSendEvent {
194                 /**
195                  * The node_id of the node which should receive these message(s)
196                 */
197                 public final byte[] node_id;
198                 /**
199                  * The update messages which should be sent. ALL messages in the struct should be sent!
200                 */
201                 public final CommitmentUpdate updates;
202                 private UpdateHTLCs(long ptr, bindings.LDKMessageSendEvent.UpdateHTLCs obj) {
203                         super(null, ptr);
204                         this.node_id = obj.node_id;
205                         long updates = obj.updates;
206                         CommitmentUpdate updates_hu_conv = new CommitmentUpdate(null, updates);
207                         updates_hu_conv.ptrs_to.add(this);
208                         this.updates = updates_hu_conv;
209                 }
210         }
211         public final static class SendRevokeAndACK extends MessageSendEvent {
212                 /**
213                  * The node_id of the node which should receive this message
214                 */
215                 public final byte[] node_id;
216                 /**
217                  * The message which should be sent.
218                 */
219                 public final RevokeAndACK msg;
220                 private SendRevokeAndACK(long ptr, bindings.LDKMessageSendEvent.SendRevokeAndACK obj) {
221                         super(null, ptr);
222                         this.node_id = obj.node_id;
223                         long msg = obj.msg;
224                         RevokeAndACK msg_hu_conv = new RevokeAndACK(null, msg);
225                         msg_hu_conv.ptrs_to.add(this);
226                         this.msg = msg_hu_conv;
227                 }
228         }
229         public final static class SendClosingSigned extends MessageSendEvent {
230                 /**
231                  * The node_id of the node which should receive this message
232                 */
233                 public final byte[] node_id;
234                 /**
235                  * The message which should be sent.
236                 */
237                 public final ClosingSigned msg;
238                 private SendClosingSigned(long ptr, bindings.LDKMessageSendEvent.SendClosingSigned obj) {
239                         super(null, ptr);
240                         this.node_id = obj.node_id;
241                         long msg = obj.msg;
242                         ClosingSigned msg_hu_conv = new ClosingSigned(null, msg);
243                         msg_hu_conv.ptrs_to.add(this);
244                         this.msg = msg_hu_conv;
245                 }
246         }
247         public final static class SendShutdown extends MessageSendEvent {
248                 /**
249                  * The node_id of the node which should receive this message
250                 */
251                 public final byte[] node_id;
252                 /**
253                  * The message which should be sent.
254                 */
255                 public final Shutdown msg;
256                 private SendShutdown(long ptr, bindings.LDKMessageSendEvent.SendShutdown obj) {
257                         super(null, ptr);
258                         this.node_id = obj.node_id;
259                         long msg = obj.msg;
260                         Shutdown msg_hu_conv = new Shutdown(null, msg);
261                         msg_hu_conv.ptrs_to.add(this);
262                         this.msg = msg_hu_conv;
263                 }
264         }
265         public final static class SendChannelReestablish extends MessageSendEvent {
266                 /**
267                  * The node_id of the node which should receive this message
268                 */
269                 public final byte[] node_id;
270                 /**
271                  * The message which should be sent.
272                 */
273                 public final ChannelReestablish msg;
274                 private SendChannelReestablish(long ptr, bindings.LDKMessageSendEvent.SendChannelReestablish obj) {
275                         super(null, ptr);
276                         this.node_id = obj.node_id;
277                         long msg = obj.msg;
278                         ChannelReestablish msg_hu_conv = new ChannelReestablish(null, msg);
279                         msg_hu_conv.ptrs_to.add(this);
280                         this.msg = msg_hu_conv;
281                 }
282         }
283         public final static class BroadcastChannelAnnouncement extends MessageSendEvent {
284                 /**
285                  * The channel_announcement which should be sent.
286                 */
287                 public final ChannelAnnouncement msg;
288                 /**
289                  * The followup channel_update which should be sent.
290                 */
291                 public final ChannelUpdate update_msg;
292                 private BroadcastChannelAnnouncement(long ptr, bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement obj) {
293                         super(null, ptr);
294                         long msg = obj.msg;
295                         ChannelAnnouncement msg_hu_conv = new ChannelAnnouncement(null, msg);
296                         msg_hu_conv.ptrs_to.add(this);
297                         this.msg = msg_hu_conv;
298                         long update_msg = obj.update_msg;
299                         ChannelUpdate update_msg_hu_conv = new ChannelUpdate(null, update_msg);
300                         update_msg_hu_conv.ptrs_to.add(this);
301                         this.update_msg = update_msg_hu_conv;
302                 }
303         }
304         public final static class BroadcastNodeAnnouncement extends MessageSendEvent {
305                 /**
306                  * The node_announcement which should be sent.
307                 */
308                 public final NodeAnnouncement msg;
309                 private BroadcastNodeAnnouncement(long ptr, bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement obj) {
310                         super(null, ptr);
311                         long msg = obj.msg;
312                         NodeAnnouncement msg_hu_conv = new NodeAnnouncement(null, msg);
313                         msg_hu_conv.ptrs_to.add(this);
314                         this.msg = msg_hu_conv;
315                 }
316         }
317         public final static class BroadcastChannelUpdate extends MessageSendEvent {
318                 /**
319                  * The channel_update which should be sent.
320                 */
321                 public final ChannelUpdate msg;
322                 private BroadcastChannelUpdate(long ptr, bindings.LDKMessageSendEvent.BroadcastChannelUpdate obj) {
323                         super(null, ptr);
324                         long msg = obj.msg;
325                         ChannelUpdate msg_hu_conv = new ChannelUpdate(null, msg);
326                         msg_hu_conv.ptrs_to.add(this);
327                         this.msg = msg_hu_conv;
328                 }
329         }
330         public final static class SendChannelUpdate extends MessageSendEvent {
331                 /**
332                  * The node_id of the node which should receive this message
333                 */
334                 public final byte[] node_id;
335                 /**
336                  * The channel_update which should be sent.
337                 */
338                 public final ChannelUpdate msg;
339                 private SendChannelUpdate(long ptr, bindings.LDKMessageSendEvent.SendChannelUpdate obj) {
340                         super(null, ptr);
341                         this.node_id = obj.node_id;
342                         long msg = obj.msg;
343                         ChannelUpdate msg_hu_conv = new ChannelUpdate(null, msg);
344                         msg_hu_conv.ptrs_to.add(this);
345                         this.msg = msg_hu_conv;
346                 }
347         }
348         public final static class HandleError extends MessageSendEvent {
349                 /**
350                  * The node_id of the node which should receive this message
351                 */
352                 public final byte[] node_id;
353                 /**
354                  * The action which should be taken.
355                 */
356                 public final ErrorAction action;
357                 private HandleError(long ptr, bindings.LDKMessageSendEvent.HandleError obj) {
358                         super(null, ptr);
359                         this.node_id = obj.node_id;
360                         long action = obj.action;
361                         ErrorAction action_hu_conv = ErrorAction.constr_from_ptr(action);
362                         action_hu_conv.ptrs_to.add(this);
363                         this.action = action_hu_conv;
364                 }
365         }
366         public final static class SendChannelRangeQuery extends MessageSendEvent {
367                 /**
368                  * The node_id of this message recipient
369                 */
370                 public final byte[] node_id;
371                 /**
372                  * The query_channel_range which should be sent.
373                 */
374                 public final QueryChannelRange msg;
375                 private SendChannelRangeQuery(long ptr, bindings.LDKMessageSendEvent.SendChannelRangeQuery obj) {
376                         super(null, ptr);
377                         this.node_id = obj.node_id;
378                         long msg = obj.msg;
379                         QueryChannelRange msg_hu_conv = new QueryChannelRange(null, msg);
380                         msg_hu_conv.ptrs_to.add(this);
381                         this.msg = msg_hu_conv;
382                 }
383         }
384         public final static class SendShortIdsQuery extends MessageSendEvent {
385                 /**
386                  * The node_id of this message recipient
387                 */
388                 public final byte[] node_id;
389                 /**
390                  * The query_short_channel_ids which should be sent.
391                 */
392                 public final QueryShortChannelIds msg;
393                 private SendShortIdsQuery(long ptr, bindings.LDKMessageSendEvent.SendShortIdsQuery obj) {
394                         super(null, ptr);
395                         this.node_id = obj.node_id;
396                         long msg = obj.msg;
397                         QueryShortChannelIds msg_hu_conv = new QueryShortChannelIds(null, msg);
398                         msg_hu_conv.ptrs_to.add(this);
399                         this.msg = msg_hu_conv;
400                 }
401         }
402         public final static class SendReplyChannelRange extends MessageSendEvent {
403                 /**
404                  * The node_id of this message recipient
405                 */
406                 public final byte[] node_id;
407                 /**
408                  * The reply_channel_range which should be sent.
409                 */
410                 public final ReplyChannelRange msg;
411                 private SendReplyChannelRange(long ptr, bindings.LDKMessageSendEvent.SendReplyChannelRange obj) {
412                         super(null, ptr);
413                         this.node_id = obj.node_id;
414                         long msg = obj.msg;
415                         ReplyChannelRange msg_hu_conv = new ReplyChannelRange(null, msg);
416                         msg_hu_conv.ptrs_to.add(this);
417                         this.msg = msg_hu_conv;
418                 }
419         }
420         /**
421          * Creates a copy of the MessageSendEvent
422          */
423         public MessageSendEvent clone() {
424                 long ret = bindings.MessageSendEvent_clone(this.ptr);
425                 if (ret >= 0 && ret < 1024) { return null; }
426                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
427                 ret_hu_conv.ptrs_to.add(this);
428                 return ret_hu_conv;
429         }
430
431         /**
432          * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
433          */
434         public static MessageSendEvent send_accept_channel(byte[] node_id, AcceptChannel msg) {
435                 long ret = bindings.MessageSendEvent_send_accept_channel(node_id, msg == null ? 0 : msg.ptr & ~1);
436                 if (ret >= 0 && ret < 1024) { return null; }
437                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
438                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
439                 return ret_hu_conv;
440         }
441
442         /**
443          * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
444          */
445         public static MessageSendEvent send_open_channel(byte[] node_id, OpenChannel msg) {
446                 long ret = bindings.MessageSendEvent_send_open_channel(node_id, msg == null ? 0 : msg.ptr & ~1);
447                 if (ret >= 0 && ret < 1024) { return null; }
448                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
449                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
450                 return ret_hu_conv;
451         }
452
453         /**
454          * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
455          */
456         public static MessageSendEvent send_funding_created(byte[] node_id, FundingCreated msg) {
457                 long ret = bindings.MessageSendEvent_send_funding_created(node_id, msg == null ? 0 : msg.ptr & ~1);
458                 if (ret >= 0 && ret < 1024) { return null; }
459                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
460                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
461                 return ret_hu_conv;
462         }
463
464         /**
465          * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
466          */
467         public static MessageSendEvent send_funding_signed(byte[] node_id, FundingSigned msg) {
468                 long ret = bindings.MessageSendEvent_send_funding_signed(node_id, msg == null ? 0 : msg.ptr & ~1);
469                 if (ret >= 0 && ret < 1024) { return null; }
470                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
471                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
472                 return ret_hu_conv;
473         }
474
475         /**
476          * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
477          */
478         public static MessageSendEvent send_funding_locked(byte[] node_id, FundingLocked msg) {
479                 long ret = bindings.MessageSendEvent_send_funding_locked(node_id, msg == null ? 0 : msg.ptr & ~1);
480                 if (ret >= 0 && ret < 1024) { return null; }
481                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
482                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
483                 return ret_hu_conv;
484         }
485
486         /**
487          * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
488          */
489         public static MessageSendEvent send_announcement_signatures(byte[] node_id, AnnouncementSignatures msg) {
490                 long ret = bindings.MessageSendEvent_send_announcement_signatures(node_id, msg == null ? 0 : msg.ptr & ~1);
491                 if (ret >= 0 && ret < 1024) { return null; }
492                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
493                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
494                 return ret_hu_conv;
495         }
496
497         /**
498          * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
499          */
500         public static MessageSendEvent update_htlcs(byte[] node_id, CommitmentUpdate updates) {
501                 long ret = bindings.MessageSendEvent_update_htlcs(node_id, updates == null ? 0 : updates.ptr & ~1);
502                 if (ret >= 0 && ret < 1024) { return null; }
503                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
504                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
505                 return ret_hu_conv;
506         }
507
508         /**
509          * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
510          */
511         public static MessageSendEvent send_revoke_and_ack(byte[] node_id, RevokeAndACK msg) {
512                 long ret = bindings.MessageSendEvent_send_revoke_and_ack(node_id, msg == null ? 0 : msg.ptr & ~1);
513                 if (ret >= 0 && ret < 1024) { return null; }
514                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
515                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
516                 return ret_hu_conv;
517         }
518
519         /**
520          * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
521          */
522         public static MessageSendEvent send_closing_signed(byte[] node_id, ClosingSigned msg) {
523                 long ret = bindings.MessageSendEvent_send_closing_signed(node_id, msg == null ? 0 : msg.ptr & ~1);
524                 if (ret >= 0 && ret < 1024) { return null; }
525                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
526                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
527                 return ret_hu_conv;
528         }
529
530         /**
531          * Utility method to constructs a new SendShutdown-variant MessageSendEvent
532          */
533         public static MessageSendEvent send_shutdown(byte[] node_id, Shutdown msg) {
534                 long ret = bindings.MessageSendEvent_send_shutdown(node_id, msg == null ? 0 : msg.ptr & ~1);
535                 if (ret >= 0 && ret < 1024) { return null; }
536                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
537                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
538                 return ret_hu_conv;
539         }
540
541         /**
542          * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
543          */
544         public static MessageSendEvent send_channel_reestablish(byte[] node_id, ChannelReestablish msg) {
545                 long ret = bindings.MessageSendEvent_send_channel_reestablish(node_id, msg == null ? 0 : msg.ptr & ~1);
546                 if (ret >= 0 && ret < 1024) { return null; }
547                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
548                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
549                 return ret_hu_conv;
550         }
551
552         /**
553          * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
554          */
555         public static MessageSendEvent broadcast_channel_announcement(ChannelAnnouncement msg, ChannelUpdate update_msg) {
556                 long ret = bindings.MessageSendEvent_broadcast_channel_announcement(msg == null ? 0 : msg.ptr & ~1, update_msg == null ? 0 : update_msg.ptr & ~1);
557                 if (ret >= 0 && ret < 1024) { return null; }
558                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
559                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
560                 return ret_hu_conv;
561         }
562
563         /**
564          * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
565          */
566         public static MessageSendEvent broadcast_node_announcement(NodeAnnouncement msg) {
567                 long ret = bindings.MessageSendEvent_broadcast_node_announcement(msg == null ? 0 : msg.ptr & ~1);
568                 if (ret >= 0 && ret < 1024) { return null; }
569                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
570                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
571                 return ret_hu_conv;
572         }
573
574         /**
575          * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
576          */
577         public static MessageSendEvent broadcast_channel_update(ChannelUpdate msg) {
578                 long ret = bindings.MessageSendEvent_broadcast_channel_update(msg == null ? 0 : msg.ptr & ~1);
579                 if (ret >= 0 && ret < 1024) { return null; }
580                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
581                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
582                 return ret_hu_conv;
583         }
584
585         /**
586          * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
587          */
588         public static MessageSendEvent send_channel_update(byte[] node_id, ChannelUpdate msg) {
589                 long ret = bindings.MessageSendEvent_send_channel_update(node_id, msg == null ? 0 : msg.ptr & ~1);
590                 if (ret >= 0 && ret < 1024) { return null; }
591                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
592                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
593                 return ret_hu_conv;
594         }
595
596         /**
597          * Utility method to constructs a new HandleError-variant MessageSendEvent
598          */
599         public static MessageSendEvent handle_error(byte[] node_id, ErrorAction action) {
600                 long ret = bindings.MessageSendEvent_handle_error(node_id, action.ptr);
601                 if (ret >= 0 && ret < 1024) { return null; }
602                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
603                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
604                 return ret_hu_conv;
605         }
606
607         /**
608          * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
609          */
610         public static MessageSendEvent send_channel_range_query(byte[] node_id, QueryChannelRange msg) {
611                 long ret = bindings.MessageSendEvent_send_channel_range_query(node_id, msg == null ? 0 : msg.ptr & ~1);
612                 if (ret >= 0 && ret < 1024) { return null; }
613                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
614                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
615                 return ret_hu_conv;
616         }
617
618         /**
619          * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
620          */
621         public static MessageSendEvent send_short_ids_query(byte[] node_id, QueryShortChannelIds msg) {
622                 long ret = bindings.MessageSendEvent_send_short_ids_query(node_id, msg == null ? 0 : msg.ptr & ~1);
623                 if (ret >= 0 && ret < 1024) { return null; }
624                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
625                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
626                 return ret_hu_conv;
627         }
628
629         /**
630          * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
631          */
632         public static MessageSendEvent send_reply_channel_range(byte[] node_id, ReplyChannelRange msg) {
633                 long ret = bindings.MessageSendEvent_send_reply_channel_range(node_id, msg == null ? 0 : msg.ptr & ~1);
634                 if (ret >= 0 && ret < 1024) { return null; }
635                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
636                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
637                 return ret_hu_conv;
638         }
639
640 }