UNPKG

lightningdevkit

Version:
91 lines 3.2 kB
import { ChannelId } from '../structs/ChannelId.mjs'; import { Result_SpliceLockedDecodeErrorZ } from '../structs/Result_SpliceLockedDecodeErrorZ.mjs'; import { CommonBase } from './CommonBase.mjs'; import * as bindings from '../bindings.mjs'; /** * A `splice_locked` message to be sent to or received from a peer. */ export class SpliceLocked extends CommonBase { /* @internal */ constructor(_dummy, ptr) { super(ptr, bindings.SpliceLocked_free); } /** * The channel ID */ get_channel_id() { const ret = bindings.SpliceLocked_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.SpliceLocked_set_channel_id(this.ptr, CommonBase.get_ptr_of(val)); } /** * The ID of the new funding transaction that has been locked */ get_splice_txid() { const ret = bindings.SpliceLocked_get_splice_txid(this.ptr); const ret_conv = bindings.decodeUint8Array(ret); return ret_conv; } /** * The ID of the new funding transaction that has been locked */ set_splice_txid(val) { bindings.SpliceLocked_set_splice_txid(this.ptr, bindings.encodeUint8Array(val)); } /** * Constructs a new SpliceLocked given each field */ static constructor_new(channel_id_arg, splice_txid_arg) { const ret = bindings.SpliceLocked_new(CommonBase.get_ptr_of(channel_id_arg), bindings.encodeUint8Array(splice_txid_arg)); const ret_hu_conv = new SpliceLocked(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } clone_ptr() { const ret = bindings.SpliceLocked_clone_ptr(this.ptr); return ret; } /** * Creates a copy of the SpliceLocked */ clone() { const ret = bindings.SpliceLocked_clone(this.ptr); const ret_hu_conv = new SpliceLocked(null, ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; } /** * Checks if two SpliceLockeds 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.SpliceLocked_eq(this.ptr, CommonBase.get_ptr_of(b)); CommonBase.add_ref_from(this, b); return ret; } /** * Serialize the SpliceLocked object into a byte array which can be read by SpliceLocked_read */ write() { const ret = bindings.SpliceLocked_write(this.ptr); const ret_conv = bindings.decodeUint8Array(ret); return ret_conv; } /** * Read a SpliceLocked from a byte array, created by SpliceLocked_write */ static constructor_read(ser) { const ret = bindings.SpliceLocked_read(bindings.encodeUint8Array(ser)); const ret_hu_conv = Result_SpliceLockedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; } } //# sourceMappingURL=SpliceLocked.mjs.map