X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fstructs%2FChannelMonitor.ts;fp=ts%2Fstructs%2FChannelMonitor.ts;h=a2f5913795d4596a1dd5fde138ce8631b922a384;hb=246459dcbc3be28c38b4951140a5933f4b3aa024;hp=ff746a206aa4d6710141f5d54ecf94f242e4c55e;hpb=b52dde859c138f9257499496749d1eb89f9f6f43;p=ldk-java diff --git a/ts/structs/ChannelMonitor.ts b/ts/structs/ChannelMonitor.ts index ff746a20..a2f59137 100644 --- a/ts/structs/ChannelMonitor.ts +++ b/ts/structs/ChannelMonitor.ts @@ -60,26 +60,26 @@ import * as bindings from '../bindings' // TODO: figure out location public MonitorEvent[] get_and_clear_pending_monitor_events() { number[] ret = bindings.ChannelMonitor_get_and_clear_pending_monitor_events(this.ptr); - MonitorEvent[] arr_conv_14_arr = new MonitorEvent[ret.length]; + MonitorEvent[] ret_conv_14_arr = new MonitorEvent[ret.length]; for (int o = 0; o < ret.length; o++) { - number arr_conv_14 = ret[o]; - const arr_conv_14_hu_conv: MonitorEvent = new MonitorEvent(null, arr_conv_14); - arr_conv_14_hu_conv.ptrs_to.add(this); - arr_conv_14_arr[o] = arr_conv_14_hu_conv; + number ret_conv_14 = ret[o]; + MonitorEvent ret_conv_14_hu_conv = MonitorEvent.constr_from_ptr(ret_conv_14); + ret_conv_14_hu_conv.ptrs_to.add(this); + ret_conv_14_arr[o] = ret_conv_14_hu_conv; } - return arr_conv_14_arr; + return ret_conv_14_arr; } public Event[] get_and_clear_pending_events() { number[] ret = bindings.ChannelMonitor_get_and_clear_pending_events(this.ptr); - Event[] arr_conv_7_arr = new Event[ret.length]; + Event[] ret_conv_7_arr = new Event[ret.length]; for (int h = 0; h < ret.length; h++) { - number arr_conv_7 = ret[h]; - Event arr_conv_7_hu_conv = Event.constr_from_ptr(arr_conv_7); - arr_conv_7_hu_conv.ptrs_to.add(this); - arr_conv_7_arr[h] = arr_conv_7_hu_conv; + number ret_conv_7 = ret[h]; + Event ret_conv_7_hu_conv = Event.constr_from_ptr(ret_conv_7); + ret_conv_7_hu_conv.ptrs_to.add(this); + ret_conv_7_arr[h] = ret_conv_7_hu_conv; } - return arr_conv_7_arr; + return ret_conv_7_arr; } public Uint8Array[] get_latest_holder_commitment_txn(Logger logger) { @@ -89,33 +89,33 @@ import * as bindings from '../bindings' // TODO: figure out location } public TwoTuple[]>[] block_connected(Uint8Array header, TwoTuple[] txdata, number height, BroadcasterInterface broadcaster, FeeEstimator fee_estimator, Logger logger) { - number[] ret = bindings.ChannelMonitor_block_connected(this.ptr, header, (number[])Arrays.stream(txdata).map(arr_conv_30 -> bindings.C2Tuple_usizeTransactionZ_new(arr_conv_30.a, arr_conv_30.b)).toArray(), height, broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); - TwoTuple[]>[] arr_conv_49_arr = new TwoTuple[ret.length]; + number[] ret = bindings.ChannelMonitor_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, broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); + TwoTuple[]>[] ret_conv_49_arr = new TwoTuple[ret.length]; for (int x = 0; x < ret.length; x++) { - number arr_conv_49 = ret[x]; - Uint8Array arr_conv_49_a = bindings.LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(arr_conv_49); - number[] arr_conv_49_b = bindings.LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(arr_conv_49); - TwoTuple[] arr_conv_25_arr = new TwoTuple[arr_conv_49_b.length]; - for (int z = 0; z < arr_conv_49_b.length; z++) { - number arr_conv_25 = arr_conv_49_b[z]; - number arr_conv_25_a = bindings.LDKC2Tuple_u32TxOutZ_get_a(arr_conv_25); - number arr_conv_25_b = bindings.TxOut_clone(bindings.LDKC2Tuple_u32TxOutZ_get_b(arr_conv_25)); - TxOut arr_conv_25_b_conv = new TxOut(null, arr_conv_25_b);; - TwoTuple arr_conv_25_conv = new TwoTuple(arr_conv_25_a, arr_conv_25_b_conv, () -> { - bindings.C2Tuple_u32TxOutZ_free(arr_conv_25); + number ret_conv_49 = ret[x]; + Uint8Array ret_conv_49_a = bindings.LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(ret_conv_49); + number[] ret_conv_49_b = bindings.LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(ret_conv_49); + TwoTuple[] ret_conv_49_b_conv_25_arr = new TwoTuple[ret_conv_49_b.length]; + for (int z = 0; z < ret_conv_49_b.length; z++) { + number ret_conv_49_b_conv_25 = ret_conv_49_b[z]; + number ret_conv_49_b_conv_25_a = bindings.LDKC2Tuple_u32TxOutZ_get_a(ret_conv_49_b_conv_25); + number ret_conv_49_b_conv_25_b = bindings.TxOut_clone(bindings.LDKC2Tuple_u32TxOutZ_get_b(ret_conv_49_b_conv_25)); + TxOut ret_conv_49_b_conv_25_b_conv = new TxOut(null, ret_conv_49_b_conv_25_b);; + TwoTuple ret_conv_49_b_conv_25_conv = new TwoTuple(ret_conv_49_b_conv_25_a, ret_conv_49_b_conv_25_b_conv, () -> { + bindings.C2Tuple_u32TxOutZ_free(ret_conv_49_b_conv_25); }); - arr_conv_25_b_conv.ptrs_to.add(arr_conv_25_conv); - arr_conv_25_arr[z] = arr_conv_25_conv; + ret_conv_49_b_conv_25_b_conv.ptrs_to.add(ret_conv_49_b_conv_25_conv); + ret_conv_49_b_conv_25_arr[z] = ret_conv_49_b_conv_25_conv; }; - TwoTuple[]> arr_conv_49_conv = new TwoTuple[]>(arr_conv_49_a, arr_conv_25_arr); + TwoTuple[]> ret_conv_49_conv = new TwoTuple[]>(ret_conv_49_a, ret_conv_49_b_conv_25_arr); // Warning: We may not free the C tuple object! - arr_conv_49_arr[x] = arr_conv_49_conv; + ret_conv_49_arr[x] = ret_conv_49_conv; } /* TODO 2 TwoTuple */; this.ptrs_to.add(broadcaster); this.ptrs_to.add(fee_estimator); this.ptrs_to.add(logger); - return arr_conv_49_arr; + return ret_conv_49_arr; } public void block_disconnected(Uint8Array header, number height, BroadcasterInterface broadcaster, FeeEstimator fee_estimator, Logger logger) {