[C#] Check in initial auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / StaticPaymentOutputDescriptor.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  * Information about a spendable output to our \"payment key\".
11  * 
12  * See [`SpendableOutputDescriptor::StaticPaymentOutput`] for more details on how to spend this.
13  */
14 public class StaticPaymentOutputDescriptor : CommonBase {
15         internal StaticPaymentOutputDescriptor(object _dummy, long ptr) : base(ptr) { }
16         ~StaticPaymentOutputDescriptor() {
17                 if (ptr != 0) { bindings.StaticPaymentOutputDescriptor_free(ptr); }
18         }
19
20         /**
21          * The outpoint which is spendable.
22          */
23         public OutPoint get_outpoint() {
24                 long ret = bindings.StaticPaymentOutputDescriptor_get_outpoint(this.ptr);
25                 GC.KeepAlive(this);
26                 if (ret >= 0 && ret <= 4096) { return null; }
27                 org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); }
28                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
29                 return ret_hu_conv;
30         }
31
32         /**
33          * The outpoint which is spendable.
34          */
35         public void set_outpoint(org.ldk.structs.OutPoint val) {
36                 bindings.StaticPaymentOutputDescriptor_set_outpoint(this.ptr, val == null ? 0 : val.ptr);
37                 GC.KeepAlive(this);
38                 GC.KeepAlive(val);
39                 if (this != null) { this.ptrs_to.AddLast(val); };
40         }
41
42         /**
43          * The output which is referenced by the given outpoint.
44          * 
45          * Returns a copy of the field.
46          */
47         public TxOut get_output() {
48                 long ret = bindings.StaticPaymentOutputDescriptor_get_output(this.ptr);
49                 GC.KeepAlive(this);
50                 if (ret >= 0 && ret <= 4096) { return null; }
51                 TxOut ret_conv = new TxOut(null, ret);
52                 return ret_conv;
53         }
54
55         /**
56          * The output which is referenced by the given outpoint.
57          */
58         public void set_output(org.ldk.structs.TxOut val) {
59                 bindings.StaticPaymentOutputDescriptor_set_output(this.ptr, val.ptr);
60                 GC.KeepAlive(this);
61                 GC.KeepAlive(val);
62         }
63
64         /**
65          * Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`].
66          * This may be useful in re-deriving keys used in the channel to spend the output.
67          */
68         public byte[] get_channel_keys_id() {
69                 byte[] ret = bindings.StaticPaymentOutputDescriptor_get_channel_keys_id(this.ptr);
70                 GC.KeepAlive(this);
71                 return ret;
72         }
73
74         /**
75          * Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`].
76          * This may be useful in re-deriving keys used in the channel to spend the output.
77          */
78         public void set_channel_keys_id(byte[] val) {
79                 bindings.StaticPaymentOutputDescriptor_set_channel_keys_id(this.ptr, InternalUtils.check_arr_len(val, 32));
80                 GC.KeepAlive(this);
81                 GC.KeepAlive(val);
82         }
83
84         /**
85          * The value of the channel which this transactions spends.
86          */
87         public long get_channel_value_satoshis() {
88                 long ret = bindings.StaticPaymentOutputDescriptor_get_channel_value_satoshis(this.ptr);
89                 GC.KeepAlive(this);
90                 return ret;
91         }
92
93         /**
94          * The value of the channel which this transactions spends.
95          */
96         public void set_channel_value_satoshis(long val) {
97                 bindings.StaticPaymentOutputDescriptor_set_channel_value_satoshis(this.ptr, val);
98                 GC.KeepAlive(this);
99                 GC.KeepAlive(val);
100         }
101
102         /**
103          * Constructs a new StaticPaymentOutputDescriptor given each field
104          */
105         public static StaticPaymentOutputDescriptor of(org.ldk.structs.OutPoint outpoint_arg, org.ldk.structs.TxOut output_arg, byte[] channel_keys_id_arg, long channel_value_satoshis_arg) {
106                 long ret = bindings.StaticPaymentOutputDescriptor_new(outpoint_arg == null ? 0 : outpoint_arg.ptr, output_arg.ptr, InternalUtils.check_arr_len(channel_keys_id_arg, 32), channel_value_satoshis_arg);
107                 GC.KeepAlive(outpoint_arg);
108                 GC.KeepAlive(output_arg);
109                 GC.KeepAlive(channel_keys_id_arg);
110                 GC.KeepAlive(channel_value_satoshis_arg);
111                 if (ret >= 0 && ret <= 4096) { return null; }
112                 org.ldk.structs.StaticPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.StaticPaymentOutputDescriptor(null, ret); }
113                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
114                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(outpoint_arg); };
115                 return ret_hu_conv;
116         }
117
118         internal long clone_ptr() {
119                 long ret = bindings.StaticPaymentOutputDescriptor_clone_ptr(this.ptr);
120                 GC.KeepAlive(this);
121                 return ret;
122         }
123
124         /**
125          * Creates a copy of the StaticPaymentOutputDescriptor
126          */
127         public StaticPaymentOutputDescriptor clone() {
128                 long ret = bindings.StaticPaymentOutputDescriptor_clone(this.ptr);
129                 GC.KeepAlive(this);
130                 if (ret >= 0 && ret <= 4096) { return null; }
131                 org.ldk.structs.StaticPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.StaticPaymentOutputDescriptor(null, ret); }
132                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
133                 return ret_hu_conv;
134         }
135
136         /**
137          * Checks if two StaticPaymentOutputDescriptors contain equal inner contents.
138          * This ignores pointers and is_owned flags and looks at the values in fields.
139          * Two objects with NULL inner values will be considered "equal" here.
140          */
141         public bool eq(org.ldk.structs.StaticPaymentOutputDescriptor b) {
142                 bool ret = bindings.StaticPaymentOutputDescriptor_eq(this.ptr, b == null ? 0 : b.ptr);
143                 GC.KeepAlive(this);
144                 GC.KeepAlive(b);
145                 if (this != null) { this.ptrs_to.AddLast(b); };
146                 return ret;
147         }
148
149         public override bool Equals(object o) {
150                 if (!(o is StaticPaymentOutputDescriptor)) return false;
151                 return this.eq((StaticPaymentOutputDescriptor)o);
152         }
153         /**
154          * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
155          */
156         public byte[] write() {
157                 byte[] ret = bindings.StaticPaymentOutputDescriptor_write(this.ptr);
158                 GC.KeepAlive(this);
159                 return ret;
160         }
161
162         /**
163          * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
164          */
165         public static Result_StaticPaymentOutputDescriptorDecodeErrorZ read(byte[] ser) {
166                 long ret = bindings.StaticPaymentOutputDescriptor_read(ser);
167                 GC.KeepAlive(ser);
168                 if (ret >= 0 && ret <= 4096) { return null; }
169                 Result_StaticPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_StaticPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret);
170                 return ret_hu_conv;
171         }
172
173 }
174 } } }