UNPKG

lightningdevkit

Version:
99 lines 3.42 kB
import { ChannelId } from '../structs/ChannelId.mjs'; import { Result_TxRemoveInputDecodeErrorZ } from '../structs/Result_TxRemoveInputDecodeErrorZ.mjs'; import { CommonBase } from './CommonBase.mjs'; import * as bindings from '../bindings.mjs'; /** * A [`tx_remove_input`] message for removing an input during interactive transaction construction. * * [`tx_remove_input`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_remove_input-and-tx_remove_output-messages */ export class TxRemoveInput extends CommonBase { /* @internal */ constructor(_dummy, ptr) { super(ptr, bindings.TxRemoveInput_free); } /** * The channel ID */ get_channel_id() { const ret = bindings.TxRemoveInput_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.TxRemoveInput_set_channel_id(this.ptr, CommonBase.get_ptr_of(val)); } /** * The serial ID of the input to be removed */ get_serial_id() { const ret = bindings.TxRemoveInput_get_serial_id(this.ptr); return ret; } /** * The serial ID of the input to be removed */ set_serial_id(val) { bindings.TxRemoveInput_set_serial_id(this.ptr, val); } /** * Constructs a new TxRemoveInput given each field */ static constructor_new(channel_id_arg, serial_id_arg) { const ret = bindings.TxRemoveInput_new(CommonBase.get_ptr_of(channel_id_arg), serial_id_arg); const ret_hu_conv = new TxRemoveInput(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } clone_ptr() { const ret = bindings.TxRemoveInput_clone_ptr(this.ptr); return ret; } /** * Creates a copy of the TxRemoveInput */ clone() { const ret = bindings.TxRemoveInput_clone(this.ptr); const ret_hu_conv = new TxRemoveInput(null, ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; } /** * Generates a non-cryptographic 64-bit hash of the TxRemoveInput. */ hash() { const ret = bindings.TxRemoveInput_hash(this.ptr); return ret; } /** * Checks if two TxRemoveInputs 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.TxRemoveInput_eq(this.ptr, CommonBase.get_ptr_of(b)); CommonBase.add_ref_from(this, b); return ret; } /** * Serialize the TxRemoveInput object into a byte array which can be read by TxRemoveInput_read */ write() { const ret = bindings.TxRemoveInput_write(this.ptr); const ret_conv = bindings.decodeUint8Array(ret); return ret_conv; } /** * Read a TxRemoveInput from a byte array, created by TxRemoveInput_write */ static constructor_read(ser) { const ret = bindings.TxRemoveInput_read(bindings.encodeUint8Array(ser)); const ret_hu_conv = Result_TxRemoveInputDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; } } //# sourceMappingURL=TxRemoveInput.mjs.map