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