6 namespace org { namespace ldk { namespace structs {
10 * Route hints used in constructing invoices for [phantom node payents].
12 * [phantom node payments]: crate::sign::PhantomKeysManager
14 public class PhantomRouteHints : CommonBase {
15 internal PhantomRouteHints(object _dummy, long ptr) : base(ptr) { }
16 ~PhantomRouteHints() {
17 if (ptr != 0) { bindings.PhantomRouteHints_free(ptr); }
21 * The list of channels to be included in the invoice route hints.
23 public ChannelDetails[] get_channels() {
24 long ret = bindings.PhantomRouteHints_get_channels(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 int ret_conv_16_len = InternalUtils.getArrayLength(ret);
28 ChannelDetails[] ret_conv_16_arr = new ChannelDetails[ret_conv_16_len];
29 for (int q = 0; q < ret_conv_16_len; q++) {
30 long ret_conv_16 = InternalUtils.getU64ArrayElem(ret, q);
31 org.ldk.structs.ChannelDetails ret_conv_16_hu_conv = null; if (ret_conv_16 < 0 || ret_conv_16 > 4096) { ret_conv_16_hu_conv = new org.ldk.structs.ChannelDetails(null, ret_conv_16); }
32 if (ret_conv_16_hu_conv != null) { ret_conv_16_hu_conv.ptrs_to.AddLast(this); };
33 ret_conv_16_arr[q] = ret_conv_16_hu_conv;
35 bindings.free_buffer(ret);
36 return ret_conv_16_arr;
40 * The list of channels to be included in the invoice route hints.
42 public void set_channels(ChannelDetails[] val) {
43 bindings.PhantomRouteHints_set_channels(this.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(val, val_conv_16 => val_conv_16.ptr)));
46 foreach (ChannelDetails val_conv_16 in val) { if (this != null) { this.ptrs_to.AddLast(val_conv_16); }; };
50 * A fake scid used for representing the phantom node's fake channel in generating the invoice
53 public long get_phantom_scid() {
54 long ret = bindings.PhantomRouteHints_get_phantom_scid(this.ptr);
60 * A fake scid used for representing the phantom node's fake channel in generating the invoice
63 public void set_phantom_scid(long val) {
64 bindings.PhantomRouteHints_set_phantom_scid(this.ptr, val);
70 * The pubkey of the real backing node that would ultimately receive the payment.
72 public byte[] get_real_node_pubkey() {
73 long ret = bindings.PhantomRouteHints_get_real_node_pubkey(this.ptr);
75 if (ret >= 0 && ret <= 4096) { return null; }
76 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
81 * The pubkey of the real backing node that would ultimately receive the payment.
83 public void set_real_node_pubkey(byte[] val) {
84 bindings.PhantomRouteHints_set_real_node_pubkey(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
90 * Constructs a new PhantomRouteHints given each field
92 public static PhantomRouteHints of(ChannelDetails[] channels_arg, long phantom_scid_arg, byte[] real_node_pubkey_arg) {
93 long ret = bindings.PhantomRouteHints_new(InternalUtils.encodeUint64Array(InternalUtils.mapArray(channels_arg, channels_arg_conv_16 => channels_arg_conv_16.ptr)), phantom_scid_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(real_node_pubkey_arg, 33)));
94 GC.KeepAlive(channels_arg);
95 GC.KeepAlive(phantom_scid_arg);
96 GC.KeepAlive(real_node_pubkey_arg);
97 if (ret >= 0 && ret <= 4096) { return null; }
98 org.ldk.structs.PhantomRouteHints ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PhantomRouteHints(null, ret); }
99 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
100 foreach (ChannelDetails channels_arg_conv_16 in channels_arg) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channels_arg_conv_16); }; };
104 internal long clone_ptr() {
105 long ret = bindings.PhantomRouteHints_clone_ptr(this.ptr);
111 * Creates a copy of the PhantomRouteHints
113 public PhantomRouteHints clone() {
114 long ret = bindings.PhantomRouteHints_clone(this.ptr);
116 if (ret >= 0 && ret <= 4096) { return null; }
117 org.ldk.structs.PhantomRouteHints ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PhantomRouteHints(null, ret); }
118 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
123 * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read
125 public byte[] write() {
126 long ret = bindings.PhantomRouteHints_write(this.ptr);
128 if (ret >= 0 && ret <= 4096) { return null; }
129 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
134 * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
136 public static Result_PhantomRouteHintsDecodeErrorZ read(byte[] ser) {
137 long ret = bindings.PhantomRouteHints_read(InternalUtils.encodeUint8Array(ser));
139 if (ret >= 0 && ret <= 4096) { return null; }
140 Result_PhantomRouteHintsDecodeErrorZ ret_hu_conv = Result_PhantomRouteHintsDecodeErrorZ.constr_from_ptr(ret);