[TS] Update auto-generated TypeScript Bindings
[ldk-java] / ts / structs / CustomMessageReader.mts
index 35989097e9e0c566c821e50c17a2faa56a80eca0..4f31381980091a1fc269978058c6c1cfec8d5ae8 100644 (file)
@@ -280,11 +280,16 @@ import { MultiThreadedLockableScore } from '../structs/MultiThreadedLockableScor
 
 import CommonBase from './CommonBase.mjs';
 import * as bindings from '../bindings.mjs'
-import * as InternalUtils from '../InternalUtils.mjs'
 
 
 
+/** An implementation of CustomMessageReader */
 export interface CustomMessageReaderInterface {
+       /**Decodes a custom message to `CustomMessageType`. If the given message type is known to the
+        * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
+        * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
+        * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
+        */
        read(message_type: number, buffer: Uint8Array): Result_COption_TypeZDecodeErrorZ;
 }
 
@@ -292,6 +297,10 @@ class LDKCustomMessageReaderHolder {
        held: CustomMessageReader;
 }
 
+/**
+ * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
+ * decoders.
+ */
 export class CustomMessageReader extends CommonBase {
        /* @internal */
        public bindings_instance?: bindings.LDKCustomMessageReader;
@@ -302,11 +311,13 @@ export class CustomMessageReader extends CommonBase {
                this.bindings_instance = null;
        }
 
-       static new_impl(arg: CustomMessageReaderInterface): CustomMessageReader {
+       /** Creates a new instance of CustomMessageReader from a given implementation */
+       public static new_impl(arg: CustomMessageReaderInterface): CustomMessageReader {
                const impl_holder: LDKCustomMessageReaderHolder = new LDKCustomMessageReaderHolder();
                let structImplementation = {
-                       read (message_type: number, buffer: Uint8Array): number {
-                               const ret: Result_COption_TypeZDecodeErrorZ = arg.read(message_type, buffer);
+                       read (message_type: number, buffer: number): number {
+                               const buffer_conv: Uint8Array = bindings.decodeUint8Array(buffer);
+                               const ret: Result_COption_TypeZDecodeErrorZ = arg.read(message_type, buffer_conv);
                                const result: number = ret == null ? 0 : ret.clone_ptr();
                                return result;
                        },
@@ -317,8 +328,15 @@ export class CustomMessageReader extends CommonBase {
                impl_holder.held.bindings_instance = structImplementation;
                return impl_holder.held;
        }
+
+       /**
+        * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
+        * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
+        * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
+        * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
+        */
        public read(message_type: number, buffer: Uint8Array): Result_COption_TypeZDecodeErrorZ {
-               const ret: number = bindings.CustomMessageReader_read(this.ptr, message_type, buffer);
+               const ret: number = bindings.CustomMessageReader_read(this.ptr, message_type, bindings.encodeUint8Array(buffer));
                const ret_hu_conv: Result_COption_TypeZDecodeErrorZ = Result_COption_TypeZDecodeErrorZ.constr_from_ptr(ret);
                return ret_hu_conv;
        }