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