Update auto-generated bindings
[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.HandleError) {
56                         return new HandleError(this.ptr, raw_val);
57                 }
58                 if (raw_val instanceof bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate) {
59                         return new PaymentFailureNetworkUpdate(this.ptr, raw_val);
60                 }
61                 if (raw_val instanceof bindings.LDKMessageSendEvent.SendChannelRangeQuery) {
62                         return new SendChannelRangeQuery(this.ptr, raw_val);
63                 }
64                 if (raw_val instanceof bindings.LDKMessageSendEvent.SendShortIdsQuery) {
65                         return new SendShortIdsQuery(this.ptr, raw_val);
66                 }
67                 if (raw_val instanceof bindings.LDKMessageSendEvent.SendReplyChannelRange) {
68                         return new SendReplyChannelRange(this.ptr, raw_val);
69                 }
70                 throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
71         }
72
73 }
74 export class SendAcceptChannel extends MessageSendEvent {
75         public node_id: Uint8Array;
76         public msg: AcceptChannel;
77         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendAcceptChannel) {
78                 super(null, ptr);
79                 this.node_id = obj.node_id;
80                 const msg: number = obj.msg;
81                 const msg_hu_conv: AcceptChannel = new AcceptChannel(null, msg);
82                         msg_hu_conv.ptrs_to.add(this);
83                 this.msg = msg_hu_conv;
84         }
85 }
86 export class SendOpenChannel extends MessageSendEvent {
87         public node_id: Uint8Array;
88         public msg: OpenChannel;
89         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendOpenChannel) {
90                 super(null, ptr);
91                 this.node_id = obj.node_id;
92                 const msg: number = obj.msg;
93                 const msg_hu_conv: OpenChannel = new OpenChannel(null, msg);
94                         msg_hu_conv.ptrs_to.add(this);
95                 this.msg = msg_hu_conv;
96         }
97 }
98 export class SendFundingCreated extends MessageSendEvent {
99         public node_id: Uint8Array;
100         public msg: FundingCreated;
101         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendFundingCreated) {
102                 super(null, ptr);
103                 this.node_id = obj.node_id;
104                 const msg: number = obj.msg;
105                 const msg_hu_conv: FundingCreated = new FundingCreated(null, msg);
106                         msg_hu_conv.ptrs_to.add(this);
107                 this.msg = msg_hu_conv;
108         }
109 }
110 export class SendFundingSigned extends MessageSendEvent {
111         public node_id: Uint8Array;
112         public msg: FundingSigned;
113         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendFundingSigned) {
114                 super(null, ptr);
115                 this.node_id = obj.node_id;
116                 const msg: number = obj.msg;
117                 const msg_hu_conv: FundingSigned = new FundingSigned(null, msg);
118                         msg_hu_conv.ptrs_to.add(this);
119                 this.msg = msg_hu_conv;
120         }
121 }
122 export class SendFundingLocked extends MessageSendEvent {
123         public node_id: Uint8Array;
124         public msg: FundingLocked;
125         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendFundingLocked) {
126                 super(null, ptr);
127                 this.node_id = obj.node_id;
128                 const msg: number = obj.msg;
129                 const msg_hu_conv: FundingLocked = new FundingLocked(null, msg);
130                         msg_hu_conv.ptrs_to.add(this);
131                 this.msg = msg_hu_conv;
132         }
133 }
134 export class SendAnnouncementSignatures extends MessageSendEvent {
135         public node_id: Uint8Array;
136         public msg: AnnouncementSignatures;
137         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendAnnouncementSignatures) {
138                 super(null, ptr);
139                 this.node_id = obj.node_id;
140                 const msg: number = obj.msg;
141                 const msg_hu_conv: AnnouncementSignatures = new AnnouncementSignatures(null, msg);
142                         msg_hu_conv.ptrs_to.add(this);
143                 this.msg = msg_hu_conv;
144         }
145 }
146 export class UpdateHTLCs extends MessageSendEvent {
147         public node_id: Uint8Array;
148         public updates: CommitmentUpdate;
149         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.UpdateHTLCs) {
150                 super(null, ptr);
151                 this.node_id = obj.node_id;
152                 const updates: number = obj.updates;
153                 const updates_hu_conv: CommitmentUpdate = new CommitmentUpdate(null, updates);
154                         updates_hu_conv.ptrs_to.add(this);
155                 this.updates = updates_hu_conv;
156         }
157 }
158 export class SendRevokeAndACK extends MessageSendEvent {
159         public node_id: Uint8Array;
160         public msg: RevokeAndACK;
161         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendRevokeAndACK) {
162                 super(null, ptr);
163                 this.node_id = obj.node_id;
164                 const msg: number = obj.msg;
165                 const msg_hu_conv: RevokeAndACK = new RevokeAndACK(null, msg);
166                         msg_hu_conv.ptrs_to.add(this);
167                 this.msg = msg_hu_conv;
168         }
169 }
170 export class SendClosingSigned extends MessageSendEvent {
171         public node_id: Uint8Array;
172         public msg: ClosingSigned;
173         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendClosingSigned) {
174                 super(null, ptr);
175                 this.node_id = obj.node_id;
176                 const msg: number = obj.msg;
177                 const msg_hu_conv: ClosingSigned = new ClosingSigned(null, msg);
178                         msg_hu_conv.ptrs_to.add(this);
179                 this.msg = msg_hu_conv;
180         }
181 }
182 export class SendShutdown extends MessageSendEvent {
183         public node_id: Uint8Array;
184         public msg: Shutdown;
185         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendShutdown) {
186                 super(null, ptr);
187                 this.node_id = obj.node_id;
188                 const msg: number = obj.msg;
189                 const msg_hu_conv: Shutdown = new Shutdown(null, msg);
190                         msg_hu_conv.ptrs_to.add(this);
191                 this.msg = msg_hu_conv;
192         }
193 }
194 export class SendChannelReestablish extends MessageSendEvent {
195         public node_id: Uint8Array;
196         public msg: ChannelReestablish;
197         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendChannelReestablish) {
198                 super(null, ptr);
199                 this.node_id = obj.node_id;
200                 const msg: number = obj.msg;
201                 const msg_hu_conv: ChannelReestablish = new ChannelReestablish(null, msg);
202                         msg_hu_conv.ptrs_to.add(this);
203                 this.msg = msg_hu_conv;
204         }
205 }
206 export class BroadcastChannelAnnouncement extends MessageSendEvent {
207         public msg: ChannelAnnouncement;
208         public update_msg: ChannelUpdate;
209         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement) {
210                 super(null, ptr);
211                 const msg: number = obj.msg;
212                 const msg_hu_conv: ChannelAnnouncement = new ChannelAnnouncement(null, msg);
213                         msg_hu_conv.ptrs_to.add(this);
214                 this.msg = msg_hu_conv;
215                 const update_msg: number = obj.update_msg;
216                 const update_msg_hu_conv: ChannelUpdate = new ChannelUpdate(null, update_msg);
217                         update_msg_hu_conv.ptrs_to.add(this);
218                 this.update_msg = update_msg_hu_conv;
219         }
220 }
221 export class BroadcastNodeAnnouncement extends MessageSendEvent {
222         public msg: NodeAnnouncement;
223         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement) {
224                 super(null, ptr);
225                 const msg: number = obj.msg;
226                 const msg_hu_conv: NodeAnnouncement = new NodeAnnouncement(null, msg);
227                         msg_hu_conv.ptrs_to.add(this);
228                 this.msg = msg_hu_conv;
229         }
230 }
231 export class BroadcastChannelUpdate extends MessageSendEvent {
232         public msg: ChannelUpdate;
233         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.BroadcastChannelUpdate) {
234                 super(null, ptr);
235                 const msg: number = obj.msg;
236                 const msg_hu_conv: ChannelUpdate = new ChannelUpdate(null, msg);
237                         msg_hu_conv.ptrs_to.add(this);
238                 this.msg = msg_hu_conv;
239         }
240 }
241 export class HandleError extends MessageSendEvent {
242         public node_id: Uint8Array;
243         public action: ErrorAction;
244         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.HandleError) {
245                 super(null, ptr);
246                 this.node_id = obj.node_id;
247                 const action: number = obj.action;
248                 ErrorAction action_hu_conv = ErrorAction.constr_from_ptr(action);
249                         action_hu_conv.ptrs_to.add(this);
250                 this.action = action_hu_conv;
251         }
252 }
253 export class PaymentFailureNetworkUpdate extends MessageSendEvent {
254         public update: HTLCFailChannelUpdate;
255         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate) {
256                 super(null, ptr);
257                 const update: number = obj.update;
258                 HTLCFailChannelUpdate update_hu_conv = HTLCFailChannelUpdate.constr_from_ptr(update);
259                         update_hu_conv.ptrs_to.add(this);
260                 this.update = update_hu_conv;
261         }
262 }
263 export class SendChannelRangeQuery extends MessageSendEvent {
264         public node_id: Uint8Array;
265         public msg: QueryChannelRange;
266         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendChannelRangeQuery) {
267                 super(null, ptr);
268                 this.node_id = obj.node_id;
269                 const msg: number = obj.msg;
270                 const msg_hu_conv: QueryChannelRange = new QueryChannelRange(null, msg);
271                         msg_hu_conv.ptrs_to.add(this);
272                 this.msg = msg_hu_conv;
273         }
274 }
275 export class SendShortIdsQuery extends MessageSendEvent {
276         public node_id: Uint8Array;
277         public msg: QueryShortChannelIds;
278         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendShortIdsQuery) {
279                 super(null, ptr);
280                 this.node_id = obj.node_id;
281                 const msg: number = obj.msg;
282                 const msg_hu_conv: QueryShortChannelIds = new QueryShortChannelIds(null, msg);
283                         msg_hu_conv.ptrs_to.add(this);
284                 this.msg = msg_hu_conv;
285         }
286 }
287 export class SendReplyChannelRange extends MessageSendEvent {
288         public node_id: Uint8Array;
289         public msg: ReplyChannelRange;
290         private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendReplyChannelRange) {
291                 super(null, ptr);
292                 this.node_id = obj.node_id;
293                 const msg: number = obj.msg;
294                 const msg_hu_conv: ReplyChannelRange = new ReplyChannelRange(null, msg);
295                         msg_hu_conv.ptrs_to.add(this);
296                 this.msg = msg_hu_conv;
297         }
298 }
299         public MessageSendEvent clone() {
300                 number ret = bindings.MessageSendEvent_clone(this.ptr);
301                 MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
302                 ret_hu_conv.ptrs_to.add(this);
303                 return ret_hu_conv;
304         }
305
306 }