6 namespace org { namespace ldk { namespace structs {
10 * Builds an [`InvoiceRequest`] from an [`Offer`] for the \"offer to be paid\" flow.
12 * See [module-level documentation] for usage.
14 * [module-level documentation]: self
16 public class InvoiceRequestWithExplicitPayerIdBuilder : CommonBase {
17 internal InvoiceRequestWithExplicitPayerIdBuilder(object _dummy, long ptr) : base(ptr) { }
18 ~InvoiceRequestWithExplicitPayerIdBuilder() {
19 if (ptr != 0) { bindings.InvoiceRequestWithExplicitPayerIdBuilder_free(ptr); }
23 * Builds an unsigned [`InvoiceRequest`] after checking for valid semantics. It can be signed
24 * by [`UnsignedInvoiceRequest::sign`].
26 public Result_UnsignedInvoiceRequestBolt12SemanticErrorZ build() {
27 long ret = bindings.InvoiceRequestWithExplicitPayerIdBuilder_build(this.ptr);
29 if (ret >= 0 && ret <= 4096) { return null; }
30 Result_UnsignedInvoiceRequestBolt12SemanticErrorZ ret_hu_conv = Result_UnsignedInvoiceRequestBolt12SemanticErrorZ.constr_from_ptr(ret);
31 if (this != null) { this.ptrs_to.AddLast(this); };
32 // Due to rust's strict-ownership memory model, in some cases we need to "move"
33 // an object to pass exclusive ownership to the function being called.
34 // In most cases, we avoid this being visible in GC'd languages by cloning the object
35 // at the FFI layer, creating a new object which Rust can claim ownership of
36 // However, in some cases (eg here), there is no way to clone an object, and thus
37 // we actually have to pass full ownership to Rust.
38 // Thus, after this call, this is reset to null and is now a dummy object.
44 * Sets the [`InvoiceRequest::chain`] of the given [`Network`] for paying an invoice. If not
45 * called, [`Network::Bitcoin`] is assumed. Errors if the chain for `network` is not supported
48 * Successive calls to this method will override the previous setting.
50 public Result_NoneBolt12SemanticErrorZ chain(Network network) {
51 long ret = bindings.InvoiceRequestWithExplicitPayerIdBuilder_chain(this.ptr, network);
53 GC.KeepAlive(network);
54 if (ret >= 0 && ret <= 4096) { return null; }
55 Result_NoneBolt12SemanticErrorZ ret_hu_conv = Result_NoneBolt12SemanticErrorZ.constr_from_ptr(ret);
56 if (this != null) { this.ptrs_to.AddLast(this); };
57 // Due to rust's strict-ownership memory model, in some cases we need to "move"
58 // an object to pass exclusive ownership to the function being called.
59 // In most cases, we avoid this being visible in GC'd languages by cloning the object
60 // at the FFI layer, creating a new object which Rust can claim ownership of
61 // However, in some cases (eg here), there is no way to clone an object, and thus
62 // we actually have to pass full ownership to Rust.
63 // Thus, after this call, this is reset to null and is now a dummy object.
69 * Sets the [`InvoiceRequest::amount_msats`] for paying an invoice. Errors if `amount_msats` is
70 * not at least the expected invoice amount (i.e., [`Offer::amount`] times [`quantity`]).
72 * Successive calls to this method will override the previous setting.
74 * [`quantity`]: Self::quantity
76 public Result_NoneBolt12SemanticErrorZ amount_msats(long amount_msats) {
77 long ret = bindings.InvoiceRequestWithExplicitPayerIdBuilder_amount_msats(this.ptr, amount_msats);
79 GC.KeepAlive(amount_msats);
80 if (ret >= 0 && ret <= 4096) { return null; }
81 Result_NoneBolt12SemanticErrorZ ret_hu_conv = Result_NoneBolt12SemanticErrorZ.constr_from_ptr(ret);
82 if (this != null) { this.ptrs_to.AddLast(this); };
83 // Due to rust's strict-ownership memory model, in some cases we need to "move"
84 // an object to pass exclusive ownership to the function being called.
85 // In most cases, we avoid this being visible in GC'd languages by cloning the object
86 // at the FFI layer, creating a new object which Rust can claim ownership of
87 // However, in some cases (eg here), there is no way to clone an object, and thus
88 // we actually have to pass full ownership to Rust.
89 // Thus, after this call, this is reset to null and is now a dummy object.
95 * Sets [`InvoiceRequest::quantity`] of items. If not set, `1` is assumed. Errors if `quantity`
96 * does not conform to [`Offer::is_valid_quantity`].
98 * Successive calls to this method will override the previous setting.
100 public Result_NoneBolt12SemanticErrorZ quantity(long quantity) {
101 long ret = bindings.InvoiceRequestWithExplicitPayerIdBuilder_quantity(this.ptr, quantity);
103 GC.KeepAlive(quantity);
104 if (ret >= 0 && ret <= 4096) { return null; }
105 Result_NoneBolt12SemanticErrorZ ret_hu_conv = Result_NoneBolt12SemanticErrorZ.constr_from_ptr(ret);
106 if (this != null) { this.ptrs_to.AddLast(this); };
107 // Due to rust's strict-ownership memory model, in some cases we need to "move"
108 // an object to pass exclusive ownership to the function being called.
109 // In most cases, we avoid this being visible in GC'd languages by cloning the object
110 // at the FFI layer, creating a new object which Rust can claim ownership of
111 // However, in some cases (eg here), there is no way to clone an object, and thus
112 // we actually have to pass full ownership to Rust.
113 // Thus, after this call, this is reset to null and is now a dummy object.
119 * Sets the [`InvoiceRequest::payer_note`].
121 * Successive calls to this method will override the previous setting.
123 public void payer_note(string payer_note) {
124 bindings.InvoiceRequestWithExplicitPayerIdBuilder_payer_note(this.ptr, InternalUtils.encodeString(payer_note));
126 GC.KeepAlive(payer_note);
127 if (this != null) { this.ptrs_to.AddLast(this); };
128 // Due to rust's strict-ownership memory model, in some cases we need to "move"
129 // an object to pass exclusive ownership to the function being called.
130 // In most cases, we avoid this being visible in GC'd languages by cloning the object
131 // at the FFI layer, creating a new object which Rust can claim ownership of
132 // However, in some cases (eg here), there is no way to clone an object, and thus
133 // we actually have to pass full ownership to Rust.
134 // Thus, after this call, this is reset to null and is now a dummy object.