7 namespace org { namespace ldk { namespace structs {
11 /** An implementation of WriteableEcdsaChannelSigner */
12 public interface WriteableEcdsaChannelSignerInterface {
13 /**Serialize the object into a byte array
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`].
24 * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
25 * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
27 public class WriteableEcdsaChannelSigner : CommonBase {
28 internal bindings.LDKWriteableEcdsaChannelSigner bindings_instance;
29 internal long instance_idx;
31 internal WriteableEcdsaChannelSigner(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
32 ~WriteableEcdsaChannelSigner() {
33 if (ptr != 0) { bindings.WriteableEcdsaChannelSigner_free(ptr); }
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;
42 byte[] ret = arg.write();
44 long result = InternalUtils.encodeUint8Array(ret);
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.clone_ptr());
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;
66 * Serialize the object into a byte array
68 public byte[] write() {
69 long ret = bindings.WriteableEcdsaChannelSigner_write(this.ptr);
71 if (ret >= 0 && ret <= 4096) { return null; }
72 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
76 internal long clone_ptr() {
77 long ret = bindings.WriteableEcdsaChannelSigner_clone_ptr(this.ptr);
83 * Creates a copy of a WriteableEcdsaChannelSigner
85 public WriteableEcdsaChannelSigner clone() {
86 long ret = bindings.WriteableEcdsaChannelSigner_clone(this.ptr);
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); };