+
using org.ldk.impl;
using org.ldk.enums;
using org.ldk.util;
namespace org { namespace ldk { namespace structs {
+
+
+/** An implementation of WriteableEcdsaChannelSigner */
+public interface WriteableEcdsaChannelSignerInterface {
+ /**Serialize the object into a byte array
+ */
+ byte[] write();
+}
+
/**
* A writeable signer.
*
* [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
*/
public class WriteableEcdsaChannelSigner : CommonBase {
- internal readonly bindings.LDKWriteableEcdsaChannelSigner bindings_instance;
+ internal bindings.LDKWriteableEcdsaChannelSigner bindings_instance;
+ internal long instance_idx;
+
internal WriteableEcdsaChannelSigner(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
- private WriteableEcdsaChannelSigner(bindings.LDKWriteableEcdsaChannelSigner arg, bindings.LDKEcdsaChannelSigner EcdsaChannelSigner, bindings.LDKChannelSigner ChannelSigner, ChannelPublicKeys pubkeys) : base(bindings.LDKWriteableEcdsaChannelSigner_new(arg, EcdsaChannelSigner, ChannelSigner, pubkeys == null ? 0 : pubkeys.clone_ptr())) {
- this.ptrs_to.AddLast(arg);
- this.ptrs_to.AddLast(EcdsaChannelSigner);
- this.ptrs_to.AddLast(ChannelSigner);
- this.bindings_instance = arg;
- }
~WriteableEcdsaChannelSigner() {
if (ptr != 0) { bindings.WriteableEcdsaChannelSigner_free(ptr); }
}
- public interface WriteableEcdsaChannelSignerInterface {
- /**
- * Serialize the object into a byte array
- */
- byte[] write();
- }
private class LDKWriteableEcdsaChannelSignerHolder { internal WriteableEcdsaChannelSigner held; }
private class LDKWriteableEcdsaChannelSignerImpl : bindings.LDKWriteableEcdsaChannelSigner {
internal LDKWriteableEcdsaChannelSignerImpl(WriteableEcdsaChannelSignerInterface arg, LDKWriteableEcdsaChannelSignerHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
private WriteableEcdsaChannelSignerInterface arg;
private LDKWriteableEcdsaChannelSignerHolder impl_holder;
- public byte[] write() {
+ public long write() {
byte[] ret = arg.write();
GC.KeepAlive(arg);
- return ret;
+ long result = InternalUtils.encodeUint8Array(ret);
+ return result;
}
}
- public static WriteableEcdsaChannelSigner new_impl(WriteableEcdsaChannelSignerInterface arg, EcdsaChannelSigner.EcdsaChannelSignerInterface EcdsaChannelSigner_impl, ChannelSigner.ChannelSignerInterface ChannelSigner_impl, ChannelPublicKeys pubkeys) {
- LDKWriteableEcdsaChannelSignerHolder impl_holder = new LDKWriteableEcdsaChannelSignerHolder();
- impl_holder.held = new WriteableEcdsaChannelSigner(new LDKWriteableEcdsaChannelSignerImpl(arg, impl_holder), EcdsaChannelSigner.new_impl(EcdsaChannelSigner_impl, ChannelSigner_impl, pubkeys).bindings_instance, ChannelSigner.new_impl(ChannelSigner_impl, pubkeys).bindings_instance, pubkeys);
- return impl_holder.held;
- }
-
- /**
- * Gets the underlying EcdsaChannelSigner.
- */
- public EcdsaChannelSigner get_ecdsa_channel_signer() {
- EcdsaChannelSigner res = new EcdsaChannelSigner(null, bindings.LDKWriteableEcdsaChannelSigner_get_EcdsaChannelSigner(this.ptr));
- this.ptrs_to.AddLast(res);
- return res;
- }
+ /** Creates a new instance of WriteableEcdsaChannelSigner from a given implementation */
+ public static WriteableEcdsaChannelSigner new_impl(WriteableEcdsaChannelSignerInterface arg, EcdsaChannelSignerInterface ecdsaChannelSigner_impl, ChannelSignerInterface channelSigner_impl, ChannelPublicKeys pubkeys) {
+ LDKWriteableEcdsaChannelSignerHolder impl_holder = new LDKWriteableEcdsaChannelSignerHolder();
+ LDKWriteableEcdsaChannelSignerImpl impl = new LDKWriteableEcdsaChannelSignerImpl(arg, impl_holder);
+ EcdsaChannelSigner ecdsaChannelSigner = EcdsaChannelSigner.new_impl(ecdsaChannelSigner_impl, channelSigner_impl, pubkeys);
+ ChannelSigner channelSigner = ChannelSigner.new_impl(channelSigner_impl, pubkeys);
+ long[] ptr_idx = bindings.LDKWriteableEcdsaChannelSigner_new(impl, ecdsaChannelSigner.instance_idx, channelSigner.instance_idx, pubkeys == null ? 0 : pubkeys.clone_ptr());
- /**
- * Gets the underlying ChannelSigner.
- */
- public ChannelSigner get_channel_signer() {
- ChannelSigner res = new ChannelSigner(null, bindings.LDKWriteableEcdsaChannelSigner_get_ChannelSigner(this.ptr));
- this.ptrs_to.AddLast(res);
- return res;
+ impl_holder.held = new WriteableEcdsaChannelSigner(null, ptr_idx[0]);
+ impl_holder.held.instance_idx = ptr_idx[1];
+ impl_holder.held.bindings_instance = impl;
+ impl_holder.held.ptrs_to.AddLast(ecdsaChannelSigner);
+ impl_holder.held.ptrs_to.AddLast(channelSigner);
+ return impl_holder.held;
}
/**
* Serialize the object into a byte array
*/
public byte[] write() {
- byte[] ret = bindings.WriteableEcdsaChannelSigner_write(this.ptr);
+ long ret = bindings.WriteableEcdsaChannelSigner_write(this.ptr);
GC.KeepAlive(this);
- return ret;
+ if (ret >= 0 && ret <= 4096) { return null; }
+ byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+ return ret_conv;
}
internal long clone_ptr() {