X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fstructs%2FPong.mts;h=34a8d79eade438372e855cf7250f84b6841465e5;hb=0fcde6be16ac8c2d63bd5398d5396da5890461d7;hp=dd17250bf6aa933619b09f1eca0311b9a20a6bee;hpb=bf08029c1ad5244b59902eada723b634dcade62d;p=ldk-java diff --git a/ts/structs/Pong.mts b/ts/structs/Pong.mts index dd17250b..34a8d79e 100644 --- a/ts/structs/Pong.mts +++ b/ts/structs/Pong.mts @@ -279,24 +279,37 @@ import { MultiThreadedLockableScore } from '../structs/MultiThreadedLockableScor import CommonBase from './CommonBase.mjs'; import * as bindings from '../bindings.mjs' -import * as InternalUtils from '../InternalUtils.mjs' +/** + * A pong message to be sent or received from a peer + */ export class Pong extends CommonBase { /* @internal */ public constructor(_dummy: object, ptr: number) { super(ptr, bindings.Pong_free); } + /** + * The pong packet size. + * This field is not sent on the wire. byteslen zeros are sent. + */ public get_byteslen(): number { const ret: number = bindings.Pong_get_byteslen(this.ptr); return ret; } + /** + * The pong packet size. + * This field is not sent on the wire. byteslen zeros are sent. + */ public set_byteslen(val: number): void { bindings.Pong_set_byteslen(this.ptr, val); } + /** + * Constructs a new Pong given each field + */ public static constructor_new(byteslen_arg: number): Pong { const ret: number = bindings.Pong_new(byteslen_arg); const ret_hu_conv: Pong = new Pong(null, ret); @@ -309,6 +322,9 @@ export class Pong extends CommonBase { return ret; } + /** + * Creates a copy of the Pong + */ public clone(): Pong { const ret: number = bindings.Pong_clone(this.ptr); const ret_hu_conv: Pong = new Pong(null, ret); @@ -316,13 +332,20 @@ export class Pong extends CommonBase { return ret_hu_conv; } + /** + * Serialize the Pong object into a byte array which can be read by Pong_read + */ public write(): Uint8Array { - const ret: Uint8Array = bindings.Pong_write(this.ptr); - return ret; + const ret: number = bindings.Pong_write(this.ptr); + const ret_conv: Uint8Array = bindings.decodeUint8Array(ret); + return ret_conv; } + /** + * Read a Pong from a byte array, created by Pong_write + */ public static constructor_read(ser: Uint8Array): Result_PongDecodeErrorZ { - const ret: number = bindings.Pong_read(ser); + const ret: number = bindings.Pong_read(bindings.encodeUint8Array(ser)); const ret_hu_conv: Result_PongDecodeErrorZ = Result_PongDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; }