1 import { TxOut } from '../structs/TxOut.mjs';
2 import { TxIn } from '../structs/TxIn.mjs';
3 import { BigEndianScalar } from '../structs/BigEndianScalar.mjs';
4 import { Bolt11SemanticError } from '../enums/Bolt11SemanticError.mjs';
5 import { Bolt12SemanticError } from '../enums/Bolt12SemanticError.mjs';
6 import { COption_NoneZ } from '../enums/COption_NoneZ.mjs';
7 import { ChannelMonitorUpdateStatus } from '../enums/ChannelMonitorUpdateStatus.mjs';
8 import { ChannelShutdownState } from '../enums/ChannelShutdownState.mjs';
9 import { ConfirmationTarget } from '../enums/ConfirmationTarget.mjs';
10 import { CreationError } from '../enums/CreationError.mjs';
11 import { Currency } from '../enums/Currency.mjs';
12 import { HTLCClaim } from '../enums/HTLCClaim.mjs';
13 import { IOError } from '../enums/IOError.mjs';
14 import { Level } from '../enums/Level.mjs';
15 import { Network } from '../enums/Network.mjs';
16 import { PaymentFailureReason } from '../enums/PaymentFailureReason.mjs';
17 import { Recipient } from '../enums/Recipient.mjs';
18 import { RetryableSendFailure } from '../enums/RetryableSendFailure.mjs';
19 import { Secp256k1Error } from '../enums/Secp256k1Error.mjs';
20 import { SiPrefix } from '../enums/SiPrefix.mjs';
21 import { SocketAddressParseError } from '../enums/SocketAddressParseError.mjs';
22 import { UtxoLookupError } from '../enums/UtxoLookupError.mjs';
23 import { Bech32Error } from '../structs/Bech32Error.mjs';
24 import { Option_u64Z } from '../structs/Option_u64Z.mjs';
25 import { BlindedPath } from '../structs/BlindedPath.mjs';
26 import { Refund } from '../structs/Refund.mjs';
27 import { Bolt12ParseError } from '../structs/Bolt12ParseError.mjs';
28 import { Result_RefundBolt12ParseErrorZ } from '../structs/Result_RefundBolt12ParseErrorZ.mjs';
29 import { Retry } from '../structs/Retry.mjs';
30 import { DecodeError } from '../structs/DecodeError.mjs';
31 import { Result_RetryDecodeErrorZ } from '../structs/Result_RetryDecodeErrorZ.mjs';
32 import { ShutdownScript } from '../structs/ShutdownScript.mjs';
33 import { APIError } from '../structs/APIError.mjs';
34 import { Result_NoneAPIErrorZ } from '../structs/Result_NoneAPIErrorZ.mjs';
35 import { Option_ThirtyTwoBytesZ } from '../structs/Option_ThirtyTwoBytesZ.mjs';
36 import { Option_CVec_u8ZZ } from '../structs/Option_CVec_u8ZZ.mjs';
37 import { RecipientOnionFields } from '../structs/RecipientOnionFields.mjs';
38 import { Result_RecipientOnionFieldsDecodeErrorZ } from '../structs/Result_RecipientOnionFieldsDecodeErrorZ.mjs';
39 import { TwoTuple_u64CVec_u8ZZ } from '../structs/TwoTuple_u64CVec_u8ZZ.mjs';
40 import { Result_RecipientOnionFieldsNoneZ } from '../structs/Result_RecipientOnionFieldsNoneZ.mjs';
41 import { Option_CVec_ThirtyTwoBytesZZ } from '../structs/Option_CVec_ThirtyTwoBytesZZ.mjs';
42 import { Result_ThirtyTwoBytesNoneZ } from '../structs/Result_ThirtyTwoBytesNoneZ.mjs';
43 import { BlindedPayInfo } from '../structs/BlindedPayInfo.mjs';
44 import { Result_BlindedPayInfoDecodeErrorZ } from '../structs/Result_BlindedPayInfoDecodeErrorZ.mjs';
45 import { DelayedPaymentOutputDescriptor } from '../structs/DelayedPaymentOutputDescriptor.mjs';
46 import { Result_DelayedPaymentOutputDescriptorDecodeErrorZ } from '../structs/Result_DelayedPaymentOutputDescriptorDecodeErrorZ.mjs';
47 import { StaticPaymentOutputDescriptor } from '../structs/StaticPaymentOutputDescriptor.mjs';
48 import { Result_StaticPaymentOutputDescriptorDecodeErrorZ } from '../structs/Result_StaticPaymentOutputDescriptorDecodeErrorZ.mjs';
49 import { OutPoint } from '../structs/OutPoint.mjs';
50 import { SpendableOutputDescriptor } from '../structs/SpendableOutputDescriptor.mjs';
51 import { Result_SpendableOutputDescriptorDecodeErrorZ } from '../structs/Result_SpendableOutputDescriptorDecodeErrorZ.mjs';
52 import { Option_u32Z } from '../structs/Option_u32Z.mjs';
53 import { TwoTuple_CVec_u8ZusizeZ } from '../structs/TwoTuple_CVec_u8ZusizeZ.mjs';
54 import { Result_C2Tuple_CVec_u8ZusizeZNoneZ } from '../structs/Result_C2Tuple_CVec_u8ZusizeZNoneZ.mjs';
55 import { Result_NoneNoneZ } from '../structs/Result_NoneNoneZ.mjs';
56 import { TwoTuple_ECDSASignatureCVec_ECDSASignatureZZ } from '../structs/TwoTuple_ECDSASignatureCVec_ECDSASignatureZZ.mjs';
57 import { Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ } from '../structs/Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ.mjs';
58 import { Result_ECDSASignatureNoneZ } from '../structs/Result_ECDSASignatureNoneZ.mjs';
59 import { Result_PublicKeyNoneZ } from '../structs/Result_PublicKeyNoneZ.mjs';
60 import { Option_BigEndianScalarZ } from '../structs/Option_BigEndianScalarZ.mjs';
61 import { Result_RecoverableSignatureNoneZ } from '../structs/Result_RecoverableSignatureNoneZ.mjs';
62 import { Result_SchnorrSignatureNoneZ } from '../structs/Result_SchnorrSignatureNoneZ.mjs';
63 import { CommitmentTransaction } from '../structs/CommitmentTransaction.mjs';
64 import { HolderCommitmentTransaction } from '../structs/HolderCommitmentTransaction.mjs';
65 import { HTLCOutputInCommitment } from '../structs/HTLCOutputInCommitment.mjs';
66 import { HTLCDescriptor } from '../structs/HTLCDescriptor.mjs';
67 import { ClosingTransaction } from '../structs/ClosingTransaction.mjs';
68 import { UnsignedChannelAnnouncement } from '../structs/UnsignedChannelAnnouncement.mjs';
69 import { ChannelPublicKeys } from '../structs/ChannelPublicKeys.mjs';
70 import { ChannelTransactionParameters } from '../structs/ChannelTransactionParameters.mjs';
71 import { ChannelSigner, ChannelSignerInterface } from '../structs/ChannelSigner.mjs';
72 import { EcdsaChannelSigner, EcdsaChannelSignerInterface } from '../structs/EcdsaChannelSigner.mjs';
73 import { WriteableEcdsaChannelSigner, WriteableEcdsaChannelSignerInterface } from '../structs/WriteableEcdsaChannelSigner.mjs';
74 import { Result_WriteableEcdsaChannelSignerDecodeErrorZ } from '../structs/Result_WriteableEcdsaChannelSignerDecodeErrorZ.mjs';
75 import { Result_CVec_u8ZNoneZ } from '../structs/Result_CVec_u8ZNoneZ.mjs';
76 import { Result_ShutdownScriptNoneZ } from '../structs/Result_ShutdownScriptNoneZ.mjs';
77 import { Option_u16Z } from '../structs/Option_u16Z.mjs';
78 import { Option_boolZ } from '../structs/Option_boolZ.mjs';
79 import { Result_CVec_CVec_u8ZZNoneZ } from '../structs/Result_CVec_CVec_u8ZZNoneZ.mjs';
80 import { InMemorySigner } from '../structs/InMemorySigner.mjs';
81 import { Result_InMemorySignerDecodeErrorZ } from '../structs/Result_InMemorySignerDecodeErrorZ.mjs';
82 import { Result_TransactionNoneZ } from '../structs/Result_TransactionNoneZ.mjs';
83 import { ChannelDetails } from '../structs/ChannelDetails.mjs';
84 import { Route } from '../structs/Route.mjs';
85 import { LightningError } from '../structs/LightningError.mjs';
86 import { Result_RouteLightningErrorZ } from '../structs/Result_RouteLightningErrorZ.mjs';
87 import { InFlightHtlcs } from '../structs/InFlightHtlcs.mjs';
88 import { Result_InFlightHtlcsDecodeErrorZ } from '../structs/Result_InFlightHtlcsDecodeErrorZ.mjs';
89 import { RouteHop } from '../structs/RouteHop.mjs';
90 import { Result_RouteHopDecodeErrorZ } from '../structs/Result_RouteHopDecodeErrorZ.mjs';
91 import { BlindedHop } from '../structs/BlindedHop.mjs';
92 import { BlindedTail } from '../structs/BlindedTail.mjs';
93 import { Result_BlindedTailDecodeErrorZ } from '../structs/Result_BlindedTailDecodeErrorZ.mjs';
94 import { Path } from '../structs/Path.mjs';
95 import { Result_RouteDecodeErrorZ } from '../structs/Result_RouteDecodeErrorZ.mjs';
96 import { RouteParameters } from '../structs/RouteParameters.mjs';
97 import { Result_RouteParametersDecodeErrorZ } from '../structs/Result_RouteParametersDecodeErrorZ.mjs';
98 import { PaymentParameters } from '../structs/PaymentParameters.mjs';
99 import { Result_PaymentParametersDecodeErrorZ } from '../structs/Result_PaymentParametersDecodeErrorZ.mjs';
100 import { TwoTuple_BlindedPayInfoBlindedPathZ } from '../structs/TwoTuple_BlindedPayInfoBlindedPathZ.mjs';
101 import { RouteHint } from '../structs/RouteHint.mjs';
102 import { RouteHintHop } from '../structs/RouteHintHop.mjs';
103 import { Result_RouteHintDecodeErrorZ } from '../structs/Result_RouteHintDecodeErrorZ.mjs';
104 import { Result_RouteHintHopDecodeErrorZ } from '../structs/Result_RouteHintHopDecodeErrorZ.mjs';
105 import { FixedPenaltyScorer } from '../structs/FixedPenaltyScorer.mjs';
106 import { Result_FixedPenaltyScorerDecodeErrorZ } from '../structs/Result_FixedPenaltyScorerDecodeErrorZ.mjs';
107 import { NodeId } from '../structs/NodeId.mjs';
108 import { TwoTuple_u64u64Z } from '../structs/TwoTuple_u64u64Z.mjs';
109 import { Option_C2Tuple_u64u64ZZ } from '../structs/Option_C2Tuple_u64u64ZZ.mjs';
110 import { TwoTuple_Z } from '../structs/TwoTuple_Z.mjs';
111 import { TwoTuple__u1632_u1632Z } from '../structs/TwoTuple__u1632_u1632Z.mjs';
112 import { Option_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ } from '../structs/Option_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ.mjs';
113 import { Option_f64Z } from '../structs/Option_f64Z.mjs';
114 import { Record } from '../structs/Record.mjs';
115 import { Logger, LoggerInterface } from '../structs/Logger.mjs';
116 import { NetworkGraph } from '../structs/NetworkGraph.mjs';
117 import { ProbabilisticScorer } from '../structs/ProbabilisticScorer.mjs';
118 import { Result_ProbabilisticScorerDecodeErrorZ } from '../structs/Result_ProbabilisticScorerDecodeErrorZ.mjs';
119 import { TwoTuple_usizeTransactionZ } from '../structs/TwoTuple_usizeTransactionZ.mjs';
120 import { TwoTuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ } from '../structs/TwoTuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ.mjs';
121 import { Result_ChannelMonitorUpdateStatusNoneZ } from '../structs/Result_ChannelMonitorUpdateStatusNoneZ.mjs';
122 import { HTLCUpdate } from '../structs/HTLCUpdate.mjs';
123 import { MonitorEvent } from '../structs/MonitorEvent.mjs';
124 import { ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ } from '../structs/ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ.mjs';
125 import { InitFeatures } from '../structs/InitFeatures.mjs';
126 import { Result_InitFeaturesDecodeErrorZ } from '../structs/Result_InitFeaturesDecodeErrorZ.mjs';
127 import { ChannelFeatures } from '../structs/ChannelFeatures.mjs';
128 import { Result_ChannelFeaturesDecodeErrorZ } from '../structs/Result_ChannelFeaturesDecodeErrorZ.mjs';
129 import { NodeFeatures } from '../structs/NodeFeatures.mjs';
130 import { Result_NodeFeaturesDecodeErrorZ } from '../structs/Result_NodeFeaturesDecodeErrorZ.mjs';
131 import { Bolt11InvoiceFeatures } from '../structs/Bolt11InvoiceFeatures.mjs';
132 import { Result_Bolt11InvoiceFeaturesDecodeErrorZ } from '../structs/Result_Bolt11InvoiceFeaturesDecodeErrorZ.mjs';
133 import { Bolt12InvoiceFeatures } from '../structs/Bolt12InvoiceFeatures.mjs';
134 import { Result_Bolt12InvoiceFeaturesDecodeErrorZ } from '../structs/Result_Bolt12InvoiceFeaturesDecodeErrorZ.mjs';
135 import { BlindedHopFeatures } from '../structs/BlindedHopFeatures.mjs';
136 import { Result_BlindedHopFeaturesDecodeErrorZ } from '../structs/Result_BlindedHopFeaturesDecodeErrorZ.mjs';
137 import { ChannelTypeFeatures } from '../structs/ChannelTypeFeatures.mjs';
138 import { Result_ChannelTypeFeaturesDecodeErrorZ } from '../structs/Result_ChannelTypeFeaturesDecodeErrorZ.mjs';
139 import { Offer } from '../structs/Offer.mjs';
140 import { Result_OfferBolt12ParseErrorZ } from '../structs/Result_OfferBolt12ParseErrorZ.mjs';
141 import { Result_PublicKeySecp256k1ErrorZ } from '../structs/Result_PublicKeySecp256k1ErrorZ.mjs';
142 import { Result_NodeIdDecodeErrorZ } from '../structs/Result_NodeIdDecodeErrorZ.mjs';
143 import { ChannelUpdate } from '../structs/ChannelUpdate.mjs';
144 import { NetworkUpdate } from '../structs/NetworkUpdate.mjs';
145 import { Option_NetworkUpdateZ } from '../structs/Option_NetworkUpdateZ.mjs';
146 import { Result_COption_NetworkUpdateZDecodeErrorZ } from '../structs/Result_COption_NetworkUpdateZDecodeErrorZ.mjs';
147 import { Result_TxOutUtxoLookupErrorZ } from '../structs/Result_TxOutUtxoLookupErrorZ.mjs';
148 import { UtxoFuture } from '../structs/UtxoFuture.mjs';
149 import { UtxoResult } from '../structs/UtxoResult.mjs';
150 import { UtxoLookup, UtxoLookupInterface } from '../structs/UtxoLookup.mjs';
151 import { Option_UtxoLookupZ } from '../structs/Option_UtxoLookupZ.mjs';
152 import { Result_NoneLightningErrorZ } from '../structs/Result_NoneLightningErrorZ.mjs';
153 import { Result_boolLightningErrorZ } from '../structs/Result_boolLightningErrorZ.mjs';
154 import { ChannelAnnouncement } from '../structs/ChannelAnnouncement.mjs';
155 import { ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ } from '../structs/ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.mjs';
156 import { Option_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ } from '../structs/Option_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ.mjs';
157 import { AcceptChannel } from '../structs/AcceptChannel.mjs';
158 import { AcceptChannelV2 } from '../structs/AcceptChannelV2.mjs';
159 import { OpenChannel } from '../structs/OpenChannel.mjs';
160 import { OpenChannelV2 } from '../structs/OpenChannelV2.mjs';
161 import { FundingCreated } from '../structs/FundingCreated.mjs';
162 import { FundingSigned } from '../structs/FundingSigned.mjs';
163 import { TxAddInput } from '../structs/TxAddInput.mjs';
164 import { TxAddOutput } from '../structs/TxAddOutput.mjs';
165 import { TxRemoveInput } from '../structs/TxRemoveInput.mjs';
166 import { TxRemoveOutput } from '../structs/TxRemoveOutput.mjs';
167 import { TxComplete } from '../structs/TxComplete.mjs';
168 import { TxSignatures } from '../structs/TxSignatures.mjs';
169 import { TxInitRbf } from '../structs/TxInitRbf.mjs';
170 import { TxAckRbf } from '../structs/TxAckRbf.mjs';
171 import { TxAbort } from '../structs/TxAbort.mjs';
172 import { ChannelReady } from '../structs/ChannelReady.mjs';
173 import { AnnouncementSignatures } from '../structs/AnnouncementSignatures.mjs';
174 import { CommitmentUpdate } from '../structs/CommitmentUpdate.mjs';
175 import { RevokeAndACK } from '../structs/RevokeAndACK.mjs';
176 import { ClosingSigned } from '../structs/ClosingSigned.mjs';
177 import { Shutdown } from '../structs/Shutdown.mjs';
178 import { ChannelReestablish } from '../structs/ChannelReestablish.mjs';
179 import { NodeAnnouncement } from '../structs/NodeAnnouncement.mjs';
180 import { ErrorMessage } from '../structs/ErrorMessage.mjs';
181 import { WarningMessage } from '../structs/WarningMessage.mjs';
182 import { ErrorAction } from '../structs/ErrorAction.mjs';
183 import { QueryChannelRange } from '../structs/QueryChannelRange.mjs';
184 import { QueryShortChannelIds } from '../structs/QueryShortChannelIds.mjs';
185 import { ReplyChannelRange } from '../structs/ReplyChannelRange.mjs';
186 import { GossipTimestampFilter } from '../structs/GossipTimestampFilter.mjs';
187 import { MessageSendEvent } from '../structs/MessageSendEvent.mjs';
188 import { ChannelUpdateInfo } from '../structs/ChannelUpdateInfo.mjs';
189 import { Result_ChannelUpdateInfoDecodeErrorZ } from '../structs/Result_ChannelUpdateInfoDecodeErrorZ.mjs';
190 import { ChannelInfo } from '../structs/ChannelInfo.mjs';
191 import { Result_ChannelInfoDecodeErrorZ } from '../structs/Result_ChannelInfoDecodeErrorZ.mjs';
192 import { RoutingFees } from '../structs/RoutingFees.mjs';
193 import { Result_RoutingFeesDecodeErrorZ } from '../structs/Result_RoutingFeesDecodeErrorZ.mjs';
194 import { Hostname } from '../structs/Hostname.mjs';
195 import { SocketAddress } from '../structs/SocketAddress.mjs';
196 import { NodeAnnouncementInfo } from '../structs/NodeAnnouncementInfo.mjs';
197 import { Result_NodeAnnouncementInfoDecodeErrorZ } from '../structs/Result_NodeAnnouncementInfoDecodeErrorZ.mjs';
198 import { NodeAlias } from '../structs/NodeAlias.mjs';
199 import { Result_NodeAliasDecodeErrorZ } from '../structs/Result_NodeAliasDecodeErrorZ.mjs';
200 import { NodeInfo } from '../structs/NodeInfo.mjs';
201 import { Result_NodeInfoDecodeErrorZ } from '../structs/Result_NodeInfoDecodeErrorZ.mjs';
202 import { Result_NetworkGraphDecodeErrorZ } from '../structs/Result_NetworkGraphDecodeErrorZ.mjs';
203 import { Option_CVec_SocketAddressZZ } from '../structs/Option_CVec_SocketAddressZZ.mjs';
204 import { ChannelDerivationParameters } from '../structs/ChannelDerivationParameters.mjs';
205 import { Result_ChannelDerivationParametersDecodeErrorZ } from '../structs/Result_ChannelDerivationParametersDecodeErrorZ.mjs';
206 import { Result_HTLCDescriptorDecodeErrorZ } from '../structs/Result_HTLCDescriptorDecodeErrorZ.mjs';
207 import { Utxo } from '../structs/Utxo.mjs';
208 import { Option_TxOutZ } from '../structs/Option_TxOutZ.mjs';
209 import { Input } from '../structs/Input.mjs';
210 import { CoinSelection } from '../structs/CoinSelection.mjs';
211 import { Result_CoinSelectionNoneZ } from '../structs/Result_CoinSelectionNoneZ.mjs';
212 import { Result_CVec_UtxoZNoneZ } from '../structs/Result_CVec_UtxoZNoneZ.mjs';
213 import { TwoTuple_u64u16Z } from '../structs/TwoTuple_u64u16Z.mjs';
214 import { Option_C2Tuple_u64u16ZZ } from '../structs/Option_C2Tuple_u64u16ZZ.mjs';
215 import { Option_ChannelShutdownStateZ } from '../structs/Option_ChannelShutdownStateZ.mjs';
216 import { Result_ThirtyTwoBytesAPIErrorZ } from '../structs/Result_ThirtyTwoBytesAPIErrorZ.mjs';
217 import { RecentPaymentDetails } from '../structs/RecentPaymentDetails.mjs';
218 import { PaymentSendFailure } from '../structs/PaymentSendFailure.mjs';
219 import { Result_NonePaymentSendFailureZ } from '../structs/Result_NonePaymentSendFailureZ.mjs';
220 import { Result_NoneRetryableSendFailureZ } from '../structs/Result_NoneRetryableSendFailureZ.mjs';
221 import { Result_ThirtyTwoBytesPaymentSendFailureZ } from '../structs/Result_ThirtyTwoBytesPaymentSendFailureZ.mjs';
222 import { Result_ThirtyTwoBytesRetryableSendFailureZ } from '../structs/Result_ThirtyTwoBytesRetryableSendFailureZ.mjs';
223 import { TwoTuple_ThirtyTwoBytesThirtyTwoBytesZ } from '../structs/TwoTuple_ThirtyTwoBytesThirtyTwoBytesZ.mjs';
224 import { Result_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ } from '../structs/Result_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ.mjs';
225 import { ProbeSendFailure } from '../structs/ProbeSendFailure.mjs';
226 import { Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ } from '../structs/Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ.mjs';
227 import { TwoTuple_ThirtyTwoBytesPublicKeyZ } from '../structs/TwoTuple_ThirtyTwoBytesPublicKeyZ.mjs';
228 import { Result_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ } from '../structs/Result_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ.mjs';
229 import { CounterpartyForwardingInfo } from '../structs/CounterpartyForwardingInfo.mjs';
230 import { Result_CounterpartyForwardingInfoDecodeErrorZ } from '../structs/Result_CounterpartyForwardingInfoDecodeErrorZ.mjs';
231 import { ChannelCounterparty } from '../structs/ChannelCounterparty.mjs';
232 import { Result_ChannelCounterpartyDecodeErrorZ } from '../structs/Result_ChannelCounterpartyDecodeErrorZ.mjs';
233 import { Result_ChannelDetailsDecodeErrorZ } from '../structs/Result_ChannelDetailsDecodeErrorZ.mjs';
234 import { PhantomRouteHints } from '../structs/PhantomRouteHints.mjs';
235 import { Result_PhantomRouteHintsDecodeErrorZ } from '../structs/Result_PhantomRouteHintsDecodeErrorZ.mjs';
236 import { Result_ChannelShutdownStateDecodeErrorZ } from '../structs/Result_ChannelShutdownStateDecodeErrorZ.mjs';
237 import { ChannelMonitor } from '../structs/ChannelMonitor.mjs';
238 import { ChannelMonitorUpdate } from '../structs/ChannelMonitorUpdate.mjs';
239 import { Watch, WatchInterface } from '../structs/Watch.mjs';
240 import { BroadcasterInterface, BroadcasterInterfaceInterface } from '../structs/BroadcasterInterface.mjs';
241 import { EntropySource, EntropySourceInterface } from '../structs/EntropySource.mjs';
242 import { UnsignedInvoiceRequest } from '../structs/UnsignedInvoiceRequest.mjs';
243 import { UnsignedBolt12Invoice } from '../structs/UnsignedBolt12Invoice.mjs';
244 import { UnsignedChannelUpdate } from '../structs/UnsignedChannelUpdate.mjs';
245 import { UnsignedNodeAnnouncement } from '../structs/UnsignedNodeAnnouncement.mjs';
246 import { UnsignedGossipMessage } from '../structs/UnsignedGossipMessage.mjs';
247 import { NodeSigner, NodeSignerInterface } from '../structs/NodeSigner.mjs';
248 import { SignerProvider, SignerProviderInterface } from '../structs/SignerProvider.mjs';
249 import { FeeEstimator, FeeEstimatorInterface } from '../structs/FeeEstimator.mjs';
250 import { Router, RouterInterface } from '../structs/Router.mjs';
251 import { TwoTuple_ThirtyTwoBytesChannelManagerZ } from '../structs/TwoTuple_ThirtyTwoBytesChannelManagerZ.mjs';
252 import { Result_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ } from '../structs/Result_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ.mjs';
253 import { MaxDustHTLCExposure } from '../structs/MaxDustHTLCExposure.mjs';
254 import { Result_MaxDustHTLCExposureDecodeErrorZ } from '../structs/Result_MaxDustHTLCExposureDecodeErrorZ.mjs';
255 import { ChannelConfig } from '../structs/ChannelConfig.mjs';
256 import { Result_ChannelConfigDecodeErrorZ } from '../structs/Result_ChannelConfigDecodeErrorZ.mjs';
257 import { Option_MaxDustHTLCExposureZ } from '../structs/Option_MaxDustHTLCExposureZ.mjs';
258 import { Option_APIErrorZ } from '../structs/Option_APIErrorZ.mjs';
259 import { Result_COption_APIErrorZDecodeErrorZ } from '../structs/Result_COption_APIErrorZDecodeErrorZ.mjs';
260 import { Result_ChannelMonitorUpdateDecodeErrorZ } from '../structs/Result_ChannelMonitorUpdateDecodeErrorZ.mjs';
261 import { Option_MonitorEventZ } from '../structs/Option_MonitorEventZ.mjs';
262 import { Result_COption_MonitorEventZDecodeErrorZ } from '../structs/Result_COption_MonitorEventZDecodeErrorZ.mjs';
263 import { Result_HTLCUpdateDecodeErrorZ } from '../structs/Result_HTLCUpdateDecodeErrorZ.mjs';
264 import { TwoTuple_OutPointCVec_u8ZZ } from '../structs/TwoTuple_OutPointCVec_u8ZZ.mjs';
265 import { TwoTuple_u32CVec_u8ZZ } from '../structs/TwoTuple_u32CVec_u8ZZ.mjs';
266 import { TwoTuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ } from '../structs/TwoTuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ.mjs';
267 import { TwoTuple_u32TxOutZ } from '../structs/TwoTuple_u32TxOutZ.mjs';
268 import { TwoTuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ } from '../structs/TwoTuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ.mjs';
269 import { Balance } from '../structs/Balance.mjs';
270 import { TwoTuple_ThirtyTwoBytesChannelMonitorZ } from '../structs/TwoTuple_ThirtyTwoBytesChannelMonitorZ.mjs';
271 import { Result_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ } from '../structs/Result_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ.mjs';
272 import { Type, TypeInterface } from '../structs/Type.mjs';
273 import { TwoTuple_PublicKeyTypeZ } from '../structs/TwoTuple_PublicKeyTypeZ.mjs';
274 import { InvoiceRequest } from '../structs/InvoiceRequest.mjs';
275 import { Bolt12Invoice } from '../structs/Bolt12Invoice.mjs';
276 import { InvoiceError } from '../structs/InvoiceError.mjs';
277 import { OffersMessage } from '../structs/OffersMessage.mjs';
278 import { Option_OffersMessageZ } from '../structs/Option_OffersMessageZ.mjs';
279 import { CustomOnionMessageContents, CustomOnionMessageContentsInterface } from '../structs/CustomOnionMessageContents.mjs';
280 import { Option_CustomOnionMessageContentsZ } from '../structs/Option_CustomOnionMessageContentsZ.mjs';
281 import { Result_COption_CustomOnionMessageContentsZDecodeErrorZ } from '../structs/Result_COption_CustomOnionMessageContentsZDecodeErrorZ.mjs';
282 import { Option_TypeZ } from '../structs/Option_TypeZ.mjs';
283 import { Result_COption_TypeZDecodeErrorZ } from '../structs/Result_COption_TypeZDecodeErrorZ.mjs';
284 import { Option_SocketAddressZ } from '../structs/Option_SocketAddressZ.mjs';
285 import { TwoTuple_PublicKeyCOption_SocketAddressZZ } from '../structs/TwoTuple_PublicKeyCOption_SocketAddressZZ.mjs';
286 import { PeerHandleError } from '../structs/PeerHandleError.mjs';
287 import { Result_CVec_u8ZPeerHandleErrorZ } from '../structs/Result_CVec_u8ZPeerHandleErrorZ.mjs';
288 import { Result_NonePeerHandleErrorZ } from '../structs/Result_NonePeerHandleErrorZ.mjs';
289 import { Result_boolPeerHandleErrorZ } from '../structs/Result_boolPeerHandleErrorZ.mjs';
290 import { GraphSyncError } from '../structs/GraphSyncError.mjs';
291 import { Result_u32GraphSyncErrorZ } from '../structs/Result_u32GraphSyncErrorZ.mjs';
292 import { Result_CVec_u8ZIOErrorZ } from '../structs/Result_CVec_u8ZIOErrorZ.mjs';
293 import { Result_NoneIOErrorZ } from '../structs/Result_NoneIOErrorZ.mjs';
294 import { Result_CVec_StrZIOErrorZ } from '../structs/Result_CVec_StrZIOErrorZ.mjs';
295 import { Result_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ } from '../structs/Result_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ.mjs';
296 import { Result_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ } from '../structs/Result_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ.mjs';
297 import { Option_SecretKeyZ } from '../structs/Option_SecretKeyZ.mjs';
298 import { VerifiedInvoiceRequest } from '../structs/VerifiedInvoiceRequest.mjs';
299 import { Result_VerifiedInvoiceRequestNoneZ } from '../structs/Result_VerifiedInvoiceRequestNoneZ.mjs';
300 import { Option_i64Z } from '../structs/Option_i64Z.mjs';
301 import { Result_SocketAddressDecodeErrorZ } from '../structs/Result_SocketAddressDecodeErrorZ.mjs';
302 import { Result_SocketAddressSocketAddressParseErrorZ } from '../structs/Result_SocketAddressSocketAddressParseErrorZ.mjs';
303 import { UpdateAddHTLC } from '../structs/UpdateAddHTLC.mjs';
304 import { UpdateFulfillHTLC } from '../structs/UpdateFulfillHTLC.mjs';
305 import { UpdateFailHTLC } from '../structs/UpdateFailHTLC.mjs';
306 import { UpdateFailMalformedHTLC } from '../structs/UpdateFailMalformedHTLC.mjs';
307 import { Result_AcceptChannelDecodeErrorZ } from '../structs/Result_AcceptChannelDecodeErrorZ.mjs';
308 import { Result_AcceptChannelV2DecodeErrorZ } from '../structs/Result_AcceptChannelV2DecodeErrorZ.mjs';
309 import { Result_TxAddInputDecodeErrorZ } from '../structs/Result_TxAddInputDecodeErrorZ.mjs';
310 import { Result_TxAddOutputDecodeErrorZ } from '../structs/Result_TxAddOutputDecodeErrorZ.mjs';
311 import { Result_TxRemoveInputDecodeErrorZ } from '../structs/Result_TxRemoveInputDecodeErrorZ.mjs';
312 import { Result_TxRemoveOutputDecodeErrorZ } from '../structs/Result_TxRemoveOutputDecodeErrorZ.mjs';
313 import { Result_TxCompleteDecodeErrorZ } from '../structs/Result_TxCompleteDecodeErrorZ.mjs';
314 import { Result_TxSignaturesDecodeErrorZ } from '../structs/Result_TxSignaturesDecodeErrorZ.mjs';
315 import { Result_TxInitRbfDecodeErrorZ } from '../structs/Result_TxInitRbfDecodeErrorZ.mjs';
316 import { Result_TxAckRbfDecodeErrorZ } from '../structs/Result_TxAckRbfDecodeErrorZ.mjs';
317 import { Result_TxAbortDecodeErrorZ } from '../structs/Result_TxAbortDecodeErrorZ.mjs';
318 import { Result_AnnouncementSignaturesDecodeErrorZ } from '../structs/Result_AnnouncementSignaturesDecodeErrorZ.mjs';
319 import { Result_ChannelReestablishDecodeErrorZ } from '../structs/Result_ChannelReestablishDecodeErrorZ.mjs';
320 import { Result_ClosingSignedDecodeErrorZ } from '../structs/Result_ClosingSignedDecodeErrorZ.mjs';
321 import { ClosingSignedFeeRange } from '../structs/ClosingSignedFeeRange.mjs';
322 import { Result_ClosingSignedFeeRangeDecodeErrorZ } from '../structs/Result_ClosingSignedFeeRangeDecodeErrorZ.mjs';
323 import { CommitmentSigned } from '../structs/CommitmentSigned.mjs';
324 import { Result_CommitmentSignedDecodeErrorZ } from '../structs/Result_CommitmentSignedDecodeErrorZ.mjs';
325 import { Result_FundingCreatedDecodeErrorZ } from '../structs/Result_FundingCreatedDecodeErrorZ.mjs';
326 import { Result_FundingSignedDecodeErrorZ } from '../structs/Result_FundingSignedDecodeErrorZ.mjs';
327 import { Result_ChannelReadyDecodeErrorZ } from '../structs/Result_ChannelReadyDecodeErrorZ.mjs';
328 import { Init } from '../structs/Init.mjs';
329 import { Result_InitDecodeErrorZ } from '../structs/Result_InitDecodeErrorZ.mjs';
330 import { Result_OpenChannelDecodeErrorZ } from '../structs/Result_OpenChannelDecodeErrorZ.mjs';
331 import { Result_OpenChannelV2DecodeErrorZ } from '../structs/Result_OpenChannelV2DecodeErrorZ.mjs';
332 import { Result_RevokeAndACKDecodeErrorZ } from '../structs/Result_RevokeAndACKDecodeErrorZ.mjs';
333 import { Result_ShutdownDecodeErrorZ } from '../structs/Result_ShutdownDecodeErrorZ.mjs';
334 import { Result_UpdateFailHTLCDecodeErrorZ } from '../structs/Result_UpdateFailHTLCDecodeErrorZ.mjs';
335 import { Result_UpdateFailMalformedHTLCDecodeErrorZ } from '../structs/Result_UpdateFailMalformedHTLCDecodeErrorZ.mjs';
336 import { UpdateFee } from '../structs/UpdateFee.mjs';
337 import { Result_UpdateFeeDecodeErrorZ } from '../structs/Result_UpdateFeeDecodeErrorZ.mjs';
338 import { Result_UpdateFulfillHTLCDecodeErrorZ } from '../structs/Result_UpdateFulfillHTLCDecodeErrorZ.mjs';
339 import { Result_UpdateAddHTLCDecodeErrorZ } from '../structs/Result_UpdateAddHTLCDecodeErrorZ.mjs';
340 import { OnionMessage } from '../structs/OnionMessage.mjs';
341 import { Result_OnionMessageDecodeErrorZ } from '../structs/Result_OnionMessageDecodeErrorZ.mjs';
342 import { Ping } from '../structs/Ping.mjs';
343 import { Result_PingDecodeErrorZ } from '../structs/Result_PingDecodeErrorZ.mjs';
344 import { Pong } from '../structs/Pong.mjs';
345 import { Result_PongDecodeErrorZ } from '../structs/Result_PongDecodeErrorZ.mjs';
346 import { Result_UnsignedChannelAnnouncementDecodeErrorZ } from '../structs/Result_UnsignedChannelAnnouncementDecodeErrorZ.mjs';
347 import { Result_ChannelAnnouncementDecodeErrorZ } from '../structs/Result_ChannelAnnouncementDecodeErrorZ.mjs';
348 import { Result_UnsignedChannelUpdateDecodeErrorZ } from '../structs/Result_UnsignedChannelUpdateDecodeErrorZ.mjs';
349 import { Result_ChannelUpdateDecodeErrorZ } from '../structs/Result_ChannelUpdateDecodeErrorZ.mjs';
350 import { Result_ErrorMessageDecodeErrorZ } from '../structs/Result_ErrorMessageDecodeErrorZ.mjs';
351 import { Result_WarningMessageDecodeErrorZ } from '../structs/Result_WarningMessageDecodeErrorZ.mjs';
352 import { Result_UnsignedNodeAnnouncementDecodeErrorZ } from '../structs/Result_UnsignedNodeAnnouncementDecodeErrorZ.mjs';
353 import { Result_NodeAnnouncementDecodeErrorZ } from '../structs/Result_NodeAnnouncementDecodeErrorZ.mjs';
354 import { Result_QueryShortChannelIdsDecodeErrorZ } from '../structs/Result_QueryShortChannelIdsDecodeErrorZ.mjs';
355 import { ReplyShortChannelIdsEnd } from '../structs/ReplyShortChannelIdsEnd.mjs';
356 import { Result_ReplyShortChannelIdsEndDecodeErrorZ } from '../structs/Result_ReplyShortChannelIdsEndDecodeErrorZ.mjs';
357 import { Result_QueryChannelRangeDecodeErrorZ } from '../structs/Result_QueryChannelRangeDecodeErrorZ.mjs';
358 import { Result_ReplyChannelRangeDecodeErrorZ } from '../structs/Result_ReplyChannelRangeDecodeErrorZ.mjs';
359 import { Result_GossipTimestampFilterDecodeErrorZ } from '../structs/Result_GossipTimestampFilterDecodeErrorZ.mjs';
360 import { Bolt11Invoice } from '../structs/Bolt11Invoice.mjs';
361 import { SignOrCreationError } from '../structs/SignOrCreationError.mjs';
362 import { Result_Bolt11InvoiceSignOrCreationErrorZ } from '../structs/Result_Bolt11InvoiceSignOrCreationErrorZ.mjs';
363 import { Result_OffersMessageDecodeErrorZ } from '../structs/Result_OffersMessageDecodeErrorZ.mjs';
364 import { Option_HTLCClaimZ } from '../structs/Option_HTLCClaimZ.mjs';
365 import { CounterpartyCommitmentSecrets } from '../structs/CounterpartyCommitmentSecrets.mjs';
366 import { Result_CounterpartyCommitmentSecretsDecodeErrorZ } from '../structs/Result_CounterpartyCommitmentSecretsDecodeErrorZ.mjs';
367 import { TxCreationKeys } from '../structs/TxCreationKeys.mjs';
368 import { Result_TxCreationKeysDecodeErrorZ } from '../structs/Result_TxCreationKeysDecodeErrorZ.mjs';
369 import { Result_ChannelPublicKeysDecodeErrorZ } from '../structs/Result_ChannelPublicKeysDecodeErrorZ.mjs';
370 import { Result_HTLCOutputInCommitmentDecodeErrorZ } from '../structs/Result_HTLCOutputInCommitmentDecodeErrorZ.mjs';
371 import { CounterpartyChannelTransactionParameters } from '../structs/CounterpartyChannelTransactionParameters.mjs';
372 import { Result_CounterpartyChannelTransactionParametersDecodeErrorZ } from '../structs/Result_CounterpartyChannelTransactionParametersDecodeErrorZ.mjs';
373 import { Result_ChannelTransactionParametersDecodeErrorZ } from '../structs/Result_ChannelTransactionParametersDecodeErrorZ.mjs';
374 import { Result_HolderCommitmentTransactionDecodeErrorZ } from '../structs/Result_HolderCommitmentTransactionDecodeErrorZ.mjs';
375 import { BuiltCommitmentTransaction } from '../structs/BuiltCommitmentTransaction.mjs';
376 import { Result_BuiltCommitmentTransactionDecodeErrorZ } from '../structs/Result_BuiltCommitmentTransactionDecodeErrorZ.mjs';
377 import { TrustedClosingTransaction } from '../structs/TrustedClosingTransaction.mjs';
378 import { Result_TrustedClosingTransactionNoneZ } from '../structs/Result_TrustedClosingTransactionNoneZ.mjs';
379 import { Result_CommitmentTransactionDecodeErrorZ } from '../structs/Result_CommitmentTransactionDecodeErrorZ.mjs';
380 import { TrustedCommitmentTransaction } from '../structs/TrustedCommitmentTransaction.mjs';
381 import { Result_TrustedCommitmentTransactionNoneZ } from '../structs/Result_TrustedCommitmentTransactionNoneZ.mjs';
382 import { Result_CVec_ECDSASignatureZNoneZ } from '../structs/Result_CVec_ECDSASignatureZNoneZ.mjs';
383 import { Option_usizeZ } from '../structs/Option_usizeZ.mjs';
384 import { Result_ShutdownScriptDecodeErrorZ } from '../structs/Result_ShutdownScriptDecodeErrorZ.mjs';
385 import { InvalidShutdownScript } from '../structs/InvalidShutdownScript.mjs';
386 import { Result_ShutdownScriptInvalidShutdownScriptZ } from '../structs/Result_ShutdownScriptInvalidShutdownScriptZ.mjs';
387 import { PaymentPurpose } from '../structs/PaymentPurpose.mjs';
388 import { Result_PaymentPurposeDecodeErrorZ } from '../structs/Result_PaymentPurposeDecodeErrorZ.mjs';
389 import { ClaimedHTLC } from '../structs/ClaimedHTLC.mjs';
390 import { Result_ClaimedHTLCDecodeErrorZ } from '../structs/Result_ClaimedHTLCDecodeErrorZ.mjs';
391 import { PathFailure } from '../structs/PathFailure.mjs';
392 import { Option_PathFailureZ } from '../structs/Option_PathFailureZ.mjs';
393 import { Result_COption_PathFailureZDecodeErrorZ } from '../structs/Result_COption_PathFailureZDecodeErrorZ.mjs';
394 import { UntrustedString } from '../structs/UntrustedString.mjs';
395 import { ClosureReason } from '../structs/ClosureReason.mjs';
396 import { Option_ClosureReasonZ } from '../structs/Option_ClosureReasonZ.mjs';
397 import { Result_COption_ClosureReasonZDecodeErrorZ } from '../structs/Result_COption_ClosureReasonZDecodeErrorZ.mjs';
398 import { HTLCDestination } from '../structs/HTLCDestination.mjs';
399 import { Option_HTLCDestinationZ } from '../structs/Option_HTLCDestinationZ.mjs';
400 import { Result_COption_HTLCDestinationZDecodeErrorZ } from '../structs/Result_COption_HTLCDestinationZDecodeErrorZ.mjs';
401 import { Result_PaymentFailureReasonDecodeErrorZ } from '../structs/Result_PaymentFailureReasonDecodeErrorZ.mjs';
402 import { Option_U128Z } from '../structs/Option_U128Z.mjs';
403 import { Option_PaymentFailureReasonZ } from '../structs/Option_PaymentFailureReasonZ.mjs';
404 import { AnchorDescriptor } from '../structs/AnchorDescriptor.mjs';
405 import { BumpTransactionEvent } from '../structs/BumpTransactionEvent.mjs';
406 import { Event } from '../structs/Event.mjs';
407 import { Option_EventZ } from '../structs/Option_EventZ.mjs';
408 import { Result_COption_EventZDecodeErrorZ } from '../structs/Result_COption_EventZDecodeErrorZ.mjs';
409 import { Bolt11ParseError } from '../structs/Bolt11ParseError.mjs';
410 import { Result_SiPrefixBolt11ParseErrorZ } from '../structs/Result_SiPrefixBolt11ParseErrorZ.mjs';
411 import { ParseOrSemanticError } from '../structs/ParseOrSemanticError.mjs';
412 import { Result_Bolt11InvoiceParseOrSemanticErrorZ } from '../structs/Result_Bolt11InvoiceParseOrSemanticErrorZ.mjs';
413 import { SignedRawBolt11Invoice } from '../structs/SignedRawBolt11Invoice.mjs';
414 import { Result_SignedRawBolt11InvoiceBolt11ParseErrorZ } from '../structs/Result_SignedRawBolt11InvoiceBolt11ParseErrorZ.mjs';
415 import { RawBolt11Invoice } from '../structs/RawBolt11Invoice.mjs';
416 import { Bolt11InvoiceSignature } from '../structs/Bolt11InvoiceSignature.mjs';
417 import { ThreeTuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ } from '../structs/ThreeTuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ.mjs';
418 import { PayeePubKey } from '../structs/PayeePubKey.mjs';
419 import { Result_PayeePubKeySecp256k1ErrorZ } from '../structs/Result_PayeePubKeySecp256k1ErrorZ.mjs';
420 import { PrivateRoute } from '../structs/PrivateRoute.mjs';
421 import { PositiveTimestamp } from '../structs/PositiveTimestamp.mjs';
422 import { Result_PositiveTimestampCreationErrorZ } from '../structs/Result_PositiveTimestampCreationErrorZ.mjs';
423 import { Result_NoneBolt11SemanticErrorZ } from '../structs/Result_NoneBolt11SemanticErrorZ.mjs';
424 import { Result_Bolt11InvoiceBolt11SemanticErrorZ } from '../structs/Result_Bolt11InvoiceBolt11SemanticErrorZ.mjs';
425 import { Description } from '../structs/Description.mjs';
426 import { Result_DescriptionCreationErrorZ } from '../structs/Result_DescriptionCreationErrorZ.mjs';
427 import { Result_PrivateRouteCreationErrorZ } from '../structs/Result_PrivateRouteCreationErrorZ.mjs';
428 import { Result_OutPointDecodeErrorZ } from '../structs/Result_OutPointDecodeErrorZ.mjs';
429 import { BigSize } from '../structs/BigSize.mjs';
430 import { Result_BigSizeDecodeErrorZ } from '../structs/Result_BigSizeDecodeErrorZ.mjs';
431 import { Result_HostnameDecodeErrorZ } from '../structs/Result_HostnameDecodeErrorZ.mjs';
432 import { TransactionU16LenLimited } from '../structs/TransactionU16LenLimited.mjs';
433 import { Result_TransactionU16LenLimitedNoneZ } from '../structs/Result_TransactionU16LenLimitedNoneZ.mjs';
434 import { Result_TransactionU16LenLimitedDecodeErrorZ } from '../structs/Result_TransactionU16LenLimitedDecodeErrorZ.mjs';
435 import { Result_UntrustedStringDecodeErrorZ } from '../structs/Result_UntrustedStringDecodeErrorZ.mjs';
436 import { ReceiveTlvs } from '../structs/ReceiveTlvs.mjs';
437 import { Result_ReceiveTlvsDecodeErrorZ } from '../structs/Result_ReceiveTlvsDecodeErrorZ.mjs';
438 import { PaymentRelay } from '../structs/PaymentRelay.mjs';
439 import { Result_PaymentRelayDecodeErrorZ } from '../structs/Result_PaymentRelayDecodeErrorZ.mjs';
440 import { PaymentConstraints } from '../structs/PaymentConstraints.mjs';
441 import { Result_PaymentConstraintsDecodeErrorZ } from '../structs/Result_PaymentConstraintsDecodeErrorZ.mjs';
442 import { PaymentError } from '../structs/PaymentError.mjs';
443 import { Result_ThirtyTwoBytesPaymentErrorZ } from '../structs/Result_ThirtyTwoBytesPaymentErrorZ.mjs';
444 import { Result_NonePaymentErrorZ } from '../structs/Result_NonePaymentErrorZ.mjs';
445 import { ProbingError } from '../structs/ProbingError.mjs';
446 import { Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ } from '../structs/Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ.mjs';
447 import { Result_StrSecp256k1ErrorZ } from '../structs/Result_StrSecp256k1ErrorZ.mjs';
448 import { OnionMessagePath } from '../structs/OnionMessagePath.mjs';
449 import { Result_OnionMessagePathNoneZ } from '../structs/Result_OnionMessagePathNoneZ.mjs';
450 import { TwoTuple_PublicKeyOnionMessageZ } from '../structs/TwoTuple_PublicKeyOnionMessageZ.mjs';
451 import { SendError } from '../structs/SendError.mjs';
452 import { Result_C2Tuple_PublicKeyOnionMessageZSendErrorZ } from '../structs/Result_C2Tuple_PublicKeyOnionMessageZSendErrorZ.mjs';
453 import { Result_NoneSendErrorZ } from '../structs/Result_NoneSendErrorZ.mjs';
454 import { Result_BlindedPathNoneZ } from '../structs/Result_BlindedPathNoneZ.mjs';
455 import { Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ } from '../structs/Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.mjs';
456 import { Result_BlindedPathDecodeErrorZ } from '../structs/Result_BlindedPathDecodeErrorZ.mjs';
457 import { Result_BlindedHopDecodeErrorZ } from '../structs/Result_BlindedHopDecodeErrorZ.mjs';
458 import { Result_InvoiceErrorDecodeErrorZ } from '../structs/Result_InvoiceErrorDecodeErrorZ.mjs';
459 import { WatchedOutput } from '../structs/WatchedOutput.mjs';
460 import { Filter, FilterInterface } from '../structs/Filter.mjs';
461 import { Option_FilterZ } from '../structs/Option_FilterZ.mjs';
462 import { LockedChannelMonitor } from '../structs/LockedChannelMonitor.mjs';
463 import { Result_LockedChannelMonitorNoneZ } from '../structs/Result_LockedChannelMonitorNoneZ.mjs';
464 import { MonitorUpdateId } from '../structs/MonitorUpdateId.mjs';
465 import { TwoTuple_OutPointCVec_MonitorUpdateIdZZ } from '../structs/TwoTuple_OutPointCVec_MonitorUpdateIdZZ.mjs';
466 import { KVStore, KVStoreInterface } from '../structs/KVStore.mjs';
467 import { ChannelUsage } from '../structs/ChannelUsage.mjs';
468 import { ProbabilisticScoringFeeParameters } from '../structs/ProbabilisticScoringFeeParameters.mjs';
469 import { ScoreLookUp, ScoreLookUpInterface } from '../structs/ScoreLookUp.mjs';
470 import { ScoreUpdate, ScoreUpdateInterface } from '../structs/ScoreUpdate.mjs';
471 import { LockableScore, LockableScoreInterface } from '../structs/LockableScore.mjs';
472 import { WriteableScore, WriteableScoreInterface } from '../structs/WriteableScore.mjs';
473 import { Persister, PersisterInterface } from '../structs/Persister.mjs';
474 import { MonitorUpdatingPersister } from '../structs/MonitorUpdatingPersister.mjs';
475 import { Persist, PersistInterface } from '../structs/Persist.mjs';
476 import { PrintableString } from '../structs/PrintableString.mjs';
477 import { FutureCallback, FutureCallbackInterface } from '../structs/FutureCallback.mjs';
478 import { Future } from '../structs/Future.mjs';
479 import { ChannelHandshakeConfig } from '../structs/ChannelHandshakeConfig.mjs';
480 import { ChannelHandshakeLimits } from '../structs/ChannelHandshakeLimits.mjs';
481 import { ChannelConfigUpdate } from '../structs/ChannelConfigUpdate.mjs';
482 import { UserConfig } from '../structs/UserConfig.mjs';
483 import { BestBlock } from '../structs/BestBlock.mjs';
484 import { Listen, ListenInterface } from '../structs/Listen.mjs';
485 import { Confirm, ConfirmInterface } from '../structs/Confirm.mjs';
486 import { ChainMonitor } from '../structs/ChainMonitor.mjs';
487 import { EventHandler, EventHandlerInterface } from '../structs/EventHandler.mjs';
488 import { EventsProvider, EventsProviderInterface } from '../structs/EventsProvider.mjs';
489 import { FailureCode } from '../structs/FailureCode.mjs';
490 import { ChainParameters } from '../structs/ChainParameters.mjs';
491 import { MessageSendEventsProvider, MessageSendEventsProviderInterface } from '../structs/MessageSendEventsProvider.mjs';
492 import { ChannelMessageHandler, ChannelMessageHandlerInterface } from '../structs/ChannelMessageHandler.mjs';
493 import { ChannelManagerReadArgs } from '../structs/ChannelManagerReadArgs.mjs';
494 import { ExpandedKey } from '../structs/ExpandedKey.mjs';
495 import { Packet } from '../structs/Packet.mjs';
496 import { RoutingMessageHandler, RoutingMessageHandlerInterface } from '../structs/RoutingMessageHandler.mjs';
497 import { OnionMessageProvider, OnionMessageProviderInterface } from '../structs/OnionMessageProvider.mjs';
498 import { OnionMessageHandler, OnionMessageHandlerInterface } from '../structs/OnionMessageHandler.mjs';
499 import { CustomMessageReader, CustomMessageReaderInterface } from '../structs/CustomMessageReader.mjs';
500 import { CustomMessageHandler, CustomMessageHandlerInterface } from '../structs/CustomMessageHandler.mjs';
501 import { IgnoringMessageHandler } from '../structs/IgnoringMessageHandler.mjs';
502 import { OffersMessageHandler, OffersMessageHandlerInterface } from '../structs/OffersMessageHandler.mjs';
503 import { CustomOnionMessageHandler, CustomOnionMessageHandlerInterface } from '../structs/CustomOnionMessageHandler.mjs';
504 import { ErroringMessageHandler } from '../structs/ErroringMessageHandler.mjs';
505 import { MessageHandler } from '../structs/MessageHandler.mjs';
506 import { SocketDescriptor, SocketDescriptorInterface } from '../structs/SocketDescriptor.mjs';
507 import { PeerManager } from '../structs/PeerManager.mjs';
508 import { DirectedChannelTransactionParameters } from '../structs/DirectedChannelTransactionParameters.mjs';
509 import { OfferFeatures } from '../structs/OfferFeatures.mjs';
510 import { InvoiceRequestFeatures } from '../structs/InvoiceRequestFeatures.mjs';
511 import { Amount } from '../structs/Amount.mjs';
512 import { Quantity } from '../structs/Quantity.mjs';
513 import { TaggedHash } from '../structs/TaggedHash.mjs';
514 import { ErroneousField } from '../structs/ErroneousField.mjs';
515 import { P2PGossipSync } from '../structs/P2PGossipSync.mjs';
516 import { ReadOnlyNetworkGraph } from '../structs/ReadOnlyNetworkGraph.mjs';
517 import { DirectedChannelInfo } from '../structs/DirectedChannelInfo.mjs';
518 import { EffectiveCapacity } from '../structs/EffectiveCapacity.mjs';
519 import { DefaultRouter } from '../structs/DefaultRouter.mjs';
520 import { ScorerAccountingForInFlightHtlcs } from '../structs/ScorerAccountingForInFlightHtlcs.mjs';
521 import { Payee } from '../structs/Payee.mjs';
522 import { Score, ScoreInterface } from '../structs/Score.mjs';
523 import { MultiThreadedLockableScore } from '../structs/MultiThreadedLockableScore.mjs';
524 import { MultiThreadedScoreLockRead } from '../structs/MultiThreadedScoreLockRead.mjs';
525 import { MultiThreadedScoreLockWrite } from '../structs/MultiThreadedScoreLockWrite.mjs';
526 import { ProbabilisticScoringDecayParameters } from '../structs/ProbabilisticScoringDecayParameters.mjs';
527 import { KeysManager } from '../structs/KeysManager.mjs';
528 import { PhantomKeysManager } from '../structs/PhantomKeysManager.mjs';
529 import { Destination } from '../structs/Destination.mjs';
530 import { MessageRouter, MessageRouterInterface } from '../structs/MessageRouter.mjs';
531 import { OnionMessenger } from '../structs/OnionMessenger.mjs';
532 import { DefaultMessageRouter } from '../structs/DefaultMessageRouter.mjs';
533 import { OnionMessageContents } from '../structs/OnionMessageContents.mjs';
534 import { ForwardNode } from '../structs/ForwardNode.mjs';
535 import { ForwardTlvs } from '../structs/ForwardTlvs.mjs';
536 import { CoinSelectionSource, CoinSelectionSourceInterface } from '../structs/CoinSelectionSource.mjs';
537 import { WalletSource, WalletSourceInterface } from '../structs/WalletSource.mjs';
538 import { Wallet } from '../structs/Wallet.mjs';
539 import { BumpTransactionEventHandler } from '../structs/BumpTransactionEventHandler.mjs';
540 import { RapidGossipSync } from '../structs/RapidGossipSync.mjs';
541 import { GossipSync } from '../structs/GossipSync.mjs';
542 import { RawDataPart } from '../structs/RawDataPart.mjs';
543 import { Sha256 } from '../structs/Sha256.mjs';
544 import { ExpiryTime } from '../structs/ExpiryTime.mjs';
545 import { MinFinalCltvExpiryDelta } from '../structs/MinFinalCltvExpiryDelta.mjs';
546 import { Fallback } from '../structs/Fallback.mjs';
548 import { CommonBase, UInt5, WitnessVersion, UnqualifiedError } from './CommonBase.mjs';
549 import * as bindings from '../bindings.mjs'
553 * Manager which keeps track of a number of channels and sends messages to the appropriate
554 * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
556 * Implements [`ChannelMessageHandler`], handling the multi-channel parts and passing things through
557 * to individual Channels.
559 * Implements [`Writeable`] to write out all channel state to disk. Implies [`peer_disconnected`] for
560 * all peers during write/read (though does not modify this instance, only the instance being
561 * serialized). This will result in any channels which have not yet exchanged [`funding_created`] (i.e.,
562 * called [`funding_transaction_generated`] for outbound channels) being closed.
564 * Note that you can be a bit lazier about writing out `ChannelManager` than you can be with
565 * [`ChannelMonitor`]. With [`ChannelMonitor`] you MUST durably write each
566 * [`ChannelMonitorUpdate`] before returning from
567 * [`chain::Watch::watch_channel`]/[`update_channel`] or before completing async writes. With
568 * `ChannelManager`s, writing updates happens out-of-band (and will prevent any other
569 * `ChannelManager` operations from occurring during the serialization process). If the
570 * deserialized version is out-of-date compared to the [`ChannelMonitor`] passed by reference to
571 * [`read`], those channels will be force-closed based on the `ChannelMonitor` state and no funds
572 * will be lost (modulo on-chain transaction fees).
574 * Note that the deserializer is only implemented for `(`[`BlockHash`]`, `[`ChannelManager`]`)`, which
575 * tells you the last block hash which was connected. You should get the best block tip before using the manager.
576 * See [`chain::Listen`] and [`chain::Confirm`] for more details.
578 * Note that `ChannelManager` is responsible for tracking liveness of its channels and generating
579 * [`ChannelUpdate`] messages informing peers that the channel is temporarily disabled. To avoid
580 * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
581 * offline for a full minute. In order to track this, you must call
582 * [`timer_tick_occurred`] roughly once per minute, though it doesn't have to be perfect.
584 * To avoid trivial DoS issues, `ChannelManager` limits the number of inbound connections and
585 * inbound channels without confirmed funding transactions. This may result in nodes which we do
586 * not have a channel with being unable to connect to us or open new channels with us if we have
587 * many peers with unfunded channels.
589 * Because it is an indication of trust, inbound channels which we've accepted as 0conf are
590 * exempted from the count of unfunded channels. Similarly, outbound channels and connections are
591 * never limited. Please ensure you limit the count of such channels yourself.
593 * Rather than using a plain `ChannelManager`, it is preferable to use either a [`SimpleArcChannelManager`]
594 * a [`SimpleRefChannelManager`], for conciseness. See their documentation for more details, but
595 * essentially you should default to using a [`SimpleRefChannelManager`], and use a
596 * [`SimpleArcChannelManager`] when you require a `ChannelManager` with a static lifetime, such as when
597 * you're using lightning-net-tokio.
599 * [`peer_disconnected`]: msgs::ChannelMessageHandler::peer_disconnected
600 * [`funding_created`]: msgs::FundingCreated
601 * [`funding_transaction_generated`]: Self::funding_transaction_generated
602 * [`BlockHash`]: bitcoin::hash_types::BlockHash
603 * [`update_channel`]: chain::Watch::update_channel
604 * [`ChannelUpdate`]: msgs::ChannelUpdate
605 * [`timer_tick_occurred`]: Self::timer_tick_occurred
606 * [`read`]: ReadableArgs::read
608 export class ChannelManager extends CommonBase {
610 public constructor(_dummy: null, ptr: bigint) {
611 super(ptr, bindings.ChannelManager_free);
615 * Constructs a new `ChannelManager` to hold several channels and route between them.
617 * The current time or latest block header time can be provided as the `current_timestamp`.
619 * This is the main \"logic hub\" for all channel-related actions, and implements
620 * [`ChannelMessageHandler`].
622 * Non-proportional fees are fixed according to our risk using the provided fee estimator.
624 * Users need to notify the new `ChannelManager` when a new block is connected or
625 * disconnected using its [`block_connected`] and [`block_disconnected`] methods, starting
626 * from after [`params.best_block.block_hash`]. See [`chain::Listen`] and [`chain::Confirm`] for
629 * [`block_connected`]: chain::Listen::block_connected
630 * [`block_disconnected`]: chain::Listen::block_disconnected
631 * [`params.best_block.block_hash`]: chain::BestBlock::block_hash
633 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, current_timestamp: number): ChannelManager {
634 const ret: bigint = bindings.ChannelManager_new(CommonBase.get_ptr_of(fee_est), CommonBase.get_ptr_of(chain_monitor), CommonBase.get_ptr_of(tx_broadcaster), CommonBase.get_ptr_of(router), CommonBase.get_ptr_of(logger), CommonBase.get_ptr_of(entropy_source), CommonBase.get_ptr_of(node_signer), CommonBase.get_ptr_of(signer_provider), config == null ? 0n : CommonBase.get_ptr_of(config), params == null ? 0n : CommonBase.get_ptr_of(params), current_timestamp);
635 const ret_hu_conv: ChannelManager = new ChannelManager(null, ret);
636 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
637 CommonBase.add_ref_from(ret_hu_conv, fee_est);
638 CommonBase.add_ref_from(ret_hu_conv, chain_monitor);
639 CommonBase.add_ref_from(ret_hu_conv, tx_broadcaster);
640 CommonBase.add_ref_from(ret_hu_conv, router);
641 CommonBase.add_ref_from(ret_hu_conv, logger);
642 CommonBase.add_ref_from(ret_hu_conv, entropy_source);
643 CommonBase.add_ref_from(ret_hu_conv, node_signer);
644 CommonBase.add_ref_from(ret_hu_conv, signer_provider);
645 CommonBase.add_ref_from(ret_hu_conv, config);
646 CommonBase.add_ref_from(ret_hu_conv, params);
651 * Gets the current configuration applied to all new channels.
653 public get_current_default_configuration(): UserConfig {
654 const ret: bigint = bindings.ChannelManager_get_current_default_configuration(this.ptr);
655 const ret_hu_conv: UserConfig = new UserConfig(null, ret);
656 CommonBase.add_ref_from(ret_hu_conv, this);
661 * Creates a new outbound channel to the given remote node and with the given value.
663 * `user_channel_id` will be provided back as in
664 * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
665 * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to a
666 * randomized value for inbound channels. `user_channel_id` has no meaning inside of LDK, it
667 * is simply copied to events and otherwise ignored.
669 * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
670 * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
672 * Raises [`APIError::ChannelUnavailable`] if the channel cannot be opened due to failing to
673 * generate a shutdown scriptpubkey or destination script set by
674 * [`SignerProvider::get_shutdown_scriptpubkey`] or [`SignerProvider::get_destination_script`].
676 * Note that we do not check if you are currently connected to the given peer. If no
677 * connection is available, the outbound `open_channel` message may fail to send, resulting in
678 * the channel eventually being silently forgotten (dropped on reload).
680 * Returns the new Channel's temporary `channel_id`. This ID will appear as
681 * [`Event::FundingGenerationReady::temporary_channel_id`] and in
682 * [`ChannelDetails::channel_id`] until after
683 * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
684 * one derived from the funding transaction's TXID. If the counterparty rejects the channel
685 * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
687 * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
688 * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
689 * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
691 * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
693 public create_channel(their_network_key: Uint8Array, channel_value_satoshis: bigint, push_msat: bigint, user_channel_id: bigint, override_config: UserConfig|null): Result_ThirtyTwoBytesAPIErrorZ {
694 const ret: bigint = bindings.ChannelManager_create_channel(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_network_key, 33)), channel_value_satoshis, push_msat, bindings.encodeUint128(user_channel_id), override_config == null ? 0n : CommonBase.get_ptr_of(override_config));
695 const ret_hu_conv: Result_ThirtyTwoBytesAPIErrorZ = Result_ThirtyTwoBytesAPIErrorZ.constr_from_ptr(ret);
696 CommonBase.add_ref_from(this, override_config);
701 * Gets the list of open channels, in random order. See [`ChannelDetails`] field documentation for
704 public list_channels(): ChannelDetails[] {
705 const ret: number = bindings.ChannelManager_list_channels(this.ptr);
706 const ret_conv_16_len: number = bindings.getArrayLength(ret);
707 const ret_conv_16_arr: ChannelDetails[] = new Array(ret_conv_16_len).fill(null);
708 for (var q = 0; q < ret_conv_16_len; q++) {
709 const ret_conv_16: bigint = bindings.getU64ArrayElem(ret, q);
710 const ret_conv_16_hu_conv: ChannelDetails = new ChannelDetails(null, ret_conv_16);
711 CommonBase.add_ref_from(ret_conv_16_hu_conv, this);
712 ret_conv_16_arr[q] = ret_conv_16_hu_conv;
714 bindings.freeWasmMemory(ret)
715 return ret_conv_16_arr;
719 * Gets the list of usable channels, in random order. Useful as an argument to
720 * [`Router::find_route`] to ensure non-announced channels are used.
722 * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
723 * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
726 public list_usable_channels(): ChannelDetails[] {
727 const ret: number = bindings.ChannelManager_list_usable_channels(this.ptr);
728 const ret_conv_16_len: number = bindings.getArrayLength(ret);
729 const ret_conv_16_arr: ChannelDetails[] = new Array(ret_conv_16_len).fill(null);
730 for (var q = 0; q < ret_conv_16_len; q++) {
731 const ret_conv_16: bigint = bindings.getU64ArrayElem(ret, q);
732 const ret_conv_16_hu_conv: ChannelDetails = new ChannelDetails(null, ret_conv_16);
733 CommonBase.add_ref_from(ret_conv_16_hu_conv, this);
734 ret_conv_16_arr[q] = ret_conv_16_hu_conv;
736 bindings.freeWasmMemory(ret)
737 return ret_conv_16_arr;
741 * Gets the list of channels we have with a given counterparty, in random order.
743 public list_channels_with_counterparty(counterparty_node_id: Uint8Array): ChannelDetails[] {
744 const ret: number = bindings.ChannelManager_list_channels_with_counterparty(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(counterparty_node_id, 33)));
745 const ret_conv_16_len: number = bindings.getArrayLength(ret);
746 const ret_conv_16_arr: ChannelDetails[] = new Array(ret_conv_16_len).fill(null);
747 for (var q = 0; q < ret_conv_16_len; q++) {
748 const ret_conv_16: bigint = bindings.getU64ArrayElem(ret, q);
749 const ret_conv_16_hu_conv: ChannelDetails = new ChannelDetails(null, ret_conv_16);
750 CommonBase.add_ref_from(ret_conv_16_hu_conv, this);
751 ret_conv_16_arr[q] = ret_conv_16_hu_conv;
753 bindings.freeWasmMemory(ret)
754 return ret_conv_16_arr;
758 * Returns in an undefined order recent payments that -- if not fulfilled -- have yet to find a
759 * successful path, or have unresolved HTLCs.
761 * This can be useful for payments that may have been prepared, but ultimately not sent, as a
762 * result of a crash. If such a payment exists, is not listed here, and an
763 * [`Event::PaymentSent`] has not been received, you may consider resending the payment.
765 * [`Event::PaymentSent`]: events::Event::PaymentSent
767 public list_recent_payments(): RecentPaymentDetails[] {
768 const ret: number = bindings.ChannelManager_list_recent_payments(this.ptr);
769 const ret_conv_22_len: number = bindings.getArrayLength(ret);
770 const ret_conv_22_arr: RecentPaymentDetails[] = new Array(ret_conv_22_len).fill(null);
771 for (var w = 0; w < ret_conv_22_len; w++) {
772 const ret_conv_22: bigint = bindings.getU64ArrayElem(ret, w);
773 const ret_conv_22_hu_conv: RecentPaymentDetails = RecentPaymentDetails.constr_from_ptr(ret_conv_22);
774 CommonBase.add_ref_from(ret_conv_22_hu_conv, this);
775 ret_conv_22_arr[w] = ret_conv_22_hu_conv;
777 bindings.freeWasmMemory(ret)
778 return ret_conv_22_arr;
782 * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
783 * will be accepted on the given channel, and after additional timeout/the closing of all
784 * pending HTLCs, the channel will be closed on chain.
786 * If we are the channel initiator, we will pay between our [`Background`] and
787 * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
789 * If our counterparty is the channel initiator, we will require a channel closing
790 * transaction feerate of at least our [`Background`] feerate or the feerate which
791 * would appear on a force-closure transaction, whichever is lower. We will allow our
792 * counterparty to pay as much fee as they'd like, however.
794 * May generate a [`SendShutdown`] message event on success, which should be relayed.
796 * Raises [`APIError::ChannelUnavailable`] if the channel cannot be closed due to failing to
797 * generate a shutdown scriptpubkey or destination script set by
798 * [`SignerProvider::get_shutdown_scriptpubkey`]. A force-closure may be needed to close the
801 * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
802 * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
803 * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
804 * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
806 public close_channel(channel_id: Uint8Array, counterparty_node_id: Uint8Array): Result_NoneAPIErrorZ {
807 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)));
808 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
813 * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
814 * will be accepted on the given channel, and after additional timeout/the closing of all
815 * pending HTLCs, the channel will be closed on chain.
817 * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
818 * the channel being closed or not:
819 * If we are the channel initiator, we will pay at least this feerate on the closing
820 * transaction. The upper-bound is set by
821 * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
822 * estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
823 * If our counterparty is the channel initiator, we will refuse to accept a channel closure
824 * transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
825 * will appear on a force-closure transaction, whichever is lower).
827 * The `shutdown_script` provided will be used as the `scriptPubKey` for the closing transaction.
828 * Will fail if a shutdown script has already been set for this channel by
829 * ['ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]. The given shutdown script must
830 * also be compatible with our and the counterparty's features.
832 * May generate a [`SendShutdown`] message event on success, which should be relayed.
834 * Raises [`APIError::ChannelUnavailable`] if the channel cannot be closed due to failing to
835 * generate a shutdown scriptpubkey or destination script set by
836 * [`SignerProvider::get_shutdown_scriptpubkey`]. A force-closure may be needed to close the
839 * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
840 * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
841 * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
842 * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
844 * Note that shutdown_script (or a relevant inner pointer) may be NULL or all-0s to represent None
846 public close_channel_with_feerate_and_script(channel_id: Uint8Array, counterparty_node_id: Uint8Array, target_feerate_sats_per_1000_weight: Option_u32Z, shutdown_script: ShutdownScript|null): Result_NoneAPIErrorZ {
847 const ret: bigint = bindings.ChannelManager_close_channel_with_feerate_and_script(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(channel_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(counterparty_node_id, 33)), CommonBase.get_ptr_of(target_feerate_sats_per_1000_weight), shutdown_script == null ? 0n : CommonBase.get_ptr_of(shutdown_script));
848 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
849 CommonBase.add_ref_from(this, target_feerate_sats_per_1000_weight);
850 CommonBase.add_ref_from(this, shutdown_script);
855 * Force closes a channel, immediately broadcasting the latest local transaction(s) and
856 * rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to
857 * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding
860 public force_close_broadcasting_latest_txn(channel_id: Uint8Array, counterparty_node_id: Uint8Array): Result_NoneAPIErrorZ {
861 const ret: bigint = bindings.ChannelManager_force_close_broadcasting_latest_txn(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(channel_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(counterparty_node_id, 33)));
862 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
867 * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting
868 * the latest local transaction(s). Fails if `channel_id` is unknown to the manager, or if the
869 * `counterparty_node_id` isn't the counterparty of the corresponding channel.
871 * You can always get the latest local transaction(s) to broadcast from
872 * [`ChannelMonitor::get_latest_holder_commitment_txn`].
874 public force_close_without_broadcasting_txn(channel_id: Uint8Array, counterparty_node_id: Uint8Array): Result_NoneAPIErrorZ {
875 const ret: bigint = bindings.ChannelManager_force_close_without_broadcasting_txn(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(channel_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(counterparty_node_id, 33)));
876 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
881 * Force close all channels, immediately broadcasting the latest local commitment transaction
882 * for each to the chain and rejecting new HTLCs on each.
884 public force_close_all_channels_broadcasting_latest_txn(): void {
885 bindings.ChannelManager_force_close_all_channels_broadcasting_latest_txn(this.ptr);
889 * Force close all channels rejecting new HTLCs on each but without broadcasting the latest
890 * local transaction(s).
892 public force_close_all_channels_without_broadcasting_txn(): void {
893 bindings.ChannelManager_force_close_all_channels_without_broadcasting_txn(this.ptr);
897 * Sends a payment along a given route.
899 * Value parameters are provided via the last hop in route, see documentation for [`RouteHop`]
900 * fields for more info.
902 * May generate [`UpdateHTLCs`] message(s) event on success, which should be relayed (e.g. via
903 * [`PeerManager::process_events`]).
905 * # Avoiding Duplicate Payments
907 * If a pending payment is currently in-flight with the same [`PaymentId`] provided, this
908 * method will error with an [`APIError::InvalidRoute`]. Note, however, that once a payment
909 * is no longer pending (either via [`ChannelManager::abandon_payment`], or handling of an
910 * [`Event::PaymentSent`] or [`Event::PaymentFailed`]) LDK will not stop you from sending a
911 * second payment with the same [`PaymentId`].
913 * Thus, in order to ensure duplicate payments are not sent, you should implement your own
914 * tracking of payments, including state to indicate once a payment has completed. Because you
915 * should also ensure that [`PaymentHash`]es are not re-used, for simplicity, you should
916 * consider using the [`PaymentHash`] as the key for tracking payments. In that case, the
917 * [`PaymentId`] should be a copy of the [`PaymentHash`] bytes.
919 * Additionally, in the scenario where we begin the process of sending a payment, but crash
920 * before `send_payment` returns (or prior to [`ChannelMonitorUpdate`] persistence if you're
921 * using [`ChannelMonitorUpdateStatus::InProgress`]), the payment may be lost on restart. See
922 * [`ChannelManager::list_recent_payments`] for more information.
924 * # Possible Error States on [`PaymentSendFailure`]
926 * Each path may have a different return value, and [`PaymentSendFailure`] may return a `Vec` with
927 * each entry matching the corresponding-index entry in the route paths, see
928 * [`PaymentSendFailure`] for more info.
930 * In general, a path may raise:
931 * [`APIError::InvalidRoute`] when an invalid route or forwarding parameter (cltv_delta, fee,
932 * node public key) is specified.
933 * [`APIError::ChannelUnavailable`] if the next-hop channel is not available as it has been
934 * closed, doesn't exist, or the peer is currently disconnected.
935 * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the
938 * Note that depending on the type of the [`PaymentSendFailure`] the HTLC may have been
939 * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
940 * different route unless you intend to pay twice!
942 * [`RouteHop`]: crate::routing::router::RouteHop
943 * [`Event::PaymentSent`]: events::Event::PaymentSent
944 * [`Event::PaymentFailed`]: events::Event::PaymentFailed
945 * [`UpdateHTLCs`]: events::MessageSendEvent::UpdateHTLCs
946 * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
947 * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
949 public send_payment_with_route(route: Route, payment_hash: Uint8Array, recipient_onion: RecipientOnionFields, payment_id: Uint8Array): Result_NonePaymentSendFailureZ {
950 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)));
951 const ret_hu_conv: Result_NonePaymentSendFailureZ = Result_NonePaymentSendFailureZ.constr_from_ptr(ret);
952 CommonBase.add_ref_from(this, route);
953 CommonBase.add_ref_from(this, recipient_onion);
958 * Similar to [`ChannelManager::send_payment_with_route`], but will automatically find a route based on
959 * `route_params` and retry failed payment paths based on `retry_strategy`.
961 public send_payment(payment_hash: Uint8Array, recipient_onion: RecipientOnionFields, payment_id: Uint8Array, route_params: RouteParameters, retry_strategy: Retry): Result_NoneRetryableSendFailureZ {
962 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));
963 const ret_hu_conv: Result_NoneRetryableSendFailureZ = Result_NoneRetryableSendFailureZ.constr_from_ptr(ret);
964 CommonBase.add_ref_from(this, recipient_onion);
965 CommonBase.add_ref_from(this, route_params);
966 CommonBase.add_ref_from(this, retry_strategy);
971 * Signals that no further attempts for the given payment should occur. Useful if you have a
972 * pending outbound payment with retries remaining, but wish to stop retrying the payment before
973 * retries are exhausted.
977 * If no [`Event::PaymentFailed`] event had been generated before, one will be generated as soon
978 * as there are no remaining pending HTLCs for this payment.
980 * Note that calling this method does *not* prevent a payment from succeeding. You must still
981 * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
982 * determine the ultimate status of a payment.
986 * If an [`Event::PaymentFailed`] is generated and we restart without first persisting the
987 * [`ChannelManager`], another [`Event::PaymentFailed`] may be generated.
989 public abandon_payment(payment_id: Uint8Array): void {
990 bindings.ChannelManager_abandon_payment(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32)));
994 * Send a spontaneous payment, which is a payment that does not require the recipient to have
995 * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
996 * the preimage, it must be a cryptographically secure random value that no intermediate node
997 * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
998 * never reach the recipient.
1000 * See [`send_payment`] documentation for more details on the return value of this function
1001 * and idempotency guarantees provided by the [`PaymentId`] key.
1003 * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
1004 * [`send_payment`] for more information about the risks of duplicate preimage usage.
1006 * [`send_payment`]: Self::send_payment
1008 public send_spontaneous_payment(route: Route, payment_preimage: Option_ThirtyTwoBytesZ, recipient_onion: RecipientOnionFields, payment_id: Uint8Array): Result_ThirtyTwoBytesPaymentSendFailureZ {
1009 const ret: bigint = bindings.ChannelManager_send_spontaneous_payment(this.ptr, route == null ? 0n : CommonBase.get_ptr_of(route), CommonBase.get_ptr_of(payment_preimage), recipient_onion == null ? 0n : CommonBase.get_ptr_of(recipient_onion), bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32)));
1010 const ret_hu_conv: Result_ThirtyTwoBytesPaymentSendFailureZ = Result_ThirtyTwoBytesPaymentSendFailureZ.constr_from_ptr(ret);
1011 CommonBase.add_ref_from(this, route);
1012 CommonBase.add_ref_from(this, payment_preimage);
1013 CommonBase.add_ref_from(this, recipient_onion);
1018 * Similar to [`ChannelManager::send_spontaneous_payment`], but will automatically find a route
1019 * based on `route_params` and retry failed payment paths based on `retry_strategy`.
1021 * See [`PaymentParameters::for_keysend`] for help in constructing `route_params` for spontaneous
1024 * [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend
1026 public send_spontaneous_payment_with_retry(payment_preimage: Option_ThirtyTwoBytesZ, recipient_onion: RecipientOnionFields, payment_id: Uint8Array, route_params: RouteParameters, retry_strategy: Retry): Result_ThirtyTwoBytesRetryableSendFailureZ {
1027 const ret: bigint = bindings.ChannelManager_send_spontaneous_payment_with_retry(this.ptr, CommonBase.get_ptr_of(payment_preimage), 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));
1028 const ret_hu_conv: Result_ThirtyTwoBytesRetryableSendFailureZ = Result_ThirtyTwoBytesRetryableSendFailureZ.constr_from_ptr(ret);
1029 CommonBase.add_ref_from(this, payment_preimage);
1030 CommonBase.add_ref_from(this, recipient_onion);
1031 CommonBase.add_ref_from(this, route_params);
1032 CommonBase.add_ref_from(this, retry_strategy);
1037 * Send a payment that is probing the given route for liquidity. We calculate the
1038 * [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows
1039 * us to easily discern them from real payments.
1041 public send_probe(path: Path): Result_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
1042 const ret: bigint = bindings.ChannelManager_send_probe(this.ptr, path == null ? 0n : CommonBase.get_ptr_of(path));
1043 const ret_hu_conv: Result_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ = Result_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ.constr_from_ptr(ret);
1044 CommonBase.add_ref_from(this, path);
1049 * Sends payment probes over all paths of a route that would be used to pay the given
1050 * amount to the given `node_id`.
1052 * See [`ChannelManager::send_preflight_probes`] for more information.
1054 public send_spontaneous_preflight_probes(node_id: Uint8Array, amount_msat: bigint, final_cltv_expiry_delta: number, liquidity_limit_multiplier: Option_u64Z): Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
1055 const ret: bigint = bindings.ChannelManager_send_spontaneous_preflight_probes(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(node_id, 33)), amount_msat, final_cltv_expiry_delta, CommonBase.get_ptr_of(liquidity_limit_multiplier));
1056 const ret_hu_conv: Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ = Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ.constr_from_ptr(ret);
1057 CommonBase.add_ref_from(this, liquidity_limit_multiplier);
1062 * Sends payment probes over all paths of a route that would be used to pay a route found
1063 * according to the given [`RouteParameters`].
1065 * This may be used to send \"pre-flight\" probes, i.e., to train our scorer before conducting
1066 * the actual payment. Note this is only useful if there likely is sufficient time for the
1067 * probe to settle before sending out the actual payment, e.g., when waiting for user
1068 * confirmation in a wallet UI.
1070 * Otherwise, there is a chance the probe could take up some liquidity needed to complete the
1071 * actual payment. Users should therefore be cautious and might avoid sending probes if
1072 * liquidity is scarce and/or they don't expect the probe to return before they send the
1073 * payment. To mitigate this issue, channels with available liquidity less than the required
1074 * amount times the given `liquidity_limit_multiplier` won't be used to send pre-flight
1075 * probes. If `None` is given as `liquidity_limit_multiplier`, it defaults to `3`.
1077 public send_preflight_probes(route_params: RouteParameters, liquidity_limit_multiplier: Option_u64Z): Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
1078 const ret: bigint = bindings.ChannelManager_send_preflight_probes(this.ptr, route_params == null ? 0n : CommonBase.get_ptr_of(route_params), CommonBase.get_ptr_of(liquidity_limit_multiplier));
1079 const ret_hu_conv: Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ = Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ.constr_from_ptr(ret);
1080 CommonBase.add_ref_from(this, route_params);
1081 CommonBase.add_ref_from(this, liquidity_limit_multiplier);
1086 * Call this upon creation of a funding transaction for the given channel.
1088 * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
1089 * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
1091 * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation
1092 * across the p2p network.
1094 * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
1095 * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
1097 * May panic if the output found in the funding transaction is duplicative with some other
1098 * channel (note that this should be trivially prevented by using unique funding transaction
1099 * keys per-channel).
1101 * Do NOT broadcast the funding transaction yourself. When we have safely received our
1102 * counterparty's signature the funding transaction will automatically be broadcast via the
1103 * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
1105 * Note that this includes RBF or similar transaction replacement strategies - lightning does
1106 * not currently support replacing a funding transaction on an existing channel. Instead,
1107 * create a new channel with a conflicting funding transaction.
1109 * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend
1110 * the wallet software generating the funding transaction to apply anti-fee sniping as
1111 * implemented by Bitcoin Core wallet. See <https://bitcoinops.org/en/topics/fee-sniping/>
1114 * [`Event::FundingGenerationReady`]: crate::events::Event::FundingGenerationReady
1115 * [`Event::ChannelClosed`]: crate::events::Event::ChannelClosed
1117 public funding_transaction_generated(temporary_channel_id: Uint8Array, counterparty_node_id: Uint8Array, funding_transaction: Uint8Array): Result_NoneAPIErrorZ {
1118 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));
1119 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
1124 * Call this upon creation of a batch funding transaction for the given channels.
1126 * Return values are identical to [`Self::funding_transaction_generated`], respective to
1127 * each individual channel and transaction output.
1129 * Do NOT broadcast the funding transaction yourself. This batch funding transcaction
1130 * will only be broadcast when we have safely received and persisted the counterparty's
1131 * signature for each channel.
1133 * If there is an error, all channels in the batch are to be considered closed.
1135 public batch_funding_transaction_generated(temporary_channels: TwoTuple_ThirtyTwoBytesPublicKeyZ[], funding_transaction: Uint8Array): Result_NoneAPIErrorZ {
1136 const ret: bigint = bindings.ChannelManager_batch_funding_transaction_generated(this.ptr, bindings.encodeUint64Array(temporary_channels.map(temporary_channels_conv_35 => temporary_channels_conv_35 != null ? CommonBase.get_ptr_of(temporary_channels_conv_35) : 0n)), bindings.encodeUint8Array(funding_transaction));
1137 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
1142 * Atomically applies partial updates to the [`ChannelConfig`] of the given channels.
1144 * Once the updates are applied, each eligible channel (advertised with a known short channel
1145 * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`],
1146 * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated
1147 * containing the new [`ChannelUpdate`] message which should be broadcast to the network.
1149 * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect
1150 * `counterparty_node_id` is provided.
1152 * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value
1153 * below [`MIN_CLTV_EXPIRY_DELTA`].
1155 * If an error is returned, none of the updates should be considered applied.
1157 * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
1158 * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat
1159 * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta
1160 * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate
1161 * [`ChannelUpdate`]: msgs::ChannelUpdate
1162 * [`ChannelUnavailable`]: APIError::ChannelUnavailable
1163 * [`APIMisuseError`]: APIError::APIMisuseError
1165 public update_partial_channel_config(counterparty_node_id: Uint8Array, channel_ids: Uint8Array[], config_update: ChannelConfigUpdate): Result_NoneAPIErrorZ {
1166 const ret: bigint = bindings.ChannelManager_update_partial_channel_config(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(counterparty_node_id, 33)), bindings.encodeUint32Array(channel_ids.map(channel_ids_conv_12 => bindings.encodeUint8Array(bindings.check_arr_len(channel_ids_conv_12, 32)))), config_update == null ? 0n : CommonBase.get_ptr_of(config_update));
1167 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
1168 CommonBase.add_ref_from(this, config_update);
1173 * Atomically updates the [`ChannelConfig`] for the given channels.
1175 * Once the updates are applied, each eligible channel (advertised with a known short channel
1176 * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`],
1177 * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated
1178 * containing the new [`ChannelUpdate`] message which should be broadcast to the network.
1180 * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect
1181 * `counterparty_node_id` is provided.
1183 * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value
1184 * below [`MIN_CLTV_EXPIRY_DELTA`].
1186 * If an error is returned, none of the updates should be considered applied.
1188 * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
1189 * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat
1190 * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta
1191 * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate
1192 * [`ChannelUpdate`]: msgs::ChannelUpdate
1193 * [`ChannelUnavailable`]: APIError::ChannelUnavailable
1194 * [`APIMisuseError`]: APIError::APIMisuseError
1196 public update_channel_config(counterparty_node_id: Uint8Array, channel_ids: Uint8Array[], config: ChannelConfig): Result_NoneAPIErrorZ {
1197 const ret: bigint = bindings.ChannelManager_update_channel_config(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(counterparty_node_id, 33)), bindings.encodeUint32Array(channel_ids.map(channel_ids_conv_12 => bindings.encodeUint8Array(bindings.check_arr_len(channel_ids_conv_12, 32)))), config == null ? 0n : CommonBase.get_ptr_of(config));
1198 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
1199 CommonBase.add_ref_from(this, config);
1204 * Attempts to forward an intercepted HTLC over the provided channel id and with the provided
1205 * amount to forward. Should only be called in response to an [`HTLCIntercepted`] event.
1207 * Intercepted HTLCs can be useful for Lightning Service Providers (LSPs) to open a just-in-time
1208 * channel to a receiving node if the node lacks sufficient inbound liquidity.
1210 * To make use of intercepted HTLCs, set [`UserConfig::accept_intercept_htlcs`] and use
1211 * [`ChannelManager::get_intercept_scid`] to generate short channel id(s) to put in the
1212 * receiver's invoice route hints. These route hints will signal to LDK to generate an
1213 * [`HTLCIntercepted`] event when it receives the forwarded HTLC, and this method or
1214 * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to the event.
1216 * Note that LDK does not enforce fee requirements in `amt_to_forward_msat`, and will not stop
1217 * you from forwarding more than you received. See
1218 * [`HTLCIntercepted::expected_outbound_amount_msat`] for more on forwarding a different amount
1221 * Errors if the event was not handled in time, in which case the HTLC was automatically failed
1224 * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
1225 * [`HTLCIntercepted`]: events::Event::HTLCIntercepted
1226 * [`HTLCIntercepted::expected_outbound_amount_msat`]: events::Event::HTLCIntercepted::expected_outbound_amount_msat
1228 public forward_intercepted_htlc(intercept_id: Uint8Array, next_hop_channel_id: Uint8Array, next_node_id: Uint8Array, amt_to_forward_msat: bigint): Result_NoneAPIErrorZ {
1229 const ret: bigint = bindings.ChannelManager_forward_intercepted_htlc(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(intercept_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(next_hop_channel_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(next_node_id, 33)), amt_to_forward_msat);
1230 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
1235 * Fails the intercepted HTLC indicated by intercept_id. Should only be called in response to
1236 * an [`HTLCIntercepted`] event. See [`ChannelManager::forward_intercepted_htlc`].
1238 * Errors if the event was not handled in time, in which case the HTLC was automatically failed
1241 * [`HTLCIntercepted`]: events::Event::HTLCIntercepted
1243 public fail_intercepted_htlc(intercept_id: Uint8Array): Result_NoneAPIErrorZ {
1244 const ret: bigint = bindings.ChannelManager_fail_intercepted_htlc(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(intercept_id, 32)));
1245 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
1250 * Processes HTLCs which are pending waiting on random forward delay.
1252 * Should only really ever be called in response to a PendingHTLCsForwardable event.
1253 * Will likely generate further events.
1255 public process_pending_htlc_forwards(): void {
1256 bindings.ChannelManager_process_pending_htlc_forwards(this.ptr);
1260 * Performs actions which should happen on startup and roughly once per minute thereafter.
1262 * This currently includes:
1263 * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
1264 * Broadcasting [`ChannelUpdate`] messages if we've been disconnected from our peer for more
1265 * than a minute, informing the network that they should no longer attempt to route over
1267 * Expiring a channel's previous [`ChannelConfig`] if necessary to only allow forwarding HTLCs
1268 * with the current [`ChannelConfig`].
1269 * Removing peers which have disconnected but and no longer have any channels.
1270 * Force-closing and removing channels which have not completed establishment in a timely manner.
1272 * Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate
1275 * [`ChannelUpdate`]: msgs::ChannelUpdate
1276 * [`ChannelConfig`]: crate::util::config::ChannelConfig
1278 public timer_tick_occurred(): void {
1279 bindings.ChannelManager_timer_tick_occurred(this.ptr);
1283 * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
1284 * after a PaymentClaimable event, failing the HTLC back to its origin and freeing resources
1285 * along the path (including in our own channel on which we received it).
1287 * Note that in some cases around unclean shutdown, it is possible the payment may have
1288 * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a
1289 * second copy of) the [`events::Event::PaymentClaimable`] event. Alternatively, the payment
1290 * may have already been failed automatically by LDK if it was nearing its expiration time.
1292 * While LDK will never claim a payment automatically on your behalf (i.e. without you calling
1293 * [`ChannelManager::claim_funds`]), you should still monitor for
1294 * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on
1295 * startup during which time claims that were in-progress at shutdown may be replayed.
1297 public fail_htlc_backwards(payment_hash: Uint8Array): void {
1298 bindings.ChannelManager_fail_htlc_backwards(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)));
1302 * This is a variant of [`ChannelManager::fail_htlc_backwards`] that allows you to specify the
1303 * reason for the failure.
1305 * See [`FailureCode`] for valid failure codes.
1307 public fail_htlc_backwards_with_reason(payment_hash: Uint8Array, failure_code: FailureCode): void {
1308 bindings.ChannelManager_fail_htlc_backwards_with_reason(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), CommonBase.get_ptr_of(failure_code));
1309 CommonBase.add_ref_from(this, failure_code);
1313 * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any
1314 * [`MessageSendEvent`]s needed to claim the payment.
1316 * This method is guaranteed to ensure the payment has been claimed but only if the current
1317 * height is strictly below [`Event::PaymentClaimable::claim_deadline`]. To avoid race
1318 * conditions, you should wait for an [`Event::PaymentClaimed`] before considering the payment
1319 * successful. It will generally be available in the next [`process_pending_events`] call.
1321 * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
1322 * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentClaimable`
1323 * event matches your expectation. If you fail to do so and call this method, you may provide
1324 * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
1326 * This function will fail the payment if it has custom TLVs with even type numbers, as we
1327 * will assume they are unknown. If you intend to accept even custom TLVs, you should use
1328 * [`claim_funds_with_known_custom_tlvs`].
1330 * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable
1331 * [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline
1332 * [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed
1333 * [`process_pending_events`]: EventsProvider::process_pending_events
1334 * [`create_inbound_payment`]: Self::create_inbound_payment
1335 * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
1336 * [`claim_funds_with_known_custom_tlvs`]: Self::claim_funds_with_known_custom_tlvs
1338 public claim_funds(payment_preimage: Uint8Array): void {
1339 bindings.ChannelManager_claim_funds(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(payment_preimage, 32)));
1343 * This is a variant of [`claim_funds`] that allows accepting a payment with custom TLVs with
1344 * even type numbers.
1348 * You MUST check you've understood all even TLVs before using this to
1349 * claim, otherwise you may unintentionally agree to some protocol you do not understand.
1351 * [`claim_funds`]: Self::claim_funds
1353 public claim_funds_with_known_custom_tlvs(payment_preimage: Uint8Array): void {
1354 bindings.ChannelManager_claim_funds_with_known_custom_tlvs(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(payment_preimage, 32)));
1358 * Gets the node_id held by this ChannelManager
1360 public get_our_node_id(): Uint8Array {
1361 const ret: number = bindings.ChannelManager_get_our_node_id(this.ptr);
1362 const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
1367 * Accepts a request to open a channel after a [`Event::OpenChannelRequest`].
1369 * The `temporary_channel_id` parameter indicates which inbound channel should be accepted,
1370 * and the `counterparty_node_id` parameter is the id of the peer which has requested to open
1373 * The `user_channel_id` parameter will be provided back in
1374 * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
1375 * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
1377 * Note that this method will return an error and reject the channel, if it requires support
1378 * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be
1379 * used to accept such channels.
1381 * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
1382 * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
1384 public accept_inbound_channel(temporary_channel_id: Uint8Array, counterparty_node_id: Uint8Array, user_channel_id: bigint): Result_NoneAPIErrorZ {
1385 const ret: bigint = bindings.ChannelManager_accept_inbound_channel(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(temporary_channel_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(counterparty_node_id, 33)), bindings.encodeUint128(user_channel_id));
1386 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
1391 * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating
1392 * it as confirmed immediately.
1394 * The `user_channel_id` parameter will be provided back in
1395 * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
1396 * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
1398 * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel
1399 * and (if the counterparty agrees), enables forwarding of payments immediately.
1401 * This fully trusts that the counterparty has honestly and correctly constructed the funding
1402 * transaction and blindly assumes that it will eventually confirm.
1404 * If it does not confirm before we decide to close the channel, or if the funding transaction
1405 * does not pay to the correct script the correct amount, *you will lose funds*.
1407 * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
1408 * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
1410 public accept_inbound_channel_from_trusted_peer_0conf(temporary_channel_id: Uint8Array, counterparty_node_id: Uint8Array, user_channel_id: bigint): Result_NoneAPIErrorZ {
1411 const ret: bigint = bindings.ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(temporary_channel_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(counterparty_node_id, 33)), bindings.encodeUint128(user_channel_id));
1412 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
1417 * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
1420 * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
1421 * [`PaymentHash`] and [`PaymentPreimage`] for you.
1423 * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentClaimable`], which
1424 * will have the [`PaymentClaimable::purpose`] be [`PaymentPurpose::InvoicePayment`] with
1425 * its [`PaymentPurpose::InvoicePayment::payment_preimage`] field filled in. That should then be
1426 * passed directly to [`claim_funds`].
1428 * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
1430 * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
1431 * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
1435 * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
1436 * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
1438 * Errors if `min_value_msat` is greater than total bitcoin supply.
1440 * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
1441 * on versions of LDK prior to 0.0.114.
1443 * [`claim_funds`]: Self::claim_funds
1444 * [`PaymentClaimable`]: events::Event::PaymentClaimable
1445 * [`PaymentClaimable::purpose`]: events::Event::PaymentClaimable::purpose
1446 * [`PaymentPurpose::InvoicePayment`]: events::PaymentPurpose::InvoicePayment
1447 * [`PaymentPurpose::InvoicePayment::payment_preimage`]: events::PaymentPurpose::InvoicePayment::payment_preimage
1448 * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
1450 public create_inbound_payment(min_value_msat: Option_u64Z, invoice_expiry_delta_secs: number, min_final_cltv_expiry_delta: Option_u16Z): Result_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
1451 const ret: bigint = bindings.ChannelManager_create_inbound_payment(this.ptr, CommonBase.get_ptr_of(min_value_msat), invoice_expiry_delta_secs, CommonBase.get_ptr_of(min_final_cltv_expiry_delta));
1452 const ret_hu_conv: Result_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ = Result_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ.constr_from_ptr(ret);
1453 CommonBase.add_ref_from(this, min_value_msat);
1454 CommonBase.add_ref_from(this, min_final_cltv_expiry_delta);
1459 * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
1460 * stored external to LDK.
1462 * A [`PaymentClaimable`] event will only be generated if the [`PaymentSecret`] matches a
1463 * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
1464 * the `min_value_msat` provided here, if one is provided.
1466 * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
1467 * note that LDK will not stop you from registering duplicate payment hashes for inbound
1470 * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
1471 * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
1472 * before a [`PaymentClaimable`] event will be generated, ensuring that we do not provide the
1473 * sender \"proof-of-payment\" unless they have paid the required amount.
1475 * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
1476 * in excess of the current time. This should roughly match the expiry time set in the invoice.
1477 * After this many seconds, we will remove the inbound payment, resulting in any attempts to
1478 * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
1479 * invoices when no timeout is set.
1481 * Note that we use block header time to time-out pending inbound payments (with some margin
1482 * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
1483 * accept a payment and generate a [`PaymentClaimable`] event for some time after the expiry.
1484 * If you need exact expiry semantics, you should enforce them upon receipt of
1485 * [`PaymentClaimable`].
1487 * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry_delta`
1488 * set to at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
1490 * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
1491 * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
1495 * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
1496 * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
1498 * Errors if `min_value_msat` is greater than total bitcoin supply.
1500 * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
1501 * on versions of LDK prior to 0.0.114.
1503 * [`create_inbound_payment`]: Self::create_inbound_payment
1504 * [`PaymentClaimable`]: events::Event::PaymentClaimable
1506 public create_inbound_payment_for_hash(payment_hash: Uint8Array, min_value_msat: Option_u64Z, invoice_expiry_delta_secs: number, min_final_cltv_expiry: Option_u16Z): Result_ThirtyTwoBytesNoneZ {
1507 const ret: bigint = bindings.ChannelManager_create_inbound_payment_for_hash(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), CommonBase.get_ptr_of(min_value_msat), invoice_expiry_delta_secs, CommonBase.get_ptr_of(min_final_cltv_expiry));
1508 const ret_hu_conv: Result_ThirtyTwoBytesNoneZ = Result_ThirtyTwoBytesNoneZ.constr_from_ptr(ret);
1509 CommonBase.add_ref_from(this, min_value_msat);
1510 CommonBase.add_ref_from(this, min_final_cltv_expiry);
1515 * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
1516 * previously returned from [`create_inbound_payment`].
1518 * [`create_inbound_payment`]: Self::create_inbound_payment
1520 public get_payment_preimage(payment_hash: Uint8Array, payment_secret: Uint8Array): Result_ThirtyTwoBytesAPIErrorZ {
1521 const ret: bigint = bindings.ChannelManager_get_payment_preimage(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), bindings.encodeUint8Array(bindings.check_arr_len(payment_secret, 32)));
1522 const ret_hu_conv: Result_ThirtyTwoBytesAPIErrorZ = Result_ThirtyTwoBytesAPIErrorZ.constr_from_ptr(ret);
1527 * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
1528 * are used when constructing the phantom invoice's route hints.
1530 * [phantom node payments]: crate::sign::PhantomKeysManager
1532 public get_phantom_scid(): bigint {
1533 const ret: bigint = bindings.ChannelManager_get_phantom_scid(this.ptr);
1538 * Gets route hints for use in receiving [phantom node payments].
1540 * [phantom node payments]: crate::sign::PhantomKeysManager
1542 public get_phantom_route_hints(): PhantomRouteHints {
1543 const ret: bigint = bindings.ChannelManager_get_phantom_route_hints(this.ptr);
1544 const ret_hu_conv: PhantomRouteHints = new PhantomRouteHints(null, ret);
1545 CommonBase.add_ref_from(ret_hu_conv, this);
1550 * Gets a fake short channel id for use in receiving intercepted payments. These fake scids are
1551 * used when constructing the route hints for HTLCs intended to be intercepted. See
1552 * [`ChannelManager::forward_intercepted_htlc`].
1554 * Note that this method is not guaranteed to return unique values, you may need to call it a few
1555 * times to get a unique scid.
1557 public get_intercept_scid(): bigint {
1558 const ret: bigint = bindings.ChannelManager_get_intercept_scid(this.ptr);
1563 * Gets inflight HTLC information by processing pending outbound payments that are in
1564 * our channels. May be used during pathfinding to account for in-use channel liquidity.
1566 public compute_inflight_htlcs(): InFlightHtlcs {
1567 const ret: bigint = bindings.ChannelManager_compute_inflight_htlcs(this.ptr);
1568 const ret_hu_conv: InFlightHtlcs = new InFlightHtlcs(null, ret);
1569 CommonBase.add_ref_from(ret_hu_conv, this);
1574 * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
1575 * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
1577 public as_MessageSendEventsProvider(): MessageSendEventsProvider {
1578 const ret: bigint = bindings.ChannelManager_as_MessageSendEventsProvider(this.ptr);
1579 const ret_hu_conv: MessageSendEventsProvider = new MessageSendEventsProvider(null, ret);
1580 CommonBase.add_ref_from(ret_hu_conv, this);
1585 * Constructs a new EventsProvider which calls the relevant methods on this_arg.
1586 * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
1588 public as_EventsProvider(): EventsProvider {
1589 const ret: bigint = bindings.ChannelManager_as_EventsProvider(this.ptr);
1590 const ret_hu_conv: EventsProvider = new EventsProvider(null, ret);
1591 CommonBase.add_ref_from(ret_hu_conv, this);
1596 * Constructs a new Listen which calls the relevant methods on this_arg.
1597 * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
1599 public as_Listen(): Listen {
1600 const ret: bigint = bindings.ChannelManager_as_Listen(this.ptr);
1601 const ret_hu_conv: Listen = new Listen(null, ret);
1602 CommonBase.add_ref_from(ret_hu_conv, this);
1607 * Constructs a new Confirm which calls the relevant methods on this_arg.
1608 * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
1610 public as_Confirm(): Confirm {
1611 const ret: bigint = bindings.ChannelManager_as_Confirm(this.ptr);
1612 const ret_hu_conv: Confirm = new Confirm(null, ret);
1613 CommonBase.add_ref_from(ret_hu_conv, this);
1618 * Gets a [`Future`] that completes when this [`ChannelManager`] may need to be persisted or
1619 * may have events that need processing.
1621 * In order to check if this [`ChannelManager`] needs persisting, call
1622 * [`Self::get_and_clear_needs_persistence`].
1624 * Note that callbacks registered on the [`Future`] MUST NOT call back into this
1625 * [`ChannelManager`] and should instead register actions to be taken later.
1627 public get_event_or_persistence_needed_future(): Future {
1628 const ret: bigint = bindings.ChannelManager_get_event_or_persistence_needed_future(this.ptr);
1629 const ret_hu_conv: Future = new Future(null, ret);
1630 CommonBase.add_ref_from(ret_hu_conv, this);
1635 * Returns true if this [`ChannelManager`] needs to be persisted.
1637 public get_and_clear_needs_persistence(): boolean {
1638 const ret: boolean = bindings.ChannelManager_get_and_clear_needs_persistence(this.ptr);
1643 * Gets the latest best block which was connected either via the [`chain::Listen`] or
1644 * [`chain::Confirm`] interfaces.
1646 public current_best_block(): BestBlock {
1647 const ret: bigint = bindings.ChannelManager_current_best_block(this.ptr);
1648 const ret_hu_conv: BestBlock = new BestBlock(null, ret);
1649 CommonBase.add_ref_from(ret_hu_conv, this);
1654 * Fetches the set of [`NodeFeatures`] flags which are provided by or required by
1655 * [`ChannelManager`].
1657 public node_features(): NodeFeatures {
1658 const ret: bigint = bindings.ChannelManager_node_features(this.ptr);
1659 const ret_hu_conv: NodeFeatures = new NodeFeatures(null, ret);
1660 CommonBase.add_ref_from(ret_hu_conv, this);
1665 * Fetches the set of [`ChannelFeatures`] flags which are provided by or required by
1666 * [`ChannelManager`].
1668 public channel_features(): ChannelFeatures {
1669 const ret: bigint = bindings.ChannelManager_channel_features(this.ptr);
1670 const ret_hu_conv: ChannelFeatures = new ChannelFeatures(null, ret);
1671 CommonBase.add_ref_from(ret_hu_conv, this);
1676 * Fetches the set of [`ChannelTypeFeatures`] flags which are provided by or required by
1677 * [`ChannelManager`].
1679 public channel_type_features(): ChannelTypeFeatures {
1680 const ret: bigint = bindings.ChannelManager_channel_type_features(this.ptr);
1681 const ret_hu_conv: ChannelTypeFeatures = new ChannelTypeFeatures(null, ret);
1682 CommonBase.add_ref_from(ret_hu_conv, this);
1687 * Fetches the set of [`InitFeatures`] flags which are provided by or required by
1688 * [`ChannelManager`].
1690 public init_features(): InitFeatures {
1691 const ret: bigint = bindings.ChannelManager_init_features(this.ptr);
1692 const ret_hu_conv: InitFeatures = new InitFeatures(null, ret);
1693 CommonBase.add_ref_from(ret_hu_conv, this);
1698 * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
1699 * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
1701 public as_ChannelMessageHandler(): ChannelMessageHandler {
1702 const ret: bigint = bindings.ChannelManager_as_ChannelMessageHandler(this.ptr);
1703 const ret_hu_conv: ChannelMessageHandler = new ChannelMessageHandler(null, ret);
1704 CommonBase.add_ref_from(ret_hu_conv, this);
1709 * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
1711 public write(): Uint8Array {
1712 const ret: number = bindings.ChannelManager_write(this.ptr);
1713 const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);