[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / WalletSource.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  * An alternative to [`CoinSelectionSource`] that can be implemented and used along [`Wallet`] to
10  * provide a default implementation to [`CoinSelectionSource`].
11  */
12 public class WalletSource : CommonBase {
13         internal readonly bindings.LDKWalletSource bindings_instance;
14         internal WalletSource(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
15         private WalletSource(bindings.LDKWalletSource arg) : base(bindings.LDKWalletSource_new(arg)) {
16                 this.ptrs_to.AddLast(arg);
17                 this.bindings_instance = arg;
18         }
19         ~WalletSource() {
20                 if (ptr != 0) { bindings.WalletSource_free(ptr); }
21         }
22
23         public interface WalletSourceInterface {
24                 /**
25                  * Returns all UTXOs, with at least 1 confirmation each, that are available to spend.
26                  */
27                 Result_CVec_UtxoZNoneZ list_confirmed_utxos();
28                 /**
29                  * Returns a script to use for change above dust resulting from a successful coin selection
30                  * attempt.
31                  */
32                 Result_ScriptNoneZ get_change_script();
33                 /**
34                  * Signs and provides the full [`TxIn::script_sig`] and [`TxIn::witness`] for all inputs within
35                  * the transaction known to the wallet (i.e., any provided via
36                  * [`WalletSource::list_confirmed_utxos`]).
37                  */
38                 Result_TransactionNoneZ sign_tx(byte[] _tx);
39         }
40         private class LDKWalletSourceHolder { internal WalletSource held; }
41         private class LDKWalletSourceImpl : bindings.LDKWalletSource {
42                 internal LDKWalletSourceImpl(WalletSourceInterface arg, LDKWalletSourceHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
43                 private WalletSourceInterface arg;
44                 private LDKWalletSourceHolder impl_holder;
45                 public long list_confirmed_utxos() {
46                         Result_CVec_UtxoZNoneZ ret = arg.list_confirmed_utxos();
47                                 GC.KeepAlive(arg);
48                         long result = ret == null ? 0 : ret.clone_ptr();
49                         return result;
50                 }
51                 public long get_change_script() {
52                         Result_ScriptNoneZ ret = arg.get_change_script();
53                                 GC.KeepAlive(arg);
54                         long result = ret == null ? 0 : ret.clone_ptr();
55                         return result;
56                 }
57                 public long sign_tx(byte[] _tx) {
58                         Result_TransactionNoneZ ret = arg.sign_tx(_tx);
59                                 GC.KeepAlive(arg);
60                         long result = ret == null ? 0 : ret.clone_ptr();
61                         return result;
62                 }
63         }
64         public static WalletSource new_impl(WalletSourceInterface arg) {
65                 LDKWalletSourceHolder impl_holder = new LDKWalletSourceHolder();
66                 impl_holder.held = new WalletSource(new LDKWalletSourceImpl(arg, impl_holder));
67                 return impl_holder.held;
68         }
69         /**
70          * Returns all UTXOs, with at least 1 confirmation each, that are available to spend.
71          */
72         public Result_CVec_UtxoZNoneZ list_confirmed_utxos() {
73                 long ret = bindings.WalletSource_list_confirmed_utxos(this.ptr);
74                 GC.KeepAlive(this);
75                 if (ret >= 0 && ret <= 4096) { return null; }
76                 Result_CVec_UtxoZNoneZ ret_hu_conv = Result_CVec_UtxoZNoneZ.constr_from_ptr(ret);
77                 return ret_hu_conv;
78         }
79
80         /**
81          * Returns a script to use for change above dust resulting from a successful coin selection
82          * attempt.
83          */
84         public Result_ScriptNoneZ get_change_script() {
85                 long ret = bindings.WalletSource_get_change_script(this.ptr);
86                 GC.KeepAlive(this);
87                 if (ret >= 0 && ret <= 4096) { return null; }
88                 Result_ScriptNoneZ ret_hu_conv = Result_ScriptNoneZ.constr_from_ptr(ret);
89                 return ret_hu_conv;
90         }
91
92         /**
93          * Signs and provides the full [`TxIn::script_sig`] and [`TxIn::witness`] for all inputs within
94          * the transaction known to the wallet (i.e., any provided via
95          * [`WalletSource::list_confirmed_utxos`]).
96          */
97         public Result_TransactionNoneZ sign_tx(byte[] tx) {
98                 long ret = bindings.WalletSource_sign_tx(this.ptr, tx);
99                 GC.KeepAlive(this);
100                 GC.KeepAlive(tx);
101                 if (ret >= 0 && ret <= 4096) { return null; }
102                 Result_TransactionNoneZ ret_hu_conv = Result_TransactionNoneZ.constr_from_ptr(ret);
103                 return ret_hu_conv;
104         }
105
106 }
107 } } }