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