--- /dev/null
+using org.ldk.impl;
+using org.ldk.enums;
+using org.ldk.util;
+using System;
+
+namespace org { namespace ldk { namespace structs {
+
+
+/**
+ * Information communicated in the onion to the recipient for multi-part tracking and proof that
+ * the payment is associated with an invoice.
+ */
+public class FinalOnionHopData : CommonBase {
+ internal FinalOnionHopData(object _dummy, long ptr) : base(ptr) { }
+ ~FinalOnionHopData() {
+ if (ptr != 0) { bindings.FinalOnionHopData_free(ptr); }
+ }
+
+ /**
+ * When sending a multi-part payment, this secret is used to identify a payment across HTLCs.
+ * Because it is generated by the recipient and included in the invoice, it also provides
+ * proof to the recipient that the payment was sent by someone with the generated invoice.
+ */
+ public byte[] get_payment_secret() {
+ long ret = bindings.FinalOnionHopData_get_payment_secret(this.ptr);
+ GC.KeepAlive(this);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+ return ret_conv;
+ }
+
+ /**
+ * When sending a multi-part payment, this secret is used to identify a payment across HTLCs.
+ * Because it is generated by the recipient and included in the invoice, it also provides
+ * proof to the recipient that the payment was sent by someone with the generated invoice.
+ */
+ public void set_payment_secret(byte[] val) {
+ bindings.FinalOnionHopData_set_payment_secret(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
+ GC.KeepAlive(this);
+ GC.KeepAlive(val);
+ }
+
+ /**
+ * The intended total amount that this payment is for.
+ *
+ * Message serialization may panic if this value is more than 21 million Bitcoin.
+ */
+ public long get_total_msat() {
+ long ret = bindings.FinalOnionHopData_get_total_msat(this.ptr);
+ GC.KeepAlive(this);
+ return ret;
+ }
+
+ /**
+ * The intended total amount that this payment is for.
+ *
+ * Message serialization may panic if this value is more than 21 million Bitcoin.
+ */
+ public void set_total_msat(long val) {
+ bindings.FinalOnionHopData_set_total_msat(this.ptr, val);
+ GC.KeepAlive(this);
+ GC.KeepAlive(val);
+ }
+
+ /**
+ * Constructs a new FinalOnionHopData given each field
+ */
+ public static FinalOnionHopData of(byte[] payment_secret_arg, long total_msat_arg) {
+ long ret = bindings.FinalOnionHopData_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_secret_arg, 32)), total_msat_arg);
+ GC.KeepAlive(payment_secret_arg);
+ GC.KeepAlive(total_msat_arg);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.FinalOnionHopData ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FinalOnionHopData(null, ret); }
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
+ return ret_hu_conv;
+ }
+
+ internal long clone_ptr() {
+ long ret = bindings.FinalOnionHopData_clone_ptr(this.ptr);
+ GC.KeepAlive(this);
+ return ret;
+ }
+
+ /**
+ * Creates a copy of the FinalOnionHopData
+ */
+ public FinalOnionHopData clone() {
+ long ret = bindings.FinalOnionHopData_clone(this.ptr);
+ GC.KeepAlive(this);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.FinalOnionHopData ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FinalOnionHopData(null, ret); }
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Serialize the FinalOnionHopData object into a byte array which can be read by FinalOnionHopData_read
+ */
+ public byte[] write() {
+ long ret = bindings.FinalOnionHopData_write(this.ptr);
+ GC.KeepAlive(this);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+ return ret_conv;
+ }
+
+ /**
+ * Read a FinalOnionHopData from a byte array, created by FinalOnionHopData_write
+ */
+ public static Result_FinalOnionHopDataDecodeErrorZ read(byte[] ser) {
+ long ret = bindings.FinalOnionHopData_read(InternalUtils.encodeUint8Array(ser));
+ GC.KeepAlive(ser);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ Result_FinalOnionHopDataDecodeErrorZ ret_hu_conv = Result_FinalOnionHopDataDecodeErrorZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+}
+} } }