[TS] Update auto-generated TypeScript Bindings
[ldk-java] / ts / structs / HTLCUpdate.mts
index cb55c9fbd9ebb7a9b9d283a041921f112539be77..b792216e55f53f9932adcb83aec4c14f3cd606fc 100644 (file)
@@ -279,9 +279,13 @@ import { MultiThreadedLockableScore } from '../structs/MultiThreadedLockableScor
 
 import CommonBase from './CommonBase.mjs';
 import * as bindings from '../bindings.mjs'
-import * as InternalUtils from '../InternalUtils.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) {
@@ -293,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);
@@ -300,13 +307,20 @@ 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: Uint8Array = bindings.HTLCUpdate_write(this.ptr);
-               return ret;
+               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(ser);
+               const ret: number = bindings.HTLCUpdate_read(bindings.encodeUint8Array(ser));
                const ret_hu_conv: Result_HTLCUpdateDecodeErrorZ = Result_HTLCUpdateDecodeErrorZ.constr_from_ptr(ret);
                return ret_hu_conv;
        }