6 namespace org { namespace ldk { namespace structs {
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`
13 public class UtxoResult : CommonBase {
14 protected UtxoResult(object _dummy, long ptr) : base(ptr) { }
16 if (ptr != 0) { bindings.UtxoResult_free(ptr); }
19 internal static UtxoResult constr_from_ptr(long ptr) {
20 long raw_ty = bindings.LDKUtxoResult_ty_from_ptr(ptr);
22 case 0: return new UtxoResult_Sync(ptr);
23 case 1: return new UtxoResult_Async(ptr);
25 throw new ArgumentException("Impossible enum variant");
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;
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;
48 internal long clone_ptr() {
49 long ret = bindings.UtxoResult_clone_ptr(this.ptr);
55 * Creates a copy of the UtxoResult
57 public UtxoResult clone() {
58 long ret = bindings.UtxoResult_clone(this.ptr);
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); };
67 * Utility method to constructs a new Sync-variant UtxoResult
69 public static UtxoResult sync(org.ldk.structs.Result_TxOutUtxoLookupErrorZ a) {
70 long ret = bindings.UtxoResult_sync(a.ptr);
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); };
79 * Utility method to constructs a new Async-variant UtxoResult
81 public static UtxoResult async(org.ldk.structs.UtxoFuture a) {
82 long ret = bindings.UtxoResult_async(a.ptr);
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); };