X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fstructs%2FOutPoint.ts;h=29005226fc4f73c7a9d1e6650240528b45164c2c;hb=f3e670e9341decac613d33fc52febf19cea32f20;hp=decbf7b744897d63ce403fff6ea7fbb392b066e8;hpb=fed2245c60159f6c074c9ed5c0f3ce273ad9841b;p=ldk-java diff --git a/ts/structs/OutPoint.ts b/ts/structs/OutPoint.ts index decbf7b7..29005226 100644 --- a/ts/structs/OutPoint.ts +++ b/ts/structs/OutPoint.ts @@ -18,20 +18,13 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.OutPoint_free(this.ptr); } } - public OutPoint clone() { - number ret = bindings.OutPoint_clone(this.ptr); - const ret_hu_conv: OutPoint = new OutPoint(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - public Uint8Array get_txid() { Uint8Array ret = bindings.OutPoint_get_txid(this.ptr); return ret; } public void set_txid(Uint8Array val) { - bindings.OutPoint_set_txid(this.ptr, val); + bindings.OutPoint_set_txid(this.ptr, InternalUtils.check_arr_len(val, 32)); } public number get_index() { @@ -44,12 +37,35 @@ import * as bindings from '../bindings' // TODO: figure out location } public static OutPoint constructor_new(Uint8Array txid_arg, number index_arg) { - number ret = bindings.OutPoint_new(txid_arg, index_arg); + number ret = bindings.OutPoint_new(InternalUtils.check_arr_len(txid_arg, 32), index_arg); const ret_hu_conv: OutPoint = new OutPoint(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } + public number clone_ptr() { + number ret = bindings.OutPoint_clone_ptr(this.ptr); + return ret; + } + + public OutPoint clone() { + number ret = bindings.OutPoint_clone(this.ptr); + const ret_hu_conv: OutPoint = new OutPoint(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public boolean eq(OutPoint b) { + boolean ret = bindings.OutPoint_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + this.ptrs_to.add(b); + return ret; + } + + public number hash() { + number ret = bindings.OutPoint_hash(this.ptr); + return ret; + } + public Uint8Array to_channel_id() { Uint8Array ret = bindings.OutPoint_to_channel_id(this.ptr); return ret; @@ -60,10 +76,9 @@ import * as bindings from '../bindings' // TODO: figure out location return ret; } - public static OutPoint constructor_read(Uint8Array ser) { + public static Result_OutPointDecodeErrorZ constructor_read(Uint8Array ser) { number ret = bindings.OutPoint_read(ser); - const ret_hu_conv: OutPoint = new OutPoint(null, ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); + Result_OutPointDecodeErrorZ ret_hu_conv = Result_OutPointDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; }