lightningdevkit
Version:
Lightning Development Kit
119 lines • 4.45 kB
JavaScript
import { ChannelId } from '../structs/ChannelId.mjs';
import { Result_SpliceAckDecodeErrorZ } from '../structs/Result_SpliceAckDecodeErrorZ.mjs';
import { CommonBase } from './CommonBase.mjs';
import * as bindings from '../bindings.mjs';
/**
* A `splice_ack` message to be received by or sent to the splice initiator.
*/
export class SpliceAck extends CommonBase {
/* @internal */
constructor(_dummy, ptr) {
super(ptr, bindings.SpliceAck_free);
}
/**
* The channel ID where splicing is intended
*/
get_channel_id() {
const ret = bindings.SpliceAck_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 where splicing is intended
*/
set_channel_id(val) {
bindings.SpliceAck_set_channel_id(this.ptr, CommonBase.get_ptr_of(val));
}
/**
* The amount the splice acceptor is intending to add to its channel balance (splice-in)
* or remove from its channel balance (splice-out).
*/
get_funding_contribution_satoshis() {
const ret = bindings.SpliceAck_get_funding_contribution_satoshis(this.ptr);
return ret;
}
/**
* The amount the splice acceptor is intending to add to its channel balance (splice-in)
* or remove from its channel balance (splice-out).
*/
set_funding_contribution_satoshis(val) {
bindings.SpliceAck_set_funding_contribution_satoshis(this.ptr, val);
}
/**
* The key of the sender (splice acceptor) controlling the new funding transaction
*/
get_funding_pubkey() {
const ret = bindings.SpliceAck_get_funding_pubkey(this.ptr);
const ret_conv = bindings.decodeUint8Array(ret);
return ret_conv;
}
/**
* The key of the sender (splice acceptor) controlling the new funding transaction
*/
set_funding_pubkey(val) {
bindings.SpliceAck_set_funding_pubkey(this.ptr, bindings.encodeUint8Array(val));
}
/**
* If set, only confirmed inputs added (by the splice initiator) will be accepted
*/
get_require_confirmed_inputs() {
const ret = bindings.SpliceAck_get_require_confirmed_inputs(this.ptr);
return ret;
}
/**
* If set, only confirmed inputs added (by the splice initiator) will be accepted
*/
set_require_confirmed_inputs(val) {
bindings.SpliceAck_set_require_confirmed_inputs(this.ptr, val);
}
/**
* Constructs a new SpliceAck given each field
*/
static constructor_new(channel_id_arg, funding_contribution_satoshis_arg, funding_pubkey_arg, require_confirmed_inputs_arg) {
const ret = bindings.SpliceAck_new(CommonBase.get_ptr_of(channel_id_arg), funding_contribution_satoshis_arg, bindings.encodeUint8Array(funding_pubkey_arg), require_confirmed_inputs_arg);
const ret_hu_conv = new SpliceAck(null, ret);
CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
return ret_hu_conv;
}
clone_ptr() {
const ret = bindings.SpliceAck_clone_ptr(this.ptr);
return ret;
}
/**
* Creates a copy of the SpliceAck
*/
clone() {
const ret = bindings.SpliceAck_clone(this.ptr);
const ret_hu_conv = new SpliceAck(null, ret);
CommonBase.add_ref_from(ret_hu_conv, this);
return ret_hu_conv;
}
/**
* Checks if two SpliceAcks 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.SpliceAck_eq(this.ptr, CommonBase.get_ptr_of(b));
CommonBase.add_ref_from(this, b);
return ret;
}
/**
* Serialize the SpliceAck object into a byte array which can be read by SpliceAck_read
*/
write() {
const ret = bindings.SpliceAck_write(this.ptr);
const ret_conv = bindings.decodeUint8Array(ret);
return ret_conv;
}
/**
* Read a SpliceAck from a byte array, created by SpliceAck_write
*/
static constructor_read(ser) {
const ret = bindings.SpliceAck_read(bindings.encodeUint8Array(ser));
const ret_hu_conv = Result_SpliceAckDecodeErrorZ.constr_from_ptr(ret);
return ret_hu_conv;
}
}
//# sourceMappingURL=SpliceAck.mjs.map