6 namespace org { namespace ldk { namespace structs {
11 * There will always be two instances of a signer per channel, one occupied by the
12 * [`ChannelManager`] and another by the channel's [`ChannelMonitor`].
14 * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
15 * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
17 public class Sign : CommonBase {
18 internal readonly bindings.LDKSign bindings_instance;
19 internal Sign(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
20 private Sign(bindings.LDKSign arg, bindings.LDKBaseSign BaseSign, ChannelPublicKeys pubkeys) : base(bindings.LDKSign_new(arg, BaseSign, pubkeys == null ? 0 : pubkeys.clone_ptr())) {
21 this.ptrs_to.AddLast(arg);
22 this.ptrs_to.AddLast(BaseSign);
23 this.bindings_instance = arg;
26 if (ptr != 0) { bindings.Sign_free(ptr); }
29 public interface SignInterface {
31 * Serialize the object into a byte array
35 private class LDKSignHolder { internal Sign held; }
36 private class LDKSignImpl : bindings.LDKSign {
37 internal LDKSignImpl(SignInterface arg, LDKSignHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
38 private SignInterface arg;
39 private LDKSignHolder impl_holder;
40 public byte[] write() {
41 byte[] ret = arg.write();
46 public static Sign new_impl(SignInterface arg, BaseSign.BaseSignInterface BaseSign_impl, ChannelPublicKeys pubkeys) {
47 LDKSignHolder impl_holder = new LDKSignHolder();
48 impl_holder.held = new Sign(new LDKSignImpl(arg, impl_holder), BaseSign.new_impl(BaseSign_impl, pubkeys).bindings_instance, pubkeys);
49 return impl_holder.held;
53 * Gets the underlying BaseSign.
55 public BaseSign get_base_sign() {
56 BaseSign res = new BaseSign(null, bindings.LDKSign_get_BaseSign(this.ptr));
57 this.ptrs_to.AddLast(res);
62 * Serialize the object into a byte array
64 public byte[] write() {
65 byte[] ret = bindings.Sign_write(this.ptr);
70 internal long clone_ptr() {
71 long ret = bindings.Sign_clone_ptr(this.ptr);
77 * Creates a copy of a Sign
80 long ret = bindings.Sign_clone(this.ptr);
82 if (ret >= 0 && ret <= 4096) { return null; }
83 Sign ret_hu_conv = new Sign(null, ret);
84 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };