X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-java;a=blobdiff_plain;f=ts%2Fstructs%2FHTLCUpdate.mts;h=b792216e55f53f9932adcb83aec4c14f3cd606fc;hp=49fccab023e101bbf0ac0a48f64522460b004087;hb=c629a01650402c8e2f9b9db8ced9ed63ce687727;hpb=d1d0121c000b713c10fd0bedd249eb8dda2e4db7 diff --git a/ts/structs/HTLCUpdate.mts b/ts/structs/HTLCUpdate.mts index 49fccab0..b792216e 100644 --- a/ts/structs/HTLCUpdate.mts +++ b/ts/structs/HTLCUpdate.mts @@ -281,6 +281,11 @@ import CommonBase from './CommonBase.mjs'; import * as bindings from '../bindings.mjs' +/** + * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on + * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the + * preimage claim backward will lead to loss of funds. + */ export class HTLCUpdate extends CommonBase { /* @internal */ public constructor(_dummy: object, ptr: number) { @@ -292,6 +297,9 @@ export class HTLCUpdate extends CommonBase { return ret; } + /** + * Creates a copy of the HTLCUpdate + */ public clone(): HTLCUpdate { const ret: number = bindings.HTLCUpdate_clone(this.ptr); const ret_hu_conv: HTLCUpdate = new HTLCUpdate(null, ret); @@ -299,12 +307,18 @@ export class HTLCUpdate extends CommonBase { return ret_hu_conv; } + /** + * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read + */ public write(): Uint8Array { const ret: number = bindings.HTLCUpdate_write(this.ptr); const ret_conv: Uint8Array = bindings.decodeUint8Array(ret); return ret_conv; } + /** + * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write + */ public static constructor_read(ser: Uint8Array): Result_HTLCUpdateDecodeErrorZ { const ret: number = bindings.HTLCUpdate_read(bindings.encodeUint8Array(ser)); const ret_hu_conv: Result_HTLCUpdateDecodeErrorZ = Result_HTLCUpdateDecodeErrorZ.constr_from_ptr(ret);