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