6 namespace org { namespace ldk { namespace structs {
10 * Features used within an `invoice`.
12 public class Bolt12InvoiceFeatures : CommonBase {
13 internal Bolt12InvoiceFeatures(object _dummy, long ptr) : base(ptr) { }
14 ~Bolt12InvoiceFeatures() {
15 if (ptr != 0) { bindings.Bolt12InvoiceFeatures_free(ptr); }
19 * Checks if two Bolt12InvoiceFeaturess 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.Bolt12InvoiceFeatures b) {
24 bool ret = bindings.Bolt12InvoiceFeatures_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 Bolt12InvoiceFeatures)) return false;
33 return this.eq((Bolt12InvoiceFeatures)o);
35 internal long clone_ptr() {
36 long ret = bindings.Bolt12InvoiceFeatures_clone_ptr(this.ptr);
42 * Creates a copy of the Bolt12InvoiceFeatures
44 public Bolt12InvoiceFeatures clone() {
45 long ret = bindings.Bolt12InvoiceFeatures_clone(this.ptr);
47 if (ret >= 0 && ret <= 4096) { return null; }
48 org.ldk.structs.Bolt12InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt12InvoiceFeatures(null, ret); }
49 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
54 * Create a blank Features with no features set
56 public static Bolt12InvoiceFeatures empty() {
57 long ret = bindings.Bolt12InvoiceFeatures_empty();
58 if (ret >= 0 && ret <= 4096) { return null; }
59 org.ldk.structs.Bolt12InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt12InvoiceFeatures(null, ret); }
60 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
65 * Returns true if this `Features` object contains required features unknown by `other`.
67 public bool requires_unknown_bits_from(org.ldk.structs.Bolt12InvoiceFeatures other) {
68 bool ret = bindings.Bolt12InvoiceFeatures_requires_unknown_bits_from(this.ptr, other == null ? 0 : other.ptr);
71 if (this != null) { this.ptrs_to.AddLast(other); };
76 * Returns true if this `Features` object contains unknown feature flags which are set as
79 public bool requires_unknown_bits() {
80 bool ret = bindings.Bolt12InvoiceFeatures_requires_unknown_bits(this.ptr);
86 * Sets a required feature bit. Errors if `bit` is outside the feature range as defined
89 * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
90 * be set instead (i.e., `bit - 1`).
92 * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
94 public Result_NoneNoneZ set_required_feature_bit(long bit) {
95 long ret = bindings.Bolt12InvoiceFeatures_set_required_feature_bit(this.ptr, bit);
98 if (ret >= 0 && ret <= 4096) { return null; }
99 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
104 * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined
107 * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
108 * set instead (i.e., `bit + 1`).
110 * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
112 public Result_NoneNoneZ set_optional_feature_bit(long bit) {
113 long ret = bindings.Bolt12InvoiceFeatures_set_optional_feature_bit(this.ptr, bit);
116 if (ret >= 0 && ret <= 4096) { return null; }
117 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
122 * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
123 * by [bLIP 2] or if it is a known `T` feature.
125 * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
126 * be set instead (i.e., `bit - 1`).
128 * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
130 public Result_NoneNoneZ set_required_custom_bit(long bit) {
131 long ret = bindings.Bolt12InvoiceFeatures_set_required_custom_bit(this.ptr, bit);
134 if (ret >= 0 && ret <= 4096) { return null; }
135 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
140 * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
141 * by [bLIP 2] or if it is a known `T` feature.
143 * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
144 * set instead (i.e., `bit + 1`).
146 * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
148 public Result_NoneNoneZ set_optional_custom_bit(long bit) {
149 long ret = bindings.Bolt12InvoiceFeatures_set_optional_custom_bit(this.ptr, bit);
152 if (ret >= 0 && ret <= 4096) { return null; }
153 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
158 * Serialize the Bolt12InvoiceFeatures object into a byte array which can be read by Bolt12InvoiceFeatures_read
160 public byte[] write() {
161 long ret = bindings.Bolt12InvoiceFeatures_write(this.ptr);
163 if (ret >= 0 && ret <= 4096) { return null; }
164 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
169 * Read a Bolt12InvoiceFeatures from a byte array, created by Bolt12InvoiceFeatures_write
171 public static Result_Bolt12InvoiceFeaturesDecodeErrorZ read(byte[] ser) {
172 long ret = bindings.Bolt12InvoiceFeatures_read(InternalUtils.encodeUint8Array(ser));
174 if (ret >= 0 && ret <= 4096) { return null; }
175 Result_Bolt12InvoiceFeaturesDecodeErrorZ ret_hu_conv = Result_Bolt12InvoiceFeaturesDecodeErrorZ.constr_from_ptr(ret);
180 * Set this feature as optional.
182 public void set_basic_mpp_optional() {
183 bindings.Bolt12InvoiceFeatures_set_basic_mpp_optional(this.ptr);
188 * Set this feature as required.
190 public void set_basic_mpp_required() {
191 bindings.Bolt12InvoiceFeatures_set_basic_mpp_required(this.ptr);
196 * Checks if this feature is supported.
198 public bool supports_basic_mpp() {
199 bool ret = bindings.Bolt12InvoiceFeatures_supports_basic_mpp(this.ptr);
205 * Checks if this feature is required.
207 public bool requires_basic_mpp() {
208 bool ret = bindings.Bolt12InvoiceFeatures_requires_basic_mpp(this.ptr);