6 namespace org { namespace ldk { namespace structs {
9 * The destination of an onion message.
11 public class Destination : CommonBase {
12 protected Destination(object _dummy, long ptr) : base(ptr) { }
14 if (ptr != 0) { bindings.Destination_free(ptr); }
17 internal static Destination constr_from_ptr(long ptr) {
18 long raw_ty = bindings.LDKDestination_ty_from_ptr(ptr);
20 case 0: return new Destination_Node(ptr);
21 case 1: return new Destination_BlindedPath(ptr);
23 throw new ArgumentException("Impossible enum variant");
27 /** A Destination of type Node */
28 public class Destination_Node : Destination {
30 internal Destination_Node(long ptr) : base(null, ptr) {
31 this.node = bindings.LDKDestination_Node_get_node(ptr);
34 /** A Destination of type BlindedPath */
35 public class Destination_BlindedPath : Destination {
36 public BlindedPath blinded_path;
37 internal Destination_BlindedPath(long ptr) : base(null, ptr) {
38 long blinded_path = bindings.LDKDestination_BlindedPath_get_blinded_path(ptr);
39 org.ldk.structs.BlindedPath blinded_path_hu_conv = null; if (blinded_path < 0 || blinded_path > 4096) { blinded_path_hu_conv = new org.ldk.structs.BlindedPath(null, blinded_path); }
40 if (blinded_path_hu_conv != null) { blinded_path_hu_conv.ptrs_to.AddLast(this); };
41 this.blinded_path = blinded_path_hu_conv;
44 internal long clone_ptr() {
45 long ret = bindings.Destination_clone_ptr(this.ptr);
51 * Creates a copy of the Destination
53 public Destination clone() {
54 long ret = bindings.Destination_clone(this.ptr);
56 if (ret >= 0 && ret <= 4096) { return null; }
57 org.ldk.structs.Destination ret_hu_conv = org.ldk.structs.Destination.constr_from_ptr(ret);
58 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
63 * Utility method to constructs a new Node-variant Destination
65 public static Destination node(byte[] a) {
66 long ret = bindings.Destination_node(InternalUtils.check_arr_len(a, 33));
68 if (ret >= 0 && ret <= 4096) { return null; }
69 org.ldk.structs.Destination ret_hu_conv = org.ldk.structs.Destination.constr_from_ptr(ret);
70 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
75 * Utility method to constructs a new BlindedPath-variant Destination
77 public static Destination blinded_path(org.ldk.structs.BlindedPath a) {
78 long ret = bindings.Destination_blinded_path(a == null ? 0 : a.ptr);
80 if (ret >= 0 && ret <= 4096) { return null; }
81 org.ldk.structs.Destination ret_hu_conv = org.ldk.structs.Destination.constr_from_ptr(ret);
82 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
83 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(a); };