[C#] Run tests against release library in determinism CI run
[ldk-java] / c_sharp / src / org / ldk / structs / UtxoResult.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  * The result of a [`UtxoLookup::get_utxo`] call. A call may resolve either synchronously,
10  * returning the `Sync` variant, or asynchronously, returning an [`UtxoFuture`] in the `Async`
11  * variant.
12  */
13 public class UtxoResult : CommonBase {
14         protected UtxoResult(object _dummy, long ptr) : base(ptr) { }
15         ~UtxoResult() {
16                 if (ptr != 0) { bindings.UtxoResult_free(ptr); }
17         }
18
19         internal static UtxoResult constr_from_ptr(long ptr) {
20                 long raw_ty = bindings.LDKUtxoResult_ty_from_ptr(ptr);
21                 switch (raw_ty) {
22                         case 0: return new UtxoResult_Sync(ptr);
23                         case 1: return new UtxoResult_Async(ptr);
24                         default:
25                                 throw new ArgumentException("Impossible enum variant");
26                 }
27         }
28
29         /** A UtxoResult of type Sync */
30         public class UtxoResult_Sync : UtxoResult {
31                 public Result_TxOutUtxoLookupErrorZ sync;
32                 internal UtxoResult_Sync(long ptr) : base(null, ptr) {
33                         long sync = bindings.LDKUtxoResult_Sync_get_sync(ptr);
34                         Result_TxOutUtxoLookupErrorZ sync_hu_conv = Result_TxOutUtxoLookupErrorZ.constr_from_ptr(sync);
35                         this.sync = sync_hu_conv;
36                 }
37         }
38         /** A UtxoResult of type Async */
39         public class UtxoResult_Async : UtxoResult {
40                 public UtxoFuture async;
41                 internal UtxoResult_Async(long ptr) : base(null, ptr) {
42                         long async = bindings.LDKUtxoResult_Async_get_async(ptr);
43                         org.ldk.structs.UtxoFuture async_hu_conv = null; if (async < 0 || async > 4096) { async_hu_conv = new org.ldk.structs.UtxoFuture(null, async); }
44                         if (async_hu_conv != null) { async_hu_conv.ptrs_to.AddLast(this); };
45                         this.async = async_hu_conv;
46                 }
47         }
48         internal long clone_ptr() {
49                 long ret = bindings.UtxoResult_clone_ptr(this.ptr);
50                 GC.KeepAlive(this);
51                 return ret;
52         }
53
54         /**
55          * Creates a copy of the UtxoResult
56          */
57         public UtxoResult clone() {
58                 long ret = bindings.UtxoResult_clone(this.ptr);
59                 GC.KeepAlive(this);
60                 if (ret >= 0 && ret <= 4096) { return null; }
61                 org.ldk.structs.UtxoResult ret_hu_conv = org.ldk.structs.UtxoResult.constr_from_ptr(ret);
62                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
63                 return ret_hu_conv;
64         }
65
66         /**
67          * Utility method to constructs a new Sync-variant UtxoResult
68          */
69         public static UtxoResult sync(org.ldk.structs.Result_TxOutUtxoLookupErrorZ a) {
70                 long ret = bindings.UtxoResult_sync(a.ptr);
71                 GC.KeepAlive(a);
72                 if (ret >= 0 && ret <= 4096) { return null; }
73                 org.ldk.structs.UtxoResult ret_hu_conv = org.ldk.structs.UtxoResult.constr_from_ptr(ret);
74                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
75                 return ret_hu_conv;
76         }
77
78         /**
79          * Utility method to constructs a new Async-variant UtxoResult
80          */
81         public static UtxoResult async(org.ldk.structs.UtxoFuture a) {
82                 long ret = bindings.UtxoResult_async(a.ptr);
83                 GC.KeepAlive(a);
84                 if (ret >= 0 && ret <= 4096) { return null; }
85                 org.ldk.structs.UtxoResult ret_hu_conv = org.ldk.structs.UtxoResult.constr_from_ptr(ret);
86                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
87                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(a); };
88                 return ret_hu_conv;
89         }
90
91 }
92 } } }