6 namespace org { namespace ldk { namespace structs {
10 * Route hints used in constructing invoices for [phantom node payents].
12 * [phantom node payments]: crate::chain::keysinterface::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 int ret_conv_16_len = ret.Length;
27 ChannelDetails[] ret_conv_16_arr = new ChannelDetails[ret_conv_16_len];
28 for (int q = 0; q < ret_conv_16_len; q++) {
29 long ret_conv_16 = ret[q];
30 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); }
31 if (ret_conv_16_hu_conv != null) { ret_conv_16_hu_conv.ptrs_to.AddLast(this); };
32 ret_conv_16_arr[q] = ret_conv_16_hu_conv;
34 return ret_conv_16_arr;
38 * The list of channels to be included in the invoice route hints.
40 public void set_channels(ChannelDetails[] val) {
41 bindings.PhantomRouteHints_set_channels(this.ptr, val != null ? InternalUtils.mapArray(val, val_conv_16 => val_conv_16 == null ? 0 : val_conv_16.ptr) : null);
44 foreach (ChannelDetails val_conv_16 in val) { if (this != null) { this.ptrs_to.AddLast(val_conv_16); }; };
48 * A fake scid used for representing the phantom node's fake channel in generating the invoice
51 public long get_phantom_scid() {
52 long ret = bindings.PhantomRouteHints_get_phantom_scid(this.ptr);
58 * A fake scid used for representing the phantom node's fake channel in generating the invoice
61 public void set_phantom_scid(long val) {
62 bindings.PhantomRouteHints_set_phantom_scid(this.ptr, val);
68 * The pubkey of the real backing node that would ultimately receive the payment.
70 public byte[] get_real_node_pubkey() {
71 byte[] ret = bindings.PhantomRouteHints_get_real_node_pubkey(this.ptr);
77 * The pubkey of the real backing node that would ultimately receive the payment.
79 public void set_real_node_pubkey(byte[] val) {
80 bindings.PhantomRouteHints_set_real_node_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
86 * Constructs a new PhantomRouteHints given each field
88 public static PhantomRouteHints of(ChannelDetails[] channels_arg, long phantom_scid_arg, byte[] real_node_pubkey_arg) {
89 long ret = bindings.PhantomRouteHints_new(channels_arg != null ? InternalUtils.mapArray(channels_arg, channels_arg_conv_16 => channels_arg_conv_16 == null ? 0 : channels_arg_conv_16.ptr) : null, phantom_scid_arg, InternalUtils.check_arr_len(real_node_pubkey_arg, 33));
90 GC.KeepAlive(channels_arg);
91 GC.KeepAlive(phantom_scid_arg);
92 GC.KeepAlive(real_node_pubkey_arg);
93 if (ret >= 0 && ret <= 4096) { return null; }
94 org.ldk.structs.PhantomRouteHints ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PhantomRouteHints(null, ret); }
95 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
96 foreach (ChannelDetails channels_arg_conv_16 in channels_arg) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channels_arg_conv_16); }; };
100 internal long clone_ptr() {
101 long ret = bindings.PhantomRouteHints_clone_ptr(this.ptr);
107 * Creates a copy of the PhantomRouteHints
109 public PhantomRouteHints clone() {
110 long ret = bindings.PhantomRouteHints_clone(this.ptr);
112 if (ret >= 0 && ret <= 4096) { return null; }
113 org.ldk.structs.PhantomRouteHints ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PhantomRouteHints(null, ret); }
114 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
119 * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read
121 public byte[] write() {
122 byte[] ret = bindings.PhantomRouteHints_write(this.ptr);
128 * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
130 public static Result_PhantomRouteHintsDecodeErrorZ read(byte[] ser) {
131 long ret = bindings.PhantomRouteHints_read(ser);
133 if (ret >= 0 && ret <= 4096) { return null; }
134 Result_PhantomRouteHintsDecodeErrorZ ret_hu_conv = Result_PhantomRouteHintsDecodeErrorZ.constr_from_ptr(ret);