import CommonBase from './CommonBase.mjs';
import * as bindings from '../bindings.mjs'
-import * as InternalUtils from '../InternalUtils.mjs'
+/**
+ * The unsigned part of a channel_update
+ */
export class UnsignedChannelUpdate extends CommonBase {
/* @internal */
public constructor(_dummy: object, ptr: number) {
super(ptr, bindings.UnsignedChannelUpdate_free);
}
+ /**
+ * The genesis hash of the blockchain where the channel is to be opened
+ */
public get_chain_hash(): Uint8Array {
- const ret: Uint8Array = bindings.UnsignedChannelUpdate_get_chain_hash(this.ptr);
- return ret;
+ const ret: number = bindings.UnsignedChannelUpdate_get_chain_hash(this.ptr);
+ const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
+ return ret_conv;
}
+ /**
+ * The genesis hash of the blockchain where the channel is to be opened
+ */
public set_chain_hash(val: Uint8Array): void {
- bindings.UnsignedChannelUpdate_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
+ bindings.UnsignedChannelUpdate_set_chain_hash(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(val, 32)));
}
- public get_short_channel_id(): number {
- const ret: number = bindings.UnsignedChannelUpdate_get_short_channel_id(this.ptr);
+ /**
+ * The short channel ID
+ */
+ public get_short_channel_id(): bigint {
+ const ret: bigint = bindings.UnsignedChannelUpdate_get_short_channel_id(this.ptr);
return ret;
}
- public set_short_channel_id(val: number): void {
+ /**
+ * The short channel ID
+ */
+ public set_short_channel_id(val: bigint): void {
bindings.UnsignedChannelUpdate_set_short_channel_id(this.ptr, val);
}
+ /**
+ * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
+ */
public get_timestamp(): number {
const ret: number = bindings.UnsignedChannelUpdate_get_timestamp(this.ptr);
return ret;
}
+ /**
+ * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
+ */
public set_timestamp(val: number): void {
bindings.UnsignedChannelUpdate_set_timestamp(this.ptr, val);
}
+ /**
+ * Channel flags
+ */
public get_flags(): number {
const ret: number = bindings.UnsignedChannelUpdate_get_flags(this.ptr);
return ret;
}
+ /**
+ * Channel flags
+ */
public set_flags(val: number): void {
bindings.UnsignedChannelUpdate_set_flags(this.ptr, val);
}
+ /**
+ * The number of blocks such that if:
+ * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
+ * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
+ * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
+ * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
+ * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
+ * forwarding. Note that the HTLC sender is the one who originally sets this value when
+ * constructing the route.
+ */
public get_cltv_expiry_delta(): number {
const ret: number = bindings.UnsignedChannelUpdate_get_cltv_expiry_delta(this.ptr);
return ret;
}
+ /**
+ * The number of blocks such that if:
+ * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
+ * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
+ * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
+ * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
+ * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
+ * forwarding. Note that the HTLC sender is the one who originally sets this value when
+ * constructing the route.
+ */
public set_cltv_expiry_delta(val: number): void {
bindings.UnsignedChannelUpdate_set_cltv_expiry_delta(this.ptr, val);
}
- public get_htlc_minimum_msat(): number {
- const ret: number = bindings.UnsignedChannelUpdate_get_htlc_minimum_msat(this.ptr);
+ /**
+ * The minimum HTLC size incoming to sender, in milli-satoshi
+ */
+ public get_htlc_minimum_msat(): bigint {
+ const ret: bigint = bindings.UnsignedChannelUpdate_get_htlc_minimum_msat(this.ptr);
return ret;
}
- public set_htlc_minimum_msat(val: number): void {
+ /**
+ * The minimum HTLC size incoming to sender, in milli-satoshi
+ */
+ public set_htlc_minimum_msat(val: bigint): void {
bindings.UnsignedChannelUpdate_set_htlc_minimum_msat(this.ptr, val);
}
+ /**
+ * The base HTLC fee charged by sender, in milli-satoshi
+ */
public get_fee_base_msat(): number {
const ret: number = bindings.UnsignedChannelUpdate_get_fee_base_msat(this.ptr);
return ret;
}
+ /**
+ * The base HTLC fee charged by sender, in milli-satoshi
+ */
public set_fee_base_msat(val: number): void {
bindings.UnsignedChannelUpdate_set_fee_base_msat(this.ptr, val);
}
+ /**
+ * The amount to fee multiplier, in micro-satoshi
+ */
public get_fee_proportional_millionths(): number {
const ret: number = bindings.UnsignedChannelUpdate_get_fee_proportional_millionths(this.ptr);
return ret;
}
+ /**
+ * The amount to fee multiplier, in micro-satoshi
+ */
public set_fee_proportional_millionths(val: number): void {
bindings.UnsignedChannelUpdate_set_fee_proportional_millionths(this.ptr, val);
}
return ret;
}
+ /**
+ * Creates a copy of the UnsignedChannelUpdate
+ */
public clone(): UnsignedChannelUpdate {
const ret: number = bindings.UnsignedChannelUpdate_clone(this.ptr);
const ret_hu_conv: UnsignedChannelUpdate = new UnsignedChannelUpdate(null, ret);
return ret_hu_conv;
}
+ /**
+ * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
+ */
public write(): Uint8Array {
- const ret: Uint8Array = bindings.UnsignedChannelUpdate_write(this.ptr);
- return ret;
+ const ret: number = bindings.UnsignedChannelUpdate_write(this.ptr);
+ const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
+ return ret_conv;
}
+ /**
+ * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
+ */
public static constructor_read(ser: Uint8Array): Result_UnsignedChannelUpdateDecodeErrorZ {
- const ret: number = bindings.UnsignedChannelUpdate_read(ser);
+ const ret: number = bindings.UnsignedChannelUpdate_read(bindings.encodeUint8Array(ser));
const ret_hu_conv: Result_UnsignedChannelUpdateDecodeErrorZ = Result_UnsignedChannelUpdateDecodeErrorZ.constr_from_ptr(ret);
return ret_hu_conv;
}