[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / PhantomRouteHints.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * Route hints used in constructing invoices for [phantom node payents].
11  * 
12  * [phantom node payments]: crate::sign::PhantomKeysManager
13  */
14 public class PhantomRouteHints : CommonBase {
15         internal PhantomRouteHints(object _dummy, long ptr) : base(ptr) { }
16         ~PhantomRouteHints() {
17                 if (ptr != 0) { bindings.PhantomRouteHints_free(ptr); }
18         }
19
20         /**
21          * The list of channels to be included in the invoice route hints.
22          */
23         public ChannelDetails[] get_channels() {
24                 long ret = bindings.PhantomRouteHints_get_channels(this.ptr);
25                 GC.KeepAlive(this);
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;
34                 }
35                 bindings.free_buffer(ret);
36                 return ret_conv_16_arr;
37         }
38
39         /**
40          * The list of channels to be included in the invoice route hints.
41          */
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 == null ? 0 : val_conv_16.ptr)));
44                 GC.KeepAlive(this);
45                 GC.KeepAlive(val);
46                 foreach (ChannelDetails val_conv_16 in val) { if (this != null) { this.ptrs_to.AddLast(val_conv_16); }; };
47         }
48
49         /**
50          * A fake scid used for representing the phantom node's fake channel in generating the invoice
51          * route hints.
52          */
53         public long get_phantom_scid() {
54                 long ret = bindings.PhantomRouteHints_get_phantom_scid(this.ptr);
55                 GC.KeepAlive(this);
56                 return ret;
57         }
58
59         /**
60          * A fake scid used for representing the phantom node's fake channel in generating the invoice
61          * route hints.
62          */
63         public void set_phantom_scid(long val) {
64                 bindings.PhantomRouteHints_set_phantom_scid(this.ptr, val);
65                 GC.KeepAlive(this);
66                 GC.KeepAlive(val);
67         }
68
69         /**
70          * The pubkey of the real backing node that would ultimately receive the payment.
71          */
72         public byte[] get_real_node_pubkey() {
73                 long ret = bindings.PhantomRouteHints_get_real_node_pubkey(this.ptr);
74                 GC.KeepAlive(this);
75                 if (ret >= 0 && ret <= 4096) { return null; }
76                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
77                 return ret_conv;
78         }
79
80         /**
81          * The pubkey of the real backing node that would ultimately receive the payment.
82          */
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)));
85                 GC.KeepAlive(this);
86                 GC.KeepAlive(val);
87         }
88
89         /**
90          * Constructs a new PhantomRouteHints given each field
91          */
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 == null ? 0 : 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); }; };
101                 return ret_hu_conv;
102         }
103
104         internal long clone_ptr() {
105                 long ret = bindings.PhantomRouteHints_clone_ptr(this.ptr);
106                 GC.KeepAlive(this);
107                 return ret;
108         }
109
110         /**
111          * Creates a copy of the PhantomRouteHints
112          */
113         public PhantomRouteHints clone() {
114                 long ret = bindings.PhantomRouteHints_clone(this.ptr);
115                 GC.KeepAlive(this);
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); };
119                 return ret_hu_conv;
120         }
121
122         /**
123          * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read
124          */
125         public byte[] write() {
126                 long ret = bindings.PhantomRouteHints_write(this.ptr);
127                 GC.KeepAlive(this);
128                 if (ret >= 0 && ret <= 4096) { return null; }
129                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
130                 return ret_conv;
131         }
132
133         /**
134          * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
135          */
136         public static Result_PhantomRouteHintsDecodeErrorZ read(byte[] ser) {
137                 long ret = bindings.PhantomRouteHints_read(InternalUtils.encodeUint8Array(ser));
138                 GC.KeepAlive(ser);
139                 if (ret >= 0 && ret <= 4096) { return null; }
140                 Result_PhantomRouteHintsDecodeErrorZ ret_hu_conv = Result_PhantomRouteHintsDecodeErrorZ.constr_from_ptr(ret);
141                 return ret_hu_conv;
142         }
143
144 }
145 } } }