X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fstructs%2FNodeInfo.mts;h=e02aa018297b511b8f6d588bd5c8e54f0ca7d3cb;hb=f6d7282fcf6324519ea1fe4b584c8d02c95acd9e;hp=f5873b71296ef9536afd3db7c6ceeb71982ab422;hpb=293bcee787de3eb181b82175a1784a4ef311e012;p=ldk-java diff --git a/ts/structs/NodeInfo.mts b/ts/structs/NodeInfo.mts index f5873b71..e02aa018 100644 --- a/ts/structs/NodeInfo.mts +++ b/ts/structs/NodeInfo.mts @@ -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,7 +107,7 @@ 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'; @@ -138,6 +141,7 @@ 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 { NetAddress } from '../structs/NetAddress.mjs'; import { NodeAnnouncementInfo } from '../structs/NodeAnnouncementInfo.mjs'; import { Result_NodeAnnouncementInfoDecodeErrorZ } from '../structs/Result_NodeAnnouncementInfoDecodeErrorZ.mjs'; @@ -357,10 +361,21 @@ import * as bindings from '../bindings.mjs' */ export class NodeInfo extends CommonBase { /* @internal */ - public constructor(_dummy: object, ptr: number) { + public constructor(_dummy: object, ptr: bigint) { super(ptr, bindings.NodeInfo_free); } + /** + * All valid channels a node has announced + * + * Returns a copy of the field. + */ + public get_channels(): bigint[] { + const ret: number = bindings.NodeInfo_get_channels(this.ptr); + const ret_conv: bigint[] = bindings.decodeUint64Array(ret); + return ret_conv; + } + /** * All valid channels a node has announced */ @@ -376,7 +391,7 @@ export class NodeInfo extends CommonBase { * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ public get_lowest_inbound_channel_fees(): RoutingFees { - const ret: number = bindings.NodeInfo_get_lowest_inbound_channel_fees(this.ptr); + const ret: bigint = bindings.NodeInfo_get_lowest_inbound_channel_fees(this.ptr); const ret_hu_conv: RoutingFees = new RoutingFees(null, ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; @@ -390,7 +405,8 @@ export class NodeInfo extends CommonBase { * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ public set_lowest_inbound_channel_fees(val: RoutingFees): void { - bindings.NodeInfo_set_lowest_inbound_channel_fees(this.ptr, val == null ? 0 : CommonBase.get_ptr_of(val) & ~1); + bindings.NodeInfo_set_lowest_inbound_channel_fees(this.ptr, val == null ? 0n : CommonBase.get_ptr_of(val)); + CommonBase.add_ref_from(this, val); } /** @@ -401,7 +417,7 @@ export class NodeInfo extends CommonBase { * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ public get_announcement_info(): NodeAnnouncementInfo { - const ret: number = bindings.NodeInfo_get_announcement_info(this.ptr); + const ret: bigint = bindings.NodeInfo_get_announcement_info(this.ptr); const ret_hu_conv: NodeAnnouncementInfo = new NodeAnnouncementInfo(null, ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; @@ -415,21 +431,24 @@ export class NodeInfo extends CommonBase { * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ public set_announcement_info(val: NodeAnnouncementInfo): void { - bindings.NodeInfo_set_announcement_info(this.ptr, val == null ? 0 : CommonBase.get_ptr_of(val) & ~1); + bindings.NodeInfo_set_announcement_info(this.ptr, val == null ? 0n : CommonBase.get_ptr_of(val)); + CommonBase.add_ref_from(this, val); } /** * Constructs a new NodeInfo given each field */ public static constructor_new(channels_arg: bigint[], lowest_inbound_channel_fees_arg: RoutingFees, announcement_info_arg: NodeAnnouncementInfo): NodeInfo { - const ret: number = bindings.NodeInfo_new(bindings.encodeUint64Array(channels_arg), lowest_inbound_channel_fees_arg == null ? 0 : CommonBase.get_ptr_of(lowest_inbound_channel_fees_arg) & ~1, announcement_info_arg == null ? 0 : CommonBase.get_ptr_of(announcement_info_arg) & ~1); + const ret: bigint = bindings.NodeInfo_new(bindings.encodeUint64Array(channels_arg), lowest_inbound_channel_fees_arg == null ? 0n : CommonBase.get_ptr_of(lowest_inbound_channel_fees_arg), announcement_info_arg == null ? 0n : CommonBase.get_ptr_of(announcement_info_arg)); const ret_hu_conv: NodeInfo = new NodeInfo(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); + CommonBase.add_ref_from(ret_hu_conv, lowest_inbound_channel_fees_arg); + CommonBase.add_ref_from(ret_hu_conv, announcement_info_arg); return ret_hu_conv; } - public clone_ptr(): number { - const ret: number = bindings.NodeInfo_clone_ptr(this.ptr); + public clone_ptr(): bigint { + const ret: bigint = bindings.NodeInfo_clone_ptr(this.ptr); return ret; } @@ -437,7 +456,7 @@ export class NodeInfo extends CommonBase { * Creates a copy of the NodeInfo */ public clone(): NodeInfo { - const ret: number = bindings.NodeInfo_clone(this.ptr); + const ret: bigint = bindings.NodeInfo_clone(this.ptr); const ret_hu_conv: NodeInfo = new NodeInfo(null, ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; @@ -456,7 +475,7 @@ export class NodeInfo extends CommonBase { * Read a NodeInfo from a byte array, created by NodeInfo_write */ public static constructor_read(ser: Uint8Array): Result_NodeInfoDecodeErrorZ { - const ret: number = bindings.NodeInfo_read(bindings.encodeUint8Array(ser)); + const ret: bigint = bindings.NodeInfo_read(bindings.encodeUint8Array(ser)); const ret_hu_conv: Result_NodeInfoDecodeErrorZ = Result_NodeInfoDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; }