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