+ /**
+ * Creates a new [`RecipientOnionFields`] from an existing one, adding custom TLVs. Each
+ * TLV is provided as a `(u64, Vec<u8>)` for the type number and serialized value
+ * respectively. TLV type numbers must be unique and within the range
+ * reserved for custom types, i.e. >= 2^16, otherwise this method will return `Err(())`.
+ *
+ * This method will also error for types in the experimental range which have been
+ * standardized within the protocol, which only includes 5482373484 (keysend) for now.
+ *
+ * See [`Self::custom_tlvs`] for more info.
+ */
+ public Result_RecipientOnionFieldsNoneZ with_custom_tlvs(TwoTuple_u64CVec_u8ZZ[] custom_tlvs) {
+ long ret = bindings.RecipientOnionFields_with_custom_tlvs(this.ptr, custom_tlvs != null ? Arrays.stream(custom_tlvs).mapToLong(custom_tlvs_conv_23 -> custom_tlvs_conv_23 != null ? custom_tlvs_conv_23.ptr : 0).toArray() : null);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(custom_tlvs);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ Result_RecipientOnionFieldsNoneZ ret_hu_conv = Result_RecipientOnionFieldsNoneZ.constr_from_ptr(ret);
+ if (this != null) { this.ptrs_to.add(this); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Gets the custom TLVs that will be sent or have been received.
+ *
+ * Custom TLVs allow sending extra application-specific data with a payment. They provide
+ * additional flexibility on top of payment metadata, as while other implementations may
+ * require `payment_metadata` to reflect metadata provided in an invoice, custom TLVs
+ * do not have this restriction.
+ *
+ * Note that if this field is non-empty, it will contain strictly increasing TLVs, each
+ * represented by a `(u64, Vec<u8>)` for its type number and serialized value respectively.
+ * This is validated when setting this field using [`Self::with_custom_tlvs`].
+ */
+ public TwoTuple_u64CVec_u8ZZ[] custom_tlvs() {
+ long[] ret = bindings.RecipientOnionFields_custom_tlvs(this.ptr);
+ Reference.reachabilityFence(this);
+ int ret_conv_23_len = ret.length;
+ TwoTuple_u64CVec_u8ZZ[] ret_conv_23_arr = new TwoTuple_u64CVec_u8ZZ[ret_conv_23_len];
+ for (int x = 0; x < ret_conv_23_len; x++) {
+ long ret_conv_23 = ret[x];
+ TwoTuple_u64CVec_u8ZZ ret_conv_23_hu_conv = new TwoTuple_u64CVec_u8ZZ(null, ret_conv_23);
+ if (ret_conv_23_hu_conv != null) { ret_conv_23_hu_conv.ptrs_to.add(this); };
+ ret_conv_23_arr[x] = ret_conv_23_hu_conv;
+ }
+ return ret_conv_23_arr;
+ }
+