X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FForwardNode.cs;fp=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FForwardNode.cs;h=6860009e4f4ba6307883b8e758d4fc86a1d9b869;hb=8de7213fbf663ff60322896282dad51e8ab2f001;hp=0000000000000000000000000000000000000000;hpb=afc50e5d491a11364849383b75a8f939df703bac;p=ldk-java diff --git a/c_sharp/src/org/ldk/structs/ForwardNode.cs b/c_sharp/src/org/ldk/structs/ForwardNode.cs new file mode 100644 index 00000000..6860009e --- /dev/null +++ b/c_sharp/src/org/ldk/structs/ForwardNode.cs @@ -0,0 +1,114 @@ +using org.ldk.impl; +using org.ldk.enums; +using org.ldk.util; +using System; + +namespace org { namespace ldk { namespace structs { + + +/** + * An intermediate node, its outbound channel, and relay parameters. + */ +public class ForwardNode : CommonBase { + internal ForwardNode(object _dummy, long ptr) : base(ptr) { } + ~ForwardNode() { + if (ptr != 0) { bindings.ForwardNode_free(ptr); } + } + + /** + * The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also + * used for [`BlindedPayInfo`] construction. + */ + public ForwardTlvs get_tlvs() { + long ret = bindings.ForwardNode_get_tlvs(this.ptr); + GC.KeepAlive(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ForwardTlvs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ForwardTlvs(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); }; + return ret_hu_conv; + } + + /** + * The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also + * used for [`BlindedPayInfo`] construction. + */ + public void set_tlvs(org.ldk.structs.ForwardTlvs val) { + bindings.ForwardNode_set_tlvs(this.ptr, val == null ? 0 : val.ptr); + GC.KeepAlive(this); + GC.KeepAlive(val); + if (this != null) { this.ptrs_to.AddLast(val); }; + } + + /** + * This node's pubkey. + */ + public byte[] get_node_id() { + long ret = bindings.ForwardNode_get_node_id(this.ptr); + GC.KeepAlive(this); + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; + } + + /** + * This node's pubkey. + */ + public void set_node_id(byte[] val) { + bindings.ForwardNode_set_node_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33))); + GC.KeepAlive(this); + GC.KeepAlive(val); + } + + /** + * The maximum value, in msat, that may be accepted by this node. + */ + public long get_htlc_maximum_msat() { + long ret = bindings.ForwardNode_get_htlc_maximum_msat(this.ptr); + GC.KeepAlive(this); + return ret; + } + + /** + * The maximum value, in msat, that may be accepted by this node. + */ + public void set_htlc_maximum_msat(long val) { + bindings.ForwardNode_set_htlc_maximum_msat(this.ptr, val); + GC.KeepAlive(this); + GC.KeepAlive(val); + } + + /** + * Constructs a new ForwardNode given each field + */ + public static ForwardNode of(org.ldk.structs.ForwardTlvs tlvs_arg, byte[] node_id_arg, long htlc_maximum_msat_arg) { + long ret = bindings.ForwardNode_new(tlvs_arg == null ? 0 : tlvs_arg.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(node_id_arg, 33)), htlc_maximum_msat_arg); + GC.KeepAlive(tlvs_arg); + GC.KeepAlive(node_id_arg); + GC.KeepAlive(htlc_maximum_msat_arg); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ForwardNode ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ForwardNode(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(tlvs_arg); }; + return ret_hu_conv; + } + + internal long clone_ptr() { + long ret = bindings.ForwardNode_clone_ptr(this.ptr); + GC.KeepAlive(this); + return ret; + } + + /** + * Creates a copy of the ForwardNode + */ + public ForwardNode clone() { + long ret = bindings.ForwardNode_clone(this.ptr); + GC.KeepAlive(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ForwardNode ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ForwardNode(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); }; + return ret_hu_conv; + } + +} +} } }