X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fstructs%2FChainMonitor.ts;h=e65e42be81c56de272c0fb3ca3f733e513971998;hb=0fee03a8095f5599f8eccd920c1b1af6b3a20260;hp=09cf312662f1e7812b7bf5ab5d917d61c30434cb;hpb=6f84978154512148a47502caad48038e3f264392;p=ldk-java diff --git a/ts/structs/ChainMonitor.ts b/ts/structs/ChainMonitor.ts index 09cf3126..e65e42be 100644 --- a/ts/structs/ChainMonitor.ts +++ b/ts/structs/ChainMonitor.ts @@ -18,42 +18,65 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.ChainMonitor_free(this.ptr); } } - public void block_connected(Uint8Array header, TwoTuple[] txdata, number height) { - 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); - /* TODO 2 TwoTuple */; + public static ChainMonitor constructor_new(Option_FilterZ chain_source, BroadcasterInterface broadcaster, Logger logger, FeeEstimator feeest, Persist persister) { + 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); + const ret_hu_conv: ChainMonitor = new ChainMonitor(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + ret_hu_conv.ptrs_to.add(chain_source); + ret_hu_conv.ptrs_to.add(broadcaster); + ret_hu_conv.ptrs_to.add(logger); + ret_hu_conv.ptrs_to.add(feeest); + ret_hu_conv.ptrs_to.add(persister); + return ret_hu_conv; } - public void transactions_confirmed(Uint8Array header, TwoTuple[] txdata, number height) { - bindings.ChainMonitor_transactions_confirmed(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); - /* TODO 2 TwoTuple */; + public Balance[] get_claimable_balances(ChannelDetails[] ignored_channels) { + 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); + Balance[] ret_conv_9_arr = new Balance[ret.length]; + for (int j = 0; j < ret.length; j++) { + number ret_conv_9 = ret[j]; + Balance ret_conv_9_hu_conv = Balance.constr_from_ptr(ret_conv_9); + ret_conv_9_hu_conv.ptrs_to.add(this); + ret_conv_9_arr[j] = ret_conv_9_hu_conv; + } + return ret_conv_9_arr; } - public void update_best_block(Uint8Array header, number height) { - bindings.ChainMonitor_update_best_block(this.ptr, header, height); + public Result_LockedChannelMonitorNoneZ get_monitor(OutPoint funding_txo) { + number ret = bindings.ChainMonitor_get_monitor(this.ptr, funding_txo == null ? 0 : funding_txo.ptr & ~1); + Result_LockedChannelMonitorNoneZ ret_hu_conv = Result_LockedChannelMonitorNoneZ.constr_from_ptr(ret); + return ret_hu_conv; } - public void block_disconnected(Uint8Array header, number disconnected_height) { - bindings.ChainMonitor_block_disconnected(this.ptr, header, disconnected_height); + public OutPoint[] list_monitors() { + number[] ret = bindings.ChainMonitor_list_monitors(this.ptr); + OutPoint[] ret_conv_10_arr = new OutPoint[ret.length]; + for (int k = 0; k < ret.length; k++) { + number ret_conv_10 = ret[k]; + const ret_conv_10_hu_conv: OutPoint = new OutPoint(null, ret_conv_10); + ret_conv_10_hu_conv.ptrs_to.add(this); + ret_conv_10_arr[k] = ret_conv_10_hu_conv; + } + return ret_conv_10_arr; } - public void transaction_unconfirmed(Uint8Array txid) { - bindings.ChainMonitor_transaction_unconfirmed(this.ptr, txid); + public Result_NoneAPIErrorZ channel_monitor_updated(OutPoint funding_txo, MonitorUpdateId completed_update_id) { + 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); + Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; } - public Uint8Array[] get_relevant_txids() { - Uint8Array[] ret = bindings.ChainMonitor_get_relevant_txids(this.ptr); - return ret; + public Listen as_Listen() { + number ret = bindings.ChainMonitor_as_Listen(this.ptr); + Listen ret_hu_conv = new Listen(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; } - public static ChainMonitor constructor_new(Filter chain_source, BroadcasterInterface broadcaster, Logger logger, FeeEstimator feeest, Persist persister) { - 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); - const ret_hu_conv: ChainMonitor = new ChainMonitor(null, ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); - ret_hu_conv.ptrs_to.add(chain_source); - ret_hu_conv.ptrs_to.add(broadcaster); - ret_hu_conv.ptrs_to.add(logger); - ret_hu_conv.ptrs_to.add(feeest); - ret_hu_conv.ptrs_to.add(persister); + public Confirm as_Confirm() { + number ret = bindings.ChainMonitor_as_Confirm(this.ptr); + Confirm ret_hu_conv = new Confirm(null, ret); + ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; }