Merge pull request #110 from TheBlueMatt/main
[ldk-java] / ts / structs / NetAddress.mts
index 46ad000a00995a748328d09cc9d8a69a1c482f32..3b61cb17f2a4e9a01dc82eb3a60c224c6405f8e6 100644 (file)
@@ -67,6 +67,9 @@ import { Result_PaymentPurposeDecodeErrorZ } from '../structs/Result_PaymentPurp
 import { ClosureReason } from '../structs/ClosureReason.mjs';
 import { Option_ClosureReasonZ } from '../structs/Option_ClosureReasonZ.mjs';
 import { Result_COption_ClosureReasonZDecodeErrorZ } from '../structs/Result_COption_ClosureReasonZDecodeErrorZ.mjs';
+import { HTLCDestination } from '../structs/HTLCDestination.mjs';
+import { Option_HTLCDestinationZ } from '../structs/Option_HTLCDestinationZ.mjs';
+import { Result_COption_HTLCDestinationZDecodeErrorZ } from '../structs/Result_COption_HTLCDestinationZDecodeErrorZ.mjs';
 import { ChannelUpdate } from '../structs/ChannelUpdate.mjs';
 import { NetworkUpdate } from '../structs/NetworkUpdate.mjs';
 import { Option_NetworkUpdateZ } from '../structs/Option_NetworkUpdateZ.mjs';
@@ -104,10 +107,13 @@ import { TwoTuple_usizeTransactionZ } from '../structs/TwoTuple_usizeTransaction
 import { Result_NoneChannelMonitorUpdateErrZ } from '../structs/Result_NoneChannelMonitorUpdateErrZ.mjs';
 import { HTLCUpdate } from '../structs/HTLCUpdate.mjs';
 import { MonitorEvent } from '../structs/MonitorEvent.mjs';
-import { TwoTuple_OutPointCVec_MonitorEventZZ } from '../structs/TwoTuple_OutPointCVec_MonitorEventZZ.mjs';
+import { ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ } from '../structs/ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ.mjs';
 import { Option_C2Tuple_usizeTransactionZZ } from '../structs/Option_C2Tuple_usizeTransactionZZ.mjs';
 import { FixedPenaltyScorer } from '../structs/FixedPenaltyScorer.mjs';
 import { Result_FixedPenaltyScorerDecodeErrorZ } from '../structs/Result_FixedPenaltyScorerDecodeErrorZ.mjs';
+import { TwoTuple_u64u64Z } from '../structs/TwoTuple_u64u64Z.mjs';
+import { Option_C2Tuple_u64u64ZZ } from '../structs/Option_C2Tuple_u64u64ZZ.mjs';
+import { NodeId } from '../structs/NodeId.mjs';
 import { Record } from '../structs/Record.mjs';
 import { Logger, LoggerInterface } from '../structs/Logger.mjs';
 import { NetworkGraph } from '../structs/NetworkGraph.mjs';
@@ -122,7 +128,6 @@ import { Result_NodeFeaturesDecodeErrorZ } from '../structs/Result_NodeFeaturesD
 import { InvoiceFeatures } from '../structs/InvoiceFeatures.mjs';
 import { Result_InvoiceFeaturesDecodeErrorZ } from '../structs/Result_InvoiceFeaturesDecodeErrorZ.mjs';
 import { Result_ChannelTypeFeaturesDecodeErrorZ } from '../structs/Result_ChannelTypeFeaturesDecodeErrorZ.mjs';
-import { NodeId } from '../structs/NodeId.mjs';
 import { Result_NodeIdDecodeErrorZ } from '../structs/Result_NodeIdDecodeErrorZ.mjs';
 import { Result_COption_NetworkUpdateZDecodeErrorZ } from '../structs/Result_COption_NetworkUpdateZDecodeErrorZ.mjs';
 import { Access, AccessInterface } from '../structs/Access.mjs';
@@ -136,8 +141,11 @@ import { ChannelInfo } from '../structs/ChannelInfo.mjs';
 import { Result_ChannelInfoDecodeErrorZ } from '../structs/Result_ChannelInfoDecodeErrorZ.mjs';
 import { RoutingFees } from '../structs/RoutingFees.mjs';
 import { Result_RoutingFeesDecodeErrorZ } from '../structs/Result_RoutingFeesDecodeErrorZ.mjs';
+import { Hostname } from '../structs/Hostname.mjs';
 import { NodeAnnouncementInfo } from '../structs/NodeAnnouncementInfo.mjs';
 import { Result_NodeAnnouncementInfoDecodeErrorZ } from '../structs/Result_NodeAnnouncementInfoDecodeErrorZ.mjs';
+import { NodeAlias } from '../structs/NodeAlias.mjs';
+import { Result_NodeAliasDecodeErrorZ } from '../structs/Result_NodeAliasDecodeErrorZ.mjs';
 import { NodeInfo } from '../structs/NodeInfo.mjs';
 import { Result_NodeInfoDecodeErrorZ } from '../structs/Result_NodeInfoDecodeErrorZ.mjs';
 import { Result_NetworkGraphDecodeErrorZ } from '../structs/Result_NetworkGraphDecodeErrorZ.mjs';
@@ -360,6 +368,7 @@ export class NetAddress extends CommonBase {
                        case 1: return new NetAddress_IPv6(ptr);
                        case 2: return new NetAddress_OnionV2(ptr);
                        case 3: return new NetAddress_OnionV3(ptr);
+                       case 4: return new NetAddress_Hostname(ptr);
                        default:
                                throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
                }
@@ -420,6 +429,16 @@ export class NetAddress extends CommonBase {
                return ret_hu_conv;
        }
 
+       /**
+        * Utility method to constructs a new Hostname-variant NetAddress
+        */
+       public static constructor_hostname(hostname: Hostname, port: number): NetAddress {
+               const ret: number = bindings.NetAddress_hostname(hostname == null ? 0 : CommonBase.get_ptr_of(hostname) & ~1, port);
+               const ret_hu_conv: NetAddress = NetAddress.constr_from_ptr(ret);
+               CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
+               return ret_hu_conv;
+       }
+
        /**
         * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
         */
@@ -517,3 +536,23 @@ export class NetAddress_OnionV3 extends NetAddress {
                this.port = bindings.LDKNetAddress_OnionV3_get_port(ptr);
        }
 }
+/** A NetAddress of type Hostname */
+export class NetAddress_Hostname extends NetAddress {
+       /**
+        * The hostname on which the node is listening.
+        */
+       public hostname: Hostname;
+       /**
+        * The port on which the node is listening.
+        */
+       public port: number;
+       /* @internal */
+       public constructor(ptr: number) {
+               super(null, ptr);
+               const hostname: number = bindings.LDKNetAddress_Hostname_get_hostname(ptr);
+               const hostname_hu_conv: Hostname = new Hostname(null, hostname);
+                       CommonBase.add_ref_from(hostname_hu_conv, this);
+               this.hostname = hostname_hu_conv;
+               this.port = bindings.LDKNetAddress_Hostname_get_port(ptr);
+       }
+}