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 InvoiceRequestWithDerivedPayerIdBuilder : CommonBase {
17 internal InvoiceRequestWithDerivedPayerIdBuilder(object _dummy, long ptr) : base(ptr) { }
18 ~InvoiceRequestWithDerivedPayerIdBuilder() {
19 if (ptr != 0) { bindings.InvoiceRequestWithDerivedPayerIdBuilder_free(ptr); }
23 * Builds a signed [`InvoiceRequest`] after checking for valid semantics.
25 public Result_InvoiceRequestBolt12SemanticErrorZ build_and_sign() {
26 long ret = bindings.InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign(this.ptr);
28 if (ret >= 0 && ret <= 4096) { return null; }
29 Result_InvoiceRequestBolt12SemanticErrorZ ret_hu_conv = Result_InvoiceRequestBolt12SemanticErrorZ.constr_from_ptr(ret);
30 if (this != null) { this.ptrs_to.AddLast(this); };
31 // Due to rust's strict-ownership memory model, in some cases we need to "move"
32 // an object to pass exclusive ownership to the function being called.
33 // In most cases, we avoid this being visible in GC'd languages by cloning the object
34 // at the FFI layer, creating a new object which Rust can claim ownership of
35 // However, in some cases (eg here), there is no way to clone an object, and thus
36 // we actually have to pass full ownership to Rust.
37 // Thus, after this call, this is reset to null and is now a dummy object.
43 * Sets the [`InvoiceRequest::chain`] of the given [`Network`] for paying an invoice. If not
44 * called, [`Network::Bitcoin`] is assumed. Errors if the chain for `network` is not supported
47 * Successive calls to this method will override the previous setting.
49 public Result_NoneBolt12SemanticErrorZ chain(Network network) {
50 long ret = bindings.InvoiceRequestWithDerivedPayerIdBuilder_chain(this.ptr, network);
52 GC.KeepAlive(network);
53 if (ret >= 0 && ret <= 4096) { return null; }
54 Result_NoneBolt12SemanticErrorZ ret_hu_conv = Result_NoneBolt12SemanticErrorZ.constr_from_ptr(ret);
55 if (this != null) { this.ptrs_to.AddLast(this); };
56 // Due to rust's strict-ownership memory model, in some cases we need to "move"
57 // an object to pass exclusive ownership to the function being called.
58 // In most cases, we avoid this being visible in GC'd languages by cloning the object
59 // at the FFI layer, creating a new object which Rust can claim ownership of
60 // However, in some cases (eg here), there is no way to clone an object, and thus
61 // we actually have to pass full ownership to Rust.
62 // Thus, after this call, this is reset to null and is now a dummy object.
68 * Sets the [`InvoiceRequest::amount_msats`] for paying an invoice. Errors if `amount_msats` is
69 * not at least the expected invoice amount (i.e., [`Offer::amount`] times [`quantity`]).
71 * Successive calls to this method will override the previous setting.
73 * [`quantity`]: Self::quantity
75 public Result_NoneBolt12SemanticErrorZ amount_msats(long amount_msats) {
76 long ret = bindings.InvoiceRequestWithDerivedPayerIdBuilder_amount_msats(this.ptr, amount_msats);
78 GC.KeepAlive(amount_msats);
79 if (ret >= 0 && ret <= 4096) { return null; }
80 Result_NoneBolt12SemanticErrorZ ret_hu_conv = Result_NoneBolt12SemanticErrorZ.constr_from_ptr(ret);
81 if (this != null) { this.ptrs_to.AddLast(this); };
82 // Due to rust's strict-ownership memory model, in some cases we need to "move"
83 // an object to pass exclusive ownership to the function being called.
84 // In most cases, we avoid this being visible in GC'd languages by cloning the object
85 // at the FFI layer, creating a new object which Rust can claim ownership of
86 // However, in some cases (eg here), there is no way to clone an object, and thus
87 // we actually have to pass full ownership to Rust.
88 // Thus, after this call, this is reset to null and is now a dummy object.
94 * Sets [`InvoiceRequest::quantity`] of items. If not set, `1` is assumed. Errors if `quantity`
95 * does not conform to [`Offer::is_valid_quantity`].
97 * Successive calls to this method will override the previous setting.
99 public Result_NoneBolt12SemanticErrorZ quantity(long quantity) {
100 long ret = bindings.InvoiceRequestWithDerivedPayerIdBuilder_quantity(this.ptr, quantity);
102 GC.KeepAlive(quantity);
103 if (ret >= 0 && ret <= 4096) { return null; }
104 Result_NoneBolt12SemanticErrorZ ret_hu_conv = Result_NoneBolt12SemanticErrorZ.constr_from_ptr(ret);
105 if (this != null) { this.ptrs_to.AddLast(this); };
106 // Due to rust's strict-ownership memory model, in some cases we need to "move"
107 // an object to pass exclusive ownership to the function being called.
108 // In most cases, we avoid this being visible in GC'd languages by cloning the object
109 // at the FFI layer, creating a new object which Rust can claim ownership of
110 // However, in some cases (eg here), there is no way to clone an object, and thus
111 // we actually have to pass full ownership to Rust.
112 // Thus, after this call, this is reset to null and is now a dummy object.
118 * Sets the [`InvoiceRequest::payer_note`].
120 * Successive calls to this method will override the previous setting.
122 public void payer_note(string payer_note) {
123 bindings.InvoiceRequestWithDerivedPayerIdBuilder_payer_note(this.ptr, InternalUtils.encodeString(payer_note));
125 GC.KeepAlive(payer_note);
126 if (this != null) { this.ptrs_to.AddLast(this); };
127 // Due to rust's strict-ownership memory model, in some cases we need to "move"
128 // an object to pass exclusive ownership to the function being called.
129 // In most cases, we avoid this being visible in GC'd languages by cloning the object
130 // at the FFI layer, creating a new object which Rust can claim ownership of
131 // However, in some cases (eg here), there is no way to clone an object, and thus
132 // we actually have to pass full ownership to Rust.
133 // Thus, after this call, this is reset to null and is now a dummy object.