lightningdevkit
Version:
Lightning Development Kit
105 lines • 3.8 kB
JavaScript
import { ChannelId } from '../structs/ChannelId.mjs';
import { Option_i64Z } from '../structs/Option_i64Z.mjs';
import { Result_TxAckRbfDecodeErrorZ } from '../structs/Result_TxAckRbfDecodeErrorZ.mjs';
import { CommonBase } from './CommonBase.mjs';
import * as bindings from '../bindings.mjs';
/**
* A [`tx_ack_rbf`] message which acknowledges replacement of the transaction after it's been
* completed.
*
* [`tx_ack_rbf`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_ack_rbf-message
*/
export class TxAckRbf extends CommonBase {
/* @internal */
constructor(_dummy, ptr) {
super(ptr, bindings.TxAckRbf_free);
}
/**
* The channel ID
*/
get_channel_id() {
const ret = bindings.TxAckRbf_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.TxAckRbf_set_channel_id(this.ptr, CommonBase.get_ptr_of(val));
}
/**
* The number of satoshis the sender will contribute to or, if negative, remove from
* (e.g. splice-out) the funding output of the transaction
*/
get_funding_output_contribution() {
const ret = bindings.TxAckRbf_get_funding_output_contribution(this.ptr);
const ret_hu_conv = Option_i64Z.constr_from_ptr(ret);
CommonBase.add_ref_from(ret_hu_conv, this);
return ret_hu_conv;
}
/**
* The number of satoshis the sender will contribute to or, if negative, remove from
* (e.g. splice-out) the funding output of the transaction
*/
set_funding_output_contribution(val) {
bindings.TxAckRbf_set_funding_output_contribution(this.ptr, CommonBase.get_ptr_of(val));
}
/**
* Constructs a new TxAckRbf given each field
*/
static constructor_new(channel_id_arg, funding_output_contribution_arg) {
const ret = bindings.TxAckRbf_new(CommonBase.get_ptr_of(channel_id_arg), CommonBase.get_ptr_of(funding_output_contribution_arg));
const ret_hu_conv = new TxAckRbf(null, ret);
CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
return ret_hu_conv;
}
clone_ptr() {
const ret = bindings.TxAckRbf_clone_ptr(this.ptr);
return ret;
}
/**
* Creates a copy of the TxAckRbf
*/
clone() {
const ret = bindings.TxAckRbf_clone(this.ptr);
const ret_hu_conv = new TxAckRbf(null, ret);
CommonBase.add_ref_from(ret_hu_conv, this);
return ret_hu_conv;
}
/**
* Generates a non-cryptographic 64-bit hash of the TxAckRbf.
*/
hash() {
const ret = bindings.TxAckRbf_hash(this.ptr);
return ret;
}
/**
* Checks if two TxAckRbfs 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.TxAckRbf_eq(this.ptr, CommonBase.get_ptr_of(b));
CommonBase.add_ref_from(this, b);
return ret;
}
/**
* Serialize the TxAckRbf object into a byte array which can be read by TxAckRbf_read
*/
write() {
const ret = bindings.TxAckRbf_write(this.ptr);
const ret_conv = bindings.decodeUint8Array(ret);
return ret_conv;
}
/**
* Read a TxAckRbf from a byte array, created by TxAckRbf_write
*/
static constructor_read(ser) {
const ret = bindings.TxAckRbf_read(bindings.encodeUint8Array(ser));
const ret_hu_conv = Result_TxAckRbfDecodeErrorZ.constr_from_ptr(ret);
return ret_hu_conv;
}
}
//# sourceMappingURL=TxAckRbf.mjs.map