6 namespace org { namespace ldk { namespace structs {
10 * A path for sending an [`OnionMessage`].
12 public class OnionMessagePath : CommonBase {
13 internal OnionMessagePath(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.OnionMessagePath_free(ptr); }
19 * Nodes on the path between the sender and the destination.
21 * Returns a copy of the field.
23 public byte[][] get_intermediate_nodes() {
24 long ret = bindings.OnionMessagePath_get_intermediate_nodes(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 int ret_conv_8_len = InternalUtils.getArrayLength(ret);
28 byte[][] ret_conv_8_arr = new byte[ret_conv_8_len][];
29 for (int i = 0; i < ret_conv_8_len; i++) {
30 long ret_conv_8 = InternalUtils.getU64ArrayElem(ret, i);
31 byte[] ret_conv_8_conv = InternalUtils.decodeUint8Array(ret_conv_8);
32 ret_conv_8_arr[i] = ret_conv_8_conv;
34 bindings.free_buffer(ret);
35 return ret_conv_8_arr;
39 * Nodes on the path between the sender and the destination.
41 public void set_intermediate_nodes(byte[][] val) {
42 bindings.OnionMessagePath_set_intermediate_nodes(this.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(val, val_conv_8 => InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val_conv_8, 33)))));
48 * The recipient of the message.
50 public Destination get_destination() {
51 long ret = bindings.OnionMessagePath_get_destination(this.ptr);
53 if (ret >= 0 && ret <= 4096) { return null; }
54 org.ldk.structs.Destination ret_hu_conv = org.ldk.structs.Destination.constr_from_ptr(ret);
55 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
60 * The recipient of the message.
62 public void set_destination(org.ldk.structs.Destination val) {
63 bindings.OnionMessagePath_set_destination(this.ptr, val.ptr);
66 if (this != null) { this.ptrs_to.AddLast(val); };
70 * Constructs a new OnionMessagePath given each field
72 public static OnionMessagePath of(byte[][] intermediate_nodes_arg, org.ldk.structs.Destination destination_arg) {
73 long ret = bindings.OnionMessagePath_new(InternalUtils.encodeUint64Array(InternalUtils.mapArray(intermediate_nodes_arg, intermediate_nodes_arg_conv_8 => InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(intermediate_nodes_arg_conv_8, 33)))), destination_arg.ptr);
74 GC.KeepAlive(intermediate_nodes_arg);
75 GC.KeepAlive(destination_arg);
76 if (ret >= 0 && ret <= 4096) { return null; }
77 org.ldk.structs.OnionMessagePath ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OnionMessagePath(null, ret); }
78 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
79 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(destination_arg); };
83 internal long clone_ptr() {
84 long ret = bindings.OnionMessagePath_clone_ptr(this.ptr);
90 * Creates a copy of the OnionMessagePath
92 public OnionMessagePath clone() {
93 long ret = bindings.OnionMessagePath_clone(this.ptr);
95 if (ret >= 0 && ret <= 4096) { return null; }
96 org.ldk.structs.OnionMessagePath ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OnionMessagePath(null, ret); }
97 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };