[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / WriteableEcdsaChannelSigner.cs
1
2 using org.ldk.impl;
3 using org.ldk.enums;
4 using org.ldk.util;
5 using System;
6
7 namespace org { namespace ldk { namespace structs {
8
9
10
11 /** An implementation of WriteableEcdsaChannelSigner */
12 public interface WriteableEcdsaChannelSignerInterface {
13         /**Serialize the object into a byte array
14          */
15         byte[] write();
16 }
17
18 /**
19  * A writeable signer.
20  * 
21  * There will always be two instances of a signer per channel, one occupied by the
22  * [`ChannelManager`] and another by the channel's [`ChannelMonitor`].
23  * 
24  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
25  * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
26  */
27 public class WriteableEcdsaChannelSigner : CommonBase {
28         internal bindings.LDKWriteableEcdsaChannelSigner bindings_instance;
29         internal long instance_idx;
30
31         internal WriteableEcdsaChannelSigner(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
32         ~WriteableEcdsaChannelSigner() {
33                 if (ptr != 0) { bindings.WriteableEcdsaChannelSigner_free(ptr); }
34         }
35
36         private class LDKWriteableEcdsaChannelSignerHolder { internal WriteableEcdsaChannelSigner held; }
37         private class LDKWriteableEcdsaChannelSignerImpl : bindings.LDKWriteableEcdsaChannelSigner {
38                 internal LDKWriteableEcdsaChannelSignerImpl(WriteableEcdsaChannelSignerInterface arg, LDKWriteableEcdsaChannelSignerHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
39                 private WriteableEcdsaChannelSignerInterface arg;
40                 private LDKWriteableEcdsaChannelSignerHolder impl_holder;
41                 public long write() {
42                         byte[] ret = arg.write();
43                                 GC.KeepAlive(arg);
44                         long result = InternalUtils.encodeUint8Array(ret);
45                         return result;
46                 }
47         }
48
49         /** Creates a new instance of WriteableEcdsaChannelSigner from a given implementation */
50         public static WriteableEcdsaChannelSigner new_impl(WriteableEcdsaChannelSignerInterface arg, EcdsaChannelSignerInterface ecdsaChannelSigner_impl, ChannelSignerInterface channelSigner_impl, ChannelPublicKeys pubkeys) {
51                 LDKWriteableEcdsaChannelSignerHolder impl_holder = new LDKWriteableEcdsaChannelSignerHolder();
52                 LDKWriteableEcdsaChannelSignerImpl impl = new LDKWriteableEcdsaChannelSignerImpl(arg, impl_holder);
53                 EcdsaChannelSigner ecdsaChannelSigner = EcdsaChannelSigner.new_impl(ecdsaChannelSigner_impl, channelSigner_impl, pubkeys);
54                 ChannelSigner channelSigner = ChannelSigner.new_impl(channelSigner_impl, pubkeys);
55                 long[] ptr_idx = bindings.LDKWriteableEcdsaChannelSigner_new(impl, ecdsaChannelSigner.instance_idx, channelSigner.instance_idx, pubkeys == null ? 0 : pubkeys.clone_ptr());
56
57                 impl_holder.held = new WriteableEcdsaChannelSigner(null, ptr_idx[0]);
58                 impl_holder.held.instance_idx = ptr_idx[1];
59                 impl_holder.held.bindings_instance = impl;
60                 impl_holder.held.ptrs_to.AddLast(ecdsaChannelSigner);
61                 impl_holder.held.ptrs_to.AddLast(channelSigner);
62                 return impl_holder.held;
63         }
64
65         /**
66          * Serialize the object into a byte array
67          */
68         public byte[] write() {
69                 long ret = bindings.WriteableEcdsaChannelSigner_write(this.ptr);
70                 GC.KeepAlive(this);
71                 if (ret >= 0 && ret <= 4096) { return null; }
72                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
73                 return ret_conv;
74         }
75
76         internal long clone_ptr() {
77                 long ret = bindings.WriteableEcdsaChannelSigner_clone_ptr(this.ptr);
78                 GC.KeepAlive(this);
79                 return ret;
80         }
81
82         /**
83          * Creates a copy of a WriteableEcdsaChannelSigner
84          */
85         public WriteableEcdsaChannelSigner clone() {
86                 long ret = bindings.WriteableEcdsaChannelSigner_clone(this.ptr);
87                 GC.KeepAlive(this);
88                 if (ret >= 0 && ret <= 4096) { return null; }
89                 WriteableEcdsaChannelSigner ret_hu_conv = new WriteableEcdsaChannelSigner(null, ret);
90                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
91                 return ret_hu_conv;
92         }
93
94 }
95 } } }