X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=ts%2Fstructs%2FGossipTimestampFilter.mts;h=76480d91c00ee2b4e774ecfb039c1d47385c6542;hb=c629a01650402c8e2f9b9db8ced9ed63ce687727;hp=68e527fc77ea78bc115345fdf0517826332823d7;hpb=2a65456aa0b540060dcf3ca707a54dc98cc3f38a;p=ldk-java diff --git a/ts/structs/GossipTimestampFilter.mts b/ts/structs/GossipTimestampFilter.mts index 68e527fc..76480d91 100644 --- a/ts/structs/GossipTimestampFilter.mts +++ b/ts/structs/GossipTimestampFilter.mts @@ -279,44 +279,70 @@ import { MultiThreadedLockableScore } from '../structs/MultiThreadedLockableScor import CommonBase from './CommonBase.mjs'; import * as bindings from '../bindings.mjs' -import * as InternalUtils from '../InternalUtils.mjs' +/** + * A gossip_timestamp_filter message is used by a node to request + * gossip relay for messages in the requested time range when the + * gossip_queries feature has been negotiated. + */ export class GossipTimestampFilter extends CommonBase { /* @internal */ public constructor(_dummy: object, ptr: number) { super(ptr, bindings.GossipTimestampFilter_free); } + /** + * The genesis hash of the blockchain for channel and node information + */ public get_chain_hash(): Uint8Array { - const ret: Uint8Array = bindings.GossipTimestampFilter_get_chain_hash(this.ptr); - return ret; + const ret: number = bindings.GossipTimestampFilter_get_chain_hash(this.ptr); + const ret_conv: Uint8Array = bindings.decodeUint8Array(ret); + return ret_conv; } + /** + * The genesis hash of the blockchain for channel and node information + */ public set_chain_hash(val: Uint8Array): void { - bindings.GossipTimestampFilter_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32)); + bindings.GossipTimestampFilter_set_chain_hash(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(val, 32))); } + /** + * The starting unix timestamp + */ public get_first_timestamp(): number { const ret: number = bindings.GossipTimestampFilter_get_first_timestamp(this.ptr); return ret; } + /** + * The starting unix timestamp + */ public set_first_timestamp(val: number): void { bindings.GossipTimestampFilter_set_first_timestamp(this.ptr, val); } + /** + * The range of information in seconds + */ public get_timestamp_range(): number { const ret: number = bindings.GossipTimestampFilter_get_timestamp_range(this.ptr); return ret; } + /** + * The range of information in seconds + */ public set_timestamp_range(val: number): void { bindings.GossipTimestampFilter_set_timestamp_range(this.ptr, val); } + /** + * Constructs a new GossipTimestampFilter given each field + */ public static constructor_new(chain_hash_arg: Uint8Array, first_timestamp_arg: number, timestamp_range_arg: number): GossipTimestampFilter { - const ret: number = bindings.GossipTimestampFilter_new(InternalUtils.check_arr_len(chain_hash_arg, 32), first_timestamp_arg, timestamp_range_arg); + const ret: number = bindings.GossipTimestampFilter_new(bindings.encodeUint8Array(bindings.check_arr_len(chain_hash_arg, 32)), first_timestamp_arg, timestamp_range_arg); const ret_hu_conv: GossipTimestampFilter = new GossipTimestampFilter(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; @@ -327,6 +353,9 @@ export class GossipTimestampFilter extends CommonBase { return ret; } + /** + * Creates a copy of the GossipTimestampFilter + */ public clone(): GossipTimestampFilter { const ret: number = bindings.GossipTimestampFilter_clone(this.ptr); const ret_hu_conv: GossipTimestampFilter = new GossipTimestampFilter(null, ret); @@ -334,13 +363,20 @@ export class GossipTimestampFilter extends CommonBase { return ret_hu_conv; } + /** + * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read + */ public write(): Uint8Array { - const ret: Uint8Array = bindings.GossipTimestampFilter_write(this.ptr); - return ret; + const ret: number = bindings.GossipTimestampFilter_write(this.ptr); + const ret_conv: Uint8Array = bindings.decodeUint8Array(ret); + return ret_conv; } + /** + * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write + */ public static constructor_read(ser: Uint8Array): Result_GossipTimestampFilterDecodeErrorZ { - const ret: number = bindings.GossipTimestampFilter_read(ser); + const ret: number = bindings.GossipTimestampFilter_read(bindings.encodeUint8Array(ser)); const ret_hu_conv: Result_GossipTimestampFilterDecodeErrorZ = Result_GossipTimestampFilterDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; }