[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / src / org / ldk / structs / Result_OutputSweeperDecodeErrorZ.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 public class Result_OutputSweeperDecodeErrorZ : CommonBase {
9         Result_OutputSweeperDecodeErrorZ(object _dummy, long ptr) : base(ptr) { }
10         ~Result_OutputSweeperDecodeErrorZ() {
11                 if (ptr != 0) { bindings.CResult_OutputSweeperDecodeErrorZ_free(ptr); }
12         }
13
14         internal static Result_OutputSweeperDecodeErrorZ constr_from_ptr(long ptr) {
15                 if (bindings.CResult_OutputSweeperDecodeErrorZ_is_ok(ptr)) {
16                         return new Result_OutputSweeperDecodeErrorZ_OK(null, ptr);
17                 } else {
18                         return new Result_OutputSweeperDecodeErrorZ_Err(null, ptr);
19                 }
20         }
21         public class Result_OutputSweeperDecodeErrorZ_OK : Result_OutputSweeperDecodeErrorZ {
22                 public readonly OutputSweeper res;
23                 internal Result_OutputSweeperDecodeErrorZ_OK(object _dummy, long ptr) : base(_dummy, ptr) {
24                         long res = bindings.CResult_OutputSweeperDecodeErrorZ_get_ok(ptr);
25                         org.ldk.structs.OutputSweeper res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new org.ldk.structs.OutputSweeper(null, res); }
26                         if (res_hu_conv != null) { res_hu_conv.ptrs_to.AddLast(this); };
27                         this.res = res_hu_conv;
28                 }
29         }
30
31         public class Result_OutputSweeperDecodeErrorZ_Err : Result_OutputSweeperDecodeErrorZ {
32                 public readonly DecodeError err;
33                 internal Result_OutputSweeperDecodeErrorZ_Err(object _dummy, long ptr) : base(_dummy, ptr) {
34                         long err = bindings.CResult_OutputSweeperDecodeErrorZ_get_err(ptr);
35                         org.ldk.structs.DecodeError err_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(err);
36                         if (err_hu_conv != null) { err_hu_conv.ptrs_to.AddLast(this); };
37                         this.err = err_hu_conv;
38                 }
39         }
40
41         /**
42          * Creates a new CResult_OutputSweeperDecodeErrorZ in the success state.
43          */
44         public static Result_OutputSweeperDecodeErrorZ ok(BestBlock o_best_block, BroadcasterInterface o_broadcaster, FeeEstimator o_fee_estimator, Option_FilterZ o_chain_data_source, OutputSpender o_output_spender, ChangeDestinationSource o_change_destination_source, KVStore o_kv_store, Logger o_logger) {
45                 long ret = bindings.CResult_OutputSweeperDecodeErrorZ_ok(bindings.OutputSweeper_new(o_best_block.ptr, o_broadcaster.ptr, o_fee_estimator.ptr, o_chain_data_source.ptr, o_output_spender.ptr, o_change_destination_source.ptr, o_kv_store.ptr, o_logger.ptr));
46                 GC.KeepAlive(o_best_block);
47                 GC.KeepAlive(o_broadcaster);
48                 GC.KeepAlive(o_fee_estimator);
49                 GC.KeepAlive(o_chain_data_source);
50                 GC.KeepAlive(o_output_spender);
51                 GC.KeepAlive(o_change_destination_source);
52                 GC.KeepAlive(o_kv_store);
53                 GC.KeepAlive(o_logger);
54                 if (ret >= 0 && ret <= 4096) { return null; }
55                 Result_OutputSweeperDecodeErrorZ ret_hu_conv = Result_OutputSweeperDecodeErrorZ.constr_from_ptr(ret);
56                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(o_best_block); };
57                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(o_broadcaster); };
58                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(o_fee_estimator); };
59                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(o_chain_data_source); };
60                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(o_output_spender); };
61                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(o_change_destination_source); };
62                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(o_kv_store); };
63                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(o_logger); };
64                 return ret_hu_conv;
65         }
66
67         /**
68          * Creates a new CResult_OutputSweeperDecodeErrorZ in the error state.
69          */
70         public static Result_OutputSweeperDecodeErrorZ err(org.ldk.structs.DecodeError e) {
71                 long ret = bindings.CResult_OutputSweeperDecodeErrorZ_err(e.ptr);
72                 GC.KeepAlive(e);
73                 if (ret >= 0 && ret <= 4096) { return null; }
74                 Result_OutputSweeperDecodeErrorZ ret_hu_conv = Result_OutputSweeperDecodeErrorZ.constr_from_ptr(ret);
75                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(e); };
76                 return ret_hu_conv;
77         }
78
79         /**
80          * Checks if the given object is currently in the success state
81          */
82         public bool is_ok() {
83                 bool ret = bindings.CResult_OutputSweeperDecodeErrorZ_is_ok(this.ptr);
84                 GC.KeepAlive(this);
85                 return ret;
86         }
87
88 }
89 } } }