UNPKG

lightningdevkit

Version:
131 lines 4.61 kB
import { ChannelId } from '../structs/ChannelId.mjs'; import { Option_i64Z } from '../structs/Option_i64Z.mjs'; import { Result_TxInitRbfDecodeErrorZ } from '../structs/Result_TxInitRbfDecodeErrorZ.mjs'; import { CommonBase } from './CommonBase.mjs'; import * as bindings from '../bindings.mjs'; /** * A [`tx_init_rbf`] message which initiates a replacement of the transaction after it's been * completed. * * [`tx_init_rbf`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_init_rbf-message */ export class TxInitRbf extends CommonBase { /* @internal */ constructor(_dummy, ptr) { super(ptr, bindings.TxInitRbf_free); } /** * The channel ID */ get_channel_id() { const ret = bindings.TxInitRbf_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.TxInitRbf_set_channel_id(this.ptr, CommonBase.get_ptr_of(val)); } /** * The locktime of the transaction */ get_locktime() { const ret = bindings.TxInitRbf_get_locktime(this.ptr); return ret; } /** * The locktime of the transaction */ set_locktime(val) { bindings.TxInitRbf_set_locktime(this.ptr, val); } /** * The feerate of the transaction */ get_feerate_sat_per_1000_weight() { const ret = bindings.TxInitRbf_get_feerate_sat_per_1000_weight(this.ptr); return ret; } /** * The feerate of the transaction */ set_feerate_sat_per_1000_weight(val) { bindings.TxInitRbf_set_feerate_sat_per_1000_weight(this.ptr, 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.TxInitRbf_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.TxInitRbf_set_funding_output_contribution(this.ptr, CommonBase.get_ptr_of(val)); } /** * Constructs a new TxInitRbf given each field */ static constructor_new(channel_id_arg, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg) { const ret = bindings.TxInitRbf_new(CommonBase.get_ptr_of(channel_id_arg), locktime_arg, feerate_sat_per_1000_weight_arg, CommonBase.get_ptr_of(funding_output_contribution_arg)); const ret_hu_conv = new TxInitRbf(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } clone_ptr() { const ret = bindings.TxInitRbf_clone_ptr(this.ptr); return ret; } /** * Creates a copy of the TxInitRbf */ clone() { const ret = bindings.TxInitRbf_clone(this.ptr); const ret_hu_conv = new TxInitRbf(null, ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; } /** * Generates a non-cryptographic 64-bit hash of the TxInitRbf. */ hash() { const ret = bindings.TxInitRbf_hash(this.ptr); return ret; } /** * Checks if two TxInitRbfs 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.TxInitRbf_eq(this.ptr, CommonBase.get_ptr_of(b)); CommonBase.add_ref_from(this, b); return ret; } /** * Serialize the TxInitRbf object into a byte array which can be read by TxInitRbf_read */ write() { const ret = bindings.TxInitRbf_write(this.ptr); const ret_conv = bindings.decodeUint8Array(ret); return ret_conv; } /** * Read a TxInitRbf from a byte array, created by TxInitRbf_write */ static constructor_read(ser) { const ret = bindings.TxInitRbf_read(bindings.encodeUint8Array(ser)); const ret_hu_conv = Result_TxInitRbfDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; } } //# sourceMappingURL=TxInitRbf.mjs.map