lightningdevkit
Version:
Lightning Development Kit
87 lines • 2.99 kB
JavaScript
import { ChannelId } from '../structs/ChannelId.mjs';
import { Result_TxCompleteDecodeErrorZ } from '../structs/Result_TxCompleteDecodeErrorZ.mjs';
import { CommonBase } from './CommonBase.mjs';
import * as bindings from '../bindings.mjs';
/**
* [`A tx_complete`] message signalling the conclusion of a peer's transaction contributions during
* interactive transaction construction.
*
* [`tx_complete`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_complete-message
*/
export class TxComplete extends CommonBase {
/* @internal */
constructor(_dummy, ptr) {
super(ptr, bindings.TxComplete_free);
}
/**
* The channel ID
*/
get_channel_id() {
const ret = bindings.TxComplete_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.TxComplete_set_channel_id(this.ptr, CommonBase.get_ptr_of(val));
}
/**
* Constructs a new TxComplete given each field
*/
static constructor_new(channel_id_arg) {
const ret = bindings.TxComplete_new(CommonBase.get_ptr_of(channel_id_arg));
const ret_hu_conv = new TxComplete(null, ret);
CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
return ret_hu_conv;
}
clone_ptr() {
const ret = bindings.TxComplete_clone_ptr(this.ptr);
return ret;
}
/**
* Creates a copy of the TxComplete
*/
clone() {
const ret = bindings.TxComplete_clone(this.ptr);
const ret_hu_conv = new TxComplete(null, ret);
CommonBase.add_ref_from(ret_hu_conv, this);
return ret_hu_conv;
}
/**
* Generates a non-cryptographic 64-bit hash of the TxComplete.
*/
hash() {
const ret = bindings.TxComplete_hash(this.ptr);
return ret;
}
/**
* Checks if two TxCompletes 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.TxComplete_eq(this.ptr, CommonBase.get_ptr_of(b));
CommonBase.add_ref_from(this, b);
return ret;
}
/**
* Serialize the TxComplete object into a byte array which can be read by TxComplete_read
*/
write() {
const ret = bindings.TxComplete_write(this.ptr);
const ret_conv = bindings.decodeUint8Array(ret);
return ret_conv;
}
/**
* Read a TxComplete from a byte array, created by TxComplete_write
*/
static constructor_read(ser) {
const ret = bindings.TxComplete_read(bindings.encodeUint8Array(ser));
const ret_hu_conv = Result_TxCompleteDecodeErrorZ.constr_from_ptr(ret);
return ret_hu_conv;
}
}
//# sourceMappingURL=TxComplete.mjs.map