X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-java;a=blobdiff_plain;f=ts%2Fstructs%2FInit.mts;h=bda324db47d167915252849777b728c03d7c47d0;hp=eefc9b42320c8123f0d5dae3eef98906965d0ff8;hb=c629a01650402c8e2f9b9db8ced9ed63ce687727;hpb=d1d0121c000b713c10fd0bedd249eb8dda2e4db7 diff --git a/ts/structs/Init.mts b/ts/structs/Init.mts index eefc9b42..bda324db 100644 --- a/ts/structs/Init.mts +++ b/ts/structs/Init.mts @@ -281,12 +281,18 @@ import CommonBase from './CommonBase.mjs'; import * as bindings from '../bindings.mjs' +/** + * An init message to be sent or received from a peer + */ export class Init extends CommonBase { /* @internal */ public constructor(_dummy: object, ptr: number) { super(ptr, bindings.Init_free); } + /** + * The relevant features which the sender supports + */ public get_features(): InitFeatures { const ret: number = bindings.Init_get_features(this.ptr); const ret_hu_conv: InitFeatures = new InitFeatures(null, ret); @@ -294,10 +300,16 @@ export class Init extends CommonBase { return ret_hu_conv; } + /** + * The relevant features which the sender supports + */ public set_features(val: InitFeatures): void { bindings.Init_set_features(this.ptr, val == null ? 0 : CommonBase.get_ptr_of(val) & ~1); } + /** + * Constructs a new Init given each field + */ public static constructor_new(features_arg: InitFeatures): Init { const ret: number = bindings.Init_new(features_arg == null ? 0 : CommonBase.get_ptr_of(features_arg) & ~1); const ret_hu_conv: Init = new Init(null, ret); @@ -310,6 +322,9 @@ export class Init extends CommonBase { return ret; } + /** + * Creates a copy of the Init + */ public clone(): Init { const ret: number = bindings.Init_clone(this.ptr); const ret_hu_conv: Init = new Init(null, ret); @@ -317,12 +332,18 @@ export class Init extends CommonBase { return ret_hu_conv; } + /** + * Serialize the Init object into a byte array which can be read by Init_read + */ public write(): Uint8Array { const ret: number = bindings.Init_write(this.ptr); const ret_conv: Uint8Array = bindings.decodeUint8Array(ret); return ret_conv; } + /** + * Read a Init from a byte array, created by Init_write + */ public static constructor_read(ser: Uint8Array): Result_InitDecodeErrorZ { const ret: number = bindings.Init_read(bindings.encodeUint8Array(ser)); const ret_hu_conv: Result_InitDecodeErrorZ = Result_InitDecodeErrorZ.constr_from_ptr(ret);