import CommonBase from './CommonBase.mjs';
import * as bindings from '../bindings.mjs'
-import * as InternalUtils from '../InternalUtils.mjs'
+/**
+ * A reply_channel_range message is a reply to a query_channel_range
+ * message. Multiple reply_channel_range messages can be sent in reply
+ * to a single query_channel_range message. The query recipient makes a
+ * best effort to respond based on their local network view which may
+ * not be a perfect view of the network. The short_channel_ids in the
+ * reply are encoded. We only support encoding_type=0 uncompressed
+ * serialization and do not support encoding_type=1 zlib serialization.
+ */
export class ReplyChannelRange extends CommonBase {
/* @internal */
public constructor(_dummy: object, ptr: number) {
super(ptr, bindings.ReplyChannelRange_free);
}
+ /**
+ * The genesis hash of the blockchain being queried
+ */
public get_chain_hash(): Uint8Array {
- const ret: Uint8Array = bindings.ReplyChannelRange_get_chain_hash(this.ptr);
- return ret;
+ const ret: number = bindings.ReplyChannelRange_get_chain_hash(this.ptr);
+ const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
+ return ret_conv;
}
+ /**
+ * The genesis hash of the blockchain being queried
+ */
public set_chain_hash(val: Uint8Array): void {
- bindings.ReplyChannelRange_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
+ bindings.ReplyChannelRange_set_chain_hash(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(val, 32)));
}
+ /**
+ * The height of the first block in the range of the reply
+ */
public get_first_blocknum(): number {
const ret: number = bindings.ReplyChannelRange_get_first_blocknum(this.ptr);
return ret;
}
+ /**
+ * The height of the first block in the range of the reply
+ */
public set_first_blocknum(val: number): void {
bindings.ReplyChannelRange_set_first_blocknum(this.ptr, val);
}
+ /**
+ * The number of blocks included in the range of the reply
+ */
public get_number_of_blocks(): number {
const ret: number = bindings.ReplyChannelRange_get_number_of_blocks(this.ptr);
return ret;
}
+ /**
+ * The number of blocks included in the range of the reply
+ */
public set_number_of_blocks(val: number): void {
bindings.ReplyChannelRange_set_number_of_blocks(this.ptr, val);
}
+ /**
+ * True when this is the final reply for a query
+ */
public get_sync_complete(): boolean {
const ret: boolean = bindings.ReplyChannelRange_get_sync_complete(this.ptr);
return ret;
}
+ /**
+ * True when this is the final reply for a query
+ */
public set_sync_complete(val: boolean): void {
bindings.ReplyChannelRange_set_sync_complete(this.ptr, val);
}
- public set_short_channel_ids(val: number[]): void {
- bindings.ReplyChannelRange_set_short_channel_ids(this.ptr, val);
+ /**
+ * The short_channel_ids in the channel range
+ */
+ public set_short_channel_ids(val: bigint[]): void {
+ bindings.ReplyChannelRange_set_short_channel_ids(this.ptr, bindings.encodeUint64Array(val));
}
- public static constructor_new(chain_hash_arg: Uint8Array, first_blocknum_arg: number, number_of_blocks_arg: number, sync_complete_arg: boolean, short_channel_ids_arg: number[]): ReplyChannelRange {
- const ret: number = bindings.ReplyChannelRange_new(InternalUtils.check_arr_len(chain_hash_arg, 32), first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg);
+ /**
+ * Constructs a new ReplyChannelRange given each field
+ */
+ public static constructor_new(chain_hash_arg: Uint8Array, first_blocknum_arg: number, number_of_blocks_arg: number, sync_complete_arg: boolean, short_channel_ids_arg: bigint[]): ReplyChannelRange {
+ const ret: number = bindings.ReplyChannelRange_new(bindings.encodeUint8Array(bindings.check_arr_len(chain_hash_arg, 32)), first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, bindings.encodeUint64Array(short_channel_ids_arg));
const ret_hu_conv: ReplyChannelRange = new ReplyChannelRange(null, ret);
CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
return ret_hu_conv;
return ret;
}
+ /**
+ * Creates a copy of the ReplyChannelRange
+ */
public clone(): ReplyChannelRange {
const ret: number = bindings.ReplyChannelRange_clone(this.ptr);
const ret_hu_conv: ReplyChannelRange = new ReplyChannelRange(null, ret);
return ret_hu_conv;
}
+ /**
+ * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
+ */
public static constructor_read(ser: Uint8Array): Result_ReplyChannelRangeDecodeErrorZ {
- const ret: number = bindings.ReplyChannelRange_read(ser);
+ const ret: number = bindings.ReplyChannelRange_read(bindings.encodeUint8Array(ser));
const ret_hu_conv: Result_ReplyChannelRangeDecodeErrorZ = Result_ReplyChannelRangeDecodeErrorZ.constr_from_ptr(ret);
return ret_hu_conv;
}
+ /**
+ * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
+ */
public write(): Uint8Array {
- const ret: Uint8Array = bindings.ReplyChannelRange_write(this.ptr);
- return ret;
+ const ret: number = bindings.ReplyChannelRange_write(this.ptr);
+ const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
+ return ret_conv;
}
}