X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fstructs%2FTrustedCommitmentTransaction.ts;h=09248f42ff1ccd5ff964dc72b166c88bfa91cdfa;hb=f3e670e9341decac613d33fc52febf19cea32f20;hp=1d0fc4ae860a717ff85e1d130ae4b81e8c28fb97;hpb=822471992c6bf6f9985e531cc5940e4cc35e3e4c;p=ldk-java diff --git a/ts/structs/TrustedCommitmentTransaction.ts b/ts/structs/TrustedCommitmentTransaction.ts index 1d0fc4ae..09248f42 100644 --- a/ts/structs/TrustedCommitmentTransaction.ts +++ b/ts/structs/TrustedCommitmentTransaction.ts @@ -1,34 +1,44 @@ + import CommonBase from './CommonBase'; import * as bindings from '../bindings' // TODO: figure out location -public class TrustedCommitmentTransaction extends CommonBase { - TrustedCommitmentTransaction(Object _dummy, long ptr) { super(ptr); } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - super.finalize(); - if (ptr != 0) { bindings.TrustedCommitmentTransaction_free(ptr); } - } - public byte[] txid() { - byte[] ret = bindings.TrustedCommitmentTransaction_txid(this.ptr); + + export default class TrustedCommitmentTransaction extends CommonBase { + constructor(_dummy: object, ptr: number) { + super(ptr); + } + + + protected finalize() { + super.finalize(); + + if (this.ptr != 0) { + bindings.TrustedCommitmentTransaction_free(this.ptr); + } + } + public Uint8Array txid() { + Uint8Array ret = bindings.TrustedCommitmentTransaction_txid(this.ptr); return ret; } public BuiltCommitmentTransaction built_transaction() { - uint32_t ret = bindings.TrustedCommitmentTransaction_built_transaction(this.ptr); - BuiltCommitmentTransaction ret_hu_conv = new BuiltCommitmentTransaction(null, ret); + number ret = bindings.TrustedCommitmentTransaction_built_transaction(this.ptr); + const ret_hu_conv: BuiltCommitmentTransaction = new BuiltCommitmentTransaction(null, ret); + ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } public TxCreationKeys keys() { - uint32_t ret = bindings.TrustedCommitmentTransaction_keys(this.ptr); - TxCreationKeys ret_hu_conv = new TxCreationKeys(null, ret); + number ret = bindings.TrustedCommitmentTransaction_keys(this.ptr); + const ret_hu_conv: TxCreationKeys = new TxCreationKeys(null, ret); + ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } - public Result_CVec_SignatureZNoneZ get_htlc_sigs(byte[] htlc_base_key, DirectedChannelTransactionParameters channel_parameters) { - uint32_t ret = bindings.TrustedCommitmentTransaction_get_htlc_sigs(this.ptr, htlc_base_key, channel_parameters == null ? 0 : channel_parameters.ptr & ~1); + public Result_CVec_SignatureZNoneZ get_htlc_sigs(Uint8Array htlc_base_key, DirectedChannelTransactionParameters channel_parameters) { + number ret = bindings.TrustedCommitmentTransaction_get_htlc_sigs(this.ptr, InternalUtils.check_arr_len(htlc_base_key, 32), channel_parameters == null ? 0 : channel_parameters.ptr & ~1); Result_CVec_SignatureZNoneZ ret_hu_conv = Result_CVec_SignatureZNoneZ.constr_from_ptr(ret); this.ptrs_to.add(channel_parameters); return ret_hu_conv;