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