[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / Wallet.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  * A wrapper over [`WalletSource`] that implements [`CoinSelection`] by preferring UTXOs that would
11  * avoid conflicting double spends. If not enough UTXOs are available to do so, conflicting double
12  * spends may happen.
13  */
14 public class Wallet : CommonBase {
15         internal Wallet(object _dummy, long ptr) : base(ptr) { }
16         ~Wallet() {
17                 if (ptr != 0) { bindings.Wallet_free(ptr); }
18         }
19
20         /**
21          * Returns a new instance backed by the given [`WalletSource`] that serves as an implementation
22          * of [`CoinSelectionSource`].
23          */
24         public static Wallet of(org.ldk.structs.WalletSource source, org.ldk.structs.Logger logger) {
25                 long ret = bindings.Wallet_new(source.ptr, logger.ptr);
26                 GC.KeepAlive(source);
27                 GC.KeepAlive(logger);
28                 if (ret >= 0 && ret <= 4096) { return null; }
29                 org.ldk.structs.Wallet ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Wallet(null, ret); }
30                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
31                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(source); };
32                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(logger); };
33                 return ret_hu_conv;
34         }
35
36         /**
37          * Constructs a new CoinSelectionSource which calls the relevant methods on this_arg.
38          * This copies the `inner` pointer in this_arg and thus the returned CoinSelectionSource must be freed before this_arg is
39          */
40         public CoinSelectionSource as_CoinSelectionSource() {
41                 long ret = bindings.Wallet_as_CoinSelectionSource(this.ptr);
42                 GC.KeepAlive(this);
43                 if (ret >= 0 && ret <= 4096) { return null; }
44                 CoinSelectionSource ret_hu_conv = new CoinSelectionSource(null, ret);
45                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
46                 return ret_hu_conv;
47         }
48
49 }
50 } } }