[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / src / org / ldk / structs / SpendingDelay.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  * A `enum` signalling to the [`OutputSweeper`] that it should delay spending an output until a
10  * future block height is reached.
11  */
12 public class SpendingDelay : CommonBase {
13         protected SpendingDelay(object _dummy, long ptr) : base(ptr) { }
14         ~SpendingDelay() {
15                 if (ptr != 0) { bindings.SpendingDelay_free(ptr); }
16         }
17
18         internal static SpendingDelay constr_from_ptr(long ptr) {
19                 long raw_ty = bindings.LDKSpendingDelay_ty_from_ptr(ptr);
20                 switch (raw_ty) {
21                         case 0: return new SpendingDelay_Relative(ptr);
22                         case 1: return new SpendingDelay_Absolute(ptr);
23                         default:
24                                 throw new ArgumentException("Impossible enum variant");
25                 }
26         }
27
28         /** A SpendingDelay of type Relative */
29         public class SpendingDelay_Relative : SpendingDelay {
30                 /**
31                  * The number of blocks until we'll generate and broadcast the spending transaction.
32                  */
33                 public int num_blocks;
34                 internal SpendingDelay_Relative(long ptr) : base(null, ptr) {
35                         this.num_blocks = bindings.LDKSpendingDelay_Relative_get_num_blocks(ptr);
36                 }
37         }
38         /** A SpendingDelay of type Absolute */
39         public class SpendingDelay_Absolute : SpendingDelay {
40                 /**
41                  * The height at which we'll generate and broadcast the spending transaction.
42                  */
43                 public int height;
44                 internal SpendingDelay_Absolute(long ptr) : base(null, ptr) {
45                         this.height = bindings.LDKSpendingDelay_Absolute_get_height(ptr);
46                 }
47         }
48         internal long clone_ptr() {
49                 long ret = bindings.SpendingDelay_clone_ptr(this.ptr);
50                 GC.KeepAlive(this);
51                 return ret;
52         }
53
54         /**
55          * Creates a copy of the SpendingDelay
56          */
57         public SpendingDelay clone() {
58                 long ret = bindings.SpendingDelay_clone(this.ptr);
59                 GC.KeepAlive(this);
60                 if (ret >= 0 && ret <= 4096) { return null; }
61                 org.ldk.structs.SpendingDelay ret_hu_conv = org.ldk.structs.SpendingDelay.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 Relative-variant SpendingDelay
68          */
69         public static SpendingDelay relative(int num_blocks) {
70                 long ret = bindings.SpendingDelay_relative(num_blocks);
71                 GC.KeepAlive(num_blocks);
72                 if (ret >= 0 && ret <= 4096) { return null; }
73                 org.ldk.structs.SpendingDelay ret_hu_conv = org.ldk.structs.SpendingDelay.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 Absolute-variant SpendingDelay
80          */
81         public static SpendingDelay absolute(int height) {
82                 long ret = bindings.SpendingDelay_absolute(height);
83                 GC.KeepAlive(height);
84                 if (ret >= 0 && ret <= 4096) { return null; }
85                 org.ldk.structs.SpendingDelay ret_hu_conv = org.ldk.structs.SpendingDelay.constr_from_ptr(ret);
86                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
87                 return ret_hu_conv;
88         }
89
90 }
91 } } }