[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / src / org / ldk / structs / ChainParameters.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 /**
10  * Chain-related parameters used to construct a new `ChannelManager`.
11  * 
12  * Typically, the block-specific parameters are derived from the best block hash for the network,
13  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
14  * are not needed when deserializing a previously constructed `ChannelManager`.
15  */
16 public class ChainParameters : CommonBase {
17         internal ChainParameters(object _dummy, long ptr) : base(ptr) { }
18         ~ChainParameters() {
19                 if (ptr != 0) { bindings.ChainParameters_free(ptr); }
20         }
21
22         /**
23          * The network for determining the `chain_hash` in Lightning messages.
24          */
25         public Network get_network() {
26                 Network ret = bindings.ChainParameters_get_network(this.ptr);
27                 GC.KeepAlive(this);
28                 return ret;
29         }
30
31         /**
32          * The network for determining the `chain_hash` in Lightning messages.
33          */
34         public void set_network(Network val) {
35                 bindings.ChainParameters_set_network(this.ptr, val);
36                 GC.KeepAlive(this);
37                 GC.KeepAlive(val);
38         }
39
40         /**
41          * The hash and height of the latest block successfully connected.
42          * 
43          * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
44          */
45         public BestBlock get_best_block() {
46                 long ret = bindings.ChainParameters_get_best_block(this.ptr);
47                 GC.KeepAlive(this);
48                 if (ret >= 0 && ret <= 4096) { return null; }
49                 org.ldk.structs.BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BestBlock(null, ret); }
50                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
51                 return ret_hu_conv;
52         }
53
54         /**
55          * The hash and height of the latest block successfully connected.
56          * 
57          * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
58          */
59         public void set_best_block(org.ldk.structs.BestBlock val) {
60                 bindings.ChainParameters_set_best_block(this.ptr, val.ptr);
61                 GC.KeepAlive(this);
62                 GC.KeepAlive(val);
63                 if (this != null) { this.ptrs_to.AddLast(val); };
64         }
65
66         /**
67          * Constructs a new ChainParameters given each field
68          */
69         public static ChainParameters of(Network network_arg, org.ldk.structs.BestBlock best_block_arg) {
70                 long ret = bindings.ChainParameters_new(network_arg, best_block_arg.ptr);
71                 GC.KeepAlive(network_arg);
72                 GC.KeepAlive(best_block_arg);
73                 if (ret >= 0 && ret <= 4096) { return null; }
74                 org.ldk.structs.ChainParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChainParameters(null, ret); }
75                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
76                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(best_block_arg); };
77                 return ret_hu_conv;
78         }
79
80         internal long clone_ptr() {
81                 long ret = bindings.ChainParameters_clone_ptr(this.ptr);
82                 GC.KeepAlive(this);
83                 return ret;
84         }
85
86         /**
87          * Creates a copy of the ChainParameters
88          */
89         public ChainParameters clone() {
90                 long ret = bindings.ChainParameters_clone(this.ptr);
91                 GC.KeepAlive(this);
92                 if (ret >= 0 && ret <= 4096) { return null; }
93                 org.ldk.structs.ChainParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChainParameters(null, ret); }
94                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
95                 return ret_hu_conv;
96         }
97
98 }
99 } } }