import CommonBase from './CommonBase.mjs';
import * as bindings from '../bindings.mjs'
-import * as InternalUtils from '../InternalUtils.mjs'
+/**
+ * An update_fail_htlc message to be sent or received from a peer
+ */
export class UpdateFailHTLC extends CommonBase {
/* @internal */
public constructor(_dummy: object, ptr: number) {
super(ptr, bindings.UpdateFailHTLC_free);
}
+ /**
+ * The channel ID
+ */
public get_channel_id(): Uint8Array {
- const ret: Uint8Array = bindings.UpdateFailHTLC_get_channel_id(this.ptr);
- return ret;
+ const ret: number = bindings.UpdateFailHTLC_get_channel_id(this.ptr);
+ const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
+ return ret_conv;
}
+ /**
+ * The channel ID
+ */
public set_channel_id(val: Uint8Array): void {
- bindings.UpdateFailHTLC_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
+ bindings.UpdateFailHTLC_set_channel_id(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(val, 32)));
}
- public get_htlc_id(): number {
- const ret: number = bindings.UpdateFailHTLC_get_htlc_id(this.ptr);
+ /**
+ * The HTLC ID
+ */
+ public get_htlc_id(): bigint {
+ const ret: bigint = bindings.UpdateFailHTLC_get_htlc_id(this.ptr);
return ret;
}
- public set_htlc_id(val: number): void {
+ /**
+ * The HTLC ID
+ */
+ public set_htlc_id(val: bigint): void {
bindings.UpdateFailHTLC_set_htlc_id(this.ptr, val);
}
return ret;
}
+ /**
+ * Creates a copy of the UpdateFailHTLC
+ */
public clone(): UpdateFailHTLC {
const ret: number = bindings.UpdateFailHTLC_clone(this.ptr);
const ret_hu_conv: UpdateFailHTLC = new UpdateFailHTLC(null, ret);
return ret_hu_conv;
}
+ /**
+ * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
+ */
public write(): Uint8Array {
- const ret: Uint8Array = bindings.UpdateFailHTLC_write(this.ptr);
- return ret;
+ const ret: number = bindings.UpdateFailHTLC_write(this.ptr);
+ const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
+ return ret_conv;
}
+ /**
+ * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
+ */
public static constructor_read(ser: Uint8Array): Result_UpdateFailHTLCDecodeErrorZ {
- const ret: number = bindings.UpdateFailHTLC_read(ser);
+ const ret: number = bindings.UpdateFailHTLC_read(bindings.encodeUint8Array(ser));
const ret_hu_conv: Result_UpdateFailHTLCDecodeErrorZ = Result_UpdateFailHTLCDecodeErrorZ.constr_from_ptr(ret);
return ret_hu_conv;
}