[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / src / org / ldk / structs / TxInitRbf.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  * A tx_init_rbf message which initiates a replacement of the transaction after it's been
11  * completed.
12  */
13 public class TxInitRbf : CommonBase {
14         internal TxInitRbf(object _dummy, long ptr) : base(ptr) { }
15         ~TxInitRbf() {
16                 if (ptr != 0) { bindings.TxInitRbf_free(ptr); }
17         }
18
19         /**
20          * The channel ID
21          */
22         public ChannelId get_channel_id() {
23                 long ret = bindings.TxInitRbf_get_channel_id(this.ptr);
24                 GC.KeepAlive(this);
25                 if (ret >= 0 && ret <= 4096) { return null; }
26                 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
27                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
28                 return ret_hu_conv;
29         }
30
31         /**
32          * The channel ID
33          */
34         public void set_channel_id(org.ldk.structs.ChannelId val) {
35                 bindings.TxInitRbf_set_channel_id(this.ptr, val.ptr);
36                 GC.KeepAlive(this);
37                 GC.KeepAlive(val);
38                 if (this != null) { this.ptrs_to.AddLast(val); };
39         }
40
41         /**
42          * The locktime of the transaction
43          */
44         public int get_locktime() {
45                 int ret = bindings.TxInitRbf_get_locktime(this.ptr);
46                 GC.KeepAlive(this);
47                 return ret;
48         }
49
50         /**
51          * The locktime of the transaction
52          */
53         public void set_locktime(int val) {
54                 bindings.TxInitRbf_set_locktime(this.ptr, val);
55                 GC.KeepAlive(this);
56                 GC.KeepAlive(val);
57         }
58
59         /**
60          * The feerate of the transaction
61          */
62         public int get_feerate_sat_per_1000_weight() {
63                 int ret = bindings.TxInitRbf_get_feerate_sat_per_1000_weight(this.ptr);
64                 GC.KeepAlive(this);
65                 return ret;
66         }
67
68         /**
69          * The feerate of the transaction
70          */
71         public void set_feerate_sat_per_1000_weight(int val) {
72                 bindings.TxInitRbf_set_feerate_sat_per_1000_weight(this.ptr, val);
73                 GC.KeepAlive(this);
74                 GC.KeepAlive(val);
75         }
76
77         /**
78          * The number of satoshis the sender will contribute to or, if negative, remove from
79          * (e.g. splice-out) the funding output of the transaction
80          */
81         public Option_i64Z get_funding_output_contribution() {
82                 long ret = bindings.TxInitRbf_get_funding_output_contribution(this.ptr);
83                 GC.KeepAlive(this);
84                 if (ret >= 0 && ret <= 4096) { return null; }
85                 org.ldk.structs.Option_i64Z ret_hu_conv = org.ldk.structs.Option_i64Z.constr_from_ptr(ret);
86                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
87                 return ret_hu_conv;
88         }
89
90         /**
91          * The number of satoshis the sender will contribute to or, if negative, remove from
92          * (e.g. splice-out) the funding output of the transaction
93          */
94         public void set_funding_output_contribution(org.ldk.structs.Option_i64Z val) {
95                 bindings.TxInitRbf_set_funding_output_contribution(this.ptr, val.ptr);
96                 GC.KeepAlive(this);
97                 GC.KeepAlive(val);
98                 if (this != null) { this.ptrs_to.AddLast(val); };
99         }
100
101         /**
102          * Constructs a new TxInitRbf given each field
103          */
104         public static TxInitRbf of(org.ldk.structs.ChannelId channel_id_arg, int locktime_arg, int feerate_sat_per_1000_weight_arg, org.ldk.structs.Option_i64Z funding_output_contribution_arg) {
105                 long ret = bindings.TxInitRbf_new(channel_id_arg.ptr, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg.ptr);
106                 GC.KeepAlive(channel_id_arg);
107                 GC.KeepAlive(locktime_arg);
108                 GC.KeepAlive(feerate_sat_per_1000_weight_arg);
109                 GC.KeepAlive(funding_output_contribution_arg);
110                 if (ret >= 0 && ret <= 4096) { return null; }
111                 org.ldk.structs.TxInitRbf ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxInitRbf(null, ret); }
112                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
113                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_id_arg); };
114                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(funding_output_contribution_arg); };
115                 return ret_hu_conv;
116         }
117
118         internal long clone_ptr() {
119                 long ret = bindings.TxInitRbf_clone_ptr(this.ptr);
120                 GC.KeepAlive(this);
121                 return ret;
122         }
123
124         /**
125          * Creates a copy of the TxInitRbf
126          */
127         public TxInitRbf clone() {
128                 long ret = bindings.TxInitRbf_clone(this.ptr);
129                 GC.KeepAlive(this);
130                 if (ret >= 0 && ret <= 4096) { return null; }
131                 org.ldk.structs.TxInitRbf ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxInitRbf(null, ret); }
132                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
133                 return ret_hu_conv;
134         }
135
136         /**
137          * Generates a non-cryptographic 64-bit hash of the TxInitRbf.
138          */
139         public long hash() {
140                 long ret = bindings.TxInitRbf_hash(this.ptr);
141                 GC.KeepAlive(this);
142                 return ret;
143         }
144
145         public override int GetHashCode() {
146                 return (int)this.hash();
147         }
148         /**
149          * Checks if two TxInitRbfs contain equal inner contents.
150          * This ignores pointers and is_owned flags and looks at the values in fields.
151          * Two objects with NULL inner values will be considered "equal" here.
152          */
153         public bool eq(org.ldk.structs.TxInitRbf b) {
154                 bool ret = bindings.TxInitRbf_eq(this.ptr, b.ptr);
155                 GC.KeepAlive(this);
156                 GC.KeepAlive(b);
157                 if (this != null) { this.ptrs_to.AddLast(b); };
158                 return ret;
159         }
160
161         public override bool Equals(object o) {
162                 if (!(o is TxInitRbf)) return false;
163                 return this.eq((TxInitRbf)o);
164         }
165         /**
166          * Serialize the TxInitRbf object into a byte array which can be read by TxInitRbf_read
167          */
168         public byte[] write() {
169                 long ret = bindings.TxInitRbf_write(this.ptr);
170                 GC.KeepAlive(this);
171                 if (ret >= 0 && ret <= 4096) { return null; }
172                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
173                 return ret_conv;
174         }
175
176         /**
177          * Read a TxInitRbf from a byte array, created by TxInitRbf_write
178          */
179         public static Result_TxInitRbfDecodeErrorZ read(byte[] ser) {
180                 long ret = bindings.TxInitRbf_read(InternalUtils.encodeUint8Array(ser));
181                 GC.KeepAlive(ser);
182                 if (ret >= 0 && ret <= 4096) { return null; }
183                 Result_TxInitRbfDecodeErrorZ ret_hu_conv = Result_TxInitRbfDecodeErrorZ.constr_from_ptr(ret);
184                 return ret_hu_conv;
185         }
186
187 }
188 } } }