[TS] Update auto-generated bindings
[ldk-java] / ts / structs / ChannelManager.mts
1 import { TxOut } from '../structs/TxOut.mjs';
2 import { BigEndianScalar } from '../structs/BigEndianScalar.mjs';
3 import { COption_NoneZ } from '../enums/COption_NoneZ.mjs';
4 import { ChannelMonitorUpdateStatus } from '../enums/ChannelMonitorUpdateStatus.mjs';
5 import { ConfirmationTarget } from '../enums/ConfirmationTarget.mjs';
6 import { CreationError } from '../enums/CreationError.mjs';
7 import { Currency } from '../enums/Currency.mjs';
8 import { FailureCode } from '../enums/FailureCode.mjs';
9 import { HTLCClaim } from '../enums/HTLCClaim.mjs';
10 import { IOError } from '../enums/IOError.mjs';
11 import { Level } from '../enums/Level.mjs';
12 import { Network } from '../enums/Network.mjs';
13 import { PaymentFailureReason } from '../enums/PaymentFailureReason.mjs';
14 import { Recipient } from '../enums/Recipient.mjs';
15 import { RetryableSendFailure } from '../enums/RetryableSendFailure.mjs';
16 import { Secp256k1Error } from '../enums/Secp256k1Error.mjs';
17 import { SemanticError } from '../enums/SemanticError.mjs';
18 import { SiPrefix } from '../enums/SiPrefix.mjs';
19 import { UtxoLookupError } from '../enums/UtxoLookupError.mjs';
20 import { Bech32Error } from '../structs/Bech32Error.mjs';
21 import { Option_DurationZ } from '../structs/Option_DurationZ.mjs';
22 import { BlindedPath } from '../structs/BlindedPath.mjs';
23 import { Option_u64Z } from '../structs/Option_u64Z.mjs';
24 import { ShutdownScript } from '../structs/ShutdownScript.mjs';
25 import { APIError } from '../structs/APIError.mjs';
26 import { Result_NoneAPIErrorZ } from '../structs/Result_NoneAPIErrorZ.mjs';
27 import { Option_CVec_u8ZZ } from '../structs/Option_CVec_u8ZZ.mjs';
28 import { RecipientOnionFields } from '../structs/RecipientOnionFields.mjs';
29 import { DecodeError } from '../structs/DecodeError.mjs';
30 import { Result_RecipientOnionFieldsDecodeErrorZ } from '../structs/Result_RecipientOnionFieldsDecodeErrorZ.mjs';
31 import { Option_HTLCClaimZ } from '../structs/Option_HTLCClaimZ.mjs';
32 import { Result_NoneNoneZ } from '../structs/Result_NoneNoneZ.mjs';
33 import { CounterpartyCommitmentSecrets } from '../structs/CounterpartyCommitmentSecrets.mjs';
34 import { Result_CounterpartyCommitmentSecretsDecodeErrorZ } from '../structs/Result_CounterpartyCommitmentSecretsDecodeErrorZ.mjs';
35 import { TxCreationKeys } from '../structs/TxCreationKeys.mjs';
36 import { Result_TxCreationKeysDecodeErrorZ } from '../structs/Result_TxCreationKeysDecodeErrorZ.mjs';
37 import { ChannelPublicKeys } from '../structs/ChannelPublicKeys.mjs';
38 import { Result_ChannelPublicKeysDecodeErrorZ } from '../structs/Result_ChannelPublicKeysDecodeErrorZ.mjs';
39 import { Option_u32Z } from '../structs/Option_u32Z.mjs';
40 import { HTLCOutputInCommitment } from '../structs/HTLCOutputInCommitment.mjs';
41 import { Result_HTLCOutputInCommitmentDecodeErrorZ } from '../structs/Result_HTLCOutputInCommitmentDecodeErrorZ.mjs';
42 import { CounterpartyChannelTransactionParameters } from '../structs/CounterpartyChannelTransactionParameters.mjs';
43 import { Result_CounterpartyChannelTransactionParametersDecodeErrorZ } from '../structs/Result_CounterpartyChannelTransactionParametersDecodeErrorZ.mjs';
44 import { ChannelTransactionParameters } from '../structs/ChannelTransactionParameters.mjs';
45 import { Result_ChannelTransactionParametersDecodeErrorZ } from '../structs/Result_ChannelTransactionParametersDecodeErrorZ.mjs';
46 import { HolderCommitmentTransaction } from '../structs/HolderCommitmentTransaction.mjs';
47 import { Result_HolderCommitmentTransactionDecodeErrorZ } from '../structs/Result_HolderCommitmentTransactionDecodeErrorZ.mjs';
48 import { BuiltCommitmentTransaction } from '../structs/BuiltCommitmentTransaction.mjs';
49 import { Result_BuiltCommitmentTransactionDecodeErrorZ } from '../structs/Result_BuiltCommitmentTransactionDecodeErrorZ.mjs';
50 import { TrustedClosingTransaction } from '../structs/TrustedClosingTransaction.mjs';
51 import { Result_TrustedClosingTransactionNoneZ } from '../structs/Result_TrustedClosingTransactionNoneZ.mjs';
52 import { CommitmentTransaction } from '../structs/CommitmentTransaction.mjs';
53 import { Result_CommitmentTransactionDecodeErrorZ } from '../structs/Result_CommitmentTransactionDecodeErrorZ.mjs';
54 import { TrustedCommitmentTransaction } from '../structs/TrustedCommitmentTransaction.mjs';
55 import { Result_TrustedCommitmentTransactionNoneZ } from '../structs/Result_TrustedCommitmentTransactionNoneZ.mjs';
56 import { Result_CVec_SignatureZNoneZ } from '../structs/Result_CVec_SignatureZNoneZ.mjs';
57 import { Result_ShutdownScriptDecodeErrorZ } from '../structs/Result_ShutdownScriptDecodeErrorZ.mjs';
58 import { InvalidShutdownScript } from '../structs/InvalidShutdownScript.mjs';
59 import { Result_ShutdownScriptInvalidShutdownScriptZ } from '../structs/Result_ShutdownScriptInvalidShutdownScriptZ.mjs';
60 import { BlindedPayInfo } from '../structs/BlindedPayInfo.mjs';
61 import { Result_BlindedPayInfoDecodeErrorZ } from '../structs/Result_BlindedPayInfoDecodeErrorZ.mjs';
62 import { ChannelDetails } from '../structs/ChannelDetails.mjs';
63 import { Route } from '../structs/Route.mjs';
64 import { LightningError } from '../structs/LightningError.mjs';
65 import { Result_RouteLightningErrorZ } from '../structs/Result_RouteLightningErrorZ.mjs';
66 import { InFlightHtlcs } from '../structs/InFlightHtlcs.mjs';
67 import { Result_InFlightHtlcsDecodeErrorZ } from '../structs/Result_InFlightHtlcsDecodeErrorZ.mjs';
68 import { RouteHop } from '../structs/RouteHop.mjs';
69 import { Result_RouteHopDecodeErrorZ } from '../structs/Result_RouteHopDecodeErrorZ.mjs';
70 import { BlindedHop } from '../structs/BlindedHop.mjs';
71 import { BlindedTail } from '../structs/BlindedTail.mjs';
72 import { Result_BlindedTailDecodeErrorZ } from '../structs/Result_BlindedTailDecodeErrorZ.mjs';
73 import { Path } from '../structs/Path.mjs';
74 import { Result_RouteDecodeErrorZ } from '../structs/Result_RouteDecodeErrorZ.mjs';
75 import { RouteParameters } from '../structs/RouteParameters.mjs';
76 import { Result_RouteParametersDecodeErrorZ } from '../structs/Result_RouteParametersDecodeErrorZ.mjs';
77 import { PaymentParameters } from '../structs/PaymentParameters.mjs';
78 import { Result_PaymentParametersDecodeErrorZ } from '../structs/Result_PaymentParametersDecodeErrorZ.mjs';
79 import { TwoTuple_BlindedPayInfoBlindedPathZ } from '../structs/TwoTuple_BlindedPayInfoBlindedPathZ.mjs';
80 import { RouteHint } from '../structs/RouteHint.mjs';
81 import { RouteHintHop } from '../structs/RouteHintHop.mjs';
82 import { Result_RouteHintDecodeErrorZ } from '../structs/Result_RouteHintDecodeErrorZ.mjs';
83 import { Result_RouteHintHopDecodeErrorZ } from '../structs/Result_RouteHintHopDecodeErrorZ.mjs';
84 import { TwoTuple_usizeTransactionZ } from '../structs/TwoTuple_usizeTransactionZ.mjs';
85 import { TwoTuple_TxidBlockHashZ } from '../structs/TwoTuple_TxidBlockHashZ.mjs';
86 import { HTLCUpdate } from '../structs/HTLCUpdate.mjs';
87 import { OutPoint } from '../structs/OutPoint.mjs';
88 import { MonitorEvent } from '../structs/MonitorEvent.mjs';
89 import { ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ } from '../structs/ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ.mjs';
90 import { FixedPenaltyScorer } from '../structs/FixedPenaltyScorer.mjs';
91 import { Result_FixedPenaltyScorerDecodeErrorZ } from '../structs/Result_FixedPenaltyScorerDecodeErrorZ.mjs';
92 import { TwoTuple_u64u64Z } from '../structs/TwoTuple_u64u64Z.mjs';
93 import { Option_C2Tuple_u64u64ZZ } from '../structs/Option_C2Tuple_u64u64ZZ.mjs';
94 import { TwoTuple_Z } from '../structs/TwoTuple_Z.mjs';
95 import { TwoTuple__u168_u168Z } from '../structs/TwoTuple__u168_u168Z.mjs';
96 import { Option_C2Tuple_EightU16sEightU16sZZ } from '../structs/Option_C2Tuple_EightU16sEightU16sZZ.mjs';
97 import { NodeId } from '../structs/NodeId.mjs';
98 import { Record } from '../structs/Record.mjs';
99 import { Logger, LoggerInterface } from '../structs/Logger.mjs';
100 import { NetworkGraph } from '../structs/NetworkGraph.mjs';
101 import { ProbabilisticScorer } from '../structs/ProbabilisticScorer.mjs';
102 import { Result_ProbabilisticScorerDecodeErrorZ } from '../structs/Result_ProbabilisticScorerDecodeErrorZ.mjs';
103 import { InitFeatures } from '../structs/InitFeatures.mjs';
104 import { Result_InitFeaturesDecodeErrorZ } from '../structs/Result_InitFeaturesDecodeErrorZ.mjs';
105 import { ChannelFeatures } from '../structs/ChannelFeatures.mjs';
106 import { Result_ChannelFeaturesDecodeErrorZ } from '../structs/Result_ChannelFeaturesDecodeErrorZ.mjs';
107 import { NodeFeatures } from '../structs/NodeFeatures.mjs';
108 import { Result_NodeFeaturesDecodeErrorZ } from '../structs/Result_NodeFeaturesDecodeErrorZ.mjs';
109 import { InvoiceFeatures } from '../structs/InvoiceFeatures.mjs';
110 import { Result_InvoiceFeaturesDecodeErrorZ } from '../structs/Result_InvoiceFeaturesDecodeErrorZ.mjs';
111 import { BlindedHopFeatures } from '../structs/BlindedHopFeatures.mjs';
112 import { Result_BlindedHopFeaturesDecodeErrorZ } from '../structs/Result_BlindedHopFeaturesDecodeErrorZ.mjs';
113 import { ChannelTypeFeatures } from '../structs/ChannelTypeFeatures.mjs';
114 import { Result_ChannelTypeFeaturesDecodeErrorZ } from '../structs/Result_ChannelTypeFeaturesDecodeErrorZ.mjs';
115 import { PaymentPurpose } from '../structs/PaymentPurpose.mjs';
116 import { Result_PaymentPurposeDecodeErrorZ } from '../structs/Result_PaymentPurposeDecodeErrorZ.mjs';
117 import { ChannelUpdate } from '../structs/ChannelUpdate.mjs';
118 import { NetworkUpdate } from '../structs/NetworkUpdate.mjs';
119 import { Option_NetworkUpdateZ } from '../structs/Option_NetworkUpdateZ.mjs';
120 import { PathFailure } from '../structs/PathFailure.mjs';
121 import { Option_PathFailureZ } from '../structs/Option_PathFailureZ.mjs';
122 import { Result_COption_PathFailureZDecodeErrorZ } from '../structs/Result_COption_PathFailureZDecodeErrorZ.mjs';
123 import { UntrustedString } from '../structs/UntrustedString.mjs';
124 import { ClosureReason } from '../structs/ClosureReason.mjs';
125 import { Option_ClosureReasonZ } from '../structs/Option_ClosureReasonZ.mjs';
126 import { Result_COption_ClosureReasonZDecodeErrorZ } from '../structs/Result_COption_ClosureReasonZDecodeErrorZ.mjs';
127 import { HTLCDestination } from '../structs/HTLCDestination.mjs';
128 import { Option_HTLCDestinationZ } from '../structs/Option_HTLCDestinationZ.mjs';
129 import { Result_COption_HTLCDestinationZDecodeErrorZ } from '../structs/Result_COption_HTLCDestinationZDecodeErrorZ.mjs';
130 import { Result_PaymentFailureReasonDecodeErrorZ } from '../structs/Result_PaymentFailureReasonDecodeErrorZ.mjs';
131 import { Option_u128Z } from '../structs/Option_u128Z.mjs';
132 import { Option_PaymentFailureReasonZ } from '../structs/Option_PaymentFailureReasonZ.mjs';
133 import { DelayedPaymentOutputDescriptor } from '../structs/DelayedPaymentOutputDescriptor.mjs';
134 import { StaticPaymentOutputDescriptor } from '../structs/StaticPaymentOutputDescriptor.mjs';
135 import { SpendableOutputDescriptor } from '../structs/SpendableOutputDescriptor.mjs';
136 import { Event } from '../structs/Event.mjs';
137 import { Option_EventZ } from '../structs/Option_EventZ.mjs';
138 import { Result_COption_EventZDecodeErrorZ } from '../structs/Result_COption_EventZDecodeErrorZ.mjs';
139 import { AcceptChannel } from '../structs/AcceptChannel.mjs';
140 import { OpenChannel } from '../structs/OpenChannel.mjs';
141 import { FundingCreated } from '../structs/FundingCreated.mjs';
142 import { FundingSigned } from '../structs/FundingSigned.mjs';
143 import { ChannelReady } from '../structs/ChannelReady.mjs';
144 import { AnnouncementSignatures } from '../structs/AnnouncementSignatures.mjs';
145 import { CommitmentUpdate } from '../structs/CommitmentUpdate.mjs';
146 import { RevokeAndACK } from '../structs/RevokeAndACK.mjs';
147 import { ClosingSigned } from '../structs/ClosingSigned.mjs';
148 import { Shutdown } from '../structs/Shutdown.mjs';
149 import { ChannelReestablish } from '../structs/ChannelReestablish.mjs';
150 import { ChannelAnnouncement } from '../structs/ChannelAnnouncement.mjs';
151 import { NodeAnnouncement } from '../structs/NodeAnnouncement.mjs';
152 import { ErrorMessage } from '../structs/ErrorMessage.mjs';
153 import { WarningMessage } from '../structs/WarningMessage.mjs';
154 import { ErrorAction } from '../structs/ErrorAction.mjs';
155 import { QueryChannelRange } from '../structs/QueryChannelRange.mjs';
156 import { QueryShortChannelIds } from '../structs/QueryShortChannelIds.mjs';
157 import { ReplyChannelRange } from '../structs/ReplyChannelRange.mjs';
158 import { GossipTimestampFilter } from '../structs/GossipTimestampFilter.mjs';
159 import { MessageSendEvent } from '../structs/MessageSendEvent.mjs';
160 import { Result_PublicKeyErrorZ } from '../structs/Result_PublicKeyErrorZ.mjs';
161 import { Result_NodeIdDecodeErrorZ } from '../structs/Result_NodeIdDecodeErrorZ.mjs';
162 import { Result_COption_NetworkUpdateZDecodeErrorZ } from '../structs/Result_COption_NetworkUpdateZDecodeErrorZ.mjs';
163 import { Result_TxOutUtxoLookupErrorZ } from '../structs/Result_TxOutUtxoLookupErrorZ.mjs';
164 import { UtxoFuture } from '../structs/UtxoFuture.mjs';
165 import { UtxoResult } from '../structs/UtxoResult.mjs';
166 import { UtxoLookup, UtxoLookupInterface } from '../structs/UtxoLookup.mjs';
167 import { Option_UtxoLookupZ } from '../structs/Option_UtxoLookupZ.mjs';
168 import { Result_boolLightningErrorZ } from '../structs/Result_boolLightningErrorZ.mjs';
169 import { ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ } from '../structs/ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.mjs';
170 import { Option_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ } from '../structs/Option_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ.mjs';
171 import { Result_NoneLightningErrorZ } from '../structs/Result_NoneLightningErrorZ.mjs';
172 import { ChannelUpdateInfo } from '../structs/ChannelUpdateInfo.mjs';
173 import { Result_ChannelUpdateInfoDecodeErrorZ } from '../structs/Result_ChannelUpdateInfoDecodeErrorZ.mjs';
174 import { ChannelInfo } from '../structs/ChannelInfo.mjs';
175 import { Result_ChannelInfoDecodeErrorZ } from '../structs/Result_ChannelInfoDecodeErrorZ.mjs';
176 import { RoutingFees } from '../structs/RoutingFees.mjs';
177 import { Result_RoutingFeesDecodeErrorZ } from '../structs/Result_RoutingFeesDecodeErrorZ.mjs';
178 import { Hostname } from '../structs/Hostname.mjs';
179 import { NetAddress } from '../structs/NetAddress.mjs';
180 import { NodeAnnouncementInfo } from '../structs/NodeAnnouncementInfo.mjs';
181 import { Result_NodeAnnouncementInfoDecodeErrorZ } from '../structs/Result_NodeAnnouncementInfoDecodeErrorZ.mjs';
182 import { NodeAlias } from '../structs/NodeAlias.mjs';
183 import { Result_NodeAliasDecodeErrorZ } from '../structs/Result_NodeAliasDecodeErrorZ.mjs';
184 import { NodeInfo } from '../structs/NodeInfo.mjs';
185 import { Result_NodeInfoDecodeErrorZ } from '../structs/Result_NodeInfoDecodeErrorZ.mjs';
186 import { Result_NetworkGraphDecodeErrorZ } from '../structs/Result_NetworkGraphDecodeErrorZ.mjs';
187 import { Option_CVec_NetAddressZZ } from '../structs/Option_CVec_NetAddressZZ.mjs';
188 import { Result_DelayedPaymentOutputDescriptorDecodeErrorZ } from '../structs/Result_DelayedPaymentOutputDescriptorDecodeErrorZ.mjs';
189 import { Result_StaticPaymentOutputDescriptorDecodeErrorZ } from '../structs/Result_StaticPaymentOutputDescriptorDecodeErrorZ.mjs';
190 import { Result_SpendableOutputDescriptorDecodeErrorZ } from '../structs/Result_SpendableOutputDescriptorDecodeErrorZ.mjs';
191 import { TwoTuple_SignatureCVec_SignatureZZ } from '../structs/TwoTuple_SignatureCVec_SignatureZZ.mjs';
192 import { Result_C2Tuple_SignatureCVec_SignatureZZNoneZ } from '../structs/Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.mjs';
193 import { Result_SignatureNoneZ } from '../structs/Result_SignatureNoneZ.mjs';
194 import { Result_PublicKeyNoneZ } from '../structs/Result_PublicKeyNoneZ.mjs';
195 import { Option_ScalarZ } from '../structs/Option_ScalarZ.mjs';
196 import { Result_SharedSecretNoneZ } from '../structs/Result_SharedSecretNoneZ.mjs';
197 import { Result_RecoverableSignatureNoneZ } from '../structs/Result_RecoverableSignatureNoneZ.mjs';
198 import { ClosingTransaction } from '../structs/ClosingTransaction.mjs';
199 import { UnsignedChannelAnnouncement } from '../structs/UnsignedChannelAnnouncement.mjs';
200 import { ChannelSigner, ChannelSignerInterface } from '../structs/ChannelSigner.mjs';
201 import { EcdsaChannelSigner, EcdsaChannelSignerInterface } from '../structs/EcdsaChannelSigner.mjs';
202 import { WriteableEcdsaChannelSigner, WriteableEcdsaChannelSignerInterface } from '../structs/WriteableEcdsaChannelSigner.mjs';
203 import { Result_WriteableEcdsaChannelSignerDecodeErrorZ } from '../structs/Result_WriteableEcdsaChannelSignerDecodeErrorZ.mjs';
204 import { Result_CVec_CVec_u8ZZNoneZ } from '../structs/Result_CVec_CVec_u8ZZNoneZ.mjs';
205 import { InMemorySigner } from '../structs/InMemorySigner.mjs';
206 import { Result_InMemorySignerDecodeErrorZ } from '../structs/Result_InMemorySignerDecodeErrorZ.mjs';
207 import { Result_TransactionNoneZ } from '../structs/Result_TransactionNoneZ.mjs';
208 import { Option_u16Z } from '../structs/Option_u16Z.mjs';
209 import { Result__u832APIErrorZ } from '../structs/Result__u832APIErrorZ.mjs';
210 import { RecentPaymentDetails } from '../structs/RecentPaymentDetails.mjs';
211 import { PaymentSendFailure } from '../structs/PaymentSendFailure.mjs';
212 import { Result_NonePaymentSendFailureZ } from '../structs/Result_NonePaymentSendFailureZ.mjs';
213 import { Result_NoneRetryableSendFailureZ } from '../structs/Result_NoneRetryableSendFailureZ.mjs';
214 import { Result_PaymentHashPaymentSendFailureZ } from '../structs/Result_PaymentHashPaymentSendFailureZ.mjs';
215 import { Result_PaymentHashRetryableSendFailureZ } from '../structs/Result_PaymentHashRetryableSendFailureZ.mjs';
216 import { TwoTuple_PaymentHashPaymentIdZ } from '../structs/TwoTuple_PaymentHashPaymentIdZ.mjs';
217 import { Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ } from '../structs/Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.mjs';
218 import { TwoTuple_PaymentHashPaymentSecretZ } from '../structs/TwoTuple_PaymentHashPaymentSecretZ.mjs';
219 import { Result_C2Tuple_PaymentHashPaymentSecretZNoneZ } from '../structs/Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.mjs';
220 import { Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ } from '../structs/Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.mjs';
221 import { Result_PaymentSecretNoneZ } from '../structs/Result_PaymentSecretNoneZ.mjs';
222 import { Result_PaymentSecretAPIErrorZ } from '../structs/Result_PaymentSecretAPIErrorZ.mjs';
223 import { Result_PaymentPreimageAPIErrorZ } from '../structs/Result_PaymentPreimageAPIErrorZ.mjs';
224 import { CounterpartyForwardingInfo } from '../structs/CounterpartyForwardingInfo.mjs';
225 import { Result_CounterpartyForwardingInfoDecodeErrorZ } from '../structs/Result_CounterpartyForwardingInfoDecodeErrorZ.mjs';
226 import { ChannelCounterparty } from '../structs/ChannelCounterparty.mjs';
227 import { Result_ChannelCounterpartyDecodeErrorZ } from '../structs/Result_ChannelCounterpartyDecodeErrorZ.mjs';
228 import { Result_ChannelDetailsDecodeErrorZ } from '../structs/Result_ChannelDetailsDecodeErrorZ.mjs';
229 import { PhantomRouteHints } from '../structs/PhantomRouteHints.mjs';
230 import { Result_PhantomRouteHintsDecodeErrorZ } from '../structs/Result_PhantomRouteHintsDecodeErrorZ.mjs';
231 import { ChannelMonitor } from '../structs/ChannelMonitor.mjs';
232 import { ChannelMonitorUpdate } from '../structs/ChannelMonitorUpdate.mjs';
233 import { Watch, WatchInterface } from '../structs/Watch.mjs';
234 import { BroadcasterInterface, BroadcasterInterfaceInterface } from '../structs/BroadcasterInterface.mjs';
235 import { EntropySource, EntropySourceInterface } from '../structs/EntropySource.mjs';
236 import { UnsignedChannelUpdate } from '../structs/UnsignedChannelUpdate.mjs';
237 import { UnsignedNodeAnnouncement } from '../structs/UnsignedNodeAnnouncement.mjs';
238 import { UnsignedGossipMessage } from '../structs/UnsignedGossipMessage.mjs';
239 import { NodeSigner, NodeSignerInterface } from '../structs/NodeSigner.mjs';
240 import { SignerProvider, SignerProviderInterface } from '../structs/SignerProvider.mjs';
241 import { FeeEstimator, FeeEstimatorInterface } from '../structs/FeeEstimator.mjs';
242 import { Router, RouterInterface } from '../structs/Router.mjs';
243 import { TwoTuple_BlockHashChannelManagerZ } from '../structs/TwoTuple_BlockHashChannelManagerZ.mjs';
244 import { Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ } from '../structs/Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.mjs';
245 import { ChannelConfig } from '../structs/ChannelConfig.mjs';
246 import { Result_ChannelConfigDecodeErrorZ } from '../structs/Result_ChannelConfigDecodeErrorZ.mjs';
247 import { Option_APIErrorZ } from '../structs/Option_APIErrorZ.mjs';
248 import { Result_COption_APIErrorZDecodeErrorZ } from '../structs/Result_COption_APIErrorZDecodeErrorZ.mjs';
249 import { Result_UntrustedStringDecodeErrorZ } from '../structs/Result_UntrustedStringDecodeErrorZ.mjs';
250 import { Result_OutPointDecodeErrorZ } from '../structs/Result_OutPointDecodeErrorZ.mjs';
251 import { Type, TypeInterface } from '../structs/Type.mjs';
252 import { Option_TypeZ } from '../structs/Option_TypeZ.mjs';
253 import { Result_COption_TypeZDecodeErrorZ } from '../structs/Result_COption_TypeZDecodeErrorZ.mjs';
254 import { PaymentError } from '../structs/PaymentError.mjs';
255 import { Result_PaymentIdPaymentErrorZ } from '../structs/Result_PaymentIdPaymentErrorZ.mjs';
256 import { Result_NonePaymentErrorZ } from '../structs/Result_NonePaymentErrorZ.mjs';
257 import { Result_StringErrorZ } from '../structs/Result_StringErrorZ.mjs';
258 import { Result_ChannelMonitorUpdateDecodeErrorZ } from '../structs/Result_ChannelMonitorUpdateDecodeErrorZ.mjs';
259 import { Option_MonitorEventZ } from '../structs/Option_MonitorEventZ.mjs';
260 import { Result_COption_MonitorEventZDecodeErrorZ } from '../structs/Result_COption_MonitorEventZDecodeErrorZ.mjs';
261 import { Result_HTLCUpdateDecodeErrorZ } from '../structs/Result_HTLCUpdateDecodeErrorZ.mjs';
262 import { TwoTuple_OutPointScriptZ } from '../structs/TwoTuple_OutPointScriptZ.mjs';
263 import { TwoTuple_u32ScriptZ } from '../structs/TwoTuple_u32ScriptZ.mjs';
264 import { TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ } from '../structs/TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ.mjs';
265 import { TwoTuple_u32TxOutZ } from '../structs/TwoTuple_u32TxOutZ.mjs';
266 import { TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ } from '../structs/TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ.mjs';
267 import { Balance } from '../structs/Balance.mjs';
268 import { TwoTuple_BlockHashChannelMonitorZ } from '../structs/TwoTuple_BlockHashChannelMonitorZ.mjs';
269 import { Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ } from '../structs/Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.mjs';
270 import { TwoTuple_PublicKeyTypeZ } from '../structs/TwoTuple_PublicKeyTypeZ.mjs';
271 import { CustomOnionMessageContents, CustomOnionMessageContentsInterface } from '../structs/CustomOnionMessageContents.mjs';
272 import { Option_CustomOnionMessageContentsZ } from '../structs/Option_CustomOnionMessageContentsZ.mjs';
273 import { Result_COption_CustomOnionMessageContentsZDecodeErrorZ } from '../structs/Result_COption_CustomOnionMessageContentsZDecodeErrorZ.mjs';
274 import { Option_NetAddressZ } from '../structs/Option_NetAddressZ.mjs';
275 import { TwoTuple_PublicKeyCOption_NetAddressZZ } from '../structs/TwoTuple_PublicKeyCOption_NetAddressZZ.mjs';
276 import { PeerHandleError } from '../structs/PeerHandleError.mjs';
277 import { Result_CVec_u8ZPeerHandleErrorZ } from '../structs/Result_CVec_u8ZPeerHandleErrorZ.mjs';
278 import { Result_NonePeerHandleErrorZ } from '../structs/Result_NonePeerHandleErrorZ.mjs';
279 import { Result_boolPeerHandleErrorZ } from '../structs/Result_boolPeerHandleErrorZ.mjs';
280 import { SendError } from '../structs/SendError.mjs';
281 import { Result_NoneSendErrorZ } from '../structs/Result_NoneSendErrorZ.mjs';
282 import { Result_BlindedPathNoneZ } from '../structs/Result_BlindedPathNoneZ.mjs';
283 import { Result_BlindedPathDecodeErrorZ } from '../structs/Result_BlindedPathDecodeErrorZ.mjs';
284 import { Result_BlindedHopDecodeErrorZ } from '../structs/Result_BlindedHopDecodeErrorZ.mjs';
285 import { GraphSyncError } from '../structs/GraphSyncError.mjs';
286 import { Result_u32GraphSyncErrorZ } from '../structs/Result_u32GraphSyncErrorZ.mjs';
287 import { Result_NoneErrorZ } from '../structs/Result_NoneErrorZ.mjs';
288 import { Result_NetAddressDecodeErrorZ } from '../structs/Result_NetAddressDecodeErrorZ.mjs';
289 import { UpdateAddHTLC } from '../structs/UpdateAddHTLC.mjs';
290 import { UpdateFulfillHTLC } from '../structs/UpdateFulfillHTLC.mjs';
291 import { UpdateFailHTLC } from '../structs/UpdateFailHTLC.mjs';
292 import { UpdateFailMalformedHTLC } from '../structs/UpdateFailMalformedHTLC.mjs';
293 import { Result_AcceptChannelDecodeErrorZ } from '../structs/Result_AcceptChannelDecodeErrorZ.mjs';
294 import { Result_AnnouncementSignaturesDecodeErrorZ } from '../structs/Result_AnnouncementSignaturesDecodeErrorZ.mjs';
295 import { Result_ChannelReestablishDecodeErrorZ } from '../structs/Result_ChannelReestablishDecodeErrorZ.mjs';
296 import { Result_ClosingSignedDecodeErrorZ } from '../structs/Result_ClosingSignedDecodeErrorZ.mjs';
297 import { ClosingSignedFeeRange } from '../structs/ClosingSignedFeeRange.mjs';
298 import { Result_ClosingSignedFeeRangeDecodeErrorZ } from '../structs/Result_ClosingSignedFeeRangeDecodeErrorZ.mjs';
299 import { CommitmentSigned } from '../structs/CommitmentSigned.mjs';
300 import { Result_CommitmentSignedDecodeErrorZ } from '../structs/Result_CommitmentSignedDecodeErrorZ.mjs';
301 import { Result_FundingCreatedDecodeErrorZ } from '../structs/Result_FundingCreatedDecodeErrorZ.mjs';
302 import { Result_FundingSignedDecodeErrorZ } from '../structs/Result_FundingSignedDecodeErrorZ.mjs';
303 import { Result_ChannelReadyDecodeErrorZ } from '../structs/Result_ChannelReadyDecodeErrorZ.mjs';
304 import { Init } from '../structs/Init.mjs';
305 import { Result_InitDecodeErrorZ } from '../structs/Result_InitDecodeErrorZ.mjs';
306 import { Result_OpenChannelDecodeErrorZ } from '../structs/Result_OpenChannelDecodeErrorZ.mjs';
307 import { Result_RevokeAndACKDecodeErrorZ } from '../structs/Result_RevokeAndACKDecodeErrorZ.mjs';
308 import { Result_ShutdownDecodeErrorZ } from '../structs/Result_ShutdownDecodeErrorZ.mjs';
309 import { Result_UpdateFailHTLCDecodeErrorZ } from '../structs/Result_UpdateFailHTLCDecodeErrorZ.mjs';
310 import { Result_UpdateFailMalformedHTLCDecodeErrorZ } from '../structs/Result_UpdateFailMalformedHTLCDecodeErrorZ.mjs';
311 import { UpdateFee } from '../structs/UpdateFee.mjs';
312 import { Result_UpdateFeeDecodeErrorZ } from '../structs/Result_UpdateFeeDecodeErrorZ.mjs';
313 import { Result_UpdateFulfillHTLCDecodeErrorZ } from '../structs/Result_UpdateFulfillHTLCDecodeErrorZ.mjs';
314 import { Result_UpdateAddHTLCDecodeErrorZ } from '../structs/Result_UpdateAddHTLCDecodeErrorZ.mjs';
315 import { OnionMessage } from '../structs/OnionMessage.mjs';
316 import { Result_OnionMessageDecodeErrorZ } from '../structs/Result_OnionMessageDecodeErrorZ.mjs';
317 import { Ping } from '../structs/Ping.mjs';
318 import { Result_PingDecodeErrorZ } from '../structs/Result_PingDecodeErrorZ.mjs';
319 import { Pong } from '../structs/Pong.mjs';
320 import { Result_PongDecodeErrorZ } from '../structs/Result_PongDecodeErrorZ.mjs';
321 import { Result_UnsignedChannelAnnouncementDecodeErrorZ } from '../structs/Result_UnsignedChannelAnnouncementDecodeErrorZ.mjs';
322 import { Result_ChannelAnnouncementDecodeErrorZ } from '../structs/Result_ChannelAnnouncementDecodeErrorZ.mjs';
323 import { Result_UnsignedChannelUpdateDecodeErrorZ } from '../structs/Result_UnsignedChannelUpdateDecodeErrorZ.mjs';
324 import { Result_ChannelUpdateDecodeErrorZ } from '../structs/Result_ChannelUpdateDecodeErrorZ.mjs';
325 import { Result_ErrorMessageDecodeErrorZ } from '../structs/Result_ErrorMessageDecodeErrorZ.mjs';
326 import { Result_WarningMessageDecodeErrorZ } from '../structs/Result_WarningMessageDecodeErrorZ.mjs';
327 import { Result_UnsignedNodeAnnouncementDecodeErrorZ } from '../structs/Result_UnsignedNodeAnnouncementDecodeErrorZ.mjs';
328 import { Result_NodeAnnouncementDecodeErrorZ } from '../structs/Result_NodeAnnouncementDecodeErrorZ.mjs';
329 import { Result_QueryShortChannelIdsDecodeErrorZ } from '../structs/Result_QueryShortChannelIdsDecodeErrorZ.mjs';
330 import { ReplyShortChannelIdsEnd } from '../structs/ReplyShortChannelIdsEnd.mjs';
331 import { Result_ReplyShortChannelIdsEndDecodeErrorZ } from '../structs/Result_ReplyShortChannelIdsEndDecodeErrorZ.mjs';
332 import { Result_QueryChannelRangeDecodeErrorZ } from '../structs/Result_QueryChannelRangeDecodeErrorZ.mjs';
333 import { Result_ReplyChannelRangeDecodeErrorZ } from '../structs/Result_ReplyChannelRangeDecodeErrorZ.mjs';
334 import { Result_GossipTimestampFilterDecodeErrorZ } from '../structs/Result_GossipTimestampFilterDecodeErrorZ.mjs';
335 import { WatchedOutput } from '../structs/WatchedOutput.mjs';
336 import { Filter, FilterInterface } from '../structs/Filter.mjs';
337 import { Option_FilterZ } from '../structs/Option_FilterZ.mjs';
338 import { LockedChannelMonitor } from '../structs/LockedChannelMonitor.mjs';
339 import { Result_LockedChannelMonitorNoneZ } from '../structs/Result_LockedChannelMonitorNoneZ.mjs';
340 import { MonitorUpdateId } from '../structs/MonitorUpdateId.mjs';
341 import { TwoTuple_OutPointCVec_MonitorUpdateIdZZ } from '../structs/TwoTuple_OutPointCVec_MonitorUpdateIdZZ.mjs';
342 import { Invoice } from '../structs/Invoice.mjs';
343 import { SignOrCreationError } from '../structs/SignOrCreationError.mjs';
344 import { Result_InvoiceSignOrCreationErrorZ } from '../structs/Result_InvoiceSignOrCreationErrorZ.mjs';
345 import { ParseError } from '../structs/ParseError.mjs';
346 import { Result_SiPrefixParseErrorZ } from '../structs/Result_SiPrefixParseErrorZ.mjs';
347 import { ParseOrSemanticError } from '../structs/ParseOrSemanticError.mjs';
348 import { Result_InvoiceParseOrSemanticErrorZ } from '../structs/Result_InvoiceParseOrSemanticErrorZ.mjs';
349 import { SignedRawInvoice } from '../structs/SignedRawInvoice.mjs';
350 import { Result_SignedRawInvoiceParseErrorZ } from '../structs/Result_SignedRawInvoiceParseErrorZ.mjs';
351 import { RawInvoice } from '../structs/RawInvoice.mjs';
352 import { InvoiceSignature } from '../structs/InvoiceSignature.mjs';
353 import { ThreeTuple_RawInvoice_u832InvoiceSignatureZ } from '../structs/ThreeTuple_RawInvoice_u832InvoiceSignatureZ.mjs';
354 import { PayeePubKey } from '../structs/PayeePubKey.mjs';
355 import { Result_PayeePubKeyErrorZ } from '../structs/Result_PayeePubKeyErrorZ.mjs';
356 import { PrivateRoute } from '../structs/PrivateRoute.mjs';
357 import { PositiveTimestamp } from '../structs/PositiveTimestamp.mjs';
358 import { Result_PositiveTimestampCreationErrorZ } from '../structs/Result_PositiveTimestampCreationErrorZ.mjs';
359 import { Result_NoneSemanticErrorZ } from '../structs/Result_NoneSemanticErrorZ.mjs';
360 import { Result_InvoiceSemanticErrorZ } from '../structs/Result_InvoiceSemanticErrorZ.mjs';
361 import { Description } from '../structs/Description.mjs';
362 import { Result_DescriptionCreationErrorZ } from '../structs/Result_DescriptionCreationErrorZ.mjs';
363 import { Result_PrivateRouteCreationErrorZ } from '../structs/Result_PrivateRouteCreationErrorZ.mjs';
364 import { BigSize } from '../structs/BigSize.mjs';
365 import { ChannelUsage } from '../structs/ChannelUsage.mjs';
366 import { Score, ScoreInterface } from '../structs/Score.mjs';
367 import { LockableScore, LockableScoreInterface } from '../structs/LockableScore.mjs';
368 import { WriteableScore, WriteableScoreInterface } from '../structs/WriteableScore.mjs';
369 import { Persister, PersisterInterface } from '../structs/Persister.mjs';
370 import { PrintableString } from '../structs/PrintableString.mjs';
371 import { FutureCallback, FutureCallbackInterface } from '../structs/FutureCallback.mjs';
372 import { Future } from '../structs/Future.mjs';
373 import { ChannelHandshakeConfig } from '../structs/ChannelHandshakeConfig.mjs';
374 import { ChannelHandshakeLimits } from '../structs/ChannelHandshakeLimits.mjs';
375 import { UserConfig } from '../structs/UserConfig.mjs';
376 import { BestBlock } from '../structs/BestBlock.mjs';
377 import { Listen, ListenInterface } from '../structs/Listen.mjs';
378 import { Confirm, ConfirmInterface } from '../structs/Confirm.mjs';
379 import { Persist, PersistInterface } from '../structs/Persist.mjs';
380 import { ChainMonitor } from '../structs/ChainMonitor.mjs';
381 import { EventHandler, EventHandlerInterface } from '../structs/EventHandler.mjs';
382 import { EventsProvider, EventsProviderInterface } from '../structs/EventsProvider.mjs';
383 import { KeysManager } from '../structs/KeysManager.mjs';
384 import { PhantomKeysManager } from '../structs/PhantomKeysManager.mjs';
385 import { ChainParameters } from '../structs/ChainParameters.mjs';
386 import { Retry } from '../structs/Retry.mjs';
387 import { MessageSendEventsProvider, MessageSendEventsProviderInterface } from '../structs/MessageSendEventsProvider.mjs';
388 import { ChannelMessageHandler, ChannelMessageHandlerInterface } from '../structs/ChannelMessageHandler.mjs';
389 import { ChannelManagerReadArgs } from '../structs/ChannelManagerReadArgs.mjs';
390 import { ExpandedKey } from '../structs/ExpandedKey.mjs';
391 import { DataLossProtect } from '../structs/DataLossProtect.mjs';
392 import { RoutingMessageHandler, RoutingMessageHandlerInterface } from '../structs/RoutingMessageHandler.mjs';
393 import { OnionMessageProvider, OnionMessageProviderInterface } from '../structs/OnionMessageProvider.mjs';
394 import { OnionMessageHandler, OnionMessageHandlerInterface } from '../structs/OnionMessageHandler.mjs';
395 import { CustomMessageReader, CustomMessageReaderInterface } from '../structs/CustomMessageReader.mjs';
396 import { CustomMessageHandler, CustomMessageHandlerInterface } from '../structs/CustomMessageHandler.mjs';
397 import { IgnoringMessageHandler } from '../structs/IgnoringMessageHandler.mjs';
398 import { CustomOnionMessageHandler, CustomOnionMessageHandlerInterface } from '../structs/CustomOnionMessageHandler.mjs';
399 import { ErroringMessageHandler } from '../structs/ErroringMessageHandler.mjs';
400 import { MessageHandler } from '../structs/MessageHandler.mjs';
401 import { SocketDescriptor, SocketDescriptorInterface } from '../structs/SocketDescriptor.mjs';
402 import { PeerManager } from '../structs/PeerManager.mjs';
403 import { DirectedChannelTransactionParameters } from '../structs/DirectedChannelTransactionParameters.mjs';
404 import { OfferFeatures } from '../structs/OfferFeatures.mjs';
405 import { InvoiceRequestFeatures } from '../structs/InvoiceRequestFeatures.mjs';
406 import { Bolt12InvoiceFeatures } from '../structs/Bolt12InvoiceFeatures.mjs';
407 import { UnsignedInvoice } from '../structs/UnsignedInvoice.mjs';
408 import { UnsignedInvoiceRequest } from '../structs/UnsignedInvoiceRequest.mjs';
409 import { InvoiceRequest } from '../structs/InvoiceRequest.mjs';
410 import { Offer } from '../structs/Offer.mjs';
411 import { Amount } from '../structs/Amount.mjs';
412 import { Quantity } from '../structs/Quantity.mjs';
413 import { Refund } from '../structs/Refund.mjs';
414 import { P2PGossipSync } from '../structs/P2PGossipSync.mjs';
415 import { ReadOnlyNetworkGraph } from '../structs/ReadOnlyNetworkGraph.mjs';
416 import { DirectedChannelInfo } from '../structs/DirectedChannelInfo.mjs';
417 import { EffectiveCapacity } from '../structs/EffectiveCapacity.mjs';
418 import { DefaultRouter } from '../structs/DefaultRouter.mjs';
419 import { ScorerAccountingForInFlightHtlcs } from '../structs/ScorerAccountingForInFlightHtlcs.mjs';
420 import { Hints } from '../structs/Hints.mjs';
421 import { MultiThreadedLockableScore } from '../structs/MultiThreadedLockableScore.mjs';
422 import { MultiThreadedScoreLock } from '../structs/MultiThreadedScoreLock.mjs';
423 import { ProbabilisticScoringParameters } from '../structs/ProbabilisticScoringParameters.mjs';
424 import { OnionMessenger } from '../structs/OnionMessenger.mjs';
425 import { Destination } from '../structs/Destination.mjs';
426 import { OnionMessageContents } from '../structs/OnionMessageContents.mjs';
427 import { RapidGossipSync } from '../structs/RapidGossipSync.mjs';
428 import { GossipSync } from '../structs/GossipSync.mjs';
429 import { RawDataPart } from '../structs/RawDataPart.mjs';
430 import { Sha256 } from '../structs/Sha256.mjs';
431 import { ExpiryTime } from '../structs/ExpiryTime.mjs';
432 import { MinFinalCltvExpiryDelta } from '../structs/MinFinalCltvExpiryDelta.mjs';
433 import { Fallback } from '../structs/Fallback.mjs';
434
435 import { CommonBase, UInt5, WitnessVersion, UnqualifiedError } from './CommonBase.mjs';
436 import * as bindings from '../bindings.mjs'
437
438
439 /**
440  * Manager which keeps track of a number of channels and sends messages to the appropriate
441  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
442  * 
443  * Implements [`ChannelMessageHandler`], handling the multi-channel parts and passing things through
444  * to individual Channels.
445  * 
446  * Implements [`Writeable`] to write out all channel state to disk. Implies [`peer_disconnected`] for
447  * all peers during write/read (though does not modify this instance, only the instance being
448  * serialized). This will result in any channels which have not yet exchanged [`funding_created`] (i.e.,
449  * called [`funding_transaction_generated`] for outbound channels) being closed.
450  * 
451  * Note that you can be a bit lazier about writing out `ChannelManager` than you can be with
452  * [`ChannelMonitor`]. With [`ChannelMonitor`] you MUST write each monitor update out to disk before
453  * returning from [`chain::Watch::watch_channel`]/[`update_channel`], with ChannelManagers, writing updates
454  * happens out-of-band (and will prevent any other `ChannelManager` operations from occurring during
455  * the serialization process). If the deserialized version is out-of-date compared to the
456  * [`ChannelMonitor`] passed by reference to [`read`], those channels will be force-closed based on the
457  * `ChannelMonitor` state and no funds will be lost (mod on-chain transaction fees).
458  * 
459  * Note that the deserializer is only implemented for `(`[`BlockHash`]`, `[`ChannelManager`]`)`, which
460  * tells you the last block hash which was connected. You should get the best block tip before using the manager.
461  * See [`chain::Listen`] and [`chain::Confirm`] for more details.
462  * 
463  * Note that `ChannelManager` is responsible for tracking liveness of its channels and generating
464  * [`ChannelUpdate`] messages informing peers that the channel is temporarily disabled. To avoid
465  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
466  * offline for a full minute. In order to track this, you must call
467  * [`timer_tick_occurred`] roughly once per minute, though it doesn't have to be perfect.
468  * 
469  * To avoid trivial DoS issues, `ChannelManager` limits the number of inbound connections and
470  * inbound channels without confirmed funding transactions. This may result in nodes which we do
471  * not have a channel with being unable to connect to us or open new channels with us if we have
472  * many peers with unfunded channels.
473  * 
474  * Because it is an indication of trust, inbound channels which we've accepted as 0conf are
475  * exempted from the count of unfunded channels. Similarly, outbound channels and connections are
476  * never limited. Please ensure you limit the count of such channels yourself.
477  * 
478  * Rather than using a plain `ChannelManager`, it is preferable to use either a [`SimpleArcChannelManager`]
479  * a [`SimpleRefChannelManager`], for conciseness. See their documentation for more details, but
480  * essentially you should default to using a [`SimpleRefChannelManager`], and use a
481  * [`SimpleArcChannelManager`] when you require a `ChannelManager` with a static lifetime, such as when
482  * you're using lightning-net-tokio.
483  * 
484  * [`peer_disconnected`]: msgs::ChannelMessageHandler::peer_disconnected
485  * [`funding_created`]: msgs::FundingCreated
486  * [`funding_transaction_generated`]: Self::funding_transaction_generated
487  * [`BlockHash`]: bitcoin::hash_types::BlockHash
488  * [`update_channel`]: chain::Watch::update_channel
489  * [`ChannelUpdate`]: msgs::ChannelUpdate
490  * [`timer_tick_occurred`]: Self::timer_tick_occurred
491  * [`read`]: ReadableArgs::read
492  */
493 export class ChannelManager extends CommonBase {
494         /* @internal */
495         public constructor(_dummy: null, ptr: bigint) {
496                 super(ptr, bindings.ChannelManager_free);
497         }
498
499         /**
500          * Constructs a new `ChannelManager` to hold several channels and route between them.
501          * 
502          * This is the main \"logic hub\" for all channel-related actions, and implements
503          * [`ChannelMessageHandler`].
504          * 
505          * Non-proportional fees are fixed according to our risk using the provided fee estimator.
506          * 
507          * Users need to notify the new `ChannelManager` when a new block is connected or
508          * disconnected using its [`block_connected`] and [`block_disconnected`] methods, starting
509          * from after [`params.best_block.block_hash`]. See [`chain::Listen`] and [`chain::Confirm`] for
510          * more details.
511          * 
512          * [`block_connected`]: chain::Listen::block_connected
513          * [`block_disconnected`]: chain::Listen::block_disconnected
514          * [`params.best_block.block_hash`]: chain::BestBlock::block_hash
515          */
516         public static constructor_new(fee_est: FeeEstimator, chain_monitor: Watch, tx_broadcaster: BroadcasterInterface, router: Router, logger: Logger, entropy_source: EntropySource, node_signer: NodeSigner, signer_provider: SignerProvider, config: UserConfig, params: ChainParameters): ChannelManager {
517                 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));
518                 const ret_hu_conv: ChannelManager = new ChannelManager(null, ret);
519                 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
520                 CommonBase.add_ref_from(ret_hu_conv, fee_est);
521                 CommonBase.add_ref_from(ret_hu_conv, chain_monitor);
522                 CommonBase.add_ref_from(ret_hu_conv, tx_broadcaster);
523                 CommonBase.add_ref_from(ret_hu_conv, router);
524                 CommonBase.add_ref_from(ret_hu_conv, logger);
525                 CommonBase.add_ref_from(ret_hu_conv, entropy_source);
526                 CommonBase.add_ref_from(ret_hu_conv, node_signer);
527                 CommonBase.add_ref_from(ret_hu_conv, signer_provider);
528                 CommonBase.add_ref_from(ret_hu_conv, config);
529                 CommonBase.add_ref_from(ret_hu_conv, params);
530                 return ret_hu_conv;
531         }
532
533         /**
534          * Gets the current configuration applied to all new channels.
535          */
536         public get_current_default_configuration(): UserConfig {
537                 const ret: bigint = bindings.ChannelManager_get_current_default_configuration(this.ptr);
538                 const ret_hu_conv: UserConfig = new UserConfig(null, ret);
539                 CommonBase.add_ref_from(ret_hu_conv, this);
540                 return ret_hu_conv;
541         }
542
543         /**
544          * Creates a new outbound channel to the given remote node and with the given value.
545          * 
546          * `user_channel_id` will be provided back as in
547          * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
548          * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to a
549          * randomized value for inbound channels. `user_channel_id` has no meaning inside of LDK, it
550          * is simply copied to events and otherwise ignored.
551          * 
552          * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
553          * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
554          * 
555          * Note that we do not check if you are currently connected to the given peer. If no
556          * connection is available, the outbound `open_channel` message may fail to send, resulting in
557          * the channel eventually being silently forgotten (dropped on reload).
558          * 
559          * Returns the new Channel's temporary `channel_id`. This ID will appear as
560          * [`Event::FundingGenerationReady::temporary_channel_id`] and in
561          * [`ChannelDetails::channel_id`] until after
562          * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
563          * one derived from the funding transaction's TXID. If the counterparty rejects the channel
564          * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
565          * 
566          * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
567          * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
568          * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
569          * 
570          * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
571          */
572         public create_channel(their_network_key: Uint8Array, channel_value_satoshis: bigint, push_msat: bigint, user_channel_id: bigint, override_config: UserConfig|null): Result__u832APIErrorZ {
573                 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));
574                 const ret_hu_conv: Result__u832APIErrorZ = Result__u832APIErrorZ.constr_from_ptr(ret);
575                 CommonBase.add_ref_from(this, override_config);
576                 return ret_hu_conv;
577         }
578
579         /**
580          * Gets the list of open channels, in random order. See [`ChannelDetails`] field documentation for
581          * more information.
582          */
583         public list_channels(): ChannelDetails[] {
584                 const ret: number = bindings.ChannelManager_list_channels(this.ptr);
585                 const ret_conv_16_len: number = bindings.getArrayLength(ret);
586                 const ret_conv_16_arr: ChannelDetails[] = new Array(ret_conv_16_len).fill(null);
587                 for (var q = 0; q < ret_conv_16_len; q++) {
588                         const ret_conv_16: bigint = bindings.getU64ArrayElem(ret, q);
589                         const ret_conv_16_hu_conv: ChannelDetails = new ChannelDetails(null, ret_conv_16);
590                         CommonBase.add_ref_from(ret_conv_16_hu_conv, this);
591                         ret_conv_16_arr[q] = ret_conv_16_hu_conv;
592                 }
593                 bindings.freeWasmMemory(ret)
594                 return ret_conv_16_arr;
595         }
596
597         /**
598          * Gets the list of usable channels, in random order. Useful as an argument to
599          * [`Router::find_route`] to ensure non-announced channels are used.
600          * 
601          * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
602          * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
603          * are.
604          */
605         public list_usable_channels(): ChannelDetails[] {
606                 const ret: number = bindings.ChannelManager_list_usable_channels(this.ptr);
607                 const ret_conv_16_len: number = bindings.getArrayLength(ret);
608                 const ret_conv_16_arr: ChannelDetails[] = new Array(ret_conv_16_len).fill(null);
609                 for (var q = 0; q < ret_conv_16_len; q++) {
610                         const ret_conv_16: bigint = bindings.getU64ArrayElem(ret, q);
611                         const ret_conv_16_hu_conv: ChannelDetails = new ChannelDetails(null, ret_conv_16);
612                         CommonBase.add_ref_from(ret_conv_16_hu_conv, this);
613                         ret_conv_16_arr[q] = ret_conv_16_hu_conv;
614                 }
615                 bindings.freeWasmMemory(ret)
616                 return ret_conv_16_arr;
617         }
618
619         /**
620          * Gets the list of channels we have with a given counterparty, in random order.
621          */
622         public list_channels_with_counterparty(counterparty_node_id: Uint8Array): ChannelDetails[] {
623                 const ret: number = bindings.ChannelManager_list_channels_with_counterparty(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(counterparty_node_id, 33)));
624                 const ret_conv_16_len: number = bindings.getArrayLength(ret);
625                 const ret_conv_16_arr: ChannelDetails[] = new Array(ret_conv_16_len).fill(null);
626                 for (var q = 0; q < ret_conv_16_len; q++) {
627                         const ret_conv_16: bigint = bindings.getU64ArrayElem(ret, q);
628                         const ret_conv_16_hu_conv: ChannelDetails = new ChannelDetails(null, ret_conv_16);
629                         CommonBase.add_ref_from(ret_conv_16_hu_conv, this);
630                         ret_conv_16_arr[q] = ret_conv_16_hu_conv;
631                 }
632                 bindings.freeWasmMemory(ret)
633                 return ret_conv_16_arr;
634         }
635
636         /**
637          * Returns in an undefined order recent payments that -- if not fulfilled -- have yet to find a
638          * successful path, or have unresolved HTLCs.
639          * 
640          * This can be useful for payments that may have been prepared, but ultimately not sent, as a
641          * result of a crash. If such a payment exists, is not listed here, and an
642          * [`Event::PaymentSent`] has not been received, you may consider resending the payment.
643          * 
644          * [`Event::PaymentSent`]: events::Event::PaymentSent
645          */
646         public list_recent_payments(): RecentPaymentDetails[] {
647                 const ret: number = bindings.ChannelManager_list_recent_payments(this.ptr);
648                 const ret_conv_22_len: number = bindings.getArrayLength(ret);
649                 const ret_conv_22_arr: RecentPaymentDetails[] = new Array(ret_conv_22_len).fill(null);
650                 for (var w = 0; w < ret_conv_22_len; w++) {
651                         const ret_conv_22: bigint = bindings.getU64ArrayElem(ret, w);
652                         const ret_conv_22_hu_conv: RecentPaymentDetails = RecentPaymentDetails.constr_from_ptr(ret_conv_22);
653                         CommonBase.add_ref_from(ret_conv_22_hu_conv, this);
654                         ret_conv_22_arr[w] = ret_conv_22_hu_conv;
655                 }
656                 bindings.freeWasmMemory(ret)
657                 return ret_conv_22_arr;
658         }
659
660         /**
661          * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
662          * will be accepted on the given channel, and after additional timeout/the closing of all
663          * pending HTLCs, the channel will be closed on chain.
664          * 
665          * If we are the channel initiator, we will pay between our [`Background`] and
666          * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
667          * estimate.
668          * If our counterparty is the channel initiator, we will require a channel closing
669          * transaction feerate of at least our [`Background`] feerate or the feerate which
670          * would appear on a force-closure transaction, whichever is lower. We will allow our
671          * counterparty to pay as much fee as they'd like, however.
672          * 
673          * May generate a [`SendShutdown`] message event on success, which should be relayed.
674          * 
675          * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
676          * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
677          * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
678          * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
679          */
680         public close_channel(channel_id: Uint8Array, counterparty_node_id: Uint8Array): Result_NoneAPIErrorZ {
681                 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)));
682                 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
683                 return ret_hu_conv;
684         }
685
686         /**
687          * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
688          * will be accepted on the given channel, and after additional timeout/the closing of all
689          * pending HTLCs, the channel will be closed on chain.
690          * 
691          * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
692          * the channel being closed or not:
693          * If we are the channel initiator, we will pay at least this feerate on the closing
694          * transaction. The upper-bound is set by
695          * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
696          * estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
697          * If our counterparty is the channel initiator, we will refuse to accept a channel closure
698          * transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
699          * will appear on a force-closure transaction, whichever is lower).
700          * 
701          * May generate a [`SendShutdown`] message event on success, which should be relayed.
702          * 
703          * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
704          * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
705          * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
706          * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
707          */
708         public close_channel_with_target_feerate(channel_id: Uint8Array, counterparty_node_id: Uint8Array, target_feerate_sats_per_1000_weight: number): Result_NoneAPIErrorZ {
709                 const ret: bigint = bindings.ChannelManager_close_channel_with_target_feerate(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(channel_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(counterparty_node_id, 33)), target_feerate_sats_per_1000_weight);
710                 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
711                 return ret_hu_conv;
712         }
713
714         /**
715          * Force closes a channel, immediately broadcasting the latest local transaction(s) and
716          * rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to
717          * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding
718          * channel.
719          */
720         public force_close_broadcasting_latest_txn(channel_id: Uint8Array, counterparty_node_id: Uint8Array): Result_NoneAPIErrorZ {
721                 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)));
722                 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
723                 return ret_hu_conv;
724         }
725
726         /**
727          * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting
728          * the latest local transaction(s). Fails if `channel_id` is unknown to the manager, or if the
729          * `counterparty_node_id` isn't the counterparty of the corresponding channel.
730          * 
731          * You can always get the latest local transaction(s) to broadcast from
732          * [`ChannelMonitor::get_latest_holder_commitment_txn`].
733          */
734         public force_close_without_broadcasting_txn(channel_id: Uint8Array, counterparty_node_id: Uint8Array): Result_NoneAPIErrorZ {
735                 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)));
736                 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
737                 return ret_hu_conv;
738         }
739
740         /**
741          * Force close all channels, immediately broadcasting the latest local commitment transaction
742          * for each to the chain and rejecting new HTLCs on each.
743          */
744         public force_close_all_channels_broadcasting_latest_txn(): void {
745                 bindings.ChannelManager_force_close_all_channels_broadcasting_latest_txn(this.ptr);
746         }
747
748         /**
749          * Force close all channels rejecting new HTLCs on each but without broadcasting the latest
750          * local transaction(s).
751          */
752         public force_close_all_channels_without_broadcasting_txn(): void {
753                 bindings.ChannelManager_force_close_all_channels_without_broadcasting_txn(this.ptr);
754         }
755
756         /**
757          * Sends a payment along a given route.
758          * 
759          * Value parameters are provided via the last hop in route, see documentation for [`RouteHop`]
760          * fields for more info.
761          * 
762          * May generate [`UpdateHTLCs`] message(s) event on success, which should be relayed (e.g. via
763          * [`PeerManager::process_events`]).
764          * 
765          * # Avoiding Duplicate Payments
766          * 
767          * If a pending payment is currently in-flight with the same [`PaymentId`] provided, this
768          * method will error with an [`APIError::InvalidRoute`]. Note, however, that once a payment
769          * is no longer pending (either via [`ChannelManager::abandon_payment`], or handling of an
770          * [`Event::PaymentSent`] or [`Event::PaymentFailed`]) LDK will not stop you from sending a
771          * second payment with the same [`PaymentId`].
772          * 
773          * Thus, in order to ensure duplicate payments are not sent, you should implement your own
774          * tracking of payments, including state to indicate once a payment has completed. Because you
775          * should also ensure that [`PaymentHash`]es are not re-used, for simplicity, you should
776          * consider using the [`PaymentHash`] as the key for tracking payments. In that case, the
777          * [`PaymentId`] should be a copy of the [`PaymentHash`] bytes.
778          * 
779          * Additionally, in the scenario where we begin the process of sending a payment, but crash
780          * before `send_payment` returns (or prior to [`ChannelMonitorUpdate`] persistence if you're
781          * using [`ChannelMonitorUpdateStatus::InProgress`]), the payment may be lost on restart. See
782          * [`ChannelManager::list_recent_payments`] for more information.
783          * 
784          * # Possible Error States on [`PaymentSendFailure`]
785          * 
786          * Each path may have a different return value, and [`PaymentSendFailure`] may return a `Vec` with
787          * each entry matching the corresponding-index entry in the route paths, see
788          * [`PaymentSendFailure`] for more info.
789          * 
790          * In general, a path may raise:
791          * [`APIError::InvalidRoute`] when an invalid route or forwarding parameter (cltv_delta, fee,
792          * node public key) is specified.
793          * [`APIError::ChannelUnavailable`] if the next-hop channel is not available for updates
794          * (including due to previous monitor update failure or new permanent monitor update
795          * failure).
796          * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the
797          * relevant updates.
798          * 
799          * Note that depending on the type of the [`PaymentSendFailure`] the HTLC may have been
800          * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
801          * different route unless you intend to pay twice!
802          * 
803          * [`Event::PaymentSent`]: events::Event::PaymentSent
804          * [`Event::PaymentFailed`]: events::Event::PaymentFailed
805          * [`UpdateHTLCs`]: events::MessageSendEvent::UpdateHTLCs
806          * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
807          * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
808          */
809         public send_payment_with_route(route: Route, payment_hash: Uint8Array, recipient_onion: RecipientOnionFields, payment_id: Uint8Array): Result_NonePaymentSendFailureZ {
810                 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)));
811                 const ret_hu_conv: Result_NonePaymentSendFailureZ = Result_NonePaymentSendFailureZ.constr_from_ptr(ret);
812                 CommonBase.add_ref_from(this, route);
813                 CommonBase.add_ref_from(this, recipient_onion);
814                 return ret_hu_conv;
815         }
816
817         /**
818          * Similar to [`ChannelManager::send_payment`], but will automatically find a route based on
819          * `route_params` and retry failed payment paths based on `retry_strategy`.
820          */
821         public send_payment(payment_hash: Uint8Array, recipient_onion: RecipientOnionFields, payment_id: Uint8Array, route_params: RouteParameters, retry_strategy: Retry): Result_NoneRetryableSendFailureZ {
822                 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));
823                 const ret_hu_conv: Result_NoneRetryableSendFailureZ = Result_NoneRetryableSendFailureZ.constr_from_ptr(ret);
824                 CommonBase.add_ref_from(this, recipient_onion);
825                 CommonBase.add_ref_from(this, route_params);
826                 CommonBase.add_ref_from(this, retry_strategy);
827                 return ret_hu_conv;
828         }
829
830         /**
831          * Signals that no further retries for the given payment should occur. Useful if you have a
832          * pending outbound payment with retries remaining, but wish to stop retrying the payment before
833          * retries are exhausted.
834          * 
835          * If no [`Event::PaymentFailed`] event had been generated before, one will be generated as soon
836          * as there are no remaining pending HTLCs for this payment.
837          * 
838          * Note that calling this method does *not* prevent a payment from succeeding. You must still
839          * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
840          * determine the ultimate status of a payment.
841          * 
842          * If an [`Event::PaymentFailed`] event is generated and we restart without this
843          * [`ChannelManager`] having been persisted, another [`Event::PaymentFailed`] may be generated.
844          * 
845          * [`Event::PaymentFailed`]: events::Event::PaymentFailed
846          * [`Event::PaymentSent`]: events::Event::PaymentSent
847          */
848         public abandon_payment(payment_id: Uint8Array): void {
849                 bindings.ChannelManager_abandon_payment(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32)));
850         }
851
852         /**
853          * Send a spontaneous payment, which is a payment that does not require the recipient to have
854          * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
855          * the preimage, it must be a cryptographically secure random value that no intermediate node
856          * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
857          * never reach the recipient.
858          * 
859          * See [`send_payment`] documentation for more details on the return value of this function
860          * and idempotency guarantees provided by the [`PaymentId`] key.
861          * 
862          * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
863          * [`send_payment`] for more information about the risks of duplicate preimage usage.
864          * 
865          * Note that `route` must have exactly one path.
866          * 
867          * [`send_payment`]: Self::send_payment
868          * 
869          * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
870          */
871         public send_spontaneous_payment(route: Route, payment_preimage: Uint8Array|null, recipient_onion: RecipientOnionFields, payment_id: Uint8Array): Result_PaymentHashPaymentSendFailureZ {
872                 const ret: bigint = bindings.ChannelManager_send_spontaneous_payment(this.ptr, route == null ? 0n : CommonBase.get_ptr_of(route), bindings.encodeUint8Array(bindings.check_arr_len(payment_preimage, 32)), recipient_onion == null ? 0n : CommonBase.get_ptr_of(recipient_onion), bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32)));
873                 const ret_hu_conv: Result_PaymentHashPaymentSendFailureZ = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret);
874                 CommonBase.add_ref_from(this, route);
875                 CommonBase.add_ref_from(this, recipient_onion);
876                 return ret_hu_conv;
877         }
878
879         /**
880          * Similar to [`ChannelManager::send_spontaneous_payment`], but will automatically find a route
881          * based on `route_params` and retry failed payment paths based on `retry_strategy`.
882          * 
883          * See [`PaymentParameters::for_keysend`] for help in constructing `route_params` for spontaneous
884          * payments.
885          * 
886          * [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend
887          * 
888          * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
889          */
890         public send_spontaneous_payment_with_retry(payment_preimage: Uint8Array|null, recipient_onion: RecipientOnionFields, payment_id: Uint8Array, route_params: RouteParameters, retry_strategy: Retry): Result_PaymentHashRetryableSendFailureZ {
891                 const ret: bigint = bindings.ChannelManager_send_spontaneous_payment_with_retry(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(payment_preimage, 32)), recipient_onion == null ? 0n : CommonBase.get_ptr_of(recipient_onion), bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32)), route_params == null ? 0n : CommonBase.get_ptr_of(route_params), CommonBase.get_ptr_of(retry_strategy));
892                 const ret_hu_conv: Result_PaymentHashRetryableSendFailureZ = Result_PaymentHashRetryableSendFailureZ.constr_from_ptr(ret);
893                 CommonBase.add_ref_from(this, recipient_onion);
894                 CommonBase.add_ref_from(this, route_params);
895                 CommonBase.add_ref_from(this, retry_strategy);
896                 return ret_hu_conv;
897         }
898
899         /**
900          * Send a payment that is probing the given route for liquidity. We calculate the
901          * [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows
902          * us to easily discern them from real payments.
903          */
904         public send_probe(path: Path): Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
905                 const ret: bigint = bindings.ChannelManager_send_probe(this.ptr, path == null ? 0n : CommonBase.get_ptr_of(path));
906                 const ret_hu_conv: Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret);
907                 CommonBase.add_ref_from(this, path);
908                 return ret_hu_conv;
909         }
910
911         /**
912          * Call this upon creation of a funding transaction for the given channel.
913          * 
914          * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
915          * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
916          * 
917          * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation
918          * across the p2p network.
919          * 
920          * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
921          * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
922          * 
923          * May panic if the output found in the funding transaction is duplicative with some other
924          * channel (note that this should be trivially prevented by using unique funding transaction
925          * keys per-channel).
926          * 
927          * Do NOT broadcast the funding transaction yourself. When we have safely received our
928          * counterparty's signature the funding transaction will automatically be broadcast via the
929          * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
930          * 
931          * Note that this includes RBF or similar transaction replacement strategies - lightning does
932          * not currently support replacing a funding transaction on an existing channel. Instead,
933          * create a new channel with a conflicting funding transaction.
934          * 
935          * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend
936          * the wallet software generating the funding transaction to apply anti-fee sniping as
937          * implemented by Bitcoin Core wallet. See <https://bitcoinops.org/en/topics/fee-sniping/>
938          * for more details.
939          * 
940          * [`Event::FundingGenerationReady`]: crate::events::Event::FundingGenerationReady
941          * [`Event::ChannelClosed`]: crate::events::Event::ChannelClosed
942          */
943         public funding_transaction_generated(temporary_channel_id: Uint8Array, counterparty_node_id: Uint8Array, funding_transaction: Uint8Array): Result_NoneAPIErrorZ {
944                 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));
945                 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
946                 return ret_hu_conv;
947         }
948
949         /**
950          * Atomically updates the [`ChannelConfig`] for the given channels.
951          * 
952          * Once the updates are applied, each eligible channel (advertised with a known short channel
953          * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`],
954          * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated
955          * containing the new [`ChannelUpdate`] message which should be broadcast to the network.
956          * 
957          * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect
958          * `counterparty_node_id` is provided.
959          * 
960          * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value
961          * below [`MIN_CLTV_EXPIRY_DELTA`].
962          * 
963          * If an error is returned, none of the updates should be considered applied.
964          * 
965          * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
966          * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat
967          * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta
968          * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate
969          * [`ChannelUpdate`]: msgs::ChannelUpdate
970          * [`ChannelUnavailable`]: APIError::ChannelUnavailable
971          * [`APIMisuseError`]: APIError::APIMisuseError
972          */
973         public update_channel_config(counterparty_node_id: Uint8Array, channel_ids: Uint8Array[], config: ChannelConfig): Result_NoneAPIErrorZ {
974                 const ret: bigint = bindings.ChannelManager_update_channel_config(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(counterparty_node_id, 33)), bindings.encodeUint32Array(channel_ids != null ? channel_ids.map(channel_ids_conv_12 => bindings.encodeUint8Array(bindings.check_arr_len(channel_ids_conv_12, 32))) : null), config == null ? 0n : CommonBase.get_ptr_of(config));
975                 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
976                 CommonBase.add_ref_from(this, config);
977                 return ret_hu_conv;
978         }
979
980         /**
981          * Attempts to forward an intercepted HTLC over the provided channel id and with the provided
982          * amount to forward. Should only be called in response to an [`HTLCIntercepted`] event.
983          * 
984          * Intercepted HTLCs can be useful for Lightning Service Providers (LSPs) to open a just-in-time
985          * channel to a receiving node if the node lacks sufficient inbound liquidity.
986          * 
987          * To make use of intercepted HTLCs, set [`UserConfig::accept_intercept_htlcs`] and use
988          * [`ChannelManager::get_intercept_scid`] to generate short channel id(s) to put in the
989          * receiver's invoice route hints. These route hints will signal to LDK to generate an
990          * [`HTLCIntercepted`] event when it receives the forwarded HTLC, and this method or
991          * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to the event.
992          * 
993          * Note that LDK does not enforce fee requirements in `amt_to_forward_msat`, and will not stop
994          * you from forwarding more than you received.
995          * 
996          * Errors if the event was not handled in time, in which case the HTLC was automatically failed
997          * backwards.
998          * 
999          * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
1000          * [`HTLCIntercepted`]: events::Event::HTLCIntercepted
1001          */
1002         public forward_intercepted_htlc(intercept_id: Uint8Array, next_hop_channel_id: Uint8Array, next_node_id: Uint8Array, amt_to_forward_msat: bigint): Result_NoneAPIErrorZ {
1003                 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);
1004                 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
1005                 return ret_hu_conv;
1006         }
1007
1008         /**
1009          * Fails the intercepted HTLC indicated by intercept_id. Should only be called in response to
1010          * an [`HTLCIntercepted`] event. See [`ChannelManager::forward_intercepted_htlc`].
1011          * 
1012          * Errors if the event was not handled in time, in which case the HTLC was automatically failed
1013          * backwards.
1014          * 
1015          * [`HTLCIntercepted`]: events::Event::HTLCIntercepted
1016          */
1017         public fail_intercepted_htlc(intercept_id: Uint8Array): Result_NoneAPIErrorZ {
1018                 const ret: bigint = bindings.ChannelManager_fail_intercepted_htlc(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(intercept_id, 32)));
1019                 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
1020                 return ret_hu_conv;
1021         }
1022
1023         /**
1024          * Processes HTLCs which are pending waiting on random forward delay.
1025          * 
1026          * Should only really ever be called in response to a PendingHTLCsForwardable event.
1027          * Will likely generate further events.
1028          */
1029         public process_pending_htlc_forwards(): void {
1030                 bindings.ChannelManager_process_pending_htlc_forwards(this.ptr);
1031         }
1032
1033         /**
1034          * Performs actions which should happen on startup and roughly once per minute thereafter.
1035          * 
1036          * This currently includes:
1037          * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
1038          * Broadcasting [`ChannelUpdate`] messages if we've been disconnected from our peer for more
1039          * than a minute, informing the network that they should no longer attempt to route over
1040          * the channel.
1041          * Expiring a channel's previous [`ChannelConfig`] if necessary to only allow forwarding HTLCs
1042          * with the current [`ChannelConfig`].
1043          * Removing peers which have disconnected but and no longer have any channels.
1044          * 
1045          * Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate
1046          * estimate fetches.
1047          * 
1048          * [`ChannelUpdate`]: msgs::ChannelUpdate
1049          * [`ChannelConfig`]: crate::util::config::ChannelConfig
1050          */
1051         public timer_tick_occurred(): void {
1052                 bindings.ChannelManager_timer_tick_occurred(this.ptr);
1053         }
1054
1055         /**
1056          * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
1057          * after a PaymentClaimable event, failing the HTLC back to its origin and freeing resources
1058          * along the path (including in our own channel on which we received it).
1059          * 
1060          * Note that in some cases around unclean shutdown, it is possible the payment may have
1061          * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a
1062          * second copy of) the [`events::Event::PaymentClaimable`] event. Alternatively, the payment
1063          * may have already been failed automatically by LDK if it was nearing its expiration time.
1064          * 
1065          * While LDK will never claim a payment automatically on your behalf (i.e. without you calling
1066          * [`ChannelManager::claim_funds`]), you should still monitor for
1067          * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on
1068          * startup during which time claims that were in-progress at shutdown may be replayed.
1069          */
1070         public fail_htlc_backwards(payment_hash: Uint8Array): void {
1071                 bindings.ChannelManager_fail_htlc_backwards(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)));
1072         }
1073
1074         /**
1075          * This is a variant of [`ChannelManager::fail_htlc_backwards`] that allows you to specify the
1076          * reason for the failure.
1077          * 
1078          * See [`FailureCode`] for valid failure codes.
1079          */
1080         public fail_htlc_backwards_with_reason(payment_hash: Uint8Array, failure_code: FailureCode): void {
1081                 bindings.ChannelManager_fail_htlc_backwards_with_reason(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), failure_code);
1082         }
1083
1084         /**
1085          * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any
1086          * [`MessageSendEvent`]s needed to claim the payment.
1087          * 
1088          * This method is guaranteed to ensure the payment has been claimed but only if the current
1089          * height is strictly below [`Event::PaymentClaimable::claim_deadline`]. To avoid race
1090          * conditions, you should wait for an [`Event::PaymentClaimed`] before considering the payment
1091          * successful. It will generally be available in the next [`process_pending_events`] call.
1092          * 
1093          * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
1094          * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentClaimable`
1095          * event matches your expectation. If you fail to do so and call this method, you may provide
1096          * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
1097          * 
1098          * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable
1099          * [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline
1100          * [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed
1101          * [`process_pending_events`]: EventsProvider::process_pending_events
1102          * [`create_inbound_payment`]: Self::create_inbound_payment
1103          * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
1104          */
1105         public claim_funds(payment_preimage: Uint8Array): void {
1106                 bindings.ChannelManager_claim_funds(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(payment_preimage, 32)));
1107         }
1108
1109         /**
1110          * Gets the node_id held by this ChannelManager
1111          */
1112         public get_our_node_id(): Uint8Array {
1113                 const ret: number = bindings.ChannelManager_get_our_node_id(this.ptr);
1114                 const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
1115                 return ret_conv;
1116         }
1117
1118         /**
1119          * Accepts a request to open a channel after a [`Event::OpenChannelRequest`].
1120          * 
1121          * The `temporary_channel_id` parameter indicates which inbound channel should be accepted,
1122          * and the `counterparty_node_id` parameter is the id of the peer which has requested to open
1123          * the channel.
1124          * 
1125          * The `user_channel_id` parameter will be provided back in
1126          * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
1127          * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
1128          * 
1129          * Note that this method will return an error and reject the channel, if it requires support
1130          * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be
1131          * used to accept such channels.
1132          * 
1133          * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
1134          * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
1135          */
1136         public accept_inbound_channel(temporary_channel_id: Uint8Array, counterparty_node_id: Uint8Array, user_channel_id: bigint): Result_NoneAPIErrorZ {
1137                 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));
1138                 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
1139                 return ret_hu_conv;
1140         }
1141
1142         /**
1143          * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating
1144          * it as confirmed immediately.
1145          * 
1146          * The `user_channel_id` parameter will be provided back in
1147          * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
1148          * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
1149          * 
1150          * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel
1151          * and (if the counterparty agrees), enables forwarding of payments immediately.
1152          * 
1153          * This fully trusts that the counterparty has honestly and correctly constructed the funding
1154          * transaction and blindly assumes that it will eventually confirm.
1155          * 
1156          * If it does not confirm before we decide to close the channel, or if the funding transaction
1157          * does not pay to the correct script the correct amount, *you will lose funds*.
1158          * 
1159          * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
1160          * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
1161          */
1162         public accept_inbound_channel_from_trusted_peer_0conf(temporary_channel_id: Uint8Array, counterparty_node_id: Uint8Array, user_channel_id: bigint): Result_NoneAPIErrorZ {
1163                 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));
1164                 const ret_hu_conv: Result_NoneAPIErrorZ = Result_NoneAPIErrorZ.constr_from_ptr(ret);
1165                 return ret_hu_conv;
1166         }
1167
1168         /**
1169          * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
1170          * to pay us.
1171          * 
1172          * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
1173          * [`PaymentHash`] and [`PaymentPreimage`] for you.
1174          * 
1175          * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentClaimable`], which
1176          * will have the [`PaymentClaimable::purpose`] be [`PaymentPurpose::InvoicePayment`] with
1177          * its [`PaymentPurpose::InvoicePayment::payment_preimage`] field filled in. That should then be
1178          * passed directly to [`claim_funds`].
1179          * 
1180          * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
1181          * 
1182          * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
1183          * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
1184          * 
1185          * # Note
1186          * 
1187          * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
1188          * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
1189          * 
1190          * Errors if `min_value_msat` is greater than total bitcoin supply.
1191          * 
1192          * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
1193          * on versions of LDK prior to 0.0.114.
1194          * 
1195          * [`claim_funds`]: Self::claim_funds
1196          * [`PaymentClaimable`]: events::Event::PaymentClaimable
1197          * [`PaymentClaimable::purpose`]: events::Event::PaymentClaimable::purpose
1198          * [`PaymentPurpose::InvoicePayment`]: events::PaymentPurpose::InvoicePayment
1199          * [`PaymentPurpose::InvoicePayment::payment_preimage`]: events::PaymentPurpose::InvoicePayment::payment_preimage
1200          * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
1201          */
1202         public create_inbound_payment(min_value_msat: Option_u64Z, invoice_expiry_delta_secs: number, min_final_cltv_expiry_delta: Option_u16Z): Result_C2Tuple_PaymentHashPaymentSecretZNoneZ {
1203                 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));
1204                 const ret_hu_conv: Result_C2Tuple_PaymentHashPaymentSecretZNoneZ = Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.constr_from_ptr(ret);
1205                 CommonBase.add_ref_from(this, min_value_msat);
1206                 CommonBase.add_ref_from(this, min_final_cltv_expiry_delta);
1207                 return ret_hu_conv;
1208         }
1209
1210         /**
1211          * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
1212          * serialized state with LDK node(s) running 0.0.103 and earlier.
1213          * 
1214          * May panic if `invoice_expiry_delta_secs` is greater than one year.
1215          * 
1216          * # Note
1217          * This method is deprecated and will be removed soon.
1218          * 
1219          * [`create_inbound_payment`]: Self::create_inbound_payment
1220          */
1221         public create_inbound_payment_legacy(min_value_msat: Option_u64Z, invoice_expiry_delta_secs: number): Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
1222                 const ret: bigint = bindings.ChannelManager_create_inbound_payment_legacy(this.ptr, CommonBase.get_ptr_of(min_value_msat), invoice_expiry_delta_secs);
1223                 const ret_hu_conv: Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ = Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.constr_from_ptr(ret);
1224                 CommonBase.add_ref_from(this, min_value_msat);
1225                 return ret_hu_conv;
1226         }
1227
1228         /**
1229          * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
1230          * stored external to LDK.
1231          * 
1232          * A [`PaymentClaimable`] event will only be generated if the [`PaymentSecret`] matches a
1233          * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
1234          * the `min_value_msat` provided here, if one is provided.
1235          * 
1236          * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
1237          * note that LDK will not stop you from registering duplicate payment hashes for inbound
1238          * payments.
1239          * 
1240          * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
1241          * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
1242          * before a [`PaymentClaimable`] event will be generated, ensuring that we do not provide the
1243          * sender \"proof-of-payment\" unless they have paid the required amount.
1244          * 
1245          * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
1246          * in excess of the current time. This should roughly match the expiry time set in the invoice.
1247          * After this many seconds, we will remove the inbound payment, resulting in any attempts to
1248          * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
1249          * invoices when no timeout is set.
1250          * 
1251          * Note that we use block header time to time-out pending inbound payments (with some margin
1252          * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
1253          * accept a payment and generate a [`PaymentClaimable`] event for some time after the expiry.
1254          * If you need exact expiry semantics, you should enforce them upon receipt of
1255          * [`PaymentClaimable`].
1256          * 
1257          * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry_delta`
1258          * set to at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
1259          * 
1260          * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
1261          * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
1262          * 
1263          * # Note
1264          * 
1265          * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
1266          * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
1267          * 
1268          * Errors if `min_value_msat` is greater than total bitcoin supply.
1269          * 
1270          * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
1271          * on versions of LDK prior to 0.0.114.
1272          * 
1273          * [`create_inbound_payment`]: Self::create_inbound_payment
1274          * [`PaymentClaimable`]: events::Event::PaymentClaimable
1275          */
1276         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_PaymentSecretNoneZ {
1277                 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));
1278                 const ret_hu_conv: Result_PaymentSecretNoneZ = Result_PaymentSecretNoneZ.constr_from_ptr(ret);
1279                 CommonBase.add_ref_from(this, min_value_msat);
1280                 CommonBase.add_ref_from(this, min_final_cltv_expiry);
1281                 return ret_hu_conv;
1282         }
1283
1284         /**
1285          * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
1286          * serialized state with LDK node(s) running 0.0.103 and earlier.
1287          * 
1288          * May panic if `invoice_expiry_delta_secs` is greater than one year.
1289          * 
1290          * # Note
1291          * This method is deprecated and will be removed soon.
1292          * 
1293          * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
1294          */
1295         public create_inbound_payment_for_hash_legacy(payment_hash: Uint8Array, min_value_msat: Option_u64Z, invoice_expiry_delta_secs: number): Result_PaymentSecretAPIErrorZ {
1296                 const ret: bigint = bindings.ChannelManager_create_inbound_payment_for_hash_legacy(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), CommonBase.get_ptr_of(min_value_msat), invoice_expiry_delta_secs);
1297                 const ret_hu_conv: Result_PaymentSecretAPIErrorZ = Result_PaymentSecretAPIErrorZ.constr_from_ptr(ret);
1298                 CommonBase.add_ref_from(this, min_value_msat);
1299                 return ret_hu_conv;
1300         }
1301
1302         /**
1303          * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
1304          * previously returned from [`create_inbound_payment`].
1305          * 
1306          * [`create_inbound_payment`]: Self::create_inbound_payment
1307          */
1308         public get_payment_preimage(payment_hash: Uint8Array, payment_secret: Uint8Array): Result_PaymentPreimageAPIErrorZ {
1309                 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)));
1310                 const ret_hu_conv: Result_PaymentPreimageAPIErrorZ = Result_PaymentPreimageAPIErrorZ.constr_from_ptr(ret);
1311                 return ret_hu_conv;
1312         }
1313
1314         /**
1315          * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
1316          * are used when constructing the phantom invoice's route hints.
1317          * 
1318          * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
1319          */
1320         public get_phantom_scid(): bigint {
1321                 const ret: bigint = bindings.ChannelManager_get_phantom_scid(this.ptr);
1322                 return ret;
1323         }
1324
1325         /**
1326          * Gets route hints for use in receiving [phantom node payments].
1327          * 
1328          * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
1329          */
1330         public get_phantom_route_hints(): PhantomRouteHints {
1331                 const ret: bigint = bindings.ChannelManager_get_phantom_route_hints(this.ptr);
1332                 const ret_hu_conv: PhantomRouteHints = new PhantomRouteHints(null, ret);
1333                 CommonBase.add_ref_from(ret_hu_conv, this);
1334                 return ret_hu_conv;
1335         }
1336
1337         /**
1338          * Gets a fake short channel id for use in receiving intercepted payments. These fake scids are
1339          * used when constructing the route hints for HTLCs intended to be intercepted. See
1340          * [`ChannelManager::forward_intercepted_htlc`].
1341          * 
1342          * Note that this method is not guaranteed to return unique values, you may need to call it a few
1343          * times to get a unique scid.
1344          */
1345         public get_intercept_scid(): bigint {
1346                 const ret: bigint = bindings.ChannelManager_get_intercept_scid(this.ptr);
1347                 return ret;
1348         }
1349
1350         /**
1351          * Gets inflight HTLC information by processing pending outbound payments that are in
1352          * our channels. May be used during pathfinding to account for in-use channel liquidity.
1353          */
1354         public compute_inflight_htlcs(): InFlightHtlcs {
1355                 const ret: bigint = bindings.ChannelManager_compute_inflight_htlcs(this.ptr);
1356                 const ret_hu_conv: InFlightHtlcs = new InFlightHtlcs(null, ret);
1357                 CommonBase.add_ref_from(ret_hu_conv, this);
1358                 return ret_hu_conv;
1359         }
1360
1361         /**
1362          * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
1363          * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
1364          */
1365         public as_MessageSendEventsProvider(): MessageSendEventsProvider {
1366                 const ret: bigint = bindings.ChannelManager_as_MessageSendEventsProvider(this.ptr);
1367                 const ret_hu_conv: MessageSendEventsProvider = new MessageSendEventsProvider(null, ret);
1368                 CommonBase.add_ref_from(ret_hu_conv, this);
1369                 return ret_hu_conv;
1370         }
1371
1372         /**
1373          * Constructs a new EventsProvider which calls the relevant methods on this_arg.
1374          * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
1375          */
1376         public as_EventsProvider(): EventsProvider {
1377                 const ret: bigint = bindings.ChannelManager_as_EventsProvider(this.ptr);
1378                 const ret_hu_conv: EventsProvider = new EventsProvider(null, ret);
1379                 CommonBase.add_ref_from(ret_hu_conv, this);
1380                 return ret_hu_conv;
1381         }
1382
1383         /**
1384          * Constructs a new Listen which calls the relevant methods on this_arg.
1385          * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
1386          */
1387         public as_Listen(): Listen {
1388                 const ret: bigint = bindings.ChannelManager_as_Listen(this.ptr);
1389                 const ret_hu_conv: Listen = new Listen(null, ret);
1390                 CommonBase.add_ref_from(ret_hu_conv, this);
1391                 return ret_hu_conv;
1392         }
1393
1394         /**
1395          * Constructs a new Confirm which calls the relevant methods on this_arg.
1396          * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
1397          */
1398         public as_Confirm(): Confirm {
1399                 const ret: bigint = bindings.ChannelManager_as_Confirm(this.ptr);
1400                 const ret_hu_conv: Confirm = new Confirm(null, ret);
1401                 CommonBase.add_ref_from(ret_hu_conv, this);
1402                 return ret_hu_conv;
1403         }
1404
1405         /**
1406          * Gets a [`Future`] that completes when this [`ChannelManager`] needs to be persisted.
1407          * 
1408          * Note that callbacks registered on the [`Future`] MUST NOT call back into this
1409          * [`ChannelManager`] and should instead register actions to be taken later.
1410          */
1411         public get_persistable_update_future(): Future {
1412                 const ret: bigint = bindings.ChannelManager_get_persistable_update_future(this.ptr);
1413                 const ret_hu_conv: Future = new Future(null, ret);
1414                 CommonBase.add_ref_from(ret_hu_conv, this);
1415                 return ret_hu_conv;
1416         }
1417
1418         /**
1419          * Gets the latest best block which was connected either via the [`chain::Listen`] or
1420          * [`chain::Confirm`] interfaces.
1421          */
1422         public current_best_block(): BestBlock {
1423                 const ret: bigint = bindings.ChannelManager_current_best_block(this.ptr);
1424                 const ret_hu_conv: BestBlock = new BestBlock(null, ret);
1425                 CommonBase.add_ref_from(ret_hu_conv, this);
1426                 return ret_hu_conv;
1427         }
1428
1429         /**
1430          * Fetches the set of [`NodeFeatures`] flags which are provided by or required by
1431          * [`ChannelManager`].
1432          */
1433         public node_features(): NodeFeatures {
1434                 const ret: bigint = bindings.ChannelManager_node_features(this.ptr);
1435                 const ret_hu_conv: NodeFeatures = new NodeFeatures(null, ret);
1436                 CommonBase.add_ref_from(ret_hu_conv, this);
1437                 return ret_hu_conv;
1438         }
1439
1440         /**
1441          * Fetches the set of [`ChannelFeatures`] flags which are provided by or required by
1442          * [`ChannelManager`].
1443          */
1444         public channel_features(): ChannelFeatures {
1445                 const ret: bigint = bindings.ChannelManager_channel_features(this.ptr);
1446                 const ret_hu_conv: ChannelFeatures = new ChannelFeatures(null, ret);
1447                 CommonBase.add_ref_from(ret_hu_conv, this);
1448                 return ret_hu_conv;
1449         }
1450
1451         /**
1452          * Fetches the set of [`ChannelTypeFeatures`] flags which are provided by or required by
1453          * [`ChannelManager`].
1454          */
1455         public channel_type_features(): ChannelTypeFeatures {
1456                 const ret: bigint = bindings.ChannelManager_channel_type_features(this.ptr);
1457                 const ret_hu_conv: ChannelTypeFeatures = new ChannelTypeFeatures(null, ret);
1458                 CommonBase.add_ref_from(ret_hu_conv, this);
1459                 return ret_hu_conv;
1460         }
1461
1462         /**
1463          * Fetches the set of [`InitFeatures`] flags which are provided by or required by
1464          * [`ChannelManager`].
1465          */
1466         public init_features(): InitFeatures {
1467                 const ret: bigint = bindings.ChannelManager_init_features(this.ptr);
1468                 const ret_hu_conv: InitFeatures = new InitFeatures(null, ret);
1469                 CommonBase.add_ref_from(ret_hu_conv, this);
1470                 return ret_hu_conv;
1471         }
1472
1473         /**
1474          * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
1475          * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
1476          */
1477         public as_ChannelMessageHandler(): ChannelMessageHandler {
1478                 const ret: bigint = bindings.ChannelManager_as_ChannelMessageHandler(this.ptr);
1479                 const ret_hu_conv: ChannelMessageHandler = new ChannelMessageHandler(null, ret);
1480                 CommonBase.add_ref_from(ret_hu_conv, this);
1481                 return ret_hu_conv;
1482         }
1483
1484         /**
1485          * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
1486          */
1487         public write(): Uint8Array {
1488                 const ret: number = bindings.ChannelManager_write(this.ptr);
1489                 const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
1490                 return ret_conv;
1491         }
1492
1493 }