6 namespace org { namespace ldk { namespace structs {
10 * An [`update_fee`] message to be sent to or received from a peer
12 * [`update_fee`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#updating-fees-update_fee
14 public class UpdateFee : CommonBase {
15 internal UpdateFee(object _dummy, long ptr) : base(ptr) { }
17 if (ptr != 0) { bindings.UpdateFee_free(ptr); }
23 public byte[] get_channel_id() {
24 long ret = bindings.UpdateFee_get_channel_id(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
34 public void set_channel_id(byte[] val) {
35 bindings.UpdateFee_set_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
41 * Fee rate per 1000-weight of the transaction
43 public int get_feerate_per_kw() {
44 int ret = bindings.UpdateFee_get_feerate_per_kw(this.ptr);
50 * Fee rate per 1000-weight of the transaction
52 public void set_feerate_per_kw(int val) {
53 bindings.UpdateFee_set_feerate_per_kw(this.ptr, val);
59 * Constructs a new UpdateFee given each field
61 public static UpdateFee of(byte[] channel_id_arg, int feerate_per_kw_arg) {
62 long ret = bindings.UpdateFee_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id_arg, 32)), feerate_per_kw_arg);
63 GC.KeepAlive(channel_id_arg);
64 GC.KeepAlive(feerate_per_kw_arg);
65 if (ret >= 0 && ret <= 4096) { return null; }
66 org.ldk.structs.UpdateFee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFee(null, ret); }
67 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
71 internal long clone_ptr() {
72 long ret = bindings.UpdateFee_clone_ptr(this.ptr);
78 * Creates a copy of the UpdateFee
80 public UpdateFee clone() {
81 long ret = bindings.UpdateFee_clone(this.ptr);
83 if (ret >= 0 && ret <= 4096) { return null; }
84 org.ldk.structs.UpdateFee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFee(null, ret); }
85 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
90 * Checks if two UpdateFees contain equal inner contents.
91 * This ignores pointers and is_owned flags and looks at the values in fields.
92 * Two objects with NULL inner values will be considered "equal" here.
94 public bool eq(org.ldk.structs.UpdateFee b) {
95 bool ret = bindings.UpdateFee_eq(this.ptr, b == null ? 0 : b.ptr);
98 if (this != null) { this.ptrs_to.AddLast(b); };
102 public override bool Equals(object o) {
103 if (!(o is UpdateFee)) return false;
104 return this.eq((UpdateFee)o);
107 * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
109 public byte[] write() {
110 long ret = bindings.UpdateFee_write(this.ptr);
112 if (ret >= 0 && ret <= 4096) { return null; }
113 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
118 * Read a UpdateFee from a byte array, created by UpdateFee_write
120 public static Result_UpdateFeeDecodeErrorZ read(byte[] ser) {
121 long ret = bindings.UpdateFee_read(InternalUtils.encodeUint8Array(ser));
123 if (ret >= 0 && ret <= 4096) { return null; }
124 Result_UpdateFeeDecodeErrorZ ret_hu_conv = Result_UpdateFeeDecodeErrorZ.constr_from_ptr(ret);