UNPKG

lightningdevkit

Version:
103 lines 3.56 kB
import { ChannelId } from '../structs/ChannelId.mjs'; import { Result_UpdateFailMalformedHTLCDecodeErrorZ } from '../structs/Result_UpdateFailMalformedHTLCDecodeErrorZ.mjs'; import { CommonBase } from './CommonBase.mjs'; import * as bindings from '../bindings.mjs'; /** * An [`update_fail_malformed_htlc`] message to be sent to or received from a peer. * * [`update_fail_malformed_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc */ export class UpdateFailMalformedHTLC extends CommonBase { /* @internal */ constructor(_dummy, ptr) { super(ptr, bindings.UpdateFailMalformedHTLC_free); } /** * The channel ID */ get_channel_id() { const ret = bindings.UpdateFailMalformedHTLC_get_channel_id(this.ptr); const ret_hu_conv = new ChannelId(null, ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; } /** * The channel ID */ set_channel_id(val) { bindings.UpdateFailMalformedHTLC_set_channel_id(this.ptr, CommonBase.get_ptr_of(val)); } /** * The HTLC ID */ get_htlc_id() { const ret = bindings.UpdateFailMalformedHTLC_get_htlc_id(this.ptr); return ret; } /** * The HTLC ID */ set_htlc_id(val) { bindings.UpdateFailMalformedHTLC_set_htlc_id(this.ptr, val); } /** * The failure code */ get_failure_code() { const ret = bindings.UpdateFailMalformedHTLC_get_failure_code(this.ptr); return ret; } /** * The failure code */ set_failure_code(val) { bindings.UpdateFailMalformedHTLC_set_failure_code(this.ptr, val); } clone_ptr() { const ret = bindings.UpdateFailMalformedHTLC_clone_ptr(this.ptr); return ret; } /** * Creates a copy of the UpdateFailMalformedHTLC */ clone() { const ret = bindings.UpdateFailMalformedHTLC_clone(this.ptr); const ret_hu_conv = new UpdateFailMalformedHTLC(null, ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; } /** * Generates a non-cryptographic 64-bit hash of the UpdateFailMalformedHTLC. */ hash() { const ret = bindings.UpdateFailMalformedHTLC_hash(this.ptr); return ret; } /** * Checks if two UpdateFailMalformedHTLCs contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. * Two objects with NULL inner values will be considered "equal" here. */ eq(b) { const ret = bindings.UpdateFailMalformedHTLC_eq(this.ptr, CommonBase.get_ptr_of(b)); CommonBase.add_ref_from(this, b); return ret; } /** * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read */ write() { const ret = bindings.UpdateFailMalformedHTLC_write(this.ptr); const ret_conv = bindings.decodeUint8Array(ret); return ret_conv; } /** * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write */ static constructor_read(ser) { const ret = bindings.UpdateFailMalformedHTLC_read(bindings.encodeUint8Array(ser)); const ret_hu_conv = Result_UpdateFailMalformedHTLCDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; } } //# sourceMappingURL=UpdateFailMalformedHTLC.mjs.map