Update auto-generated bindings to 0.0.103
[ldk-java] / ts / structs / Persist.ts
1
2             
3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
5
6
7
8             export class Persist extends CommonBase {
9
10                 bindings_instance?: bindings.LDKPersist;
11
12                 constructor(ptr?: number, arg?: bindings.LDKPersist) {
13                     if (Number.isFinite(ptr)) {
14                                         super(ptr);
15                                         this.bindings_instance = null;
16                                     } else {
17                                         // TODO: private constructor instantiation
18                                         super(bindings.LDKPersist_new(arg));
19                                         this.ptrs_to.push(arg);
20                                         
21                                     }
22                 }
23
24                 protected finalize() {
25                     if (this.ptr != 0) {
26                         bindings.Persist_free(this.ptr);
27                     }
28                     super.finalize();
29                 }
30
31                 static new_impl(arg: PersistInterface): Persist {
32                     const impl_holder: LDKPersistHolder = new LDKPersistHolder();
33                     let structImplementation = <bindings.LDKPersist>{
34                         // todo: in-line interface filling
35                         persist_new_channel (channel_id: number, data: number, update_id: number): number {
36                                                         const channel_id_hu_conv: OutPoint = new OutPoint(null, channel_id);
37                                 channel_id_hu_conv.ptrs_to.add(this);
38                                                         const data_hu_conv: ChannelMonitor = new ChannelMonitor(null, data);
39                                                         const update_id_hu_conv: MonitorUpdateId = new MonitorUpdateId(null, update_id);
40                                 update_id_hu_conv.ptrs_to.add(this);
41                                                         Result_NoneChannelMonitorUpdateErrZ ret = arg.persist_new_channel(channel_id_hu_conv, data_hu_conv, update_id_hu_conv);
42                                 result: number = ret != null ? ret.ptr : 0;
43                                 return result;
44                                                 },
45
46                                                 update_persisted_channel (channel_id: number, update: number, data: number, update_id: number): number {
47                                                         const channel_id_hu_conv: OutPoint = new OutPoint(null, channel_id);
48                                 channel_id_hu_conv.ptrs_to.add(this);
49                                                         const update_hu_conv: ChannelMonitorUpdate = new ChannelMonitorUpdate(null, update);
50                                                         const data_hu_conv: ChannelMonitor = new ChannelMonitor(null, data);
51                                                         const update_id_hu_conv: MonitorUpdateId = new MonitorUpdateId(null, update_id);
52                                 update_id_hu_conv.ptrs_to.add(this);
53                                                         Result_NoneChannelMonitorUpdateErrZ ret = arg.update_persisted_channel(channel_id_hu_conv, update_hu_conv, data_hu_conv, update_id_hu_conv);
54                                 result: number = ret != null ? ret.ptr : 0;
55                                 return result;
56                                                 },
57
58                                                 
59                     };
60                     impl_holder.held = new Persist (null, structImplementation);
61                 }
62             }
63
64             export interface PersistInterface {
65                 persist_new_channel(channel_id: OutPoint, data: ChannelMonitor, update_id: MonitorUpdateId): Result_NoneChannelMonitorUpdateErrZ;
66                                 update_persisted_channel(channel_id: OutPoint, update: ChannelMonitorUpdate, data: ChannelMonitor, update_id: MonitorUpdateId): Result_NoneChannelMonitorUpdateErrZ;
67                                 
68             }
69
70             class LDKPersistHolder {
71                 held: Persist;
72             }
73         public Result_NoneChannelMonitorUpdateErrZ persist_new_channel(OutPoint channel_id, ChannelMonitor data, MonitorUpdateId update_id) {
74                 number ret = bindings.Persist_persist_new_channel(this.ptr, channel_id == null ? 0 : channel_id.ptr & ~1, data == null ? 0 : data.ptr & ~1, update_id == null ? 0 : update_id.ptr & ~1);
75                 Result_NoneChannelMonitorUpdateErrZ ret_hu_conv = Result_NoneChannelMonitorUpdateErrZ.constr_from_ptr(ret);
76                 this.ptrs_to.add(data);
77                 return ret_hu_conv;
78         }
79
80         public Result_NoneChannelMonitorUpdateErrZ update_persisted_channel(OutPoint channel_id, ChannelMonitorUpdate update, ChannelMonitor data, MonitorUpdateId update_id) {
81                 number ret = bindings.Persist_update_persisted_channel(this.ptr, channel_id == null ? 0 : channel_id.ptr & ~1, update == null ? 0 : update.ptr & ~1, data == null ? 0 : data.ptr & ~1, update_id == null ? 0 : update_id.ptr & ~1);
82                 Result_NoneChannelMonitorUpdateErrZ ret_hu_conv = Result_NoneChannelMonitorUpdateErrZ.constr_from_ptr(ret);
83                 this.ptrs_to.add(update);
84                 this.ptrs_to.add(data);
85                 return ret_hu_conv;
86         }
87
88 }