import CommonBase from './CommonBase.mjs';
import * as bindings from '../bindings.mjs'
-import * as InternalUtils from '../InternalUtils.mjs'
+/**
+ * A query_short_channel_ids message is used to query a peer for
+ * routing gossip messages related to one or more short_channel_ids.
+ * The query recipient will reply with the latest, if available,
+ * channel_announcement, channel_update and node_announcement messages
+ * it maintains for the requested short_channel_ids followed by a
+ * reply_short_channel_ids_end message. The short_channel_ids sent in
+ * this query are encoded. We only support encoding_type=0 uncompressed
+ * serialization and do not support encoding_type=1 zlib serialization.
+ */
export class QueryShortChannelIds extends CommonBase {
/* @internal */
public constructor(_dummy: object, ptr: number) {
super(ptr, bindings.QueryShortChannelIds_free);
}
+ /**
+ * The genesis hash of the blockchain being queried
+ */
public get_chain_hash(): Uint8Array {
- const ret: Uint8Array = bindings.QueryShortChannelIds_get_chain_hash(this.ptr);
- return ret;
+ const ret: number = bindings.QueryShortChannelIds_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.QueryShortChannelIds_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
+ bindings.QueryShortChannelIds_set_chain_hash(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(val, 32)));
}
- public set_short_channel_ids(val: number[]): void {
- bindings.QueryShortChannelIds_set_short_channel_ids(this.ptr, val);
+ /**
+ * The short_channel_ids that are being queried
+ */
+ public set_short_channel_ids(val: bigint[]): void {
+ bindings.QueryShortChannelIds_set_short_channel_ids(this.ptr, bindings.encodeUint64Array(val));
}
- public static constructor_new(chain_hash_arg: Uint8Array, short_channel_ids_arg: number[]): QueryShortChannelIds {
- const ret: number = bindings.QueryShortChannelIds_new(InternalUtils.check_arr_len(chain_hash_arg, 32), short_channel_ids_arg);
+ /**
+ * Constructs a new QueryShortChannelIds given each field
+ */
+ public static constructor_new(chain_hash_arg: Uint8Array, short_channel_ids_arg: bigint[]): QueryShortChannelIds {
+ const ret: number = bindings.QueryShortChannelIds_new(bindings.encodeUint8Array(bindings.check_arr_len(chain_hash_arg, 32)), bindings.encodeUint64Array(short_channel_ids_arg));
const ret_hu_conv: QueryShortChannelIds = new QueryShortChannelIds(null, ret);
CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
return ret_hu_conv;
return ret;
}
+ /**
+ * Creates a copy of the QueryShortChannelIds
+ */
public clone(): QueryShortChannelIds {
const ret: number = bindings.QueryShortChannelIds_clone(this.ptr);
const ret_hu_conv: QueryShortChannelIds = new QueryShortChannelIds(null, ret);
return ret_hu_conv;
}
+ /**
+ * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
+ */
public static constructor_read(ser: Uint8Array): Result_QueryShortChannelIdsDecodeErrorZ {
- const ret: number = bindings.QueryShortChannelIds_read(ser);
+ const ret: number = bindings.QueryShortChannelIds_read(bindings.encodeUint8Array(ser));
const ret_hu_conv: Result_QueryShortChannelIdsDecodeErrorZ = Result_QueryShortChannelIdsDecodeErrorZ.constr_from_ptr(ret);
return ret_hu_conv;
}
+ /**
+ * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
+ */
public write(): Uint8Array {
- const ret: Uint8Array = bindings.QueryShortChannelIds_write(this.ptr);
- return ret;
+ const ret: number = bindings.QueryShortChannelIds_write(this.ptr);
+ const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
+ return ret_conv;
}
}