X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fstructs%2FChannelManager.mts;fp=ts%2Fstructs%2FChannelManager.mts;h=fffe30efc9b434405685fa8e3e89a4f9678a48de;hb=1a1849cb9b6e08f4ca8ba2ec4adea1f063bf248d;hp=7d3b1bce65a2b8e9cda7debca9fa88507803e291;hpb=0b07fe133fc9956d0ce1b96ebdb927252858ddc4;p=ldk-java diff --git a/ts/structs/ChannelManager.mts b/ts/structs/ChannelManager.mts index 7d3b1bce..fffe30ef 100644 --- a/ts/structs/ChannelManager.mts +++ b/ts/structs/ChannelManager.mts @@ -10,6 +10,7 @@ import { HTLCClaim } from '../enums/HTLCClaim.mjs'; import { IOError } from '../enums/IOError.mjs'; import { Level } from '../enums/Level.mjs'; import { Network } from '../enums/Network.mjs'; +import { PaymentFailureReason } from '../enums/PaymentFailureReason.mjs'; import { Recipient } from '../enums/Recipient.mjs'; import { RetryableSendFailure } from '../enums/RetryableSendFailure.mjs'; import { Secp256k1Error } from '../enums/Secp256k1Error.mjs'; @@ -17,13 +18,19 @@ import { SemanticError } from '../enums/SemanticError.mjs'; import { SiPrefix } from '../enums/SiPrefix.mjs'; import { UtxoLookupError } from '../enums/UtxoLookupError.mjs'; import { Bech32Error } from '../structs/Bech32Error.mjs'; +import { Option_DurationZ } from '../structs/Option_DurationZ.mjs'; +import { BlindedPath } from '../structs/BlindedPath.mjs'; +import { Option_u64Z } from '../structs/Option_u64Z.mjs'; import { ShutdownScript } from '../structs/ShutdownScript.mjs'; import { APIError } from '../structs/APIError.mjs'; import { Result_NoneAPIErrorZ } from '../structs/Result_NoneAPIErrorZ.mjs'; +import { Option_CVec_u8ZZ } from '../structs/Option_CVec_u8ZZ.mjs'; +import { RecipientOnionFields } from '../structs/RecipientOnionFields.mjs'; +import { DecodeError } from '../structs/DecodeError.mjs'; +import { Result_RecipientOnionFieldsDecodeErrorZ } from '../structs/Result_RecipientOnionFieldsDecodeErrorZ.mjs'; import { Option_HTLCClaimZ } from '../structs/Option_HTLCClaimZ.mjs'; import { Result_NoneNoneZ } from '../structs/Result_NoneNoneZ.mjs'; import { CounterpartyCommitmentSecrets } from '../structs/CounterpartyCommitmentSecrets.mjs'; -import { DecodeError } from '../structs/DecodeError.mjs'; import { Result_CounterpartyCommitmentSecretsDecodeErrorZ } from '../structs/Result_CounterpartyCommitmentSecretsDecodeErrorZ.mjs'; import { TxCreationKeys } from '../structs/TxCreationKeys.mjs'; import { Result_TxCreationKeysDecodeErrorZ } from '../structs/Result_TxCreationKeysDecodeErrorZ.mjs'; @@ -50,29 +57,61 @@ import { Result_CVec_SignatureZNoneZ } from '../structs/Result_CVec_SignatureZNo import { Result_ShutdownScriptDecodeErrorZ } from '../structs/Result_ShutdownScriptDecodeErrorZ.mjs'; import { InvalidShutdownScript } from '../structs/InvalidShutdownScript.mjs'; import { Result_ShutdownScriptInvalidShutdownScriptZ } from '../structs/Result_ShutdownScriptInvalidShutdownScriptZ.mjs'; -import { BlindedPath } from '../structs/BlindedPath.mjs'; -import { Result_BlindedPathNoneZ } from '../structs/Result_BlindedPathNoneZ.mjs'; -import { Result_BlindedPathDecodeErrorZ } from '../structs/Result_BlindedPathDecodeErrorZ.mjs'; -import { BlindedHop } from '../structs/BlindedHop.mjs'; -import { Result_BlindedHopDecodeErrorZ } from '../structs/Result_BlindedHopDecodeErrorZ.mjs'; +import { BlindedPayInfo } from '../structs/BlindedPayInfo.mjs'; +import { Result_BlindedPayInfoDecodeErrorZ } from '../structs/Result_BlindedPayInfoDecodeErrorZ.mjs'; import { ChannelDetails } from '../structs/ChannelDetails.mjs'; import { Route } from '../structs/Route.mjs'; import { LightningError } from '../structs/LightningError.mjs'; import { Result_RouteLightningErrorZ } from '../structs/Result_RouteLightningErrorZ.mjs'; -import { RouteHop } from '../structs/RouteHop.mjs'; -import { Option_u64Z } from '../structs/Option_u64Z.mjs'; import { InFlightHtlcs } from '../structs/InFlightHtlcs.mjs'; import { Result_InFlightHtlcsDecodeErrorZ } from '../structs/Result_InFlightHtlcsDecodeErrorZ.mjs'; +import { RouteHop } from '../structs/RouteHop.mjs'; import { Result_RouteHopDecodeErrorZ } from '../structs/Result_RouteHopDecodeErrorZ.mjs'; +import { BlindedHop } from '../structs/BlindedHop.mjs'; +import { BlindedTail } from '../structs/BlindedTail.mjs'; +import { Result_BlindedTailDecodeErrorZ } from '../structs/Result_BlindedTailDecodeErrorZ.mjs'; +import { Path } from '../structs/Path.mjs'; import { Result_RouteDecodeErrorZ } from '../structs/Result_RouteDecodeErrorZ.mjs'; import { RouteParameters } from '../structs/RouteParameters.mjs'; import { Result_RouteParametersDecodeErrorZ } from '../structs/Result_RouteParametersDecodeErrorZ.mjs'; -import { RouteHint } from '../structs/RouteHint.mjs'; import { PaymentParameters } from '../structs/PaymentParameters.mjs'; import { Result_PaymentParametersDecodeErrorZ } from '../structs/Result_PaymentParametersDecodeErrorZ.mjs'; +import { TwoTuple_BlindedPayInfoBlindedPathZ } from '../structs/TwoTuple_BlindedPayInfoBlindedPathZ.mjs'; +import { RouteHint } from '../structs/RouteHint.mjs'; import { RouteHintHop } from '../structs/RouteHintHop.mjs'; import { Result_RouteHintDecodeErrorZ } from '../structs/Result_RouteHintDecodeErrorZ.mjs'; import { Result_RouteHintHopDecodeErrorZ } from '../structs/Result_RouteHintHopDecodeErrorZ.mjs'; +import { TwoTuple_usizeTransactionZ } from '../structs/TwoTuple_usizeTransactionZ.mjs'; +import { TwoTuple_TxidBlockHashZ } from '../structs/TwoTuple_TxidBlockHashZ.mjs'; +import { HTLCUpdate } from '../structs/HTLCUpdate.mjs'; +import { OutPoint } from '../structs/OutPoint.mjs'; +import { MonitorEvent } from '../structs/MonitorEvent.mjs'; +import { ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ } from '../structs/ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ.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 { TwoTuple_Z } from '../structs/TwoTuple_Z.mjs'; +import { TwoTuple__u168_u168Z } from '../structs/TwoTuple__u168_u168Z.mjs'; +import { Option_C2Tuple_EightU16sEightU16sZZ } from '../structs/Option_C2Tuple_EightU16sEightU16sZZ.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 { ProbabilisticScorer } from '../structs/ProbabilisticScorer.mjs'; +import { Result_ProbabilisticScorerDecodeErrorZ } from '../structs/Result_ProbabilisticScorerDecodeErrorZ.mjs'; +import { InitFeatures } from '../structs/InitFeatures.mjs'; +import { Result_InitFeaturesDecodeErrorZ } from '../structs/Result_InitFeaturesDecodeErrorZ.mjs'; +import { ChannelFeatures } from '../structs/ChannelFeatures.mjs'; +import { Result_ChannelFeaturesDecodeErrorZ } from '../structs/Result_ChannelFeaturesDecodeErrorZ.mjs'; +import { NodeFeatures } from '../structs/NodeFeatures.mjs'; +import { Result_NodeFeaturesDecodeErrorZ } from '../structs/Result_NodeFeaturesDecodeErrorZ.mjs'; +import { InvoiceFeatures } from '../structs/InvoiceFeatures.mjs'; +import { Result_InvoiceFeaturesDecodeErrorZ } from '../structs/Result_InvoiceFeaturesDecodeErrorZ.mjs'; +import { BlindedHopFeatures } from '../structs/BlindedHopFeatures.mjs'; +import { Result_BlindedHopFeaturesDecodeErrorZ } from '../structs/Result_BlindedHopFeaturesDecodeErrorZ.mjs'; +import { ChannelTypeFeatures } from '../structs/ChannelTypeFeatures.mjs'; +import { Result_ChannelTypeFeaturesDecodeErrorZ } from '../structs/Result_ChannelTypeFeaturesDecodeErrorZ.mjs'; import { PaymentPurpose } from '../structs/PaymentPurpose.mjs'; import { Result_PaymentPurposeDecodeErrorZ } from '../structs/Result_PaymentPurposeDecodeErrorZ.mjs'; import { ChannelUpdate } from '../structs/ChannelUpdate.mjs'; @@ -81,18 +120,19 @@ import { Option_NetworkUpdateZ } from '../structs/Option_NetworkUpdateZ.mjs'; import { PathFailure } from '../structs/PathFailure.mjs'; import { Option_PathFailureZ } from '../structs/Option_PathFailureZ.mjs'; import { Result_COption_PathFailureZDecodeErrorZ } from '../structs/Result_COption_PathFailureZDecodeErrorZ.mjs'; +import { UntrustedString } from '../structs/UntrustedString.mjs'; 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 { Result_PaymentFailureReasonDecodeErrorZ } from '../structs/Result_PaymentFailureReasonDecodeErrorZ.mjs'; import { Option_u128Z } from '../structs/Option_u128Z.mjs'; -import { OutPoint } from '../structs/OutPoint.mjs'; +import { Option_PaymentFailureReasonZ } from '../structs/Option_PaymentFailureReasonZ.mjs'; import { DelayedPaymentOutputDescriptor } from '../structs/DelayedPaymentOutputDescriptor.mjs'; import { StaticPaymentOutputDescriptor } from '../structs/StaticPaymentOutputDescriptor.mjs'; import { SpendableOutputDescriptor } from '../structs/SpendableOutputDescriptor.mjs'; -import { ChannelTypeFeatures } from '../structs/ChannelTypeFeatures.mjs'; import { Event } from '../structs/Event.mjs'; import { Option_EventZ } from '../structs/Option_EventZ.mjs'; import { Result_COption_EventZDecodeErrorZ } from '../structs/Result_COption_EventZDecodeErrorZ.mjs'; @@ -117,35 +157,7 @@ import { QueryShortChannelIds } from '../structs/QueryShortChannelIds.mjs'; import { ReplyChannelRange } from '../structs/ReplyChannelRange.mjs'; import { GossipTimestampFilter } from '../structs/GossipTimestampFilter.mjs'; import { MessageSendEvent } from '../structs/MessageSendEvent.mjs'; -import { TwoTuple_usizeTransactionZ } from '../structs/TwoTuple_usizeTransactionZ.mjs'; -import { TwoTuple_TxidBlockHashZ } from '../structs/TwoTuple_TxidBlockHashZ.mjs'; -import { HTLCUpdate } from '../structs/HTLCUpdate.mjs'; -import { MonitorEvent } from '../structs/MonitorEvent.mjs'; -import { ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ } from '../structs/ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ.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 { TwoTuple_Z } from '../structs/TwoTuple_Z.mjs'; -import { TwoTuple__u168_u168Z } from '../structs/TwoTuple__u168_u168Z.mjs'; -import { Option_C2Tuple_EightU16sEightU16sZZ } from '../structs/Option_C2Tuple_EightU16sEightU16sZZ.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 { ProbabilisticScorer } from '../structs/ProbabilisticScorer.mjs'; -import { Result_ProbabilisticScorerDecodeErrorZ } from '../structs/Result_ProbabilisticScorerDecodeErrorZ.mjs'; -import { InitFeatures } from '../structs/InitFeatures.mjs'; -import { Result_InitFeaturesDecodeErrorZ } from '../structs/Result_InitFeaturesDecodeErrorZ.mjs'; -import { ChannelFeatures } from '../structs/ChannelFeatures.mjs'; -import { Result_ChannelFeaturesDecodeErrorZ } from '../structs/Result_ChannelFeaturesDecodeErrorZ.mjs'; -import { NodeFeatures } from '../structs/NodeFeatures.mjs'; -import { Result_NodeFeaturesDecodeErrorZ } from '../structs/Result_NodeFeaturesDecodeErrorZ.mjs'; -import { InvoiceFeatures } from '../structs/InvoiceFeatures.mjs'; -import { Result_InvoiceFeaturesDecodeErrorZ } from '../structs/Result_InvoiceFeaturesDecodeErrorZ.mjs'; -import { BlindedHopFeatures } from '../structs/BlindedHopFeatures.mjs'; -import { Result_BlindedHopFeaturesDecodeErrorZ } from '../structs/Result_BlindedHopFeaturesDecodeErrorZ.mjs'; -import { Result_ChannelTypeFeaturesDecodeErrorZ } from '../structs/Result_ChannelTypeFeaturesDecodeErrorZ.mjs'; +import { Result_PublicKeyErrorZ } from '../structs/Result_PublicKeyErrorZ.mjs'; import { Result_NodeIdDecodeErrorZ } from '../structs/Result_NodeIdDecodeErrorZ.mjs'; import { Result_COption_NetworkUpdateZDecodeErrorZ } from '../structs/Result_COption_NetworkUpdateZDecodeErrorZ.mjs'; import { Result_TxOutUtxoLookupErrorZ } from '../structs/Result_TxOutUtxoLookupErrorZ.mjs'; @@ -234,6 +246,7 @@ import { ChannelConfig } from '../structs/ChannelConfig.mjs'; import { Result_ChannelConfigDecodeErrorZ } from '../structs/Result_ChannelConfigDecodeErrorZ.mjs'; import { Option_APIErrorZ } from '../structs/Option_APIErrorZ.mjs'; import { Result_COption_APIErrorZDecodeErrorZ } from '../structs/Result_COption_APIErrorZDecodeErrorZ.mjs'; +import { Result_UntrustedStringDecodeErrorZ } from '../structs/Result_UntrustedStringDecodeErrorZ.mjs'; import { Result_OutPointDecodeErrorZ } from '../structs/Result_OutPointDecodeErrorZ.mjs'; import { Type, TypeInterface } from '../structs/Type.mjs'; import { Option_TypeZ } from '../structs/Option_TypeZ.mjs'; @@ -242,7 +255,6 @@ import { PaymentError } from '../structs/PaymentError.mjs'; import { Result_PaymentIdPaymentErrorZ } from '../structs/Result_PaymentIdPaymentErrorZ.mjs'; import { Result_NonePaymentErrorZ } from '../structs/Result_NonePaymentErrorZ.mjs'; import { Result_StringErrorZ } from '../structs/Result_StringErrorZ.mjs'; -import { Result_PublicKeyErrorZ } from '../structs/Result_PublicKeyErrorZ.mjs'; import { Result_ChannelMonitorUpdateDecodeErrorZ } from '../structs/Result_ChannelMonitorUpdateDecodeErrorZ.mjs'; import { Option_MonitorEventZ } from '../structs/Option_MonitorEventZ.mjs'; import { Result_COption_MonitorEventZDecodeErrorZ } from '../structs/Result_COption_MonitorEventZDecodeErrorZ.mjs'; @@ -267,28 +279,11 @@ import { Result_NonePeerHandleErrorZ } from '../structs/Result_NonePeerHandleErr import { Result_boolPeerHandleErrorZ } from '../structs/Result_boolPeerHandleErrorZ.mjs'; import { SendError } from '../structs/SendError.mjs'; import { Result_NoneSendErrorZ } from '../structs/Result_NoneSendErrorZ.mjs'; +import { Result_BlindedPathNoneZ } from '../structs/Result_BlindedPathNoneZ.mjs'; +import { Result_BlindedPathDecodeErrorZ } from '../structs/Result_BlindedPathDecodeErrorZ.mjs'; +import { Result_BlindedHopDecodeErrorZ } from '../structs/Result_BlindedHopDecodeErrorZ.mjs'; import { GraphSyncError } from '../structs/GraphSyncError.mjs'; import { Result_u32GraphSyncErrorZ } from '../structs/Result_u32GraphSyncErrorZ.mjs'; -import { ParseError } from '../structs/ParseError.mjs'; -import { Result_SiPrefixParseErrorZ } from '../structs/Result_SiPrefixParseErrorZ.mjs'; -import { Invoice } from '../structs/Invoice.mjs'; -import { ParseOrSemanticError } from '../structs/ParseOrSemanticError.mjs'; -import { Result_InvoiceParseOrSemanticErrorZ } from '../structs/Result_InvoiceParseOrSemanticErrorZ.mjs'; -import { SignedRawInvoice } from '../structs/SignedRawInvoice.mjs'; -import { Result_SignedRawInvoiceParseErrorZ } from '../structs/Result_SignedRawInvoiceParseErrorZ.mjs'; -import { RawInvoice } from '../structs/RawInvoice.mjs'; -import { InvoiceSignature } from '../structs/InvoiceSignature.mjs'; -import { ThreeTuple_RawInvoice_u832InvoiceSignatureZ } from '../structs/ThreeTuple_RawInvoice_u832InvoiceSignatureZ.mjs'; -import { PayeePubKey } from '../structs/PayeePubKey.mjs'; -import { Result_PayeePubKeyErrorZ } from '../structs/Result_PayeePubKeyErrorZ.mjs'; -import { PrivateRoute } from '../structs/PrivateRoute.mjs'; -import { PositiveTimestamp } from '../structs/PositiveTimestamp.mjs'; -import { Result_PositiveTimestampCreationErrorZ } from '../structs/Result_PositiveTimestampCreationErrorZ.mjs'; -import { Result_NoneSemanticErrorZ } from '../structs/Result_NoneSemanticErrorZ.mjs'; -import { Result_InvoiceSemanticErrorZ } from '../structs/Result_InvoiceSemanticErrorZ.mjs'; -import { Description } from '../structs/Description.mjs'; -import { Result_DescriptionCreationErrorZ } from '../structs/Result_DescriptionCreationErrorZ.mjs'; -import { Result_PrivateRouteCreationErrorZ } from '../structs/Result_PrivateRouteCreationErrorZ.mjs'; import { Result_NoneErrorZ } from '../structs/Result_NoneErrorZ.mjs'; import { Result_NetAddressDecodeErrorZ } from '../structs/Result_NetAddressDecodeErrorZ.mjs'; import { UpdateAddHTLC } from '../structs/UpdateAddHTLC.mjs'; @@ -337,8 +332,6 @@ import { Result_ReplyShortChannelIdsEndDecodeErrorZ } from '../structs/Result_Re import { Result_QueryChannelRangeDecodeErrorZ } from '../structs/Result_QueryChannelRangeDecodeErrorZ.mjs'; import { Result_ReplyChannelRangeDecodeErrorZ } from '../structs/Result_ReplyChannelRangeDecodeErrorZ.mjs'; import { Result_GossipTimestampFilterDecodeErrorZ } from '../structs/Result_GossipTimestampFilterDecodeErrorZ.mjs'; -import { SignOrCreationError } from '../structs/SignOrCreationError.mjs'; -import { Result_InvoiceSignOrCreationErrorZ } from '../structs/Result_InvoiceSignOrCreationErrorZ.mjs'; import { WatchedOutput } from '../structs/WatchedOutput.mjs'; import { Filter, FilterInterface } from '../structs/Filter.mjs'; import { Option_FilterZ } from '../structs/Option_FilterZ.mjs'; @@ -346,10 +339,28 @@ import { LockedChannelMonitor } from '../structs/LockedChannelMonitor.mjs'; import { Result_LockedChannelMonitorNoneZ } from '../structs/Result_LockedChannelMonitorNoneZ.mjs'; import { MonitorUpdateId } from '../structs/MonitorUpdateId.mjs'; import { TwoTuple_OutPointCVec_MonitorUpdateIdZZ } from '../structs/TwoTuple_OutPointCVec_MonitorUpdateIdZZ.mjs'; -import { MessageSendEventsProvider, MessageSendEventsProviderInterface } from '../structs/MessageSendEventsProvider.mjs'; -import { OnionMessageProvider, OnionMessageProviderInterface } from '../structs/OnionMessageProvider.mjs'; -import { EventHandler, EventHandlerInterface } from '../structs/EventHandler.mjs'; -import { EventsProvider, EventsProviderInterface } from '../structs/EventsProvider.mjs'; +import { Invoice } from '../structs/Invoice.mjs'; +import { SignOrCreationError } from '../structs/SignOrCreationError.mjs'; +import { Result_InvoiceSignOrCreationErrorZ } from '../structs/Result_InvoiceSignOrCreationErrorZ.mjs'; +import { ParseError } from '../structs/ParseError.mjs'; +import { Result_SiPrefixParseErrorZ } from '../structs/Result_SiPrefixParseErrorZ.mjs'; +import { ParseOrSemanticError } from '../structs/ParseOrSemanticError.mjs'; +import { Result_InvoiceParseOrSemanticErrorZ } from '../structs/Result_InvoiceParseOrSemanticErrorZ.mjs'; +import { SignedRawInvoice } from '../structs/SignedRawInvoice.mjs'; +import { Result_SignedRawInvoiceParseErrorZ } from '../structs/Result_SignedRawInvoiceParseErrorZ.mjs'; +import { RawInvoice } from '../structs/RawInvoice.mjs'; +import { InvoiceSignature } from '../structs/InvoiceSignature.mjs'; +import { ThreeTuple_RawInvoice_u832InvoiceSignatureZ } from '../structs/ThreeTuple_RawInvoice_u832InvoiceSignatureZ.mjs'; +import { PayeePubKey } from '../structs/PayeePubKey.mjs'; +import { Result_PayeePubKeyErrorZ } from '../structs/Result_PayeePubKeyErrorZ.mjs'; +import { PrivateRoute } from '../structs/PrivateRoute.mjs'; +import { PositiveTimestamp } from '../structs/PositiveTimestamp.mjs'; +import { Result_PositiveTimestampCreationErrorZ } from '../structs/Result_PositiveTimestampCreationErrorZ.mjs'; +import { Result_NoneSemanticErrorZ } from '../structs/Result_NoneSemanticErrorZ.mjs'; +import { Result_InvoiceSemanticErrorZ } from '../structs/Result_InvoiceSemanticErrorZ.mjs'; +import { Description } from '../structs/Description.mjs'; +import { Result_DescriptionCreationErrorZ } from '../structs/Result_DescriptionCreationErrorZ.mjs'; +import { Result_PrivateRouteCreationErrorZ } from '../structs/Result_PrivateRouteCreationErrorZ.mjs'; import { BigSize } from '../structs/BigSize.mjs'; import { ChannelUsage } from '../structs/ChannelUsage.mjs'; import { Score, ScoreInterface } from '../structs/Score.mjs'; @@ -367,15 +378,19 @@ import { Listen, ListenInterface } from '../structs/Listen.mjs'; import { Confirm, ConfirmInterface } from '../structs/Confirm.mjs'; import { Persist, PersistInterface } from '../structs/Persist.mjs'; import { ChainMonitor } from '../structs/ChainMonitor.mjs'; +import { EventHandler, EventHandlerInterface } from '../structs/EventHandler.mjs'; +import { EventsProvider, EventsProviderInterface } from '../structs/EventsProvider.mjs'; import { KeysManager } from '../structs/KeysManager.mjs'; import { PhantomKeysManager } from '../structs/PhantomKeysManager.mjs'; import { ChainParameters } from '../structs/ChainParameters.mjs'; import { Retry } from '../structs/Retry.mjs'; +import { MessageSendEventsProvider, MessageSendEventsProviderInterface } from '../structs/MessageSendEventsProvider.mjs'; import { ChannelMessageHandler, ChannelMessageHandlerInterface } from '../structs/ChannelMessageHandler.mjs'; import { ChannelManagerReadArgs } from '../structs/ChannelManagerReadArgs.mjs'; import { ExpandedKey } from '../structs/ExpandedKey.mjs'; import { DataLossProtect } from '../structs/DataLossProtect.mjs'; import { RoutingMessageHandler, RoutingMessageHandlerInterface } from '../structs/RoutingMessageHandler.mjs'; +import { OnionMessageProvider, OnionMessageProviderInterface } from '../structs/OnionMessageProvider.mjs'; import { OnionMessageHandler, OnionMessageHandlerInterface } from '../structs/OnionMessageHandler.mjs'; import { CustomMessageReader, CustomMessageReaderInterface } from '../structs/CustomMessageReader.mjs'; import { CustomMessageHandler, CustomMessageHandlerInterface } from '../structs/CustomMessageHandler.mjs'; @@ -389,12 +404,20 @@ import { DirectedChannelTransactionParameters } from '../structs/DirectedChannel import { OfferFeatures } from '../structs/OfferFeatures.mjs'; import { InvoiceRequestFeatures } from '../structs/InvoiceRequestFeatures.mjs'; import { Bolt12InvoiceFeatures } from '../structs/Bolt12InvoiceFeatures.mjs'; +import { UnsignedInvoice } from '../structs/UnsignedInvoice.mjs'; +import { UnsignedInvoiceRequest } from '../structs/UnsignedInvoiceRequest.mjs'; +import { InvoiceRequest } from '../structs/InvoiceRequest.mjs'; +import { Offer } from '../structs/Offer.mjs'; +import { Amount } from '../structs/Amount.mjs'; +import { Quantity } from '../structs/Quantity.mjs'; +import { Refund } from '../structs/Refund.mjs'; import { P2PGossipSync } from '../structs/P2PGossipSync.mjs'; import { ReadOnlyNetworkGraph } from '../structs/ReadOnlyNetworkGraph.mjs'; import { DirectedChannelInfo } from '../structs/DirectedChannelInfo.mjs'; import { EffectiveCapacity } from '../structs/EffectiveCapacity.mjs'; import { DefaultRouter } from '../structs/DefaultRouter.mjs'; import { ScorerAccountingForInFlightHtlcs } from '../structs/ScorerAccountingForInFlightHtlcs.mjs'; +import { Hints } from '../structs/Hints.mjs'; import { MultiThreadedLockableScore } from '../structs/MultiThreadedLockableScore.mjs'; import { MultiThreadedScoreLock } from '../structs/MultiThreadedScoreLock.mjs'; import { ProbabilisticScoringParameters } from '../structs/ProbabilisticScoringParameters.mjs'; @@ -417,35 +440,33 @@ import * as bindings from '../bindings.mjs' * Manager which keeps track of a number of channels and sends messages to the appropriate * channel, also tracking HTLC preimages and forwarding onion packets appropriately. * - * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through + * Implements [`ChannelMessageHandler`], handling the multi-channel parts and passing things through * to individual Channels. * - * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for + * Implements [`Writeable`] to write out all channel state to disk. Implies [`peer_disconnected`] for * all peers during write/read (though does not modify this instance, only the instance being - * serialized). This will result in any channels which have not yet exchanged funding_created (ie - * called funding_transaction_generated for outbound channels). + * serialized). This will result in any channels which have not yet exchanged [`funding_created`] (i.e., + * called [`funding_transaction_generated`] for outbound channels) being closed. * - * Note that you can be a bit lazier about writing out ChannelManager than you can be with - * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before - * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates - * happens out-of-band (and will prevent any other ChannelManager operations from occurring during + * Note that you can be a bit lazier about writing out `ChannelManager` than you can be with + * [`ChannelMonitor`]. With [`ChannelMonitor`] you MUST write each monitor update out to disk before + * returning from [`chain::Watch::watch_channel`]/[`update_channel`], with ChannelManagers, writing updates + * happens out-of-band (and will prevent any other `ChannelManager` operations from occurring during * the serialization process). If the deserialized version is out-of-date compared to the - * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the - * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees). + * [`ChannelMonitor`] passed by reference to [`read`], those channels will be force-closed based on the + * `ChannelMonitor` state and no funds will be lost (mod on-chain transaction fees). * - * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which - * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along - * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call - * block_connected() to step towards your best block) upon deserialization before using the - * object! + * Note that the deserializer is only implemented for `(`[`BlockHash`]`, `[`ChannelManager`]`)`, which + * tells you the last block hash which was connected. You should get the best block tip before using the manager. + * See [`chain::Listen`] and [`chain::Confirm`] for more details. * - * Note that ChannelManager is responsible for tracking liveness of its channels and generating - * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid + * Note that `ChannelManager` is responsible for tracking liveness of its channels and generating + * [`ChannelUpdate`] messages informing peers that the channel is temporarily disabled. To avoid * spam due to quick disconnection/reconnection, updates are not sent until the channel has been * offline for a full minute. In order to track this, you must call - * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect. + * [`timer_tick_occurred`] roughly once per minute, though it doesn't have to be perfect. * - * To avoid trivial DoS issues, ChannelManager limits the number of inbound connections and + * To avoid trivial DoS issues, `ChannelManager` limits the number of inbound connections and * inbound channels without confirmed funding transactions. This may result in nodes which we do * not have a channel with being unable to connect to us or open new channels with us if we have * many peers with unfunded channels. @@ -454,11 +475,20 @@ import * as bindings from '../bindings.mjs' * exempted from the count of unfunded channels. Similarly, outbound channels and connections are * never limited. Please ensure you limit the count of such channels yourself. * - * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager - * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but - * essentially you should default to using a SimpleRefChannelManager, and use a - * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when + * Rather than using a plain `ChannelManager`, it is preferable to use either a [`SimpleArcChannelManager`] + * a [`SimpleRefChannelManager`], for conciseness. See their documentation for more details, but + * essentially you should default to using a [`SimpleRefChannelManager`], and use a + * [`SimpleArcChannelManager`] when you require a `ChannelManager` with a static lifetime, such as when * you're using lightning-net-tokio. + * + * [`peer_disconnected`]: msgs::ChannelMessageHandler::peer_disconnected + * [`funding_created`]: msgs::FundingCreated + * [`funding_transaction_generated`]: Self::funding_transaction_generated + * [`BlockHash`]: bitcoin::hash_types::BlockHash + * [`update_channel`]: chain::Watch::update_channel + * [`ChannelUpdate`]: msgs::ChannelUpdate + * [`timer_tick_occurred`]: Self::timer_tick_occurred + * [`read`]: ReadableArgs::read */ export class ChannelManager extends CommonBase { /* @internal */ @@ -467,16 +497,21 @@ export class ChannelManager extends CommonBase { } /** - * Constructs a new ChannelManager to hold several channels and route between them. + * Constructs a new `ChannelManager` to hold several channels and route between them. * * This is the main \"logic hub\" for all channel-related actions, and implements - * ChannelMessageHandler. + * [`ChannelMessageHandler`]. * * Non-proportional fees are fixed according to our risk using the provided fee estimator. * - * Users need to notify the new ChannelManager when a new block is connected or - * disconnected using its `block_connected` and `block_disconnected` methods, starting - * from after `params.latest_hash`. + * Users need to notify the new `ChannelManager` when a new block is connected or + * disconnected using its [`block_connected`] and [`block_disconnected`] methods, starting + * from after [`params.best_block.block_hash`]. See [`chain::Listen`] and [`chain::Confirm`] for + * more details. + * + * [`block_connected`]: chain::Listen::block_connected + * [`block_disconnected`]: chain::Listen::block_disconnected + * [`params.best_block.block_hash`]: chain::BestBlock::block_hash */ public static constructor_new(fee_est: FeeEstimator, chain_monitor: Watch, tx_broadcaster: BroadcasterInterface, router: Router, logger: Logger, entropy_source: EntropySource, node_signer: NodeSigner, signer_provider: SignerProvider, config: UserConfig, params: ChainParameters): ChannelManager { const ret: bigint = bindings.ChannelManager_new(fee_est == null ? 0n : CommonBase.get_ptr_of(fee_est), chain_monitor == null ? 0n : CommonBase.get_ptr_of(chain_monitor), tx_broadcaster == null ? 0n : CommonBase.get_ptr_of(tx_broadcaster), router == null ? 0n : CommonBase.get_ptr_of(router), logger == null ? 0n : CommonBase.get_ptr_of(logger), entropy_source == null ? 0n : CommonBase.get_ptr_of(entropy_source), node_signer == null ? 0n : CommonBase.get_ptr_of(node_signer), signer_provider == null ? 0n : CommonBase.get_ptr_of(signer_provider), config == null ? 0n : CommonBase.get_ptr_of(config), params == null ? 0n : CommonBase.get_ptr_of(params)); @@ -542,7 +577,7 @@ export class ChannelManager extends CommonBase { } /** - * Gets the list of open channels, in random order. See ChannelDetail field documentation for + * Gets the list of open channels, in random order. See [`ChannelDetails`] field documentation for * more information. */ public list_channels(): ChannelDetails[] { @@ -581,6 +616,23 @@ export class ChannelManager extends CommonBase { return ret_conv_16_arr; } + /** + * Gets the list of channels we have with a given counterparty, in random order. + */ + public list_channels_with_counterparty(counterparty_node_id: Uint8Array): ChannelDetails[] { + const ret: number = bindings.ChannelManager_list_channels_with_counterparty(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(counterparty_node_id, 33))); + const ret_conv_16_len: number = bindings.getArrayLength(ret); + const ret_conv_16_arr: ChannelDetails[] = new Array(ret_conv_16_len).fill(null); + for (var q = 0; q < ret_conv_16_len; q++) { + const ret_conv_16: bigint = bindings.getU64ArrayElem(ret, q); + const ret_conv_16_hu_conv: ChannelDetails = new ChannelDetails(null, ret_conv_16); + CommonBase.add_ref_from(ret_conv_16_hu_conv, this); + ret_conv_16_arr[q] = ret_conv_16_hu_conv; + } + bindings.freeWasmMemory(ret) + return ret_conv_16_arr; + } + /** * Returns in an undefined order recent payments that -- if not fulfilled -- have yet to find a * successful path, or have unresolved HTLCs. @@ -618,11 +670,12 @@ export class ChannelManager extends CommonBase { * would appear on a force-closure transaction, whichever is lower. We will allow our * counterparty to pay as much fee as they'd like, however. * - * May generate a SendShutdown message event on success, which should be relayed. + * May generate a [`SendShutdown`] message event on success, which should be relayed. * * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal + * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown */ public close_channel(channel_id: Uint8Array, counterparty_node_id: Uint8Array): Result_NoneAPIErrorZ { const ret: bigint = bindings.ChannelManager_close_channel(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(channel_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(counterparty_node_id, 33))); @@ -645,11 +698,12 @@ export class ChannelManager extends CommonBase { * transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which * will appear on a force-closure transaction, whichever is lower). * - * May generate a SendShutdown message event on success, which should be relayed. + * May generate a [`SendShutdown`] message event on success, which should be relayed. * * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal + * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown */ public close_channel_with_target_feerate(channel_id: Uint8Array, counterparty_node_id: Uint8Array, target_feerate_sats_per_1000_weight: number): Result_NoneAPIErrorZ { const ret: bigint = bindings.ChannelManager_close_channel_with_target_feerate(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(channel_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(counterparty_node_id, 33)), target_feerate_sats_per_1000_weight); @@ -705,7 +759,7 @@ export class ChannelManager extends CommonBase { * Value parameters are provided via the last hop in route, see documentation for [`RouteHop`] * fields for more info. * - * May generate SendHTLCs message(s) event on success, which should be relayed (e.g. via + * May generate [`UpdateHTLCs`] message(s) event on success, which should be relayed (e.g. via * [`PeerManager::process_events`]). * * # Avoiding Duplicate Payments @@ -729,7 +783,7 @@ export class ChannelManager extends CommonBase { * * # Possible Error States on [`PaymentSendFailure`] * - * Each path may have a different return value, and PaymentSendValue may return a Vec with + * Each path may have a different return value, and [`PaymentSendFailure`] may return a `Vec` with * each entry matching the corresponding-index entry in the route paths, see * [`PaymentSendFailure`] for more info. * @@ -742,45 +796,32 @@ export class ChannelManager extends CommonBase { * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the * relevant updates. * - * Note that depending on the type of the PaymentSendFailure the HTLC may have been + * Note that depending on the type of the [`PaymentSendFailure`] the HTLC may have been * irrevocably committed to on our end. In such a case, do NOT retry the payment with a * different route unless you intend to pay twice! * - * # A caution on `payment_secret` - * - * `payment_secret` is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to - * authenticate the sender to the recipient and prevent payment-probing (deanonymization) - * attacks. For newer nodes, it will be provided to you in the invoice. If you do not have one, - * the [`Route`] must not contain multiple paths as multi-path payments require a - * recipient-provided `payment_secret`. - * - * If a `payment_secret` *is* provided, we assume that the invoice had the payment_secret - * feature bit set (either as required or as available). If multiple paths are present in the - * [`Route`], we assume the invoice had the basic_mpp feature set. - * * [`Event::PaymentSent`]: events::Event::PaymentSent * [`Event::PaymentFailed`]: events::Event::PaymentFailed + * [`UpdateHTLCs`]: events::MessageSendEvent::UpdateHTLCs * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress - * - * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public send_payment(route: Route, payment_hash: Uint8Array, payment_secret: Uint8Array|null, payment_id: Uint8Array): Result_NonePaymentSendFailureZ { - const ret: bigint = bindings.ChannelManager_send_payment(this.ptr, route == null ? 0n : CommonBase.get_ptr_of(route), bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), bindings.encodeUint8Array(bindings.check_arr_len(payment_secret, 32)), bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32))); + public send_payment_with_route(route: Route, payment_hash: Uint8Array, recipient_onion: RecipientOnionFields, payment_id: Uint8Array): Result_NonePaymentSendFailureZ { + const ret: bigint = bindings.ChannelManager_send_payment_with_route(this.ptr, route == null ? 0n : CommonBase.get_ptr_of(route), bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), recipient_onion == null ? 0n : CommonBase.get_ptr_of(recipient_onion), bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32))); const ret_hu_conv: Result_NonePaymentSendFailureZ = Result_NonePaymentSendFailureZ.constr_from_ptr(ret); CommonBase.add_ref_from(this, route); + CommonBase.add_ref_from(this, recipient_onion); return ret_hu_conv; } /** * Similar to [`ChannelManager::send_payment`], but will automatically find a route based on * `route_params` and retry failed payment paths based on `retry_strategy`. - * - * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public send_payment_with_retry(payment_hash: Uint8Array, payment_secret: Uint8Array|null, payment_id: Uint8Array, route_params: RouteParameters, retry_strategy: Retry): Result_NoneRetryableSendFailureZ { - const ret: bigint = bindings.ChannelManager_send_payment_with_retry(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), bindings.encodeUint8Array(bindings.check_arr_len(payment_secret, 32)), bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32)), route_params == null ? 0n : CommonBase.get_ptr_of(route_params), CommonBase.get_ptr_of(retry_strategy)); + public send_payment(payment_hash: Uint8Array, recipient_onion: RecipientOnionFields, payment_id: Uint8Array, route_params: RouteParameters, retry_strategy: Retry): Result_NoneRetryableSendFailureZ { + const ret: bigint = bindings.ChannelManager_send_payment(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), recipient_onion == null ? 0n : CommonBase.get_ptr_of(recipient_onion), bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32)), route_params == null ? 0n : CommonBase.get_ptr_of(route_params), CommonBase.get_ptr_of(retry_strategy)); const ret_hu_conv: Result_NoneRetryableSendFailureZ = Result_NoneRetryableSendFailureZ.constr_from_ptr(ret); + CommonBase.add_ref_from(this, recipient_onion); CommonBase.add_ref_from(this, route_params); CommonBase.add_ref_from(this, retry_strategy); return ret_hu_conv; @@ -827,10 +868,11 @@ export class ChannelManager extends CommonBase { * * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public send_spontaneous_payment(route: Route, payment_preimage: Uint8Array|null, payment_id: Uint8Array): Result_PaymentHashPaymentSendFailureZ { - const ret: bigint = bindings.ChannelManager_send_spontaneous_payment(this.ptr, route == null ? 0n : CommonBase.get_ptr_of(route), bindings.encodeUint8Array(bindings.check_arr_len(payment_preimage, 32)), bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32))); + public send_spontaneous_payment(route: Route, payment_preimage: Uint8Array|null, recipient_onion: RecipientOnionFields, payment_id: Uint8Array): Result_PaymentHashPaymentSendFailureZ { + const ret: bigint = bindings.ChannelManager_send_spontaneous_payment(this.ptr, route == null ? 0n : CommonBase.get_ptr_of(route), bindings.encodeUint8Array(bindings.check_arr_len(payment_preimage, 32)), recipient_onion == null ? 0n : CommonBase.get_ptr_of(recipient_onion), bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32))); const ret_hu_conv: Result_PaymentHashPaymentSendFailureZ = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret); CommonBase.add_ref_from(this, route); + CommonBase.add_ref_from(this, recipient_onion); return ret_hu_conv; } @@ -845,9 +887,10 @@ export class ChannelManager extends CommonBase { * * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public send_spontaneous_payment_with_retry(payment_preimage: Uint8Array|null, payment_id: Uint8Array, route_params: RouteParameters, retry_strategy: Retry): Result_PaymentHashRetryableSendFailureZ { - const ret: bigint = bindings.ChannelManager_send_spontaneous_payment_with_retry(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(payment_preimage, 32)), bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32)), route_params == null ? 0n : CommonBase.get_ptr_of(route_params), CommonBase.get_ptr_of(retry_strategy)); + public send_spontaneous_payment_with_retry(payment_preimage: Uint8Array|null, recipient_onion: RecipientOnionFields, payment_id: Uint8Array, route_params: RouteParameters, retry_strategy: Retry): Result_PaymentHashRetryableSendFailureZ { + const ret: bigint = bindings.ChannelManager_send_spontaneous_payment_with_retry(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(payment_preimage, 32)), recipient_onion == null ? 0n : CommonBase.get_ptr_of(recipient_onion), bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32)), route_params == null ? 0n : CommonBase.get_ptr_of(route_params), CommonBase.get_ptr_of(retry_strategy)); const ret_hu_conv: Result_PaymentHashRetryableSendFailureZ = Result_PaymentHashRetryableSendFailureZ.constr_from_ptr(ret); + CommonBase.add_ref_from(this, recipient_onion); CommonBase.add_ref_from(this, route_params); CommonBase.add_ref_from(this, retry_strategy); return ret_hu_conv; @@ -858,10 +901,10 @@ export class ChannelManager extends CommonBase { * [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows * us to easily discern them from real payments. */ - public send_probe(hops: RouteHop[]): Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { - const ret: bigint = bindings.ChannelManager_send_probe(this.ptr, bindings.encodeUint64Array(hops != null ? hops.map(hops_conv_10 => hops_conv_10 == null ? 0n : CommonBase.get_ptr_of(hops_conv_10)) : null)); + public send_probe(path: Path): Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { + const ret: bigint = bindings.ChannelManager_send_probe(this.ptr, path == null ? 0n : CommonBase.get_ptr_of(path)); const ret_hu_conv: Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret); - hops.forEach((hops_conv_10: RouteHop) => { CommonBase.add_ref_from(this, hops_conv_10); }); + CommonBase.add_ref_from(this, path); return ret_hu_conv; } @@ -894,8 +937,8 @@ export class ChannelManager extends CommonBase { * implemented by Bitcoin Core wallet. See * for more details. * - * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady - * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed + * [`Event::FundingGenerationReady`]: crate::events::Event::FundingGenerationReady + * [`Event::ChannelClosed`]: crate::events::Event::ChannelClosed */ public funding_transaction_generated(temporary_channel_id: Uint8Array, counterparty_node_id: Uint8Array, funding_transaction: Uint8Array): Result_NoneAPIErrorZ { const ret: bigint = bindings.ChannelManager_funding_transaction_generated(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(temporary_channel_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(counterparty_node_id, 33)), bindings.encodeUint8Array(funding_transaction)); @@ -992,15 +1035,18 @@ export class ChannelManager extends CommonBase { * * This currently includes: * Increasing or decreasing the on-chain feerate estimates for our outbound channels, - * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more + * Broadcasting [`ChannelUpdate`] messages if we've been disconnected from our peer for more * than a minute, informing the network that they should no longer attempt to route over * the channel. - * Expiring a channel's previous `ChannelConfig` if necessary to only allow forwarding HTLCs - * with the current `ChannelConfig`. + * Expiring a channel's previous [`ChannelConfig`] if necessary to only allow forwarding HTLCs + * with the current [`ChannelConfig`]. * Removing peers which have disconnected but and no longer have any channels. * - * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate + * Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate * estimate fetches. + * + * [`ChannelUpdate`]: msgs::ChannelUpdate + * [`ChannelConfig`]: crate::util::config::ChannelConfig */ public timer_tick_occurred(): void { bindings.ChannelManager_timer_tick_occurred(this.ptr); @@ -1039,17 +1085,19 @@ export class ChannelManager extends CommonBase { * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any * [`MessageSendEvent`]s needed to claim the payment. * - * Note that calling this method does *not* guarantee that the payment has been claimed. You - * must* wait for an [`Event::PaymentClaimed`] event which upon a successful claim will be - * provided to your [`EventHandler`] when [`process_pending_events`] is next called. + * This method is guaranteed to ensure the payment has been claimed but only if the current + * height is strictly below [`Event::PaymentClaimable::claim_deadline`]. To avoid race + * conditions, you should wait for an [`Event::PaymentClaimed`] before considering the payment + * successful. It will generally be available in the next [`process_pending_events`] call. * * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentClaimable` * event matches your expectation. If you fail to do so and call this method, you may provide * the sender \"proof-of-payment\" when they did not fulfill the full expected payment. * - * [`Event::PaymentClaimable`]: crate::util::events::Event::PaymentClaimable - * [`Event::PaymentClaimed`]: crate::util::events::Event::PaymentClaimed + * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable + * [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline + * [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed * [`process_pending_events`]: EventsProvider::process_pending_events * [`create_inbound_payment`]: Self::create_inbound_payment * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash @@ -1355,21 +1403,10 @@ export class ChannelManager extends CommonBase { } /** - * Blocks until ChannelManager needs to be persisted. Only one listener on - * [`await_persistable_update`], `await_persistable_update_timeout`, or a future returned by - * [`get_persistable_update_future`] is guaranteed to be woken up. + * Gets a [`Future`] that completes when this [`ChannelManager`] needs to be persisted. * - * [`await_persistable_update`]: Self::await_persistable_update - * [`get_persistable_update_future`]: Self::get_persistable_update_future - */ - public await_persistable_update(): void { - bindings.ChannelManager_await_persistable_update(this.ptr); - } - - /** - * Gets a [`Future`] that completes when a persistable update is available. Note that - * callbacks registered on the [`Future`] MUST NOT call back into this [`ChannelManager`] and - * should instead register actions to be taken later. + * Note that callbacks registered on the [`Future`] MUST NOT call back into this + * [`ChannelManager`] and should instead register actions to be taken later. */ public get_persistable_update_future(): Future { const ret: bigint = bindings.ChannelManager_get_persistable_update_future(this.ptr);