X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fstructs%2FConfirm.ts;h=c991e83cc6a81defc799fb5a1eff264b770eb8ca;hb=f3e670e9341decac613d33fc52febf19cea32f20;hp=26d0a1829d9275dda3e71f44ebd4b6f7dbd8680b;hpb=b0c50b891cbca28d3bd1d86276c132ff5221d8e4;p=ldk-java diff --git a/ts/structs/Confirm.ts b/ts/structs/Confirm.ts index 26d0a182..c991e83c 100644 --- a/ts/structs/Confirm.ts +++ b/ts/structs/Confirm.ts @@ -33,17 +33,14 @@ import * as bindings from '../bindings' // TODO: figure out location let structImplementation = { // todo: in-line interface filling transactions_confirmed (header: Uint8Array, txdata: number[], height: number): void { - TwoTuple[] txdata_conv_30_arr = new TwoTuple[txdata.length]; - for (int e = 0; e < txdata.length; e++) { - number txdata_conv_30 = txdata[e]; - number txdata_conv_30_a = bindings.LDKC2Tuple_usizeTransactionZ_get_a(txdata_conv_30); - Uint8Array txdata_conv_30_b = bindings.LDKC2Tuple_usizeTransactionZ_get_b(txdata_conv_30); - TwoTuple txdata_conv_30_conv = new TwoTuple(txdata_conv_30_a, txdata_conv_30_b, () -> { - bindings.C2Tuple_usizeTransactionZ_free(txdata_conv_30); - }); - txdata_conv_30_arr[e] = txdata_conv_30_conv; + TwoTuple_usizeTransactionZ[] txdata_conv_28_arr = new TwoTuple_usizeTransactionZ[txdata.length]; + for (int c = 0; c < txdata.length; c++) { + number txdata_conv_28 = txdata[c]; + TwoTuple_usizeTransactionZ txdata_conv_28_hu_conv = new TwoTuple_usizeTransactionZ(null, txdata_conv_28); + txdata_conv_28_hu_conv.ptrs_to.add(this); + txdata_conv_28_arr[c] = txdata_conv_28_hu_conv; } - arg.transactions_confirmed(header, txdata_conv_30_arr, height); + arg.transactions_confirmed(header, txdata_conv_28_arr, height); }, transaction_unconfirmed (txid: Uint8Array): void { @@ -56,7 +53,8 @@ import * as bindings from '../bindings' // TODO: figure out location get_relevant_txids (): Uint8Array[] { Uint8Array[] ret = arg.get_relevant_txids(); - return ret; + result: Uint8Array[] = ret != null ? Arrays.stream(ret).map(ret_conv_12 -> InternalUtils.check_arr_len(ret_conv_12, 32)).toArray(Uint8Array[]::new) : null; + return result; }, @@ -66,7 +64,7 @@ import * as bindings from '../bindings' // TODO: figure out location } export interface ConfirmInterface { - transactions_confirmed(header: Uint8Array, txdata: TwoTuple[], height: number): void; + transactions_confirmed(header: Uint8Array, txdata: TwoTuple_usizeTransactionZ[], height: number): void; transaction_unconfirmed(txid: Uint8Array): void; best_block_updated(header: Uint8Array, height: number): void; get_relevant_txids(): Uint8Array[]; @@ -76,17 +74,16 @@ import * as bindings from '../bindings' // TODO: figure out location class LDKConfirmHolder { held: Confirm; } - public void transactions_confirmed(Uint8Array header, TwoTuple[] txdata, number height) { - bindings.Confirm_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 void transactions_confirmed(Uint8Array header, TwoTuple_usizeTransactionZ[] txdata, number height) { + bindings.Confirm_transactions_confirmed(this.ptr, InternalUtils.check_arr_len(header, 80), txdata != null ? Arrays.stream(txdata).map(txdata_conv_28 -> txdata_conv_28 != null ? txdata_conv_28.ptr : 0).toArray(number[]::new) : null, height); } public void transaction_unconfirmed(Uint8Array txid) { - bindings.Confirm_transaction_unconfirmed(this.ptr, txid); + bindings.Confirm_transaction_unconfirmed(this.ptr, InternalUtils.check_arr_len(txid, 32)); } public void best_block_updated(Uint8Array header, number height) { - bindings.Confirm_best_block_updated(this.ptr, header, height); + bindings.Confirm_best_block_updated(this.ptr, InternalUtils.check_arr_len(header, 80), height); } public Uint8Array[] get_relevant_txids() {