[C#] Check in initial 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::chain::keysinterface::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                 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;
33                 }
34                 return ret_conv_16_arr;
35         }
36
37         /**
38          * The list of channels to be included in the invoice route hints.
39          */
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);
42                 GC.KeepAlive(this);
43                 GC.KeepAlive(val);
44                 foreach (ChannelDetails val_conv_16 in val) { if (this != null) { this.ptrs_to.AddLast(val_conv_16); }; };
45         }
46
47         /**
48          * A fake scid used for representing the phantom node's fake channel in generating the invoice
49          * route hints.
50          */
51         public long get_phantom_scid() {
52                 long ret = bindings.PhantomRouteHints_get_phantom_scid(this.ptr);
53                 GC.KeepAlive(this);
54                 return ret;
55         }
56
57         /**
58          * A fake scid used for representing the phantom node's fake channel in generating the invoice
59          * route hints.
60          */
61         public void set_phantom_scid(long val) {
62                 bindings.PhantomRouteHints_set_phantom_scid(this.ptr, val);
63                 GC.KeepAlive(this);
64                 GC.KeepAlive(val);
65         }
66
67         /**
68          * The pubkey of the real backing node that would ultimately receive the payment.
69          */
70         public byte[] get_real_node_pubkey() {
71                 byte[] ret = bindings.PhantomRouteHints_get_real_node_pubkey(this.ptr);
72                 GC.KeepAlive(this);
73                 return ret;
74         }
75
76         /**
77          * The pubkey of the real backing node that would ultimately receive the payment.
78          */
79         public void set_real_node_pubkey(byte[] val) {
80                 bindings.PhantomRouteHints_set_real_node_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
81                 GC.KeepAlive(this);
82                 GC.KeepAlive(val);
83         }
84
85         /**
86          * Constructs a new PhantomRouteHints given each field
87          */
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); }; };
97                 return ret_hu_conv;
98         }
99
100         internal long clone_ptr() {
101                 long ret = bindings.PhantomRouteHints_clone_ptr(this.ptr);
102                 GC.KeepAlive(this);
103                 return ret;
104         }
105
106         /**
107          * Creates a copy of the PhantomRouteHints
108          */
109         public PhantomRouteHints clone() {
110                 long ret = bindings.PhantomRouteHints_clone(this.ptr);
111                 GC.KeepAlive(this);
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); };
115                 return ret_hu_conv;
116         }
117
118         /**
119          * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read
120          */
121         public byte[] write() {
122                 byte[] ret = bindings.PhantomRouteHints_write(this.ptr);
123                 GC.KeepAlive(this);
124                 return ret;
125         }
126
127         /**
128          * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
129          */
130         public static Result_PhantomRouteHintsDecodeErrorZ read(byte[] ser) {
131                 long ret = bindings.PhantomRouteHints_read(ser);
132                 GC.KeepAlive(ser);
133                 if (ret >= 0 && ret <= 4096) { return null; }
134                 Result_PhantomRouteHintsDecodeErrorZ ret_hu_conv = Result_PhantomRouteHintsDecodeErrorZ.constr_from_ptr(ret);
135                 return ret_hu_conv;
136         }
137
138 }
139 } } }