lightningdevkit
Version:
Lightning Development Kit
99 lines • 3.28 kB
JavaScript
import { ChannelId } from '../structs/ChannelId.mjs';
import { Result_UpdateFeeDecodeErrorZ } from '../structs/Result_UpdateFeeDecodeErrorZ.mjs';
import { CommonBase } from './CommonBase.mjs';
import * as bindings from '../bindings.mjs';
/**
* An [`update_fee`] message to be sent to or received from a peer
*
* [`update_fee`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#updating-fees-update_fee
*/
export class UpdateFee extends CommonBase {
/* @internal */
constructor(_dummy, ptr) {
super(ptr, bindings.UpdateFee_free);
}
/**
* The channel ID
*/
get_channel_id() {
const ret = bindings.UpdateFee_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.UpdateFee_set_channel_id(this.ptr, CommonBase.get_ptr_of(val));
}
/**
* Fee rate per 1000-weight of the transaction
*/
get_feerate_per_kw() {
const ret = bindings.UpdateFee_get_feerate_per_kw(this.ptr);
return ret;
}
/**
* Fee rate per 1000-weight of the transaction
*/
set_feerate_per_kw(val) {
bindings.UpdateFee_set_feerate_per_kw(this.ptr, val);
}
/**
* Constructs a new UpdateFee given each field
*/
static constructor_new(channel_id_arg, feerate_per_kw_arg) {
const ret = bindings.UpdateFee_new(CommonBase.get_ptr_of(channel_id_arg), feerate_per_kw_arg);
const ret_hu_conv = new UpdateFee(null, ret);
CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
return ret_hu_conv;
}
clone_ptr() {
const ret = bindings.UpdateFee_clone_ptr(this.ptr);
return ret;
}
/**
* Creates a copy of the UpdateFee
*/
clone() {
const ret = bindings.UpdateFee_clone(this.ptr);
const ret_hu_conv = new UpdateFee(null, ret);
CommonBase.add_ref_from(ret_hu_conv, this);
return ret_hu_conv;
}
/**
* Generates a non-cryptographic 64-bit hash of the UpdateFee.
*/
hash() {
const ret = bindings.UpdateFee_hash(this.ptr);
return ret;
}
/**
* Checks if two UpdateFees 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.UpdateFee_eq(this.ptr, CommonBase.get_ptr_of(b));
CommonBase.add_ref_from(this, b);
return ret;
}
/**
* Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
*/
write() {
const ret = bindings.UpdateFee_write(this.ptr);
const ret_conv = bindings.decodeUint8Array(ret);
return ret_conv;
}
/**
* Read a UpdateFee from a byte array, created by UpdateFee_write
*/
static constructor_read(ser) {
const ret = bindings.UpdateFee_read(bindings.encodeUint8Array(ser));
const ret_hu_conv = Result_UpdateFeeDecodeErrorZ.constr_from_ptr(ret);
return ret_hu_conv;
}
}
//# sourceMappingURL=UpdateFee.mjs.map