Update auto-generated bindings to 0.0.101
[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 < 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 < 1024) { return null; }
437                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
438                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
439                 ret_hu_conv.ptrs_to.add(msg);
440                 return ret_hu_conv;
441         }
442
443         /**
444          * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
445          */
446         public static MessageSendEvent send_open_channel(byte[] node_id, OpenChannel msg) {
447                 long ret = bindings.MessageSendEvent_send_open_channel(node_id, msg == null ? 0 : msg.ptr & ~1);
448                 if (ret < 1024) { return null; }
449                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
450                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
451                 ret_hu_conv.ptrs_to.add(msg);
452                 return ret_hu_conv;
453         }
454
455         /**
456          * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
457          */
458         public static MessageSendEvent send_funding_created(byte[] node_id, FundingCreated msg) {
459                 long ret = bindings.MessageSendEvent_send_funding_created(node_id, msg == null ? 0 : msg.ptr & ~1);
460                 if (ret < 1024) { return null; }
461                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
462                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
463                 ret_hu_conv.ptrs_to.add(msg);
464                 return ret_hu_conv;
465         }
466
467         /**
468          * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
469          */
470         public static MessageSendEvent send_funding_signed(byte[] node_id, FundingSigned msg) {
471                 long ret = bindings.MessageSendEvent_send_funding_signed(node_id, msg == null ? 0 : msg.ptr & ~1);
472                 if (ret < 1024) { return null; }
473                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
474                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
475                 ret_hu_conv.ptrs_to.add(msg);
476                 return ret_hu_conv;
477         }
478
479         /**
480          * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
481          */
482         public static MessageSendEvent send_funding_locked(byte[] node_id, FundingLocked msg) {
483                 long ret = bindings.MessageSendEvent_send_funding_locked(node_id, msg == null ? 0 : msg.ptr & ~1);
484                 if (ret < 1024) { return null; }
485                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
486                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
487                 ret_hu_conv.ptrs_to.add(msg);
488                 return ret_hu_conv;
489         }
490
491         /**
492          * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
493          */
494         public static MessageSendEvent send_announcement_signatures(byte[] node_id, AnnouncementSignatures msg) {
495                 long ret = bindings.MessageSendEvent_send_announcement_signatures(node_id, msg == null ? 0 : msg.ptr & ~1);
496                 if (ret < 1024) { return null; }
497                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
498                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
499                 ret_hu_conv.ptrs_to.add(msg);
500                 return ret_hu_conv;
501         }
502
503         /**
504          * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
505          */
506         public static MessageSendEvent update_htlcs(byte[] node_id, CommitmentUpdate updates) {
507                 long ret = bindings.MessageSendEvent_update_htlcs(node_id, updates == null ? 0 : updates.ptr & ~1);
508                 if (ret < 1024) { return null; }
509                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
510                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
511                 ret_hu_conv.ptrs_to.add(updates);
512                 return ret_hu_conv;
513         }
514
515         /**
516          * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
517          */
518         public static MessageSendEvent send_revoke_and_ack(byte[] node_id, RevokeAndACK msg) {
519                 long ret = bindings.MessageSendEvent_send_revoke_and_ack(node_id, msg == null ? 0 : msg.ptr & ~1);
520                 if (ret < 1024) { return null; }
521                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
522                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
523                 ret_hu_conv.ptrs_to.add(msg);
524                 return ret_hu_conv;
525         }
526
527         /**
528          * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
529          */
530         public static MessageSendEvent send_closing_signed(byte[] node_id, ClosingSigned msg) {
531                 long ret = bindings.MessageSendEvent_send_closing_signed(node_id, msg == null ? 0 : msg.ptr & ~1);
532                 if (ret < 1024) { return null; }
533                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
534                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
535                 ret_hu_conv.ptrs_to.add(msg);
536                 return ret_hu_conv;
537         }
538
539         /**
540          * Utility method to constructs a new SendShutdown-variant MessageSendEvent
541          */
542         public static MessageSendEvent send_shutdown(byte[] node_id, Shutdown msg) {
543                 long ret = bindings.MessageSendEvent_send_shutdown(node_id, msg == null ? 0 : msg.ptr & ~1);
544                 if (ret < 1024) { return null; }
545                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
546                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
547                 ret_hu_conv.ptrs_to.add(msg);
548                 return ret_hu_conv;
549         }
550
551         /**
552          * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
553          */
554         public static MessageSendEvent send_channel_reestablish(byte[] node_id, ChannelReestablish msg) {
555                 long ret = bindings.MessageSendEvent_send_channel_reestablish(node_id, msg == null ? 0 : msg.ptr & ~1);
556                 if (ret < 1024) { return null; }
557                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
558                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
559                 ret_hu_conv.ptrs_to.add(msg);
560                 return ret_hu_conv;
561         }
562
563         /**
564          * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
565          */
566         public static MessageSendEvent broadcast_channel_announcement(ChannelAnnouncement msg, ChannelUpdate update_msg) {
567                 long ret = bindings.MessageSendEvent_broadcast_channel_announcement(msg == null ? 0 : msg.ptr & ~1, update_msg == null ? 0 : update_msg.ptr & ~1);
568                 if (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                 ret_hu_conv.ptrs_to.add(msg);
572                 ret_hu_conv.ptrs_to.add(update_msg);
573                 return ret_hu_conv;
574         }
575
576         /**
577          * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
578          */
579         public static MessageSendEvent broadcast_node_announcement(NodeAnnouncement msg) {
580                 long ret = bindings.MessageSendEvent_broadcast_node_announcement(msg == null ? 0 : msg.ptr & ~1);
581                 if (ret < 1024) { return null; }
582                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
583                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
584                 ret_hu_conv.ptrs_to.add(msg);
585                 return ret_hu_conv;
586         }
587
588         /**
589          * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
590          */
591         public static MessageSendEvent broadcast_channel_update(ChannelUpdate msg) {
592                 long ret = bindings.MessageSendEvent_broadcast_channel_update(msg == null ? 0 : msg.ptr & ~1);
593                 if (ret < 1024) { return null; }
594                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
595                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
596                 ret_hu_conv.ptrs_to.add(msg);
597                 return ret_hu_conv;
598         }
599
600         /**
601          * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
602          */
603         public static MessageSendEvent send_channel_update(byte[] node_id, ChannelUpdate msg) {
604                 long ret = bindings.MessageSendEvent_send_channel_update(node_id, msg == null ? 0 : msg.ptr & ~1);
605                 if (ret < 1024) { return null; }
606                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
607                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
608                 ret_hu_conv.ptrs_to.add(msg);
609                 return ret_hu_conv;
610         }
611
612         /**
613          * Utility method to constructs a new HandleError-variant MessageSendEvent
614          */
615         public static MessageSendEvent handle_error(byte[] node_id, ErrorAction action) {
616                 long ret = bindings.MessageSendEvent_handle_error(node_id, action.ptr);
617                 if (ret < 1024) { return null; }
618                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
619                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
620                 return ret_hu_conv;
621         }
622
623         /**
624          * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
625          */
626         public static MessageSendEvent send_channel_range_query(byte[] node_id, QueryChannelRange msg) {
627                 long ret = bindings.MessageSendEvent_send_channel_range_query(node_id, msg == null ? 0 : msg.ptr & ~1);
628                 if (ret < 1024) { return null; }
629                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
630                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
631                 ret_hu_conv.ptrs_to.add(msg);
632                 return ret_hu_conv;
633         }
634
635         /**
636          * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
637          */
638         public static MessageSendEvent send_short_ids_query(byte[] node_id, QueryShortChannelIds msg) {
639                 long ret = bindings.MessageSendEvent_send_short_ids_query(node_id, msg == null ? 0 : msg.ptr & ~1);
640                 if (ret < 1024) { return null; }
641                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
642                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
643                 ret_hu_conv.ptrs_to.add(msg);
644                 return ret_hu_conv;
645         }
646
647         /**
648          * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
649          */
650         public static MessageSendEvent send_reply_channel_range(byte[] node_id, ReplyChannelRange msg) {
651                 long ret = bindings.MessageSendEvent_send_reply_channel_range(node_id, msg == null ? 0 : msg.ptr & ~1);
652                 if (ret < 1024) { return null; }
653                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
654                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
655                 ret_hu_conv.ptrs_to.add(msg);
656                 return ret_hu_conv;
657         }
658
659 }