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';
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';
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';
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';
* An address which can be used to connect to a remote peer
*/
export class NetAddress extends CommonBase {
- protected constructor(_dummy: object, ptr: number) { super(ptr, bindings.NetAddress_free); }
+ protected constructor(_dummy: object, ptr: bigint) { super(ptr, bindings.NetAddress_free); }
/* @internal */
- public static constr_from_ptr(ptr: number): NetAddress {
+ public static constr_from_ptr(ptr: bigint): NetAddress {
const raw_ty: number = bindings.LDKNetAddress_ty_from_ptr(ptr);
switch (raw_ty) {
case 0: return new NetAddress_IPv4(ptr);
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
}
}
- public clone_ptr(): number {
- const ret: number = bindings.NetAddress_clone_ptr(this.ptr);
+ public clone_ptr(): bigint {
+ const ret: bigint = bindings.NetAddress_clone_ptr(this.ptr);
return ret;
}
* Creates a copy of the NetAddress
*/
public clone(): NetAddress {
- const ret: number = bindings.NetAddress_clone(this.ptr);
+ const ret: bigint = bindings.NetAddress_clone(this.ptr);
const ret_hu_conv: NetAddress = NetAddress.constr_from_ptr(ret);
CommonBase.add_ref_from(ret_hu_conv, this);
return ret_hu_conv;
* Utility method to constructs a new IPv4-variant NetAddress
*/
public static constructor_ipv4(addr: Uint8Array, port: number): NetAddress {
- const ret: number = bindings.NetAddress_ipv4(bindings.encodeUint8Array(bindings.check_arr_len(addr, 4)), port);
+ const ret: bigint = bindings.NetAddress_ipv4(bindings.encodeUint8Array(bindings.check_arr_len(addr, 4)), 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;
* Utility method to constructs a new IPv6-variant NetAddress
*/
public static constructor_ipv6(addr: Uint8Array, port: number): NetAddress {
- const ret: number = bindings.NetAddress_ipv6(bindings.encodeUint8Array(bindings.check_arr_len(addr, 16)), port);
+ const ret: bigint = bindings.NetAddress_ipv6(bindings.encodeUint8Array(bindings.check_arr_len(addr, 16)), 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;
* Utility method to constructs a new OnionV2-variant NetAddress
*/
public static constructor_onion_v2(a: Uint8Array): NetAddress {
- const ret: number = bindings.NetAddress_onion_v2(bindings.encodeUint8Array(bindings.check_arr_len(a, 12)));
+ const ret: bigint = bindings.NetAddress_onion_v2(bindings.encodeUint8Array(bindings.check_arr_len(a, 12)));
const ret_hu_conv: NetAddress = NetAddress.constr_from_ptr(ret);
CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
return ret_hu_conv;
* Utility method to constructs a new OnionV3-variant NetAddress
*/
public static constructor_onion_v3(ed25519_pubkey: Uint8Array, checksum: number, version: number, port: number): NetAddress {
- const ret: number = bindings.NetAddress_onion_v3(bindings.encodeUint8Array(bindings.check_arr_len(ed25519_pubkey, 32)), checksum, version, port);
+ const ret: bigint = bindings.NetAddress_onion_v3(bindings.encodeUint8Array(bindings.check_arr_len(ed25519_pubkey, 32)), checksum, version, 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;
+ }
+
+ /**
+ * Utility method to constructs a new Hostname-variant NetAddress
+ */
+ public static constructor_hostname(hostname: Hostname, port: number): NetAddress {
+ const ret: bigint = bindings.NetAddress_hostname(hostname == null ? 0n : CommonBase.get_ptr_of(hostname), port);
const ret_hu_conv: NetAddress = NetAddress.constr_from_ptr(ret);
CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
+ CommonBase.add_ref_from(ret_hu_conv, hostname);
return ret_hu_conv;
}
* Read a NetAddress from a byte array, created by NetAddress_write
*/
public static constructor_read(ser: Uint8Array): Result_NetAddressDecodeErrorZ {
- const ret: number = bindings.NetAddress_read(bindings.encodeUint8Array(ser));
+ const ret: bigint = bindings.NetAddress_read(bindings.encodeUint8Array(ser));
const ret_hu_conv: Result_NetAddressDecodeErrorZ = Result_NetAddressDecodeErrorZ.constr_from_ptr(ret);
return ret_hu_conv;
}
*/
public port: number;
/* @internal */
- public constructor(ptr: number) {
+ public constructor(ptr: bigint) {
super(null, ptr);
const addr: number = bindings.LDKNetAddress_IPv4_get_addr(ptr);
const addr_conv: Uint8Array = bindings.decodeUint8Array(addr);
*/
public port: number;
/* @internal */
- public constructor(ptr: number) {
+ public constructor(ptr: bigint) {
super(null, ptr);
const addr: number = bindings.LDKNetAddress_IPv6_get_addr(ptr);
const addr_conv: Uint8Array = bindings.decodeUint8Array(addr);
export class NetAddress_OnionV2 extends NetAddress {
public onion_v2: Uint8Array;
/* @internal */
- public constructor(ptr: number) {
+ public constructor(ptr: bigint) {
super(null, ptr);
const onion_v2: number = bindings.LDKNetAddress_OnionV2_get_onion_v2(ptr);
const onion_v2_conv: Uint8Array = bindings.decodeUint8Array(onion_v2);
*/
public port: number;
/* @internal */
- public constructor(ptr: number) {
+ public constructor(ptr: bigint) {
super(null, ptr);
const ed25519_pubkey: number = bindings.LDKNetAddress_OnionV3_get_ed25519_pubkey(ptr);
const ed25519_pubkey_conv: Uint8Array = bindings.decodeUint8Array(ed25519_pubkey);
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: bigint) {
+ super(null, ptr);
+ const hostname: bigint = 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);
+ }
+}