[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / ChannelDerivationParameters.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  * The parameters required to derive a channel signer via [`SignerProvider`].
11  */
12 public class ChannelDerivationParameters : CommonBase {
13         internal ChannelDerivationParameters(object _dummy, long ptr) : base(ptr) { }
14         ~ChannelDerivationParameters() {
15                 if (ptr != 0) { bindings.ChannelDerivationParameters_free(ptr); }
16         }
17
18         /**
19          * The value in satoshis of the channel we're attempting to spend the anchor output of.
20          */
21         public long get_value_satoshis() {
22                 long ret = bindings.ChannelDerivationParameters_get_value_satoshis(this.ptr);
23                 GC.KeepAlive(this);
24                 return ret;
25         }
26
27         /**
28          * The value in satoshis of the channel we're attempting to spend the anchor output of.
29          */
30         public void set_value_satoshis(long val) {
31                 bindings.ChannelDerivationParameters_set_value_satoshis(this.ptr, val);
32                 GC.KeepAlive(this);
33                 GC.KeepAlive(val);
34         }
35
36         /**
37          * The unique identifier to re-derive the signer for the associated channel.
38          */
39         public byte[] get_keys_id() {
40                 long ret = bindings.ChannelDerivationParameters_get_keys_id(this.ptr);
41                 GC.KeepAlive(this);
42                 if (ret >= 0 && ret <= 4096) { return null; }
43                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
44                 return ret_conv;
45         }
46
47         /**
48          * The unique identifier to re-derive the signer for the associated channel.
49          */
50         public void set_keys_id(byte[] val) {
51                 bindings.ChannelDerivationParameters_set_keys_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
52                 GC.KeepAlive(this);
53                 GC.KeepAlive(val);
54         }
55
56         /**
57          * The necessary channel parameters that need to be provided to the re-derived signer through
58          * [`ChannelSigner::provide_channel_parameters`].
59          */
60         public ChannelTransactionParameters get_transaction_parameters() {
61                 long ret = bindings.ChannelDerivationParameters_get_transaction_parameters(this.ptr);
62                 GC.KeepAlive(this);
63                 if (ret >= 0 && ret <= 4096) { return null; }
64                 org.ldk.structs.ChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTransactionParameters(null, ret); }
65                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
66                 return ret_hu_conv;
67         }
68
69         /**
70          * The necessary channel parameters that need to be provided to the re-derived signer through
71          * [`ChannelSigner::provide_channel_parameters`].
72          */
73         public void set_transaction_parameters(org.ldk.structs.ChannelTransactionParameters val) {
74                 bindings.ChannelDerivationParameters_set_transaction_parameters(this.ptr, val == null ? 0 : val.ptr);
75                 GC.KeepAlive(this);
76                 GC.KeepAlive(val);
77                 if (this != null) { this.ptrs_to.AddLast(val); };
78         }
79
80         /**
81          * Constructs a new ChannelDerivationParameters given each field
82          */
83         public static ChannelDerivationParameters of(long value_satoshis_arg, byte[] keys_id_arg, org.ldk.structs.ChannelTransactionParameters transaction_parameters_arg) {
84                 long ret = bindings.ChannelDerivationParameters_new(value_satoshis_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(keys_id_arg, 32)), transaction_parameters_arg == null ? 0 : transaction_parameters_arg.ptr);
85                 GC.KeepAlive(value_satoshis_arg);
86                 GC.KeepAlive(keys_id_arg);
87                 GC.KeepAlive(transaction_parameters_arg);
88                 if (ret >= 0 && ret <= 4096) { return null; }
89                 org.ldk.structs.ChannelDerivationParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelDerivationParameters(null, ret); }
90                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
91                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(transaction_parameters_arg); };
92                 return ret_hu_conv;
93         }
94
95         internal long clone_ptr() {
96                 long ret = bindings.ChannelDerivationParameters_clone_ptr(this.ptr);
97                 GC.KeepAlive(this);
98                 return ret;
99         }
100
101         /**
102          * Creates a copy of the ChannelDerivationParameters
103          */
104         public ChannelDerivationParameters clone() {
105                 long ret = bindings.ChannelDerivationParameters_clone(this.ptr);
106                 GC.KeepAlive(this);
107                 if (ret >= 0 && ret <= 4096) { return null; }
108                 org.ldk.structs.ChannelDerivationParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelDerivationParameters(null, ret); }
109                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
110                 return ret_hu_conv;
111         }
112
113         /**
114          * Checks if two ChannelDerivationParameterss contain equal inner contents.
115          * This ignores pointers and is_owned flags and looks at the values in fields.
116          * Two objects with NULL inner values will be considered "equal" here.
117          */
118         public bool eq(org.ldk.structs.ChannelDerivationParameters b) {
119                 bool ret = bindings.ChannelDerivationParameters_eq(this.ptr, b == null ? 0 : b.ptr);
120                 GC.KeepAlive(this);
121                 GC.KeepAlive(b);
122                 if (this != null) { this.ptrs_to.AddLast(b); };
123                 return ret;
124         }
125
126         public override bool Equals(object o) {
127                 if (!(o is ChannelDerivationParameters)) return false;
128                 return this.eq((ChannelDerivationParameters)o);
129         }
130         /**
131          * Serialize the ChannelDerivationParameters object into a byte array which can be read by ChannelDerivationParameters_read
132          */
133         public byte[] write() {
134                 long ret = bindings.ChannelDerivationParameters_write(this.ptr);
135                 GC.KeepAlive(this);
136                 if (ret >= 0 && ret <= 4096) { return null; }
137                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
138                 return ret_conv;
139         }
140
141         /**
142          * Read a ChannelDerivationParameters from a byte array, created by ChannelDerivationParameters_write
143          */
144         public static Result_ChannelDerivationParametersDecodeErrorZ read(byte[] ser) {
145                 long ret = bindings.ChannelDerivationParameters_read(InternalUtils.encodeUint8Array(ser));
146                 GC.KeepAlive(ser);
147                 if (ret >= 0 && ret <= 4096) { return null; }
148                 Result_ChannelDerivationParametersDecodeErrorZ ret_hu_conv = Result_ChannelDerivationParametersDecodeErrorZ.constr_from_ptr(ret);
149                 return ret_hu_conv;
150         }
151
152 }
153 } } }