X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-java;a=blobdiff_plain;f=ts%2Fstructs%2FHTLCOutputInCommitment.mts;h=c03d2816230f21c981807ca3d9af8ad64e8354a6;hp=ef679245a2a68a9488b9d0295ceddbd90a086171;hb=c629a01650402c8e2f9b9db8ced9ed63ce687727;hpb=d1d0121c000b713c10fd0bedd249eb8dda2e4db7 diff --git a/ts/structs/HTLCOutputInCommitment.mts b/ts/structs/HTLCOutputInCommitment.mts index ef679245..c03d2816 100644 --- a/ts/structs/HTLCOutputInCommitment.mts +++ b/ts/structs/HTLCOutputInCommitment.mts @@ -281,49 +281,89 @@ import CommonBase from './CommonBase.mjs'; import * as bindings from '../bindings.mjs' +/** + * Information about an HTLC as it appears in a commitment transaction + */ export class HTLCOutputInCommitment extends CommonBase { /* @internal */ public constructor(_dummy: object, ptr: number) { super(ptr, bindings.HTLCOutputInCommitment_free); } + /** + * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction). + * Note that this is not the same as whether it is ountbound *from us*. To determine that you + * need to compare this value to whether the commitment transaction in question is that of + * the counterparty or our own. + */ public get_offered(): boolean { const ret: boolean = bindings.HTLCOutputInCommitment_get_offered(this.ptr); return ret; } + /** + * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction). + * Note that this is not the same as whether it is ountbound *from us*. To determine that you + * need to compare this value to whether the commitment transaction in question is that of + * the counterparty or our own. + */ public set_offered(val: boolean): void { bindings.HTLCOutputInCommitment_set_offered(this.ptr, val); } + /** + * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is + * this divided by 1000. + */ public get_amount_msat(): bigint { const ret: bigint = bindings.HTLCOutputInCommitment_get_amount_msat(this.ptr); return ret; } + /** + * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is + * this divided by 1000. + */ public set_amount_msat(val: bigint): void { bindings.HTLCOutputInCommitment_set_amount_msat(this.ptr, val); } + /** + * The CLTV lock-time at which this HTLC expires. + */ public get_cltv_expiry(): number { const ret: number = bindings.HTLCOutputInCommitment_get_cltv_expiry(this.ptr); return ret; } + /** + * The CLTV lock-time at which this HTLC expires. + */ public set_cltv_expiry(val: number): void { bindings.HTLCOutputInCommitment_set_cltv_expiry(this.ptr, val); } + /** + * The hash of the preimage which unlocks this HTLC. + */ public get_payment_hash(): Uint8Array { const ret: number = bindings.HTLCOutputInCommitment_get_payment_hash(this.ptr); const ret_conv: Uint8Array = bindings.decodeUint8Array(ret); return ret_conv; } + /** + * The hash of the preimage which unlocks this HTLC. + */ public set_payment_hash(val: Uint8Array): void { bindings.HTLCOutputInCommitment_set_payment_hash(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(val, 32))); } + /** + * The position within the commitment transactions' outputs. This may be None if the value is + * below the dust limit (in which case no output appears in the commitment transaction and the + * value is spent to additional transaction fees). + */ public get_transaction_output_index(): Option_u32Z { const ret: number = bindings.HTLCOutputInCommitment_get_transaction_output_index(this.ptr); const ret_hu_conv: Option_u32Z = Option_u32Z.constr_from_ptr(ret); @@ -331,10 +371,18 @@ export class HTLCOutputInCommitment extends CommonBase { return ret_hu_conv; } + /** + * The position within the commitment transactions' outputs. This may be None if the value is + * below the dust limit (in which case no output appears in the commitment transaction and the + * value is spent to additional transaction fees). + */ public set_transaction_output_index(val: Option_u32Z): void { bindings.HTLCOutputInCommitment_set_transaction_output_index(this.ptr, CommonBase.get_ptr_of(val)); } + /** + * Constructs a new HTLCOutputInCommitment given each field + */ public static constructor_new(offered_arg: boolean, amount_msat_arg: bigint, cltv_expiry_arg: number, payment_hash_arg: Uint8Array, transaction_output_index_arg: Option_u32Z): HTLCOutputInCommitment { const ret: number = bindings.HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, bindings.encodeUint8Array(bindings.check_arr_len(payment_hash_arg, 32)), CommonBase.get_ptr_of(transaction_output_index_arg)); const ret_hu_conv: HTLCOutputInCommitment = new HTLCOutputInCommitment(null, ret); @@ -347,6 +395,9 @@ export class HTLCOutputInCommitment extends CommonBase { return ret; } + /** + * Creates a copy of the HTLCOutputInCommitment + */ public clone(): HTLCOutputInCommitment { const ret: number = bindings.HTLCOutputInCommitment_clone(this.ptr); const ret_hu_conv: HTLCOutputInCommitment = new HTLCOutputInCommitment(null, ret); @@ -354,12 +405,18 @@ export class HTLCOutputInCommitment extends CommonBase { return ret_hu_conv; } + /** + * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read + */ public write(): Uint8Array { const ret: number = bindings.HTLCOutputInCommitment_write(this.ptr); const ret_conv: Uint8Array = bindings.decodeUint8Array(ret); return ret_conv; } + /** + * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write + */ public static constructor_read(ser: Uint8Array): Result_HTLCOutputInCommitmentDecodeErrorZ { const ret: number = bindings.HTLCOutputInCommitment_read(bindings.encodeUint8Array(ser)); const ret_hu_conv: Result_HTLCOutputInCommitmentDecodeErrorZ = Result_HTLCOutputInCommitmentDecodeErrorZ.constr_from_ptr(ret);