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