[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / src / org / ldk / structs / ChangeDestinationSource.cs
1
2 using org.ldk.impl;
3 using org.ldk.enums;
4 using org.ldk.util;
5 using System;
6
7 namespace org { namespace ldk { namespace structs {
8
9
10
11 /** An implementation of ChangeDestinationSource */
12 public interface ChangeDestinationSourceInterface {
13         /**Returns a script pubkey which can be used as a change destination for
14          * [`OutputSpender::spend_spendable_outputs`].
15          * 
16          * This method should return a different value each time it is called, to avoid linking
17          * on-chain funds controlled to the same user.
18          */
19         Result_CVec_u8ZNoneZ get_change_destination_script();
20 }
21
22 /**
23  * A helper trait that describes an on-chain wallet capable of returning a (change) destination
24  * script.
25  */
26 public class ChangeDestinationSource : CommonBase {
27         internal bindings.LDKChangeDestinationSource bindings_instance;
28         internal long instance_idx;
29
30         internal ChangeDestinationSource(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
31         ~ChangeDestinationSource() {
32                 if (ptr != 0) { bindings.ChangeDestinationSource_free(ptr); }
33         }
34
35         private class LDKChangeDestinationSourceHolder { internal ChangeDestinationSource held; }
36         private class LDKChangeDestinationSourceImpl : bindings.LDKChangeDestinationSource {
37                 internal LDKChangeDestinationSourceImpl(ChangeDestinationSourceInterface arg, LDKChangeDestinationSourceHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
38                 private ChangeDestinationSourceInterface arg;
39                 private LDKChangeDestinationSourceHolder impl_holder;
40                 public long get_change_destination_script() {
41                         Result_CVec_u8ZNoneZ ret = arg.get_change_destination_script();
42                                 GC.KeepAlive(arg);
43                         long result = ret.clone_ptr();
44                         return result;
45                 }
46         }
47
48         /** Creates a new instance of ChangeDestinationSource from a given implementation */
49         public static ChangeDestinationSource new_impl(ChangeDestinationSourceInterface arg) {
50                 LDKChangeDestinationSourceHolder impl_holder = new LDKChangeDestinationSourceHolder();
51                 LDKChangeDestinationSourceImpl impl = new LDKChangeDestinationSourceImpl(arg, impl_holder);
52                 long[] ptr_idx = bindings.LDKChangeDestinationSource_new(impl);
53
54                 impl_holder.held = new ChangeDestinationSource(null, ptr_idx[0]);
55                 impl_holder.held.instance_idx = ptr_idx[1];
56                 impl_holder.held.bindings_instance = impl;
57                 return impl_holder.held;
58         }
59
60         /**
61          * Returns a script pubkey which can be used as a change destination for
62          * [`OutputSpender::spend_spendable_outputs`].
63          * 
64          * This method should return a different value each time it is called, to avoid linking
65          * on-chain funds controlled to the same user.
66          */
67         public Result_CVec_u8ZNoneZ get_change_destination_script() {
68                 long ret = bindings.ChangeDestinationSource_get_change_destination_script(this.ptr);
69                 GC.KeepAlive(this);
70                 if (ret >= 0 && ret <= 4096) { return null; }
71                 Result_CVec_u8ZNoneZ ret_hu_conv = Result_CVec_u8ZNoneZ.constr_from_ptr(ret);
72                 return ret_hu_conv;
73         }
74
75 }
76 } } }