3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export default class ChainMonitor extends CommonBase {
9 constructor(_dummy: object, ptr: number) {
14 protected finalize() {
18 bindings.ChainMonitor_free(this.ptr);
21 public void block_connected(Uint8Array header, TwoTuple<Number, Uint8Array>[] txdata, number height) {
22 bindings.ChainMonitor_block_connected(this.ptr, header, Arrays.stream(txdata).map(txdata_conv_30 -> bindings.C2Tuple_usizeTransactionZ_new(txdata_conv_30.a, txdata_conv_30.b)).toArray(number[]::new), height);
23 /* TODO 2 TwoTuple<Number, Uint8Array> */;
26 public void block_disconnected(Uint8Array header, number disconnected_height) {
27 bindings.ChainMonitor_block_disconnected(this.ptr, header, disconnected_height);
30 public static ChainMonitor constructor_new(Filter chain_source, BroadcasterInterface broadcaster, Logger logger, FeeEstimator feeest, Persist persister) {
31 number 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, persister == null ? 0 : persister.ptr);
32 const ret_hu_conv: ChainMonitor = new ChainMonitor(null, ret);
33 ret_hu_conv.ptrs_to.add(ret_hu_conv);
34 ret_hu_conv.ptrs_to.add(chain_source);
35 ret_hu_conv.ptrs_to.add(broadcaster);
36 ret_hu_conv.ptrs_to.add(logger);
37 ret_hu_conv.ptrs_to.add(feeest);
38 ret_hu_conv.ptrs_to.add(persister);
42 public Watch as_Watch() {
43 number ret = bindings.ChainMonitor_as_Watch(this.ptr);
44 Watch ret_hu_conv = new Watch(null, ret);
45 ret_hu_conv.ptrs_to.add(this);
49 public EventsProvider as_EventsProvider() {
50 number ret = bindings.ChainMonitor_as_EventsProvider(this.ptr);
51 EventsProvider ret_hu_conv = new EventsProvider(null, ret);
52 ret_hu_conv.ptrs_to.add(this);