6 namespace org { namespace ldk { namespace structs {
10 * Features used within an invoice.
12 public class Bolt11InvoiceFeatures : CommonBase {
13 internal Bolt11InvoiceFeatures(object _dummy, long ptr) : base(ptr) { }
14 ~Bolt11InvoiceFeatures() {
15 if (ptr != 0) { bindings.Bolt11InvoiceFeatures_free(ptr); }
19 * Checks if two Bolt11InvoiceFeaturess contain equal inner contents.
20 * This ignores pointers and is_owned flags and looks at the values in fields.
21 * Two objects with NULL inner values will be considered "equal" here.
23 public bool eq(org.ldk.structs.Bolt11InvoiceFeatures b) {
24 bool ret = bindings.Bolt11InvoiceFeatures_eq(this.ptr, b == null ? 0 : b.ptr);
27 if (this != null) { this.ptrs_to.AddLast(b); };
31 public override bool Equals(object o) {
32 if (!(o is Bolt11InvoiceFeatures)) return false;
33 return this.eq((Bolt11InvoiceFeatures)o);
35 internal long clone_ptr() {
36 long ret = bindings.Bolt11InvoiceFeatures_clone_ptr(this.ptr);
42 * Creates a copy of the Bolt11InvoiceFeatures
44 public Bolt11InvoiceFeatures clone() {
45 long ret = bindings.Bolt11InvoiceFeatures_clone(this.ptr);
47 if (ret >= 0 && ret <= 4096) { return null; }
48 org.ldk.structs.Bolt11InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt11InvoiceFeatures(null, ret); }
49 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
54 * Generates a non-cryptographic 64-bit hash of the Bolt11InvoiceFeatures.
57 long ret = bindings.Bolt11InvoiceFeatures_hash(this.ptr);
62 public override int GetHashCode() {
63 return (int)this.hash();
66 * Create a blank Features with no features set
68 public static Bolt11InvoiceFeatures empty() {
69 long ret = bindings.Bolt11InvoiceFeatures_empty();
70 if (ret >= 0 && ret <= 4096) { return null; }
71 org.ldk.structs.Bolt11InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt11InvoiceFeatures(null, ret); }
72 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
77 * Returns true if this `Features` object contains required features unknown by `other`.
79 public bool requires_unknown_bits_from(org.ldk.structs.Bolt11InvoiceFeatures other) {
80 bool ret = bindings.Bolt11InvoiceFeatures_requires_unknown_bits_from(this.ptr, other == null ? 0 : other.ptr);
83 if (this != null) { this.ptrs_to.AddLast(other); };
88 * Returns true if this `Features` object contains unknown feature flags which are set as
91 public bool requires_unknown_bits() {
92 bool ret = bindings.Bolt11InvoiceFeatures_requires_unknown_bits(this.ptr);
98 * Sets a required feature bit. Errors if `bit` is outside the feature range as defined
101 * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
102 * be set instead (i.e., `bit - 1`).
104 * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
106 public Result_NoneNoneZ set_required_feature_bit(long bit) {
107 long ret = bindings.Bolt11InvoiceFeatures_set_required_feature_bit(this.ptr, bit);
110 if (ret >= 0 && ret <= 4096) { return null; }
111 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
116 * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined
119 * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
120 * set instead (i.e., `bit + 1`).
122 * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
124 public Result_NoneNoneZ set_optional_feature_bit(long bit) {
125 long ret = bindings.Bolt11InvoiceFeatures_set_optional_feature_bit(this.ptr, bit);
128 if (ret >= 0 && ret <= 4096) { return null; }
129 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
134 * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
135 * by [bLIP 2] or if it is a known `T` feature.
137 * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
138 * be set instead (i.e., `bit - 1`).
140 * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
142 public Result_NoneNoneZ set_required_custom_bit(long bit) {
143 long ret = bindings.Bolt11InvoiceFeatures_set_required_custom_bit(this.ptr, bit);
146 if (ret >= 0 && ret <= 4096) { return null; }
147 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
152 * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
153 * by [bLIP 2] or if it is a known `T` feature.
155 * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
156 * set instead (i.e., `bit + 1`).
158 * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
160 public Result_NoneNoneZ set_optional_custom_bit(long bit) {
161 long ret = bindings.Bolt11InvoiceFeatures_set_optional_custom_bit(this.ptr, bit);
164 if (ret >= 0 && ret <= 4096) { return null; }
165 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
170 * Serialize the Bolt11InvoiceFeatures object into a byte array which can be read by Bolt11InvoiceFeatures_read
172 public byte[] write() {
173 long ret = bindings.Bolt11InvoiceFeatures_write(this.ptr);
175 if (ret >= 0 && ret <= 4096) { return null; }
176 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
181 * Read a Bolt11InvoiceFeatures from a byte array, created by Bolt11InvoiceFeatures_write
183 public static Result_Bolt11InvoiceFeaturesDecodeErrorZ read(byte[] ser) {
184 long ret = bindings.Bolt11InvoiceFeatures_read(InternalUtils.encodeUint8Array(ser));
186 if (ret >= 0 && ret <= 4096) { return null; }
187 Result_Bolt11InvoiceFeaturesDecodeErrorZ ret_hu_conv = Result_Bolt11InvoiceFeaturesDecodeErrorZ.constr_from_ptr(ret);
192 * Set this feature as optional.
194 public void set_variable_length_onion_optional() {
195 bindings.Bolt11InvoiceFeatures_set_variable_length_onion_optional(this.ptr);
200 * Set this feature as required.
202 public void set_variable_length_onion_required() {
203 bindings.Bolt11InvoiceFeatures_set_variable_length_onion_required(this.ptr);
208 * Checks if this feature is supported.
210 public bool supports_variable_length_onion() {
211 bool ret = bindings.Bolt11InvoiceFeatures_supports_variable_length_onion(this.ptr);
217 * Checks if this feature is required.
219 public bool requires_variable_length_onion() {
220 bool ret = bindings.Bolt11InvoiceFeatures_requires_variable_length_onion(this.ptr);
226 * Set this feature as optional.
228 public void set_payment_secret_optional() {
229 bindings.Bolt11InvoiceFeatures_set_payment_secret_optional(this.ptr);
234 * Set this feature as required.
236 public void set_payment_secret_required() {
237 bindings.Bolt11InvoiceFeatures_set_payment_secret_required(this.ptr);
242 * Checks if this feature is supported.
244 public bool supports_payment_secret() {
245 bool ret = bindings.Bolt11InvoiceFeatures_supports_payment_secret(this.ptr);
251 * Checks if this feature is required.
253 public bool requires_payment_secret() {
254 bool ret = bindings.Bolt11InvoiceFeatures_requires_payment_secret(this.ptr);
260 * Set this feature as optional.
262 public void set_basic_mpp_optional() {
263 bindings.Bolt11InvoiceFeatures_set_basic_mpp_optional(this.ptr);
268 * Set this feature as required.
270 public void set_basic_mpp_required() {
271 bindings.Bolt11InvoiceFeatures_set_basic_mpp_required(this.ptr);
276 * Checks if this feature is supported.
278 public bool supports_basic_mpp() {
279 bool ret = bindings.Bolt11InvoiceFeatures_supports_basic_mpp(this.ptr);
285 * Checks if this feature is required.
287 public bool requires_basic_mpp() {
288 bool ret = bindings.Bolt11InvoiceFeatures_requires_basic_mpp(this.ptr);
294 * Set this feature as optional.
296 public void set_payment_metadata_optional() {
297 bindings.Bolt11InvoiceFeatures_set_payment_metadata_optional(this.ptr);
302 * Set this feature as required.
304 public void set_payment_metadata_required() {
305 bindings.Bolt11InvoiceFeatures_set_payment_metadata_required(this.ptr);
310 * Checks if this feature is supported.
312 public bool supports_payment_metadata() {
313 bool ret = bindings.Bolt11InvoiceFeatures_supports_payment_metadata(this.ptr);
319 * Checks if this feature is required.
321 public bool requires_payment_metadata() {
322 bool ret = bindings.Bolt11InvoiceFeatures_requires_payment_metadata(this.ptr);