[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / src / org / ldk / structs / InvoiceWithDerivedSigningPubkeyBuilder.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  * Builds a [`Bolt12Invoice`] from either:
11  * - an [`InvoiceRequest`] for the \"offer to be paid\" flow or
12  * - a [`Refund`] for the \"offer for money\" flow.
13  * 
14  * See [module-level documentation] for usage.
15  * 
16  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
17  * [`Refund`]: crate::offers::refund::Refund
18  * [module-level documentation]: self
19  */
20 public class InvoiceWithDerivedSigningPubkeyBuilder : CommonBase {
21         internal InvoiceWithDerivedSigningPubkeyBuilder(object _dummy, long ptr) : base(ptr) { }
22         ~InvoiceWithDerivedSigningPubkeyBuilder() {
23                 if (ptr != 0) { bindings.InvoiceWithDerivedSigningPubkeyBuilder_free(ptr); }
24         }
25
26         /**
27          * Builds a signed [`Bolt12Invoice`] after checking for valid semantics.
28          */
29         public Result_Bolt12InvoiceBolt12SemanticErrorZ build_and_sign() {
30                 long ret = bindings.InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign(this.ptr);
31                 GC.KeepAlive(this);
32                 if (ret >= 0 && ret <= 4096) { return null; }
33                 Result_Bolt12InvoiceBolt12SemanticErrorZ ret_hu_conv = Result_Bolt12InvoiceBolt12SemanticErrorZ.constr_from_ptr(ret);
34                 if (this != null) { this.ptrs_to.AddLast(this); };
35                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
36                 // an object to pass exclusive ownership to the function being called.
37                 // In most cases, we avoid this being visible in GC'd languages by cloning the object
38                 // at the FFI layer, creating a new object which Rust can claim ownership of
39                 // However, in some cases (eg here), there is no way to clone an object, and thus
40                 // we actually have to pass full ownership to Rust.
41                 // Thus, after this call, this is reset to null and is now a dummy object.
42                 this.ptr = 0;;
43                 return ret_hu_conv;
44         }
45
46         /**
47          * Sets the [`Bolt12Invoice::relative_expiry`] as seconds since [`Bolt12Invoice::created_at`].
48          * Any expiry that has already passed is valid and can be checked for using
49          * [`Bolt12Invoice::is_expired`].
50          * 
51          * Successive calls to this method will override the previous setting.
52          */
53         public void relative_expiry(int relative_expiry_secs) {
54                 bindings.InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry(this.ptr, relative_expiry_secs);
55                 GC.KeepAlive(this);
56                 GC.KeepAlive(relative_expiry_secs);
57                 if (this != null) { this.ptrs_to.AddLast(this); };
58                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
59                 // an object to pass exclusive ownership to the function being called.
60                 // In most cases, we avoid this being visible in GC'd languages by cloning the object
61                 // at the FFI layer, creating a new object which Rust can claim ownership of
62                 // However, in some cases (eg here), there is no way to clone an object, and thus
63                 // we actually have to pass full ownership to Rust.
64                 // Thus, after this call, this is reset to null and is now a dummy object.
65                 this.ptr = 0;;
66         }
67
68         /**
69          * Adds a P2WSH address to [`Bolt12Invoice::fallbacks`].
70          * 
71          * Successive calls to this method will add another address. Caller is responsible for not
72          * adding duplicate addresses and only calling if capable of receiving to P2WSH addresses.
73          */
74         public void fallback_v0_p2wsh(byte[] script_hash) {
75                 bindings.InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(script_hash, 32)));
76                 GC.KeepAlive(this);
77                 GC.KeepAlive(script_hash);
78                 if (this != null) { this.ptrs_to.AddLast(this); };
79                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
80                 // an object to pass exclusive ownership to the function being called.
81                 // In most cases, we avoid this being visible in GC'd languages by cloning the object
82                 // at the FFI layer, creating a new object which Rust can claim ownership of
83                 // However, in some cases (eg here), there is no way to clone an object, and thus
84                 // we actually have to pass full ownership to Rust.
85                 // Thus, after this call, this is reset to null and is now a dummy object.
86                 this.ptr = 0;;
87         }
88
89         /**
90          * Adds a P2WPKH address to [`Bolt12Invoice::fallbacks`].
91          * 
92          * Successive calls to this method will add another address. Caller is responsible for not
93          * adding duplicate addresses and only calling if capable of receiving to P2WPKH addresses.
94          */
95         public void fallback_v0_p2wpkh(byte[] pubkey_hash) {
96                 bindings.InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(pubkey_hash, 20)));
97                 GC.KeepAlive(this);
98                 GC.KeepAlive(pubkey_hash);
99                 if (this != null) { this.ptrs_to.AddLast(this); };
100                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
101                 // an object to pass exclusive ownership to the function being called.
102                 // In most cases, we avoid this being visible in GC'd languages by cloning the object
103                 // at the FFI layer, creating a new object which Rust can claim ownership of
104                 // However, in some cases (eg here), there is no way to clone an object, and thus
105                 // we actually have to pass full ownership to Rust.
106                 // Thus, after this call, this is reset to null and is now a dummy object.
107                 this.ptr = 0;;
108         }
109
110         /**
111          * Adds a P2TR address to [`Bolt12Invoice::fallbacks`].
112          * 
113          * Successive calls to this method will add another address. Caller is responsible for not
114          * adding duplicate addresses and only calling if capable of receiving to P2TR addresses.
115          */
116         public void fallback_v1_p2tr_tweaked(byte[] utput_key) {
117                 bindings.InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(utput_key, 32)));
118                 GC.KeepAlive(this);
119                 GC.KeepAlive(utput_key);
120                 if (this != null) { this.ptrs_to.AddLast(this); };
121                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
122                 // an object to pass exclusive ownership to the function being called.
123                 // In most cases, we avoid this being visible in GC'd languages by cloning the object
124                 // at the FFI layer, creating a new object which Rust can claim ownership of
125                 // However, in some cases (eg here), there is no way to clone an object, and thus
126                 // we actually have to pass full ownership to Rust.
127                 // Thus, after this call, this is reset to null and is now a dummy object.
128                 this.ptr = 0;;
129         }
130
131         /**
132          * Sets [`Bolt12Invoice::invoice_features`] to indicate MPP may be used. Otherwise, MPP is
133          * disallowed.
134          */
135         public void allow_mpp() {
136                 bindings.InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp(this.ptr);
137                 GC.KeepAlive(this);
138                 if (this != null) { this.ptrs_to.AddLast(this); };
139                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
140                 // an object to pass exclusive ownership to the function being called.
141                 // In most cases, we avoid this being visible in GC'd languages by cloning the object
142                 // at the FFI layer, creating a new object which Rust can claim ownership of
143                 // However, in some cases (eg here), there is no way to clone an object, and thus
144                 // we actually have to pass full ownership to Rust.
145                 // Thus, after this call, this is reset to null and is now a dummy object.
146                 this.ptr = 0;;
147         }
148
149 }
150 } } }