Update auto-generated bindings to LDK v0.0.99
[ldk-java] / ts / structs / MessageSendEvent.ts
1
2 import CommonBase from './CommonBase';
3 import * as bindings from '../bindings' // TODO: figure out location
4
5 export default class MessageSendEvent extends CommonBase {
6         protected constructor(_dummy: object, ptr: number) { super(ptr); }
7         protected finalize() {
8                 super.finalize();
9                 if (this.ptr != 0) { bindings.MessageSendEvent_free(this.ptr); }
10         }
11         static constr_from_ptr(ptr: number): MessageSendEvent {
12                 const raw_val: bindings.LDKMessageSendEvent = bindings.LDKMessageSendEvent_ref_from_ptr(ptr);
13                 if (raw_val instanceof bindings.LDKMessageSendEvent.SendAcceptChannel) {
14                         return new SendAcceptChannel(this.ptr, raw_val);
15                 }
16                 if (raw_val instanceof bindings.LDKMessageSendEvent.SendOpenChannel) {
17                         return new SendOpenChannel(this.ptr, raw_val);
18                 }
19                 if (raw_val instanceof bindings.LDKMessageSendEvent.SendFundingCreated) {
20                         return new SendFundingCreated(this.ptr, raw_val);
21                 }
22                 if (raw_val instanceof bindings.LDKMessageSendEvent.SendFundingSigned) {
23                         return new SendFundingSigned(this.ptr, raw_val);
24                 }
25                 if (raw_val instanceof bindings.LDKMessageSendEvent.SendFundingLocked) {
26                         return new SendFundingLocked(this.ptr, raw_val);
27                 }
28                 if (raw_val instanceof bindings.LDKMessageSendEvent.SendAnnouncementSignatures) {
29                         return new SendAnnouncementSignatures(this.ptr, raw_val);
30                 }
31                 if (raw_val instanceof bindings.LDKMessageSendEvent.UpdateHTLCs) {
32                         return new UpdateHTLCs(this.ptr, raw_val);
33                 }
34                 if (raw_val instanceof bindings.LDKMessageSendEvent.SendRevokeAndACK) {
35                         return new SendRevokeAndACK(this.ptr, raw_val);
36                 }
37                 if (raw_val instanceof bindings.LDKMessageSendEvent.SendClosingSigned) {
38                         return new SendClosingSigned(this.ptr, raw_val);
39                 }
40                 if (raw_val instanceof bindings.LDKMessageSendEvent.SendShutdown) {
41                         return new SendShutdown(this.ptr, raw_val);
42                 }
43                 if (raw_val instanceof bindings.LDKMessageSendEvent.SendChannelReestablish) {
44                         return new SendChannelReestablish(this.ptr, raw_val);
45                 }
46                 if (raw_val instanceof bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement) {
47                         return new BroadcastChannelAnnouncement(this.ptr, raw_val);
48                 }
49                 if (raw_val instanceof bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement) {
50                         return new BroadcastNodeAnnouncement(this.ptr, raw_val);
51                 }
52                 if (raw_val instanceof bindings.LDKMessageSendEvent.BroadcastChannelUpdate) {
53                         return new BroadcastChannelUpdate(this.ptr, raw_val);
54                 }
55                 if (raw_val instanceof bindings.LDKMessageSendEvent.SendChannelUpdate) {
56                         return new SendChannelUpdate(this.ptr, raw_val);
57                 }
58                 if (raw_val instanceof bindings.LDKMessageSendEvent.HandleError) {
59                         return new HandleError(this.ptr, raw_val);
60                 }
61                 if (raw_val instanceof bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate) {
62                         return new PaymentFailureNetworkUpdate(this.ptr, raw_val);
63                 }
64                 if (raw_val instanceof bindings.LDKMessageSendEvent.SendChannelRangeQuery) {
65                         return new SendChannelRangeQuery(this.ptr, raw_val);
66                 }
67                 if (raw_val instanceof bindings.LDKMessageSendEvent.SendShortIdsQuery) {
68                         return new SendShortIdsQuery(this.ptr, raw_val);
69                 }
70                 if (raw_val instanceof bindings.LDKMessageSendEvent.SendReplyChannelRange) {
71                         return new SendReplyChannelRange(this.ptr, raw_val);
72                 }
73                 throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
74         }
75
76 }
77 export class SendAcceptChannel extends MessageSendEvent {
78         public node_id: Uint8Array;
79         public msg: AcceptChannel;
80         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendAcceptChannel) {
81                 super(null, ptr);
82                 this.node_id = obj.node_id;
83                 const msg: number = obj.msg;
84                 const msg_hu_conv: AcceptChannel = new AcceptChannel(null, msg);
85                         msg_hu_conv.ptrs_to.add(this);
86                 this.msg = msg_hu_conv;
87         }
88 }
89 export class SendOpenChannel extends MessageSendEvent {
90         public node_id: Uint8Array;
91         public msg: OpenChannel;
92         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendOpenChannel) {
93                 super(null, ptr);
94                 this.node_id = obj.node_id;
95                 const msg: number = obj.msg;
96                 const msg_hu_conv: OpenChannel = new OpenChannel(null, msg);
97                         msg_hu_conv.ptrs_to.add(this);
98                 this.msg = msg_hu_conv;
99         }
100 }
101 export class SendFundingCreated extends MessageSendEvent {
102         public node_id: Uint8Array;
103         public msg: FundingCreated;
104         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendFundingCreated) {
105                 super(null, ptr);
106                 this.node_id = obj.node_id;
107                 const msg: number = obj.msg;
108                 const msg_hu_conv: FundingCreated = new FundingCreated(null, msg);
109                         msg_hu_conv.ptrs_to.add(this);
110                 this.msg = msg_hu_conv;
111         }
112 }
113 export class SendFundingSigned extends MessageSendEvent {
114         public node_id: Uint8Array;
115         public msg: FundingSigned;
116         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendFundingSigned) {
117                 super(null, ptr);
118                 this.node_id = obj.node_id;
119                 const msg: number = obj.msg;
120                 const msg_hu_conv: FundingSigned = new FundingSigned(null, msg);
121                         msg_hu_conv.ptrs_to.add(this);
122                 this.msg = msg_hu_conv;
123         }
124 }
125 export class SendFundingLocked extends MessageSendEvent {
126         public node_id: Uint8Array;
127         public msg: FundingLocked;
128         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendFundingLocked) {
129                 super(null, ptr);
130                 this.node_id = obj.node_id;
131                 const msg: number = obj.msg;
132                 const msg_hu_conv: FundingLocked = new FundingLocked(null, msg);
133                         msg_hu_conv.ptrs_to.add(this);
134                 this.msg = msg_hu_conv;
135         }
136 }
137 export class SendAnnouncementSignatures extends MessageSendEvent {
138         public node_id: Uint8Array;
139         public msg: AnnouncementSignatures;
140         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendAnnouncementSignatures) {
141                 super(null, ptr);
142                 this.node_id = obj.node_id;
143                 const msg: number = obj.msg;
144                 const msg_hu_conv: AnnouncementSignatures = new AnnouncementSignatures(null, msg);
145                         msg_hu_conv.ptrs_to.add(this);
146                 this.msg = msg_hu_conv;
147         }
148 }
149 export class UpdateHTLCs extends MessageSendEvent {
150         public node_id: Uint8Array;
151         public updates: CommitmentUpdate;
152         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.UpdateHTLCs) {
153                 super(null, ptr);
154                 this.node_id = obj.node_id;
155                 const updates: number = obj.updates;
156                 const updates_hu_conv: CommitmentUpdate = new CommitmentUpdate(null, updates);
157                         updates_hu_conv.ptrs_to.add(this);
158                 this.updates = updates_hu_conv;
159         }
160 }
161 export class SendRevokeAndACK extends MessageSendEvent {
162         public node_id: Uint8Array;
163         public msg: RevokeAndACK;
164         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendRevokeAndACK) {
165                 super(null, ptr);
166                 this.node_id = obj.node_id;
167                 const msg: number = obj.msg;
168                 const msg_hu_conv: RevokeAndACK = new RevokeAndACK(null, msg);
169                         msg_hu_conv.ptrs_to.add(this);
170                 this.msg = msg_hu_conv;
171         }
172 }
173 export class SendClosingSigned extends MessageSendEvent {
174         public node_id: Uint8Array;
175         public msg: ClosingSigned;
176         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendClosingSigned) {
177                 super(null, ptr);
178                 this.node_id = obj.node_id;
179                 const msg: number = obj.msg;
180                 const msg_hu_conv: ClosingSigned = new ClosingSigned(null, msg);
181                         msg_hu_conv.ptrs_to.add(this);
182                 this.msg = msg_hu_conv;
183         }
184 }
185 export class SendShutdown extends MessageSendEvent {
186         public node_id: Uint8Array;
187         public msg: Shutdown;
188         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendShutdown) {
189                 super(null, ptr);
190                 this.node_id = obj.node_id;
191                 const msg: number = obj.msg;
192                 const msg_hu_conv: Shutdown = new Shutdown(null, msg);
193                         msg_hu_conv.ptrs_to.add(this);
194                 this.msg = msg_hu_conv;
195         }
196 }
197 export class SendChannelReestablish extends MessageSendEvent {
198         public node_id: Uint8Array;
199         public msg: ChannelReestablish;
200         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendChannelReestablish) {
201                 super(null, ptr);
202                 this.node_id = obj.node_id;
203                 const msg: number = obj.msg;
204                 const msg_hu_conv: ChannelReestablish = new ChannelReestablish(null, msg);
205                         msg_hu_conv.ptrs_to.add(this);
206                 this.msg = msg_hu_conv;
207         }
208 }
209 export class BroadcastChannelAnnouncement extends MessageSendEvent {
210         public msg: ChannelAnnouncement;
211         public update_msg: ChannelUpdate;
212         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement) {
213                 super(null, ptr);
214                 const msg: number = obj.msg;
215                 const msg_hu_conv: ChannelAnnouncement = new ChannelAnnouncement(null, msg);
216                         msg_hu_conv.ptrs_to.add(this);
217                 this.msg = msg_hu_conv;
218                 const update_msg: number = obj.update_msg;
219                 const update_msg_hu_conv: ChannelUpdate = new ChannelUpdate(null, update_msg);
220                         update_msg_hu_conv.ptrs_to.add(this);
221                 this.update_msg = update_msg_hu_conv;
222         }
223 }
224 export class BroadcastNodeAnnouncement extends MessageSendEvent {
225         public msg: NodeAnnouncement;
226         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement) {
227                 super(null, ptr);
228                 const msg: number = obj.msg;
229                 const msg_hu_conv: NodeAnnouncement = new NodeAnnouncement(null, msg);
230                         msg_hu_conv.ptrs_to.add(this);
231                 this.msg = msg_hu_conv;
232         }
233 }
234 export class BroadcastChannelUpdate extends MessageSendEvent {
235         public msg: ChannelUpdate;
236         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.BroadcastChannelUpdate) {
237                 super(null, ptr);
238                 const msg: number = obj.msg;
239                 const msg_hu_conv: ChannelUpdate = new ChannelUpdate(null, msg);
240                         msg_hu_conv.ptrs_to.add(this);
241                 this.msg = msg_hu_conv;
242         }
243 }
244 export class SendChannelUpdate extends MessageSendEvent {
245         public node_id: Uint8Array;
246         public msg: ChannelUpdate;
247         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendChannelUpdate) {
248                 super(null, ptr);
249                 this.node_id = obj.node_id;
250                 const msg: number = obj.msg;
251                 const msg_hu_conv: ChannelUpdate = new ChannelUpdate(null, msg);
252                         msg_hu_conv.ptrs_to.add(this);
253                 this.msg = msg_hu_conv;
254         }
255 }
256 export class HandleError extends MessageSendEvent {
257         public node_id: Uint8Array;
258         public action: ErrorAction;
259         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.HandleError) {
260                 super(null, ptr);
261                 this.node_id = obj.node_id;
262                 const action: number = obj.action;
263                 ErrorAction action_hu_conv = ErrorAction.constr_from_ptr(action);
264                         action_hu_conv.ptrs_to.add(this);
265                 this.action = action_hu_conv;
266         }
267 }
268 export class PaymentFailureNetworkUpdate extends MessageSendEvent {
269         public update: HTLCFailChannelUpdate;
270         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate) {
271                 super(null, ptr);
272                 const update: number = obj.update;
273                 HTLCFailChannelUpdate update_hu_conv = HTLCFailChannelUpdate.constr_from_ptr(update);
274                         update_hu_conv.ptrs_to.add(this);
275                 this.update = update_hu_conv;
276         }
277 }
278 export class SendChannelRangeQuery extends MessageSendEvent {
279         public node_id: Uint8Array;
280         public msg: QueryChannelRange;
281         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendChannelRangeQuery) {
282                 super(null, ptr);
283                 this.node_id = obj.node_id;
284                 const msg: number = obj.msg;
285                 const msg_hu_conv: QueryChannelRange = new QueryChannelRange(null, msg);
286                         msg_hu_conv.ptrs_to.add(this);
287                 this.msg = msg_hu_conv;
288         }
289 }
290 export class SendShortIdsQuery extends MessageSendEvent {
291         public node_id: Uint8Array;
292         public msg: QueryShortChannelIds;
293         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendShortIdsQuery) {
294                 super(null, ptr);
295                 this.node_id = obj.node_id;
296                 const msg: number = obj.msg;
297                 const msg_hu_conv: QueryShortChannelIds = new QueryShortChannelIds(null, msg);
298                         msg_hu_conv.ptrs_to.add(this);
299                 this.msg = msg_hu_conv;
300         }
301 }
302 export class SendReplyChannelRange extends MessageSendEvent {
303         public node_id: Uint8Array;
304         public msg: ReplyChannelRange;
305         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendReplyChannelRange) {
306                 super(null, ptr);
307                 this.node_id = obj.node_id;
308                 const msg: number = obj.msg;
309                 const msg_hu_conv: ReplyChannelRange = new ReplyChannelRange(null, msg);
310                         msg_hu_conv.ptrs_to.add(this);
311                 this.msg = msg_hu_conv;
312         }
313 }
314         public MessageSendEvent clone() {
315                 number ret = bindings.MessageSendEvent_clone(this.ptr);
316                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
317                 ret_hu_conv.ptrs_to.add(this);
318                 return ret_hu_conv;
319         }
320
321 }