]> git.bitcoin.ninja Git - ldk-java/blob - c_sharp/src/org/ldk/structs/SignError.cs
[C#] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / src / org / ldk / structs / SignError.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8 /**
9  * Error when signing messages.
10  */
11 public class SignError : CommonBase {
12         protected SignError(object _dummy, long ptr) : base(ptr) { }
13         ~SignError() {
14                 if (ptr != 0) { bindings.SignError_free(ptr); }
15         }
16
17         internal static SignError constr_from_ptr(long ptr) {
18                 long raw_ty = bindings.LDKSignError_ty_from_ptr(ptr);
19                 switch (raw_ty) {
20                         case 0: return new SignError_Signing(ptr);
21                         case 1: return new SignError_Verification(ptr);
22                         default:
23                                 throw new ArgumentException("Impossible enum variant");
24                 }
25         }
26
27         /** A SignError of type Signing */
28         public class SignError_Signing : SignError {
29                 internal SignError_Signing(long ptr) : base(null, ptr) {
30                 }
31         }
32         /** A SignError of type Verification */
33         public class SignError_Verification : SignError {
34                 public Secp256k1Error verification;
35                 internal SignError_Verification(long ptr) : base(null, ptr) {
36                         this.verification = bindings.LDKSignError_Verification_get_verification(ptr);
37                 }
38         }
39         internal long clone_ptr() {
40                 long ret = bindings.SignError_clone_ptr(this.ptr);
41                 GC.KeepAlive(this);
42                 return ret;
43         }
44
45         /**
46          * Creates a copy of the SignError
47          */
48         public SignError clone() {
49                 long ret = bindings.SignError_clone(this.ptr);
50                 GC.KeepAlive(this);
51                 if (ret >= 0 && ret <= 4096) { return null; }
52                 org.ldk.structs.SignError ret_hu_conv = org.ldk.structs.SignError.constr_from_ptr(ret);
53                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
54                 return ret_hu_conv;
55         }
56
57         /**
58          * Utility method to constructs a new Signing-variant SignError
59          */
60         public static SignError signing() {
61                 long ret = bindings.SignError_signing();
62                 if (ret >= 0 && ret <= 4096) { return null; }
63                 org.ldk.structs.SignError ret_hu_conv = org.ldk.structs.SignError.constr_from_ptr(ret);
64                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
65                 return ret_hu_conv;
66         }
67
68         /**
69          * Utility method to constructs a new Verification-variant SignError
70          */
71         public static SignError verification(Secp256k1Error a) {
72                 long ret = bindings.SignError_verification(a);
73                 GC.KeepAlive(a);
74                 if (ret >= 0 && ret <= 4096) { return null; }
75                 org.ldk.structs.SignError ret_hu_conv = org.ldk.structs.SignError.constr_from_ptr(ret);
76                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
77                 return ret_hu_conv;
78         }
79
80 }
81 } } }