7 namespace org { namespace ldk { namespace structs {
11 /** An implementation of SignBolt12InvoiceFn */
12 public interface SignBolt12InvoiceFnInterface {
13 /**Signs a [`TaggedHash`] computed over the merkle root of `message`'s TLV stream.
15 Result_SchnorrSignatureNoneZ sign_invoice(UnsignedBolt12Invoice message);
19 * A function for signing an [`UnsignedBolt12Invoice`].
21 public class SignBolt12InvoiceFn : CommonBase {
22 internal bindings.LDKSignBolt12InvoiceFn bindings_instance;
23 internal long instance_idx;
25 internal SignBolt12InvoiceFn(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
26 ~SignBolt12InvoiceFn() {
27 if (ptr != 0) { bindings.SignBolt12InvoiceFn_free(ptr); }
30 private class LDKSignBolt12InvoiceFnHolder { internal SignBolt12InvoiceFn held; }
31 private class LDKSignBolt12InvoiceFnImpl : bindings.LDKSignBolt12InvoiceFn {
32 internal LDKSignBolt12InvoiceFnImpl(SignBolt12InvoiceFnInterface arg, LDKSignBolt12InvoiceFnHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
33 private SignBolt12InvoiceFnInterface arg;
34 private LDKSignBolt12InvoiceFnHolder impl_holder;
35 public long sign_invoice(long _message) {
36 org.ldk.structs.UnsignedBolt12Invoice _message_hu_conv = null; if (_message < 0 || _message > 4096) { _message_hu_conv = new org.ldk.structs.UnsignedBolt12Invoice(null, _message); }
37 Result_SchnorrSignatureNoneZ ret = arg.sign_invoice(_message_hu_conv);
39 long result = ret.clone_ptr();
44 /** Creates a new instance of SignBolt12InvoiceFn from a given implementation */
45 public static SignBolt12InvoiceFn new_impl(SignBolt12InvoiceFnInterface arg) {
46 LDKSignBolt12InvoiceFnHolder impl_holder = new LDKSignBolt12InvoiceFnHolder();
47 LDKSignBolt12InvoiceFnImpl impl = new LDKSignBolt12InvoiceFnImpl(arg, impl_holder);
48 long[] ptr_idx = bindings.LDKSignBolt12InvoiceFn_new(impl);
50 impl_holder.held = new SignBolt12InvoiceFn(null, ptr_idx[0]);
51 impl_holder.held.instance_idx = ptr_idx[1];
52 impl_holder.held.bindings_instance = impl;
53 return impl_holder.held;
57 * Signs a [`TaggedHash`] computed over the merkle root of `message`'s TLV stream.
59 public Result_SchnorrSignatureNoneZ sign_invoice(org.ldk.structs.UnsignedBolt12Invoice message) {
60 long ret = bindings.SignBolt12InvoiceFn_sign_invoice(this.ptr, message.ptr);
62 GC.KeepAlive(message);
63 if (ret >= 0 && ret <= 4096) { return null; }
64 Result_SchnorrSignatureNoneZ ret_hu_conv = Result_SchnorrSignatureNoneZ.constr_from_ptr(ret);
65 if (this != null) { this.ptrs_to.AddLast(message); };