[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / HTLCUpdate.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  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
11  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
12  * preimage claim backward will lead to loss of funds.
13  */
14 public class HTLCUpdate : CommonBase {
15         internal HTLCUpdate(object _dummy, long ptr) : base(ptr) { }
16         ~HTLCUpdate() {
17                 if (ptr != 0) { bindings.HTLCUpdate_free(ptr); }
18         }
19
20         internal long clone_ptr() {
21                 long ret = bindings.HTLCUpdate_clone_ptr(this.ptr);
22                 GC.KeepAlive(this);
23                 return ret;
24         }
25
26         /**
27          * Creates a copy of the HTLCUpdate
28          */
29         public HTLCUpdate clone() {
30                 long ret = bindings.HTLCUpdate_clone(this.ptr);
31                 GC.KeepAlive(this);
32                 if (ret >= 0 && ret <= 4096) { return null; }
33                 org.ldk.structs.HTLCUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HTLCUpdate(null, ret); }
34                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
35                 return ret_hu_conv;
36         }
37
38         /**
39          * Checks if two HTLCUpdates contain equal inner contents.
40          * This ignores pointers and is_owned flags and looks at the values in fields.
41          * Two objects with NULL inner values will be considered "equal" here.
42          */
43         public bool eq(org.ldk.structs.HTLCUpdate b) {
44                 bool ret = bindings.HTLCUpdate_eq(this.ptr, b == null ? 0 : b.ptr);
45                 GC.KeepAlive(this);
46                 GC.KeepAlive(b);
47                 if (this != null) { this.ptrs_to.AddLast(b); };
48                 return ret;
49         }
50
51         public override bool Equals(object o) {
52                 if (!(o is HTLCUpdate)) return false;
53                 return this.eq((HTLCUpdate)o);
54         }
55         /**
56          * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
57          */
58         public byte[] write() {
59                 long ret = bindings.HTLCUpdate_write(this.ptr);
60                 GC.KeepAlive(this);
61                 if (ret >= 0 && ret <= 4096) { return null; }
62                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
63                 return ret_conv;
64         }
65
66         /**
67          * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
68          */
69         public static Result_HTLCUpdateDecodeErrorZ read(byte[] ser) {
70                 long ret = bindings.HTLCUpdate_read(InternalUtils.encodeUint8Array(ser));
71                 GC.KeepAlive(ser);
72                 if (ret >= 0 && ret <= 4096) { return null; }
73                 Result_HTLCUpdateDecodeErrorZ ret_hu_conv = Result_HTLCUpdateDecodeErrorZ.constr_from_ptr(ret);
74                 return ret_hu_conv;
75         }
76
77 }
78 } } }