Update auto-generated bindings
[ldk-java] / ts / structs / ChainMonitor.ts
1
2             
3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
5
6
7
8             export default class ChainMonitor extends CommonBase {
9                 constructor(_dummy: object, ptr: number) {
10                     super(ptr);
11                 }
12
13                 
14                 protected finalize() {
15                     super.finalize();
16
17                     if (this.ptr != 0) {
18                         bindings.ChainMonitor_free(this.ptr);
19                     }
20                 }
21         public static ChainMonitor constructor_new(Option_FilterZ chain_source, BroadcasterInterface broadcaster, Logger logger, FeeEstimator feeest, Persist persister) {
22                 number ret = bindings.ChainMonitor_new(chain_source.ptr, broadcaster == null ? 0 : broadcaster.ptr, logger == null ? 0 : logger.ptr, feeest == null ? 0 : feeest.ptr, persister == null ? 0 : persister.ptr);
23                 const ret_hu_conv: ChainMonitor = new ChainMonitor(null, ret);
24                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
25                 ret_hu_conv.ptrs_to.add(chain_source);
26                 ret_hu_conv.ptrs_to.add(broadcaster);
27                 ret_hu_conv.ptrs_to.add(logger);
28                 ret_hu_conv.ptrs_to.add(feeest);
29                 ret_hu_conv.ptrs_to.add(persister);
30                 return ret_hu_conv;
31         }
32
33         public Balance[] get_claimable_balances(ChannelDetails[] ignored_channels) {
34                 number[] ret = bindings.ChainMonitor_get_claimable_balances(this.ptr, ignored_channels != null ? Arrays.stream(ignored_channels).map(ignored_channels_conv_16 -> ignored_channels_conv_16 == null ? 0 : ignored_channels_conv_16.ptr & ~1).toArray(number[]::new) : null);
35                 Balance[] ret_conv_9_arr = new Balance[ret.length];
36                 for (int j = 0; j < ret.length; j++) {
37                         number ret_conv_9 = ret[j];
38                         Balance ret_conv_9_hu_conv = Balance.constr_from_ptr(ret_conv_9);
39                         ret_conv_9_hu_conv.ptrs_to.add(this);
40                         ret_conv_9_arr[j] = ret_conv_9_hu_conv;
41                 }
42                 return ret_conv_9_arr;
43         }
44
45         public Result_LockedChannelMonitorNoneZ get_monitor(OutPoint funding_txo) {
46                 number ret = bindings.ChainMonitor_get_monitor(this.ptr, funding_txo == null ? 0 : funding_txo.ptr & ~1);
47                 Result_LockedChannelMonitorNoneZ ret_hu_conv = Result_LockedChannelMonitorNoneZ.constr_from_ptr(ret);
48                 return ret_hu_conv;
49         }
50
51         public OutPoint[] list_monitors() {
52                 number[] ret = bindings.ChainMonitor_list_monitors(this.ptr);
53                 OutPoint[] ret_conv_10_arr = new OutPoint[ret.length];
54                 for (int k = 0; k < ret.length; k++) {
55                         number ret_conv_10 = ret[k];
56                         const ret_conv_10_hu_conv: OutPoint = new OutPoint(null, ret_conv_10);
57                         ret_conv_10_hu_conv.ptrs_to.add(this);
58                         ret_conv_10_arr[k] = ret_conv_10_hu_conv;
59                 }
60                 return ret_conv_10_arr;
61         }
62
63         public Result_NoneAPIErrorZ channel_monitor_updated(OutPoint funding_txo, MonitorUpdateId completed_update_id) {
64                 number ret = bindings.ChainMonitor_channel_monitor_updated(this.ptr, funding_txo == null ? 0 : funding_txo.ptr & ~1, completed_update_id == null ? 0 : completed_update_id.ptr & ~1);
65                 Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret);
66                 return ret_hu_conv;
67         }
68
69         public Listen as_Listen() {
70                 number ret = bindings.ChainMonitor_as_Listen(this.ptr);
71                 Listen ret_hu_conv = new Listen(null, ret);
72                 ret_hu_conv.ptrs_to.add(this);
73                 return ret_hu_conv;
74         }
75
76         public Confirm as_Confirm() {
77                 number ret = bindings.ChainMonitor_as_Confirm(this.ptr);
78                 Confirm ret_hu_conv = new Confirm(null, ret);
79                 ret_hu_conv.ptrs_to.add(this);
80                 return ret_hu_conv;
81         }
82
83         public Watch as_Watch() {
84                 number ret = bindings.ChainMonitor_as_Watch(this.ptr);
85                 Watch ret_hu_conv = new Watch(null, ret);
86                 ret_hu_conv.ptrs_to.add(this);
87                 return ret_hu_conv;
88         }
89
90         public EventsProvider as_EventsProvider() {
91                 number ret = bindings.ChainMonitor_as_EventsProvider(this.ptr);
92                 EventsProvider ret_hu_conv = new EventsProvider(null, ret);
93                 ret_hu_conv.ptrs_to.add(this);
94                 return ret_hu_conv;
95         }
96
97 }