[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / UpdateFee.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * An [`update_fee`] message to be sent to or received from a peer
11  * 
12  * [`update_fee`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#updating-fees-update_fee
13  */
14 public class UpdateFee : CommonBase {
15         internal UpdateFee(object _dummy, long ptr) : base(ptr) { }
16         ~UpdateFee() {
17                 if (ptr != 0) { bindings.UpdateFee_free(ptr); }
18         }
19
20         /**
21          * The channel ID
22          */
23         public byte[] get_channel_id() {
24                 long ret = bindings.UpdateFee_get_channel_id(this.ptr);
25                 GC.KeepAlive(this);
26                 if (ret >= 0 && ret <= 4096) { return null; }
27                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
28                 return ret_conv;
29         }
30
31         /**
32          * The channel ID
33          */
34         public void set_channel_id(byte[] val) {
35                 bindings.UpdateFee_set_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
36                 GC.KeepAlive(this);
37                 GC.KeepAlive(val);
38         }
39
40         /**
41          * Fee rate per 1000-weight of the transaction
42          */
43         public int get_feerate_per_kw() {
44                 int ret = bindings.UpdateFee_get_feerate_per_kw(this.ptr);
45                 GC.KeepAlive(this);
46                 return ret;
47         }
48
49         /**
50          * Fee rate per 1000-weight of the transaction
51          */
52         public void set_feerate_per_kw(int val) {
53                 bindings.UpdateFee_set_feerate_per_kw(this.ptr, val);
54                 GC.KeepAlive(this);
55                 GC.KeepAlive(val);
56         }
57
58         /**
59          * Constructs a new UpdateFee given each field
60          */
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); };
68                 return ret_hu_conv;
69         }
70
71         internal long clone_ptr() {
72                 long ret = bindings.UpdateFee_clone_ptr(this.ptr);
73                 GC.KeepAlive(this);
74                 return ret;
75         }
76
77         /**
78          * Creates a copy of the UpdateFee
79          */
80         public UpdateFee clone() {
81                 long ret = bindings.UpdateFee_clone(this.ptr);
82                 GC.KeepAlive(this);
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); };
86                 return ret_hu_conv;
87         }
88
89         /**
90          * Generates a non-cryptographic 64-bit hash of the UpdateFee.
91          */
92         public long hash() {
93                 long ret = bindings.UpdateFee_hash(this.ptr);
94                 GC.KeepAlive(this);
95                 return ret;
96         }
97
98         public override int GetHashCode() {
99                 return (int)this.hash();
100         }
101         /**
102          * Checks if two UpdateFees contain equal inner contents.
103          * This ignores pointers and is_owned flags and looks at the values in fields.
104          * Two objects with NULL inner values will be considered "equal" here.
105          */
106         public bool eq(org.ldk.structs.UpdateFee b) {
107                 bool ret = bindings.UpdateFee_eq(this.ptr, b == null ? 0 : b.ptr);
108                 GC.KeepAlive(this);
109                 GC.KeepAlive(b);
110                 if (this != null) { this.ptrs_to.AddLast(b); };
111                 return ret;
112         }
113
114         public override bool Equals(object o) {
115                 if (!(o is UpdateFee)) return false;
116                 return this.eq((UpdateFee)o);
117         }
118         /**
119          * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
120          */
121         public byte[] write() {
122                 long ret = bindings.UpdateFee_write(this.ptr);
123                 GC.KeepAlive(this);
124                 if (ret >= 0 && ret <= 4096) { return null; }
125                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
126                 return ret_conv;
127         }
128
129         /**
130          * Read a UpdateFee from a byte array, created by UpdateFee_write
131          */
132         public static Result_UpdateFeeDecodeErrorZ read(byte[] ser) {
133                 long ret = bindings.UpdateFee_read(InternalUtils.encodeUint8Array(ser));
134                 GC.KeepAlive(ser);
135                 if (ret >= 0 && ret <= 4096) { return null; }
136                 Result_UpdateFeeDecodeErrorZ ret_hu_conv = Result_UpdateFeeDecodeErrorZ.constr_from_ptr(ret);
137                 return ret_hu_conv;
138         }
139
140 }
141 } } }