1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
8 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
9 public class ChainMonitor extends CommonBase {
10 ChainMonitor(Object _dummy, long ptr) { super(ptr); }
11 @Override @SuppressWarnings("deprecation")
12 protected void finalize() throws Throwable {
14 if (ptr != 0) { bindings.ChainMonitor_free(ptr); }
17 public void block_connected(byte[] header, TwoTuple<Long, byte[]>[] txdata, int height) {
18 bindings.ChainMonitor_block_connected(this.ptr, header, Arrays.stream(txdata).mapToLong(arr_conv_24 -> bindings.C2Tuple_usizeTransactionZ_new(arr_conv_24.a, arr_conv_24.b)).toArray(), height);
19 /* TODO 2 TwoTuple<Long, byte[]> */;
22 public void block_disconnected(byte[] header, int disconnected_height) {
23 bindings.ChainMonitor_block_disconnected(this.ptr, header, disconnected_height);
26 public static ChainMonitor constructor_new(Filter chain_source, BroadcasterInterface broadcaster, Logger logger, FeeEstimator feeest) {
27 long ret = bindings.ChainMonitor_new(chain_source == null ? 0 : chain_source.ptr, broadcaster == null ? 0 : broadcaster.ptr, logger == null ? 0 : logger.ptr, feeest == null ? 0 : feeest.ptr);
28 ChainMonitor ret_hu_conv = new ChainMonitor(null, ret);
29 ret_hu_conv.ptrs_to.add(chain_source);
30 ret_hu_conv.ptrs_to.add(broadcaster);
31 ret_hu_conv.ptrs_to.add(logger);
32 ret_hu_conv.ptrs_to.add(feeest);
36 public Watch as_Watch() {
37 long ret = bindings.ChainMonitor_as_Watch(this.ptr);
38 Watch ret_hu_conv = new Watch(null, ret);
39 ret_hu_conv.ptrs_to.add(this);
43 public EventsProvider as_EventsProvider() {
44 long ret = bindings.ChainMonitor_as_EventsProvider(this.ptr);
45 EventsProvider ret_hu_conv = new EventsProvider(null, ret);
46 ret_hu_conv.ptrs_to.add(this);