1 import { TxOut } from '../structs/TxOut.mjs';
2 import { BigEndianScalar } from '../structs/BigEndianScalar.mjs';
3 import { AccessError } from '../enums/AccessError.mjs';
4 import { COption_NoneZ } from '../enums/COption_NoneZ.mjs';
5 import { ChannelMonitorUpdateStatus } from '../enums/ChannelMonitorUpdateStatus.mjs';
6 import { ConfirmationTarget } from '../enums/ConfirmationTarget.mjs';
7 import { CreationError } from '../enums/CreationError.mjs';
8 import { Currency } from '../enums/Currency.mjs';
9 import { HTLCClaim } from '../enums/HTLCClaim.mjs';
10 import { IOError } from '../enums/IOError.mjs';
11 import { Level } from '../enums/Level.mjs';
12 import { Network } from '../enums/Network.mjs';
13 import { Recipient } from '../enums/Recipient.mjs';
14 import { Secp256k1Error } from '../enums/Secp256k1Error.mjs';
15 import { SemanticError } from '../enums/SemanticError.mjs';
16 import { SiPrefix } from '../enums/SiPrefix.mjs';
17 import { Bech32Error } from '../structs/Bech32Error.mjs';
18 import { Option_HTLCClaimZ } from '../structs/Option_HTLCClaimZ.mjs';
19 import { Result_NoneNoneZ } from '../structs/Result_NoneNoneZ.mjs';
20 import { CounterpartyCommitmentSecrets } from '../structs/CounterpartyCommitmentSecrets.mjs';
21 import { DecodeError } from '../structs/DecodeError.mjs';
22 import { Result_CounterpartyCommitmentSecretsDecodeErrorZ } from '../structs/Result_CounterpartyCommitmentSecretsDecodeErrorZ.mjs';
23 import { TxCreationKeys } from '../structs/TxCreationKeys.mjs';
24 import { Result_TxCreationKeysDecodeErrorZ } from '../structs/Result_TxCreationKeysDecodeErrorZ.mjs';
25 import { ChannelPublicKeys } from '../structs/ChannelPublicKeys.mjs';
26 import { Result_ChannelPublicKeysDecodeErrorZ } from '../structs/Result_ChannelPublicKeysDecodeErrorZ.mjs';
27 import { Option_u32Z } from '../structs/Option_u32Z.mjs';
28 import { HTLCOutputInCommitment } from '../structs/HTLCOutputInCommitment.mjs';
29 import { Result_HTLCOutputInCommitmentDecodeErrorZ } from '../structs/Result_HTLCOutputInCommitmentDecodeErrorZ.mjs';
30 import { CounterpartyChannelTransactionParameters } from '../structs/CounterpartyChannelTransactionParameters.mjs';
31 import { Result_CounterpartyChannelTransactionParametersDecodeErrorZ } from '../structs/Result_CounterpartyChannelTransactionParametersDecodeErrorZ.mjs';
32 import { ChannelTransactionParameters } from '../structs/ChannelTransactionParameters.mjs';
33 import { Result_ChannelTransactionParametersDecodeErrorZ } from '../structs/Result_ChannelTransactionParametersDecodeErrorZ.mjs';
34 import { HolderCommitmentTransaction } from '../structs/HolderCommitmentTransaction.mjs';
35 import { Result_HolderCommitmentTransactionDecodeErrorZ } from '../structs/Result_HolderCommitmentTransactionDecodeErrorZ.mjs';
36 import { BuiltCommitmentTransaction } from '../structs/BuiltCommitmentTransaction.mjs';
37 import { Result_BuiltCommitmentTransactionDecodeErrorZ } from '../structs/Result_BuiltCommitmentTransactionDecodeErrorZ.mjs';
38 import { TrustedClosingTransaction } from '../structs/TrustedClosingTransaction.mjs';
39 import { Result_TrustedClosingTransactionNoneZ } from '../structs/Result_TrustedClosingTransactionNoneZ.mjs';
40 import { CommitmentTransaction } from '../structs/CommitmentTransaction.mjs';
41 import { Result_CommitmentTransactionDecodeErrorZ } from '../structs/Result_CommitmentTransactionDecodeErrorZ.mjs';
42 import { TrustedCommitmentTransaction } from '../structs/TrustedCommitmentTransaction.mjs';
43 import { Result_TrustedCommitmentTransactionNoneZ } from '../structs/Result_TrustedCommitmentTransactionNoneZ.mjs';
44 import { Result_CVec_SignatureZNoneZ } from '../structs/Result_CVec_SignatureZNoneZ.mjs';
45 import { ShutdownScript } from '../structs/ShutdownScript.mjs';
46 import { Result_ShutdownScriptDecodeErrorZ } from '../structs/Result_ShutdownScriptDecodeErrorZ.mjs';
47 import { InvalidShutdownScript } from '../structs/InvalidShutdownScript.mjs';
48 import { Result_ShutdownScriptInvalidShutdownScriptZ } from '../structs/Result_ShutdownScriptInvalidShutdownScriptZ.mjs';
49 import { BlindedPath } from '../structs/BlindedPath.mjs';
50 import { Result_BlindedPathNoneZ } from '../structs/Result_BlindedPathNoneZ.mjs';
51 import { Result_BlindedPathDecodeErrorZ } from '../structs/Result_BlindedPathDecodeErrorZ.mjs';
52 import { BlindedHop } from '../structs/BlindedHop.mjs';
53 import { Result_BlindedHopDecodeErrorZ } from '../structs/Result_BlindedHopDecodeErrorZ.mjs';
54 import { ChannelDetails } from '../structs/ChannelDetails.mjs';
55 import { Route } from '../structs/Route.mjs';
56 import { LightningError } from '../structs/LightningError.mjs';
57 import { Result_RouteLightningErrorZ } from '../structs/Result_RouteLightningErrorZ.mjs';
58 import { RouteHop } from '../structs/RouteHop.mjs';
59 import { Option_u64Z } from '../structs/Option_u64Z.mjs';
60 import { InFlightHtlcs } from '../structs/InFlightHtlcs.mjs';
61 import { Result_InFlightHtlcsDecodeErrorZ } from '../structs/Result_InFlightHtlcsDecodeErrorZ.mjs';
62 import { Result_RouteHopDecodeErrorZ } from '../structs/Result_RouteHopDecodeErrorZ.mjs';
63 import { Result_RouteDecodeErrorZ } from '../structs/Result_RouteDecodeErrorZ.mjs';
64 import { RouteParameters } from '../structs/RouteParameters.mjs';
65 import { Result_RouteParametersDecodeErrorZ } from '../structs/Result_RouteParametersDecodeErrorZ.mjs';
66 import { RouteHint } from '../structs/RouteHint.mjs';
67 import { PaymentParameters } from '../structs/PaymentParameters.mjs';
68 import { Result_PaymentParametersDecodeErrorZ } from '../structs/Result_PaymentParametersDecodeErrorZ.mjs';
69 import { RouteHintHop } from '../structs/RouteHintHop.mjs';
70 import { Result_RouteHintDecodeErrorZ } from '../structs/Result_RouteHintDecodeErrorZ.mjs';
71 import { Result_RouteHintHopDecodeErrorZ } from '../structs/Result_RouteHintHopDecodeErrorZ.mjs';
72 import { PaymentPurpose } from '../structs/PaymentPurpose.mjs';
73 import { Result_PaymentPurposeDecodeErrorZ } from '../structs/Result_PaymentPurposeDecodeErrorZ.mjs';
74 import { ClosureReason } from '../structs/ClosureReason.mjs';
75 import { Option_ClosureReasonZ } from '../structs/Option_ClosureReasonZ.mjs';
76 import { Result_COption_ClosureReasonZDecodeErrorZ } from '../structs/Result_COption_ClosureReasonZDecodeErrorZ.mjs';
77 import { HTLCDestination } from '../structs/HTLCDestination.mjs';
78 import { Option_HTLCDestinationZ } from '../structs/Option_HTLCDestinationZ.mjs';
79 import { Result_COption_HTLCDestinationZDecodeErrorZ } from '../structs/Result_COption_HTLCDestinationZDecodeErrorZ.mjs';
80 import { Option_u128Z } from '../structs/Option_u128Z.mjs';
81 import { ChannelUpdate } from '../structs/ChannelUpdate.mjs';
82 import { NetworkUpdate } from '../structs/NetworkUpdate.mjs';
83 import { Option_NetworkUpdateZ } from '../structs/Option_NetworkUpdateZ.mjs';
84 import { OutPoint } from '../structs/OutPoint.mjs';
85 import { DelayedPaymentOutputDescriptor } from '../structs/DelayedPaymentOutputDescriptor.mjs';
86 import { StaticPaymentOutputDescriptor } from '../structs/StaticPaymentOutputDescriptor.mjs';
87 import { SpendableOutputDescriptor } from '../structs/SpendableOutputDescriptor.mjs';
88 import { ChannelTypeFeatures } from '../structs/ChannelTypeFeatures.mjs';
89 import { Option_EventZ } from '../structs/Option_EventZ.mjs';
90 import { Result_COption_EventZDecodeErrorZ } from '../structs/Result_COption_EventZDecodeErrorZ.mjs';
91 import { AcceptChannel } from '../structs/AcceptChannel.mjs';
92 import { OpenChannel } from '../structs/OpenChannel.mjs';
93 import { FundingCreated } from '../structs/FundingCreated.mjs';
94 import { FundingSigned } from '../structs/FundingSigned.mjs';
95 import { ChannelReady } from '../structs/ChannelReady.mjs';
96 import { AnnouncementSignatures } from '../structs/AnnouncementSignatures.mjs';
97 import { CommitmentUpdate } from '../structs/CommitmentUpdate.mjs';
98 import { RevokeAndACK } from '../structs/RevokeAndACK.mjs';
99 import { ClosingSigned } from '../structs/ClosingSigned.mjs';
100 import { Shutdown } from '../structs/Shutdown.mjs';
101 import { ChannelReestablish } from '../structs/ChannelReestablish.mjs';
102 import { ChannelAnnouncement } from '../structs/ChannelAnnouncement.mjs';
103 import { ErrorMessage } from '../structs/ErrorMessage.mjs';
104 import { WarningMessage } from '../structs/WarningMessage.mjs';
105 import { ErrorAction } from '../structs/ErrorAction.mjs';
106 import { QueryChannelRange } from '../structs/QueryChannelRange.mjs';
107 import { QueryShortChannelIds } from '../structs/QueryShortChannelIds.mjs';
108 import { ReplyChannelRange } from '../structs/ReplyChannelRange.mjs';
109 import { GossipTimestampFilter } from '../structs/GossipTimestampFilter.mjs';
110 import { MessageSendEvent } from '../structs/MessageSendEvent.mjs';
111 import { Result_TxOutAccessErrorZ } from '../structs/Result_TxOutAccessErrorZ.mjs';
112 import { TwoTuple_usizeTransactionZ } from '../structs/TwoTuple_usizeTransactionZ.mjs';
113 import { TwoTuple_TxidBlockHashZ } from '../structs/TwoTuple_TxidBlockHashZ.mjs';
114 import { HTLCUpdate } from '../structs/HTLCUpdate.mjs';
115 import { MonitorEvent } from '../structs/MonitorEvent.mjs';
116 import { ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ } from '../structs/ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ.mjs';
117 import { FixedPenaltyScorer } from '../structs/FixedPenaltyScorer.mjs';
118 import { Result_FixedPenaltyScorerDecodeErrorZ } from '../structs/Result_FixedPenaltyScorerDecodeErrorZ.mjs';
119 import { TwoTuple_u64u64Z } from '../structs/TwoTuple_u64u64Z.mjs';
120 import { Option_C2Tuple_u64u64ZZ } from '../structs/Option_C2Tuple_u64u64ZZ.mjs';
121 import { NodeId } from '../structs/NodeId.mjs';
122 import { Record } from '../structs/Record.mjs';
123 import { Logger, LoggerInterface } from '../structs/Logger.mjs';
124 import { NetworkGraph } from '../structs/NetworkGraph.mjs';
125 import { ProbabilisticScorer } from '../structs/ProbabilisticScorer.mjs';
126 import { Result_ProbabilisticScorerDecodeErrorZ } from '../structs/Result_ProbabilisticScorerDecodeErrorZ.mjs';
127 import { InitFeatures } from '../structs/InitFeatures.mjs';
128 import { Result_InitFeaturesDecodeErrorZ } from '../structs/Result_InitFeaturesDecodeErrorZ.mjs';
129 import { ChannelFeatures } from '../structs/ChannelFeatures.mjs';
130 import { Result_ChannelFeaturesDecodeErrorZ } from '../structs/Result_ChannelFeaturesDecodeErrorZ.mjs';
131 import { NodeFeatures } from '../structs/NodeFeatures.mjs';
132 import { Result_NodeFeaturesDecodeErrorZ } from '../structs/Result_NodeFeaturesDecodeErrorZ.mjs';
133 import { InvoiceFeatures } from '../structs/InvoiceFeatures.mjs';
134 import { Result_InvoiceFeaturesDecodeErrorZ } from '../structs/Result_InvoiceFeaturesDecodeErrorZ.mjs';
135 import { Result_ChannelTypeFeaturesDecodeErrorZ } from '../structs/Result_ChannelTypeFeaturesDecodeErrorZ.mjs';
136 import { OfferFeatures } from '../structs/OfferFeatures.mjs';
137 import { Result_OfferFeaturesDecodeErrorZ } from '../structs/Result_OfferFeaturesDecodeErrorZ.mjs';
138 import { InvoiceRequestFeatures } from '../structs/InvoiceRequestFeatures.mjs';
139 import { Result_InvoiceRequestFeaturesDecodeErrorZ } from '../structs/Result_InvoiceRequestFeaturesDecodeErrorZ.mjs';
140 import { Result_NodeIdDecodeErrorZ } from '../structs/Result_NodeIdDecodeErrorZ.mjs';
141 import { Result_COption_NetworkUpdateZDecodeErrorZ } from '../structs/Result_COption_NetworkUpdateZDecodeErrorZ.mjs';
142 import { Access, AccessInterface } from '../structs/Access.mjs';
143 import { Option_AccessZ } from '../structs/Option_AccessZ.mjs';
144 import { Result_boolLightningErrorZ } from '../structs/Result_boolLightningErrorZ.mjs';
145 import { ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ } from '../structs/ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.mjs';
146 import { Option_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ } from '../structs/Option_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ.mjs';
147 import { Result_NoneLightningErrorZ } from '../structs/Result_NoneLightningErrorZ.mjs';
148 import { ChannelUpdateInfo } from '../structs/ChannelUpdateInfo.mjs';
149 import { Result_ChannelUpdateInfoDecodeErrorZ } from '../structs/Result_ChannelUpdateInfoDecodeErrorZ.mjs';
150 import { ChannelInfo } from '../structs/ChannelInfo.mjs';
151 import { Result_ChannelInfoDecodeErrorZ } from '../structs/Result_ChannelInfoDecodeErrorZ.mjs';
152 import { RoutingFees } from '../structs/RoutingFees.mjs';
153 import { Result_RoutingFeesDecodeErrorZ } from '../structs/Result_RoutingFeesDecodeErrorZ.mjs';
154 import { Hostname } from '../structs/Hostname.mjs';
155 import { NetAddress } from '../structs/NetAddress.mjs';
156 import { NodeAnnouncementInfo } from '../structs/NodeAnnouncementInfo.mjs';
157 import { Result_NodeAnnouncementInfoDecodeErrorZ } from '../structs/Result_NodeAnnouncementInfoDecodeErrorZ.mjs';
158 import { NodeAlias } from '../structs/NodeAlias.mjs';
159 import { Result_NodeAliasDecodeErrorZ } from '../structs/Result_NodeAliasDecodeErrorZ.mjs';
160 import { NodeInfo } from '../structs/NodeInfo.mjs';
161 import { Result_NodeInfoDecodeErrorZ } from '../structs/Result_NodeInfoDecodeErrorZ.mjs';
162 import { Result_NetworkGraphDecodeErrorZ } from '../structs/Result_NetworkGraphDecodeErrorZ.mjs';
163 import { Option_CVec_NetAddressZZ } from '../structs/Option_CVec_NetAddressZZ.mjs';
164 import { Result_DelayedPaymentOutputDescriptorDecodeErrorZ } from '../structs/Result_DelayedPaymentOutputDescriptorDecodeErrorZ.mjs';
165 import { Result_StaticPaymentOutputDescriptorDecodeErrorZ } from '../structs/Result_StaticPaymentOutputDescriptorDecodeErrorZ.mjs';
166 import { Result_SpendableOutputDescriptorDecodeErrorZ } from '../structs/Result_SpendableOutputDescriptorDecodeErrorZ.mjs';
167 import { TwoTuple_SignatureCVec_SignatureZZ } from '../structs/TwoTuple_SignatureCVec_SignatureZZ.mjs';
168 import { Result_C2Tuple_SignatureCVec_SignatureZZNoneZ } from '../structs/Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.mjs';
169 import { Result_SignatureNoneZ } from '../structs/Result_SignatureNoneZ.mjs';
170 import { TwoTuple_SignatureSignatureZ } from '../structs/TwoTuple_SignatureSignatureZ.mjs';
171 import { Result_C2Tuple_SignatureSignatureZNoneZ } from '../structs/Result_C2Tuple_SignatureSignatureZNoneZ.mjs';
172 import { Result_SecretKeyNoneZ } from '../structs/Result_SecretKeyNoneZ.mjs';
173 import { Result_PublicKeyNoneZ } from '../structs/Result_PublicKeyNoneZ.mjs';
174 import { Option_ScalarZ } from '../structs/Option_ScalarZ.mjs';
175 import { Result_SharedSecretNoneZ } from '../structs/Result_SharedSecretNoneZ.mjs';
176 import { ClosingTransaction } from '../structs/ClosingTransaction.mjs';
177 import { UnsignedChannelAnnouncement } from '../structs/UnsignedChannelAnnouncement.mjs';
178 import { BaseSign, BaseSignInterface } from '../structs/BaseSign.mjs';
179 import { Sign, SignInterface } from '../structs/Sign.mjs';
180 import { Result_SignDecodeErrorZ } from '../structs/Result_SignDecodeErrorZ.mjs';
181 import { Result_RecoverableSignatureNoneZ } from '../structs/Result_RecoverableSignatureNoneZ.mjs';
182 import { Result_CVec_CVec_u8ZZNoneZ } from '../structs/Result_CVec_CVec_u8ZZNoneZ.mjs';
183 import { InMemorySigner } from '../structs/InMemorySigner.mjs';
184 import { Result_InMemorySignerDecodeErrorZ } from '../structs/Result_InMemorySignerDecodeErrorZ.mjs';
185 import { Result_TransactionNoneZ } from '../structs/Result_TransactionNoneZ.mjs';
186 import { Option_u16Z } from '../structs/Option_u16Z.mjs';
187 import { APIError } from '../structs/APIError.mjs';
188 import { Result_NoneAPIErrorZ } from '../structs/Result_NoneAPIErrorZ.mjs';
189 import { Result__u832APIErrorZ } from '../structs/Result__u832APIErrorZ.mjs';
190 import { PaymentSendFailure } from '../structs/PaymentSendFailure.mjs';
191 import { Result_NonePaymentSendFailureZ } from '../structs/Result_NonePaymentSendFailureZ.mjs';
192 import { Result_PaymentHashPaymentSendFailureZ } from '../structs/Result_PaymentHashPaymentSendFailureZ.mjs';
193 import { TwoTuple_PaymentHashPaymentIdZ } from '../structs/TwoTuple_PaymentHashPaymentIdZ.mjs';
194 import { Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ } from '../structs/Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.mjs';
195 import { TwoTuple_PaymentHashPaymentSecretZ } from '../structs/TwoTuple_PaymentHashPaymentSecretZ.mjs';
196 import { Result_C2Tuple_PaymentHashPaymentSecretZNoneZ } from '../structs/Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.mjs';
197 import { Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ } from '../structs/Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.mjs';
198 import { Result_PaymentSecretNoneZ } from '../structs/Result_PaymentSecretNoneZ.mjs';
199 import { Result_PaymentSecretAPIErrorZ } from '../structs/Result_PaymentSecretAPIErrorZ.mjs';
200 import { Result_PaymentPreimageAPIErrorZ } from '../structs/Result_PaymentPreimageAPIErrorZ.mjs';
201 import { CounterpartyForwardingInfo } from '../structs/CounterpartyForwardingInfo.mjs';
202 import { Result_CounterpartyForwardingInfoDecodeErrorZ } from '../structs/Result_CounterpartyForwardingInfoDecodeErrorZ.mjs';
203 import { ChannelCounterparty } from '../structs/ChannelCounterparty.mjs';
204 import { Result_ChannelCounterpartyDecodeErrorZ } from '../structs/Result_ChannelCounterpartyDecodeErrorZ.mjs';
205 import { Result_ChannelDetailsDecodeErrorZ } from '../structs/Result_ChannelDetailsDecodeErrorZ.mjs';
206 import { PhantomRouteHints } from '../structs/PhantomRouteHints.mjs';
207 import { Result_PhantomRouteHintsDecodeErrorZ } from '../structs/Result_PhantomRouteHintsDecodeErrorZ.mjs';
208 import { ChannelMonitor } from '../structs/ChannelMonitor.mjs';
209 import { ChannelMonitorUpdate } from '../structs/ChannelMonitorUpdate.mjs';
210 import { Watch, WatchInterface } from '../structs/Watch.mjs';
211 import { BroadcasterInterface, BroadcasterInterfaceInterface } from '../structs/BroadcasterInterface.mjs';
212 import { KeysInterface, KeysInterfaceInterface } from '../structs/KeysInterface.mjs';
213 import { FeeEstimator, FeeEstimatorInterface } from '../structs/FeeEstimator.mjs';
214 import { ChannelManager } from '../structs/ChannelManager.mjs';
215 import { TwoTuple_BlockHashChannelManagerZ } from '../structs/TwoTuple_BlockHashChannelManagerZ.mjs';
216 import { Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ } from '../structs/Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.mjs';
217 import { ChannelConfig } from '../structs/ChannelConfig.mjs';
218 import { Result_ChannelConfigDecodeErrorZ } from '../structs/Result_ChannelConfigDecodeErrorZ.mjs';
219 import { Result_OutPointDecodeErrorZ } from '../structs/Result_OutPointDecodeErrorZ.mjs';
220 import { Type, TypeInterface } from '../structs/Type.mjs';
221 import { Option_TypeZ } from '../structs/Option_TypeZ.mjs';
222 import { Result_COption_TypeZDecodeErrorZ } from '../structs/Result_COption_TypeZDecodeErrorZ.mjs';
223 import { PaymentError } from '../structs/PaymentError.mjs';
224 import { Result_PaymentIdPaymentErrorZ } from '../structs/Result_PaymentIdPaymentErrorZ.mjs';
225 import { Result_NonePaymentErrorZ } from '../structs/Result_NonePaymentErrorZ.mjs';
226 import { Result_StringErrorZ } from '../structs/Result_StringErrorZ.mjs';
227 import { Result_PublicKeyErrorZ } from '../structs/Result_PublicKeyErrorZ.mjs';
228 import { Result_ChannelMonitorUpdateDecodeErrorZ } from '../structs/Result_ChannelMonitorUpdateDecodeErrorZ.mjs';
229 import { Option_MonitorEventZ } from '../structs/Option_MonitorEventZ.mjs';
230 import { Result_COption_MonitorEventZDecodeErrorZ } from '../structs/Result_COption_MonitorEventZDecodeErrorZ.mjs';
231 import { Result_HTLCUpdateDecodeErrorZ } from '../structs/Result_HTLCUpdateDecodeErrorZ.mjs';
232 import { TwoTuple_OutPointScriptZ } from '../structs/TwoTuple_OutPointScriptZ.mjs';
233 import { TwoTuple_u32ScriptZ } from '../structs/TwoTuple_u32ScriptZ.mjs';
234 import { TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ } from '../structs/TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ.mjs';
235 import { TwoTuple_u32TxOutZ } from '../structs/TwoTuple_u32TxOutZ.mjs';
236 import { TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ } from '../structs/TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ.mjs';
237 import { Balance } from '../structs/Balance.mjs';
238 import { TwoTuple_BlockHashChannelMonitorZ } from '../structs/TwoTuple_BlockHashChannelMonitorZ.mjs';
239 import { Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ } from '../structs/Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.mjs';
240 import { TwoTuple_PublicKeyTypeZ } from '../structs/TwoTuple_PublicKeyTypeZ.mjs';
241 import { CustomOnionMessageContents, CustomOnionMessageContentsInterface } from '../structs/CustomOnionMessageContents.mjs';
242 import { Option_CustomOnionMessageContentsZ } from '../structs/Option_CustomOnionMessageContentsZ.mjs';
243 import { Result_COption_CustomOnionMessageContentsZDecodeErrorZ } from '../structs/Result_COption_CustomOnionMessageContentsZDecodeErrorZ.mjs';
244 import { Option_NetAddressZ } from '../structs/Option_NetAddressZ.mjs';
245 import { PeerHandleError } from '../structs/PeerHandleError.mjs';
246 import { Result_CVec_u8ZPeerHandleErrorZ } from '../structs/Result_CVec_u8ZPeerHandleErrorZ.mjs';
247 import { Result_NonePeerHandleErrorZ } from '../structs/Result_NonePeerHandleErrorZ.mjs';
248 import { Result_boolPeerHandleErrorZ } from '../structs/Result_boolPeerHandleErrorZ.mjs';
249 import { SendError } from '../structs/SendError.mjs';
250 import { Result_NoneSendErrorZ } from '../structs/Result_NoneSendErrorZ.mjs';
251 import { GraphSyncError } from '../structs/GraphSyncError.mjs';
252 import { Result_u32GraphSyncErrorZ } from '../structs/Result_u32GraphSyncErrorZ.mjs';
253 import { ParseError } from '../structs/ParseError.mjs';
254 import { Result_SiPrefixParseErrorZ } from '../structs/Result_SiPrefixParseErrorZ.mjs';
255 import { Invoice } from '../structs/Invoice.mjs';
256 import { ParseOrSemanticError } from '../structs/ParseOrSemanticError.mjs';
257 import { Result_InvoiceParseOrSemanticErrorZ } from '../structs/Result_InvoiceParseOrSemanticErrorZ.mjs';
258 import { SignedRawInvoice } from '../structs/SignedRawInvoice.mjs';
259 import { Result_SignedRawInvoiceParseErrorZ } from '../structs/Result_SignedRawInvoiceParseErrorZ.mjs';
260 import { RawInvoice } from '../structs/RawInvoice.mjs';
261 import { InvoiceSignature } from '../structs/InvoiceSignature.mjs';
262 import { ThreeTuple_RawInvoice_u832InvoiceSignatureZ } from '../structs/ThreeTuple_RawInvoice_u832InvoiceSignatureZ.mjs';
263 import { PayeePubKey } from '../structs/PayeePubKey.mjs';
264 import { Result_PayeePubKeyErrorZ } from '../structs/Result_PayeePubKeyErrorZ.mjs';
265 import { PrivateRoute } from '../structs/PrivateRoute.mjs';
266 import { PositiveTimestamp } from '../structs/PositiveTimestamp.mjs';
267 import { Result_PositiveTimestampCreationErrorZ } from '../structs/Result_PositiveTimestampCreationErrorZ.mjs';
268 import { Result_NoneSemanticErrorZ } from '../structs/Result_NoneSemanticErrorZ.mjs';
269 import { Result_InvoiceSemanticErrorZ } from '../structs/Result_InvoiceSemanticErrorZ.mjs';
270 import { Description } from '../structs/Description.mjs';
271 import { Result_DescriptionCreationErrorZ } from '../structs/Result_DescriptionCreationErrorZ.mjs';
272 import { Result_PrivateRouteCreationErrorZ } from '../structs/Result_PrivateRouteCreationErrorZ.mjs';
273 import { Result_NoneErrorZ } from '../structs/Result_NoneErrorZ.mjs';
274 import { Result_NetAddressDecodeErrorZ } from '../structs/Result_NetAddressDecodeErrorZ.mjs';
275 import { UpdateAddHTLC } from '../structs/UpdateAddHTLC.mjs';
276 import { UpdateFulfillHTLC } from '../structs/UpdateFulfillHTLC.mjs';
277 import { UpdateFailHTLC } from '../structs/UpdateFailHTLC.mjs';
278 import { UpdateFailMalformedHTLC } from '../structs/UpdateFailMalformedHTLC.mjs';
279 import { Result_AcceptChannelDecodeErrorZ } from '../structs/Result_AcceptChannelDecodeErrorZ.mjs';
280 import { Result_AnnouncementSignaturesDecodeErrorZ } from '../structs/Result_AnnouncementSignaturesDecodeErrorZ.mjs';
281 import { Result_ChannelReestablishDecodeErrorZ } from '../structs/Result_ChannelReestablishDecodeErrorZ.mjs';
282 import { Result_ClosingSignedDecodeErrorZ } from '../structs/Result_ClosingSignedDecodeErrorZ.mjs';
283 import { ClosingSignedFeeRange } from '../structs/ClosingSignedFeeRange.mjs';
284 import { Result_ClosingSignedFeeRangeDecodeErrorZ } from '../structs/Result_ClosingSignedFeeRangeDecodeErrorZ.mjs';
285 import { CommitmentSigned } from '../structs/CommitmentSigned.mjs';
286 import { Result_CommitmentSignedDecodeErrorZ } from '../structs/Result_CommitmentSignedDecodeErrorZ.mjs';
287 import { Result_FundingCreatedDecodeErrorZ } from '../structs/Result_FundingCreatedDecodeErrorZ.mjs';
288 import { Result_FundingSignedDecodeErrorZ } from '../structs/Result_FundingSignedDecodeErrorZ.mjs';
289 import { Result_ChannelReadyDecodeErrorZ } from '../structs/Result_ChannelReadyDecodeErrorZ.mjs';
290 import { Init } from '../structs/Init.mjs';
291 import { Result_InitDecodeErrorZ } from '../structs/Result_InitDecodeErrorZ.mjs';
292 import { Result_OpenChannelDecodeErrorZ } from '../structs/Result_OpenChannelDecodeErrorZ.mjs';
293 import { Result_RevokeAndACKDecodeErrorZ } from '../structs/Result_RevokeAndACKDecodeErrorZ.mjs';
294 import { Result_ShutdownDecodeErrorZ } from '../structs/Result_ShutdownDecodeErrorZ.mjs';
295 import { Result_UpdateFailHTLCDecodeErrorZ } from '../structs/Result_UpdateFailHTLCDecodeErrorZ.mjs';
296 import { Result_UpdateFailMalformedHTLCDecodeErrorZ } from '../structs/Result_UpdateFailMalformedHTLCDecodeErrorZ.mjs';
297 import { UpdateFee } from '../structs/UpdateFee.mjs';
298 import { Result_UpdateFeeDecodeErrorZ } from '../structs/Result_UpdateFeeDecodeErrorZ.mjs';
299 import { Result_UpdateFulfillHTLCDecodeErrorZ } from '../structs/Result_UpdateFulfillHTLCDecodeErrorZ.mjs';
300 import { Result_UpdateAddHTLCDecodeErrorZ } from '../structs/Result_UpdateAddHTLCDecodeErrorZ.mjs';
301 import { OnionMessage } from '../structs/OnionMessage.mjs';
302 import { Result_OnionMessageDecodeErrorZ } from '../structs/Result_OnionMessageDecodeErrorZ.mjs';
303 import { Ping } from '../structs/Ping.mjs';
304 import { Result_PingDecodeErrorZ } from '../structs/Result_PingDecodeErrorZ.mjs';
305 import { Pong } from '../structs/Pong.mjs';
306 import { Result_PongDecodeErrorZ } from '../structs/Result_PongDecodeErrorZ.mjs';
307 import { Result_UnsignedChannelAnnouncementDecodeErrorZ } from '../structs/Result_UnsignedChannelAnnouncementDecodeErrorZ.mjs';
308 import { Result_ChannelAnnouncementDecodeErrorZ } from '../structs/Result_ChannelAnnouncementDecodeErrorZ.mjs';
309 import { UnsignedChannelUpdate } from '../structs/UnsignedChannelUpdate.mjs';
310 import { Result_UnsignedChannelUpdateDecodeErrorZ } from '../structs/Result_UnsignedChannelUpdateDecodeErrorZ.mjs';
311 import { Result_ChannelUpdateDecodeErrorZ } from '../structs/Result_ChannelUpdateDecodeErrorZ.mjs';
312 import { Result_ErrorMessageDecodeErrorZ } from '../structs/Result_ErrorMessageDecodeErrorZ.mjs';
313 import { Result_WarningMessageDecodeErrorZ } from '../structs/Result_WarningMessageDecodeErrorZ.mjs';
314 import { UnsignedNodeAnnouncement } from '../structs/UnsignedNodeAnnouncement.mjs';
315 import { Result_UnsignedNodeAnnouncementDecodeErrorZ } from '../structs/Result_UnsignedNodeAnnouncementDecodeErrorZ.mjs';
316 import { NodeAnnouncement } from '../structs/NodeAnnouncement.mjs';
317 import { Result_NodeAnnouncementDecodeErrorZ } from '../structs/Result_NodeAnnouncementDecodeErrorZ.mjs';
318 import { Result_QueryShortChannelIdsDecodeErrorZ } from '../structs/Result_QueryShortChannelIdsDecodeErrorZ.mjs';
319 import { ReplyShortChannelIdsEnd } from '../structs/ReplyShortChannelIdsEnd.mjs';
320 import { Result_ReplyShortChannelIdsEndDecodeErrorZ } from '../structs/Result_ReplyShortChannelIdsEndDecodeErrorZ.mjs';
321 import { Result_QueryChannelRangeDecodeErrorZ } from '../structs/Result_QueryChannelRangeDecodeErrorZ.mjs';
322 import { Result_ReplyChannelRangeDecodeErrorZ } from '../structs/Result_ReplyChannelRangeDecodeErrorZ.mjs';
323 import { Result_GossipTimestampFilterDecodeErrorZ } from '../structs/Result_GossipTimestampFilterDecodeErrorZ.mjs';
324 import { SignOrCreationError } from '../structs/SignOrCreationError.mjs';
325 import { Result_InvoiceSignOrCreationErrorZ } from '../structs/Result_InvoiceSignOrCreationErrorZ.mjs';
326 import { WatchedOutput } from '../structs/WatchedOutput.mjs';
327 import { Filter, FilterInterface } from '../structs/Filter.mjs';
328 import { Option_FilterZ } from '../structs/Option_FilterZ.mjs';
329 import { LockedChannelMonitor } from '../structs/LockedChannelMonitor.mjs';
330 import { Result_LockedChannelMonitorNoneZ } from '../structs/Result_LockedChannelMonitorNoneZ.mjs';
331 import { MonitorUpdateId } from '../structs/MonitorUpdateId.mjs';
332 import { TwoTuple_OutPointCVec_MonitorUpdateIdZZ } from '../structs/TwoTuple_OutPointCVec_MonitorUpdateIdZZ.mjs';
333 import { MessageSendEventsProvider, MessageSendEventsProviderInterface } from '../structs/MessageSendEventsProvider.mjs';
334 import { OnionMessageProvider, OnionMessageProviderInterface } from '../structs/OnionMessageProvider.mjs';
335 import { EventHandler, EventHandlerInterface } from '../structs/EventHandler.mjs';
336 import { EventsProvider, EventsProviderInterface } from '../structs/EventsProvider.mjs';
337 import { BigSize } from '../structs/BigSize.mjs';
338 import { ChannelUsage } from '../structs/ChannelUsage.mjs';
339 import { Score, ScoreInterface } from '../structs/Score.mjs';
340 import { LockableScore, LockableScoreInterface } from '../structs/LockableScore.mjs';
341 import { WriteableScore, WriteableScoreInterface } from '../structs/WriteableScore.mjs';
342 import { Persister, PersisterInterface } from '../structs/Persister.mjs';
343 import { PrintableString } from '../structs/PrintableString.mjs';
344 import { FutureCallback, FutureCallbackInterface } from '../structs/FutureCallback.mjs';
345 import { Future } from '../structs/Future.mjs';
346 import { ChannelHandshakeConfig } from '../structs/ChannelHandshakeConfig.mjs';
347 import { ChannelHandshakeLimits } from '../structs/ChannelHandshakeLimits.mjs';
348 import { UserConfig } from '../structs/UserConfig.mjs';
349 import { BestBlock } from '../structs/BestBlock.mjs';
350 import { Listen, ListenInterface } from '../structs/Listen.mjs';
351 import { Confirm, ConfirmInterface } from '../structs/Confirm.mjs';
352 import { Persist, PersistInterface } from '../structs/Persist.mjs';
353 import { ChainMonitor } from '../structs/ChainMonitor.mjs';
354 import { KeysManager } from '../structs/KeysManager.mjs';
355 import { PhantomKeysManager } from '../structs/PhantomKeysManager.mjs';
356 import { ChainParameters } from '../structs/ChainParameters.mjs';
357 import { ChannelMessageHandler, ChannelMessageHandlerInterface } from '../structs/ChannelMessageHandler.mjs';
358 import { ChannelManagerReadArgs } from '../structs/ChannelManagerReadArgs.mjs';
359 import { ExpandedKey } from '../structs/ExpandedKey.mjs';
360 import { DataLossProtect } from '../structs/DataLossProtect.mjs';
361 import { RoutingMessageHandler, RoutingMessageHandlerInterface } from '../structs/RoutingMessageHandler.mjs';
362 import { OnionMessageHandler, OnionMessageHandlerInterface } from '../structs/OnionMessageHandler.mjs';
363 import { CustomMessageReader, CustomMessageReaderInterface } from '../structs/CustomMessageReader.mjs';
364 import { CustomMessageHandler, CustomMessageHandlerInterface } from '../structs/CustomMessageHandler.mjs';
365 import { IgnoringMessageHandler } from '../structs/IgnoringMessageHandler.mjs';
366 import { CustomOnionMessageHandler, CustomOnionMessageHandlerInterface } from '../structs/CustomOnionMessageHandler.mjs';
367 import { ErroringMessageHandler } from '../structs/ErroringMessageHandler.mjs';
368 import { MessageHandler } from '../structs/MessageHandler.mjs';
369 import { SocketDescriptor, SocketDescriptorInterface } from '../structs/SocketDescriptor.mjs';
370 import { PeerManager } from '../structs/PeerManager.mjs';
371 import { DirectedChannelTransactionParameters } from '../structs/DirectedChannelTransactionParameters.mjs';
372 import { ReadOnlyNetworkGraph } from '../structs/ReadOnlyNetworkGraph.mjs';
373 import { P2PGossipSync } from '../structs/P2PGossipSync.mjs';
374 import { DirectedChannelInfo } from '../structs/DirectedChannelInfo.mjs';
375 import { EffectiveCapacity } from '../structs/EffectiveCapacity.mjs';
376 import { DefaultRouter } from '../structs/DefaultRouter.mjs';
377 import { Router, RouterInterface } from '../structs/Router.mjs';
378 import { ScorerAccountingForInFlightHtlcs } from '../structs/ScorerAccountingForInFlightHtlcs.mjs';
379 import { MultiThreadedLockableScore } from '../structs/MultiThreadedLockableScore.mjs';
380 import { MultiThreadedScoreLock } from '../structs/MultiThreadedScoreLock.mjs';
381 import { ProbabilisticScoringParameters } from '../structs/ProbabilisticScoringParameters.mjs';
382 import { OnionMessenger } from '../structs/OnionMessenger.mjs';
383 import { Destination } from '../structs/Destination.mjs';
384 import { OnionMessageContents } from '../structs/OnionMessageContents.mjs';
385 import { RapidGossipSync } from '../structs/RapidGossipSync.mjs';
386 import { RawDataPart } from '../structs/RawDataPart.mjs';
387 import { Sha256 } from '../structs/Sha256.mjs';
388 import { ExpiryTime } from '../structs/ExpiryTime.mjs';
389 import { MinFinalCltvExpiry } from '../structs/MinFinalCltvExpiry.mjs';
390 import { Fallback } from '../structs/Fallback.mjs';
391 import { Payer, PayerInterface } from '../structs/Payer.mjs';
392 import { InvoicePayer } from '../structs/InvoicePayer.mjs';
393 import { Retry } from '../structs/Retry.mjs';
395 import { CommonBase, UInt5, WitnessVersion, UnqualifiedError } from './CommonBase.mjs';
396 import * as bindings from '../bindings.mjs'
399 * An Event which you should probably take some action in response to.
401 * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
402 * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
403 * written as it makes no sense to respond to it after reconnecting to peers).
405 export class Event extends CommonBase {
406 protected constructor(_dummy: null, ptr: bigint) { super(ptr, bindings.Event_free); }
408 public static constr_from_ptr(ptr: bigint): Event {
409 const raw_ty: number = bindings.LDKEvent_ty_from_ptr(ptr);
411 case 0: return new Event_FundingGenerationReady(ptr);
412 case 1: return new Event_PaymentClaimable(ptr);
413 case 2: return new Event_PaymentClaimed(ptr);
414 case 3: return new Event_PaymentSent(ptr);
415 case 4: return new Event_PaymentFailed(ptr);
416 case 5: return new Event_PaymentPathSuccessful(ptr);
417 case 6: return new Event_PaymentPathFailed(ptr);
418 case 7: return new Event_ProbeSuccessful(ptr);
419 case 8: return new Event_ProbeFailed(ptr);
420 case 9: return new Event_PendingHTLCsForwardable(ptr);
421 case 10: return new Event_HTLCIntercepted(ptr);
422 case 11: return new Event_SpendableOutputs(ptr);
423 case 12: return new Event_PaymentForwarded(ptr);
424 case 13: return new Event_ChannelReady(ptr);
425 case 14: return new Event_ChannelClosed(ptr);
426 case 15: return new Event_DiscardFunding(ptr);
427 case 16: return new Event_OpenChannelRequest(ptr);
428 case 17: return new Event_HTLCHandlingFailed(ptr);
430 throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
434 public clone_ptr(): bigint {
435 const ret: bigint = bindings.Event_clone_ptr(this.ptr);
440 * Creates a copy of the Event
442 public clone(): Event {
443 const ret: bigint = bindings.Event_clone(this.ptr);
444 const ret_hu_conv: Event = Event.constr_from_ptr(ret);
445 CommonBase.add_ref_from(ret_hu_conv, this);
450 * Utility method to constructs a new FundingGenerationReady-variant Event
452 public static constructor_funding_generation_ready(temporary_channel_id: Uint8Array, counterparty_node_id: Uint8Array, channel_value_satoshis: bigint, output_script: Uint8Array, user_channel_id: bigint): Event {
453 const ret: bigint = bindings.Event_funding_generation_ready(bindings.encodeUint8Array(bindings.check_arr_len(temporary_channel_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(counterparty_node_id, 33)), channel_value_satoshis, bindings.encodeUint8Array(output_script), bindings.encodeUint128(user_channel_id));
454 const ret_hu_conv: Event = Event.constr_from_ptr(ret);
455 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
460 * Utility method to constructs a new PaymentClaimable-variant Event
462 public static constructor_payment_claimable(receiver_node_id: Uint8Array, payment_hash: Uint8Array, amount_msat: bigint, purpose: PaymentPurpose, via_channel_id: Uint8Array, via_user_channel_id: Option_u128Z): Event {
463 const ret: bigint = bindings.Event_payment_claimable(bindings.encodeUint8Array(bindings.check_arr_len(receiver_node_id, 33)), bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), amount_msat, CommonBase.get_ptr_of(purpose), bindings.encodeUint8Array(bindings.check_arr_len(via_channel_id, 32)), CommonBase.get_ptr_of(via_user_channel_id));
464 const ret_hu_conv: Event = Event.constr_from_ptr(ret);
465 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
470 * Utility method to constructs a new PaymentClaimed-variant Event
472 public static constructor_payment_claimed(receiver_node_id: Uint8Array, payment_hash: Uint8Array, amount_msat: bigint, purpose: PaymentPurpose): Event {
473 const ret: bigint = bindings.Event_payment_claimed(bindings.encodeUint8Array(bindings.check_arr_len(receiver_node_id, 33)), bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), amount_msat, CommonBase.get_ptr_of(purpose));
474 const ret_hu_conv: Event = Event.constr_from_ptr(ret);
475 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
480 * Utility method to constructs a new PaymentSent-variant Event
482 public static constructor_payment_sent(payment_id: Uint8Array, payment_preimage: Uint8Array, payment_hash: Uint8Array, fee_paid_msat: Option_u64Z): Event {
483 const ret: bigint = bindings.Event_payment_sent(bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(payment_preimage, 32)), bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), CommonBase.get_ptr_of(fee_paid_msat));
484 const ret_hu_conv: Event = Event.constr_from_ptr(ret);
485 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
490 * Utility method to constructs a new PaymentFailed-variant Event
492 public static constructor_payment_failed(payment_id: Uint8Array, payment_hash: Uint8Array): Event {
493 const ret: bigint = bindings.Event_payment_failed(bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)));
494 const ret_hu_conv: Event = Event.constr_from_ptr(ret);
495 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
500 * Utility method to constructs a new PaymentPathSuccessful-variant Event
502 public static constructor_payment_path_successful(payment_id: Uint8Array, payment_hash: Uint8Array, path: RouteHop[]): Event {
503 const ret: bigint = bindings.Event_payment_path_successful(bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), bindings.encodeUint64Array(path != null ? path.map(path_conv_10 => path_conv_10 == null ? 0n : CommonBase.get_ptr_of(path_conv_10)) : null));
504 const ret_hu_conv: Event = Event.constr_from_ptr(ret);
505 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
506 path.forEach((path_conv_10: RouteHop) => { CommonBase.add_ref_from(ret_hu_conv, path_conv_10); });
511 * Utility method to constructs a new PaymentPathFailed-variant Event
513 public static constructor_payment_path_failed(payment_id: Uint8Array, payment_hash: Uint8Array, payment_failed_permanently: boolean, network_update: Option_NetworkUpdateZ, all_paths_failed: boolean, path: RouteHop[], short_channel_id: Option_u64Z, retry: RouteParameters): Event {
514 const ret: bigint = bindings.Event_payment_path_failed(bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), payment_failed_permanently, CommonBase.get_ptr_of(network_update), all_paths_failed, bindings.encodeUint64Array(path != null ? path.map(path_conv_10 => path_conv_10 == null ? 0n : CommonBase.get_ptr_of(path_conv_10)) : null), CommonBase.get_ptr_of(short_channel_id), retry == null ? 0n : CommonBase.get_ptr_of(retry));
515 const ret_hu_conv: Event = Event.constr_from_ptr(ret);
516 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
517 path.forEach((path_conv_10: RouteHop) => { CommonBase.add_ref_from(ret_hu_conv, path_conv_10); });
518 CommonBase.add_ref_from(ret_hu_conv, retry);
523 * Utility method to constructs a new ProbeSuccessful-variant Event
525 public static constructor_probe_successful(payment_id: Uint8Array, payment_hash: Uint8Array, path: RouteHop[]): Event {
526 const ret: bigint = bindings.Event_probe_successful(bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), bindings.encodeUint64Array(path != null ? path.map(path_conv_10 => path_conv_10 == null ? 0n : CommonBase.get_ptr_of(path_conv_10)) : null));
527 const ret_hu_conv: Event = Event.constr_from_ptr(ret);
528 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
529 path.forEach((path_conv_10: RouteHop) => { CommonBase.add_ref_from(ret_hu_conv, path_conv_10); });
534 * Utility method to constructs a new ProbeFailed-variant Event
536 public static constructor_probe_failed(payment_id: Uint8Array, payment_hash: Uint8Array, path: RouteHop[], short_channel_id: Option_u64Z): Event {
537 const ret: bigint = bindings.Event_probe_failed(bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), bindings.encodeUint64Array(path != null ? path.map(path_conv_10 => path_conv_10 == null ? 0n : CommonBase.get_ptr_of(path_conv_10)) : null), CommonBase.get_ptr_of(short_channel_id));
538 const ret_hu_conv: Event = Event.constr_from_ptr(ret);
539 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
540 path.forEach((path_conv_10: RouteHop) => { CommonBase.add_ref_from(ret_hu_conv, path_conv_10); });
545 * Utility method to constructs a new PendingHTLCsForwardable-variant Event
547 public static constructor_pending_htlcs_forwardable(time_forwardable: bigint): Event {
548 const ret: bigint = bindings.Event_pending_htlcs_forwardable(time_forwardable);
549 const ret_hu_conv: Event = Event.constr_from_ptr(ret);
550 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
555 * Utility method to constructs a new HTLCIntercepted-variant Event
557 public static constructor_htlcintercepted(intercept_id: Uint8Array, requested_next_hop_scid: bigint, payment_hash: Uint8Array, inbound_amount_msat: bigint, expected_outbound_amount_msat: bigint): Event {
558 const ret: bigint = bindings.Event_htlcintercepted(bindings.encodeUint8Array(bindings.check_arr_len(intercept_id, 32)), requested_next_hop_scid, bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), inbound_amount_msat, expected_outbound_amount_msat);
559 const ret_hu_conv: Event = Event.constr_from_ptr(ret);
560 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
565 * Utility method to constructs a new SpendableOutputs-variant Event
567 public static constructor_spendable_outputs(outputs: SpendableOutputDescriptor[]): Event {
568 const ret: bigint = bindings.Event_spendable_outputs(bindings.encodeUint64Array(outputs != null ? outputs.map(outputs_conv_27 => CommonBase.get_ptr_of(outputs_conv_27)) : null));
569 const ret_hu_conv: Event = Event.constr_from_ptr(ret);
570 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
575 * Utility method to constructs a new PaymentForwarded-variant Event
577 public static constructor_payment_forwarded(prev_channel_id: Uint8Array, next_channel_id: Uint8Array, fee_earned_msat: Option_u64Z, claim_from_onchain_tx: boolean): Event {
578 const ret: bigint = bindings.Event_payment_forwarded(bindings.encodeUint8Array(bindings.check_arr_len(prev_channel_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(next_channel_id, 32)), CommonBase.get_ptr_of(fee_earned_msat), claim_from_onchain_tx);
579 const ret_hu_conv: Event = Event.constr_from_ptr(ret);
580 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
585 * Utility method to constructs a new ChannelReady-variant Event
587 public static constructor_channel_ready(channel_id: Uint8Array, user_channel_id: bigint, counterparty_node_id: Uint8Array, channel_type: ChannelTypeFeatures): Event {
588 const ret: bigint = bindings.Event_channel_ready(bindings.encodeUint8Array(bindings.check_arr_len(channel_id, 32)), bindings.encodeUint128(user_channel_id), bindings.encodeUint8Array(bindings.check_arr_len(counterparty_node_id, 33)), channel_type == null ? 0n : CommonBase.get_ptr_of(channel_type));
589 const ret_hu_conv: Event = Event.constr_from_ptr(ret);
590 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
591 CommonBase.add_ref_from(ret_hu_conv, channel_type);
596 * Utility method to constructs a new ChannelClosed-variant Event
598 public static constructor_channel_closed(channel_id: Uint8Array, user_channel_id: bigint, reason: ClosureReason): Event {
599 const ret: bigint = bindings.Event_channel_closed(bindings.encodeUint8Array(bindings.check_arr_len(channel_id, 32)), bindings.encodeUint128(user_channel_id), CommonBase.get_ptr_of(reason));
600 const ret_hu_conv: Event = Event.constr_from_ptr(ret);
601 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
606 * Utility method to constructs a new DiscardFunding-variant Event
608 public static constructor_discard_funding(channel_id: Uint8Array, transaction: Uint8Array): Event {
609 const ret: bigint = bindings.Event_discard_funding(bindings.encodeUint8Array(bindings.check_arr_len(channel_id, 32)), bindings.encodeUint8Array(transaction));
610 const ret_hu_conv: Event = Event.constr_from_ptr(ret);
611 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
616 * Utility method to constructs a new OpenChannelRequest-variant Event
618 public static constructor_open_channel_request(temporary_channel_id: Uint8Array, counterparty_node_id: Uint8Array, funding_satoshis: bigint, push_msat: bigint, channel_type: ChannelTypeFeatures): Event {
619 const ret: bigint = bindings.Event_open_channel_request(bindings.encodeUint8Array(bindings.check_arr_len(temporary_channel_id, 32)), bindings.encodeUint8Array(bindings.check_arr_len(counterparty_node_id, 33)), funding_satoshis, push_msat, channel_type == null ? 0n : CommonBase.get_ptr_of(channel_type));
620 const ret_hu_conv: Event = Event.constr_from_ptr(ret);
621 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
622 CommonBase.add_ref_from(ret_hu_conv, channel_type);
627 * Utility method to constructs a new HTLCHandlingFailed-variant Event
629 public static constructor_htlchandling_failed(prev_channel_id: Uint8Array, failed_next_destination: HTLCDestination): Event {
630 const ret: bigint = bindings.Event_htlchandling_failed(bindings.encodeUint8Array(bindings.check_arr_len(prev_channel_id, 32)), CommonBase.get_ptr_of(failed_next_destination));
631 const ret_hu_conv: Event = Event.constr_from_ptr(ret);
632 CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
637 * Serialize the Event object into a byte array which can be read by Event_read
639 public write(): Uint8Array {
640 const ret: number = bindings.Event_write(this.ptr);
641 const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
646 /** A Event of type FundingGenerationReady */
647 export class Event_FundingGenerationReady extends Event {
649 * The random channel_id we picked which you'll need to pass into
650 * [`ChannelManager::funding_transaction_generated`].
652 * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
654 public temporary_channel_id: Uint8Array;
656 * The counterparty's node_id, which you'll need to pass back into
657 * [`ChannelManager::funding_transaction_generated`].
659 * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
661 public counterparty_node_id: Uint8Array;
663 * The value, in satoshis, that the output should have.
665 public channel_value_satoshis: bigint;
667 * The script which should be used in the transaction output.
669 public output_script: Uint8Array;
671 * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or a
672 * random value for an inbound channel. This may be zero for objects serialized with LDK
673 * versions prior to 0.0.113.
675 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
677 public user_channel_id: bigint;
679 public constructor(ptr: bigint) {
681 const temporary_channel_id: number = bindings.LDKEvent_FundingGenerationReady_get_temporary_channel_id(ptr);
682 const temporary_channel_id_conv: Uint8Array = bindings.decodeUint8Array(temporary_channel_id);
683 this.temporary_channel_id = temporary_channel_id_conv;
684 const counterparty_node_id: number = bindings.LDKEvent_FundingGenerationReady_get_counterparty_node_id(ptr);
685 const counterparty_node_id_conv: Uint8Array = bindings.decodeUint8Array(counterparty_node_id);
686 this.counterparty_node_id = counterparty_node_id_conv;
687 this.channel_value_satoshis = bindings.LDKEvent_FundingGenerationReady_get_channel_value_satoshis(ptr);
688 const output_script: number = bindings.LDKEvent_FundingGenerationReady_get_output_script(ptr);
689 const output_script_conv: Uint8Array = bindings.decodeUint8Array(output_script);
690 this.output_script = output_script_conv;
691 const user_channel_id: number = bindings.LDKEvent_FundingGenerationReady_get_user_channel_id(ptr);
692 const user_channel_id_conv: bigint = bindings.decodeUint128(user_channel_id);
693 this.user_channel_id = user_channel_id_conv;
696 /** A Event of type PaymentClaimable */
697 export class Event_PaymentClaimable extends Event {
699 * The node that will receive the payment after it has been claimed.
700 * This is useful to identify payments received via [phantom nodes].
701 * This field will always be filled in when the event was generated by LDK versions
704 * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
706 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
708 public receiver_node_id: Uint8Array;
710 * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
711 * not stop you from registering duplicate payment hashes for inbound payments.
713 public payment_hash: Uint8Array;
715 * The value, in thousandths of a satoshi, that this payment is for.
717 public amount_msat: bigint;
719 * Information for claiming this received payment, based on whether the purpose of the
720 * payment is to pay an invoice or to send a spontaneous payment.
722 public purpose: PaymentPurpose;
724 * The `channel_id` indicating over which channel we received the payment.
726 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
728 public via_channel_id: Uint8Array;
730 * The `user_channel_id` indicating over which channel we received the payment.
732 public via_user_channel_id: Option_u128Z;
734 public constructor(ptr: bigint) {
736 const receiver_node_id: number = bindings.LDKEvent_PaymentClaimable_get_receiver_node_id(ptr);
737 const receiver_node_id_conv: Uint8Array = bindings.decodeUint8Array(receiver_node_id);
738 this.receiver_node_id = receiver_node_id_conv;
739 const payment_hash: number = bindings.LDKEvent_PaymentClaimable_get_payment_hash(ptr);
740 const payment_hash_conv: Uint8Array = bindings.decodeUint8Array(payment_hash);
741 this.payment_hash = payment_hash_conv;
742 this.amount_msat = bindings.LDKEvent_PaymentClaimable_get_amount_msat(ptr);
743 const purpose: bigint = bindings.LDKEvent_PaymentClaimable_get_purpose(ptr);
744 const purpose_hu_conv: PaymentPurpose = PaymentPurpose.constr_from_ptr(purpose);
745 CommonBase.add_ref_from(purpose_hu_conv, this);
746 this.purpose = purpose_hu_conv;
747 const via_channel_id: number = bindings.LDKEvent_PaymentClaimable_get_via_channel_id(ptr);
748 const via_channel_id_conv: Uint8Array = bindings.decodeUint8Array(via_channel_id);
749 this.via_channel_id = via_channel_id_conv;
750 const via_user_channel_id: bigint = bindings.LDKEvent_PaymentClaimable_get_via_user_channel_id(ptr);
751 const via_user_channel_id_hu_conv: Option_u128Z = Option_u128Z.constr_from_ptr(via_user_channel_id);
752 CommonBase.add_ref_from(via_user_channel_id_hu_conv, this);
753 this.via_user_channel_id = via_user_channel_id_hu_conv;
756 /** A Event of type PaymentClaimed */
757 export class Event_PaymentClaimed extends Event {
759 * The node that received the payment.
760 * This is useful to identify payments which were received via [phantom nodes].
761 * This field will always be filled in when the event was generated by LDK versions
764 * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
766 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
768 public receiver_node_id: Uint8Array;
770 * The payment hash of the claimed payment. Note that LDK will not stop you from
771 * registering duplicate payment hashes for inbound payments.
773 public payment_hash: Uint8Array;
775 * The value, in thousandths of a satoshi, that this payment is for.
777 public amount_msat: bigint;
779 * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a
780 * spontaneous payment.
782 public purpose: PaymentPurpose;
784 public constructor(ptr: bigint) {
786 const receiver_node_id: number = bindings.LDKEvent_PaymentClaimed_get_receiver_node_id(ptr);
787 const receiver_node_id_conv: Uint8Array = bindings.decodeUint8Array(receiver_node_id);
788 this.receiver_node_id = receiver_node_id_conv;
789 const payment_hash: number = bindings.LDKEvent_PaymentClaimed_get_payment_hash(ptr);
790 const payment_hash_conv: Uint8Array = bindings.decodeUint8Array(payment_hash);
791 this.payment_hash = payment_hash_conv;
792 this.amount_msat = bindings.LDKEvent_PaymentClaimed_get_amount_msat(ptr);
793 const purpose: bigint = bindings.LDKEvent_PaymentClaimed_get_purpose(ptr);
794 const purpose_hu_conv: PaymentPurpose = PaymentPurpose.constr_from_ptr(purpose);
795 CommonBase.add_ref_from(purpose_hu_conv, this);
796 this.purpose = purpose_hu_conv;
799 /** A Event of type PaymentSent */
800 export class Event_PaymentSent extends Event {
802 * The id returned by [`ChannelManager::send_payment`] and used with
803 * [`ChannelManager::retry_payment`].
805 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
806 * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
808 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
810 public payment_id: Uint8Array;
812 * The preimage to the hash given to ChannelManager::send_payment.
813 * Note that this serves as a payment receipt, if you wish to have such a thing, you must
816 public payment_preimage: Uint8Array;
818 * The hash that was given to [`ChannelManager::send_payment`].
820 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
822 public payment_hash: Uint8Array;
824 * The total fee which was spent at intermediate hops in this payment, across all paths.
826 * Note that, like [`Route::get_total_fees`] this does *not* include any potential
827 * overpayment to the recipient node.
829 * If the recipient or an intermediate node misbehaves and gives us free money, this may
830 * overstate the amount paid, though this is unlikely.
832 * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
834 public fee_paid_msat: Option_u64Z;
836 public constructor(ptr: bigint) {
838 const payment_id: number = bindings.LDKEvent_PaymentSent_get_payment_id(ptr);
839 const payment_id_conv: Uint8Array = bindings.decodeUint8Array(payment_id);
840 this.payment_id = payment_id_conv;
841 const payment_preimage: number = bindings.LDKEvent_PaymentSent_get_payment_preimage(ptr);
842 const payment_preimage_conv: Uint8Array = bindings.decodeUint8Array(payment_preimage);
843 this.payment_preimage = payment_preimage_conv;
844 const payment_hash: number = bindings.LDKEvent_PaymentSent_get_payment_hash(ptr);
845 const payment_hash_conv: Uint8Array = bindings.decodeUint8Array(payment_hash);
846 this.payment_hash = payment_hash_conv;
847 const fee_paid_msat: bigint = bindings.LDKEvent_PaymentSent_get_fee_paid_msat(ptr);
848 const fee_paid_msat_hu_conv: Option_u64Z = Option_u64Z.constr_from_ptr(fee_paid_msat);
849 CommonBase.add_ref_from(fee_paid_msat_hu_conv, this);
850 this.fee_paid_msat = fee_paid_msat_hu_conv;
853 /** A Event of type PaymentFailed */
854 export class Event_PaymentFailed extends Event {
856 * The id returned by [`ChannelManager::send_payment`] and used with
857 * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
859 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
860 * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
861 * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
863 public payment_id: Uint8Array;
865 * The hash that was given to [`ChannelManager::send_payment`].
867 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
869 public payment_hash: Uint8Array;
871 public constructor(ptr: bigint) {
873 const payment_id: number = bindings.LDKEvent_PaymentFailed_get_payment_id(ptr);
874 const payment_id_conv: Uint8Array = bindings.decodeUint8Array(payment_id);
875 this.payment_id = payment_id_conv;
876 const payment_hash: number = bindings.LDKEvent_PaymentFailed_get_payment_hash(ptr);
877 const payment_hash_conv: Uint8Array = bindings.decodeUint8Array(payment_hash);
878 this.payment_hash = payment_hash_conv;
881 /** A Event of type PaymentPathSuccessful */
882 export class Event_PaymentPathSuccessful extends Event {
884 * The id returned by [`ChannelManager::send_payment`] and used with
885 * [`ChannelManager::retry_payment`].
887 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
888 * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
890 public payment_id: Uint8Array;
892 * The hash that was given to [`ChannelManager::send_payment`].
894 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
896 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
898 public payment_hash: Uint8Array;
900 * The payment path that was successful.
902 * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
904 public path: RouteHop[];
906 public constructor(ptr: bigint) {
908 const payment_id: number = bindings.LDKEvent_PaymentPathSuccessful_get_payment_id(ptr);
909 const payment_id_conv: Uint8Array = bindings.decodeUint8Array(payment_id);
910 this.payment_id = payment_id_conv;
911 const payment_hash: number = bindings.LDKEvent_PaymentPathSuccessful_get_payment_hash(ptr);
912 const payment_hash_conv: Uint8Array = bindings.decodeUint8Array(payment_hash);
913 this.payment_hash = payment_hash_conv;
914 const path: number = bindings.LDKEvent_PaymentPathSuccessful_get_path(ptr);
915 const path_conv_10_len: number = bindings.getArrayLength(path);
916 const path_conv_10_arr: RouteHop[] = new Array(path_conv_10_len).fill(null);
917 for (var k = 0; k < path_conv_10_len; k++) {
918 const path_conv_10: bigint = bindings.getU64ArrayElem(path, k);
919 const path_conv_10_hu_conv: RouteHop = new RouteHop(null, path_conv_10);
920 CommonBase.add_ref_from(path_conv_10_hu_conv, this);
921 path_conv_10_arr[k] = path_conv_10_hu_conv;
923 bindings.freeWasmMemory(path)
924 this.path = path_conv_10_arr;
927 /** A Event of type PaymentPathFailed */
928 export class Event_PaymentPathFailed extends Event {
930 * The id returned by [`ChannelManager::send_payment`] and used with
931 * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
933 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
934 * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
935 * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
937 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
939 public payment_id: Uint8Array;
941 * The hash that was given to [`ChannelManager::send_payment`].
943 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
945 public payment_hash: Uint8Array;
947 * Indicates the payment was rejected for some reason by the recipient. This implies that
948 * the payment has failed, not just the route in question. If this is not set, you may
949 * retry the payment via a different route.
951 public payment_failed_permanently: boolean;
953 * Any failure information conveyed via the Onion return packet by a node along the failed
956 * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
957 * account the update.
959 * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
961 public network_update: Option_NetworkUpdateZ;
963 * For both single-path and multi-path payments, this is set if all paths of the payment have
964 * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
965 * larger MPP payment were still in flight when this event was generated.
967 * Note that if you are retrying individual MPP parts, using this value to determine if a
968 * payment has fully failed is race-y. Because multiple failures can happen prior to events
969 * being processed, you may retry in response to a first failure, with a second failure
970 * (with `all_paths_failed` set) still pending. Then, when the second failure is processed
971 * you will see `all_paths_failed` set even though the retry of the first failure still
972 * has an associated in-flight HTLC. See (1) for an example of such a failure.
974 * If you wish to retry individual MPP parts and learn when a payment has failed, you must
975 * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event.
977 * (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
979 * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
981 public all_paths_failed: boolean;
983 * The payment path that failed.
985 public path: RouteHop[];
987 * The channel responsible for the failed payment path.
989 * Note that for route hints or for the first hop in a path this may be an SCID alias and
990 * may not refer to a channel in the public network graph. These aliases may also collide
991 * with channels in the public network graph.
993 * If this is `Some`, then the corresponding channel should be avoided when the payment is
994 * retried. May be `None` for older [`Event`] serializations.
996 public short_channel_id: Option_u64Z;
998 * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
1000 * See [`find_route`] for details.
1002 * [`Route`]: crate::routing::router::Route
1003 * [`find_route`]: crate::routing::router::find_route
1005 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
1007 public retry: RouteParameters;
1009 public constructor(ptr: bigint) {
1011 const payment_id: number = bindings.LDKEvent_PaymentPathFailed_get_payment_id(ptr);
1012 const payment_id_conv: Uint8Array = bindings.decodeUint8Array(payment_id);
1013 this.payment_id = payment_id_conv;
1014 const payment_hash: number = bindings.LDKEvent_PaymentPathFailed_get_payment_hash(ptr);
1015 const payment_hash_conv: Uint8Array = bindings.decodeUint8Array(payment_hash);
1016 this.payment_hash = payment_hash_conv;
1017 this.payment_failed_permanently = bindings.LDKEvent_PaymentPathFailed_get_payment_failed_permanently(ptr);
1018 const network_update: bigint = bindings.LDKEvent_PaymentPathFailed_get_network_update(ptr);
1019 const network_update_hu_conv: Option_NetworkUpdateZ = Option_NetworkUpdateZ.constr_from_ptr(network_update);
1020 CommonBase.add_ref_from(network_update_hu_conv, this);
1021 this.network_update = network_update_hu_conv;
1022 this.all_paths_failed = bindings.LDKEvent_PaymentPathFailed_get_all_paths_failed(ptr);
1023 const path: number = bindings.LDKEvent_PaymentPathFailed_get_path(ptr);
1024 const path_conv_10_len: number = bindings.getArrayLength(path);
1025 const path_conv_10_arr: RouteHop[] = new Array(path_conv_10_len).fill(null);
1026 for (var k = 0; k < path_conv_10_len; k++) {
1027 const path_conv_10: bigint = bindings.getU64ArrayElem(path, k);
1028 const path_conv_10_hu_conv: RouteHop = new RouteHop(null, path_conv_10);
1029 CommonBase.add_ref_from(path_conv_10_hu_conv, this);
1030 path_conv_10_arr[k] = path_conv_10_hu_conv;
1032 bindings.freeWasmMemory(path)
1033 this.path = path_conv_10_arr;
1034 const short_channel_id: bigint = bindings.LDKEvent_PaymentPathFailed_get_short_channel_id(ptr);
1035 const short_channel_id_hu_conv: Option_u64Z = Option_u64Z.constr_from_ptr(short_channel_id);
1036 CommonBase.add_ref_from(short_channel_id_hu_conv, this);
1037 this.short_channel_id = short_channel_id_hu_conv;
1038 const retry: bigint = bindings.LDKEvent_PaymentPathFailed_get_retry(ptr);
1039 const retry_hu_conv: RouteParameters = new RouteParameters(null, retry);
1040 CommonBase.add_ref_from(retry_hu_conv, this);
1041 this.retry = retry_hu_conv;
1044 /** A Event of type ProbeSuccessful */
1045 export class Event_ProbeSuccessful extends Event {
1047 * The id returned by [`ChannelManager::send_probe`].
1049 * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
1051 public payment_id: Uint8Array;
1053 * The hash generated by [`ChannelManager::send_probe`].
1055 * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
1057 public payment_hash: Uint8Array;
1059 * The payment path that was successful.
1061 public path: RouteHop[];
1063 public constructor(ptr: bigint) {
1065 const payment_id: number = bindings.LDKEvent_ProbeSuccessful_get_payment_id(ptr);
1066 const payment_id_conv: Uint8Array = bindings.decodeUint8Array(payment_id);
1067 this.payment_id = payment_id_conv;
1068 const payment_hash: number = bindings.LDKEvent_ProbeSuccessful_get_payment_hash(ptr);
1069 const payment_hash_conv: Uint8Array = bindings.decodeUint8Array(payment_hash);
1070 this.payment_hash = payment_hash_conv;
1071 const path: number = bindings.LDKEvent_ProbeSuccessful_get_path(ptr);
1072 const path_conv_10_len: number = bindings.getArrayLength(path);
1073 const path_conv_10_arr: RouteHop[] = new Array(path_conv_10_len).fill(null);
1074 for (var k = 0; k < path_conv_10_len; k++) {
1075 const path_conv_10: bigint = bindings.getU64ArrayElem(path, k);
1076 const path_conv_10_hu_conv: RouteHop = new RouteHop(null, path_conv_10);
1077 CommonBase.add_ref_from(path_conv_10_hu_conv, this);
1078 path_conv_10_arr[k] = path_conv_10_hu_conv;
1080 bindings.freeWasmMemory(path)
1081 this.path = path_conv_10_arr;
1084 /** A Event of type ProbeFailed */
1085 export class Event_ProbeFailed extends Event {
1087 * The id returned by [`ChannelManager::send_probe`].
1089 * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
1091 public payment_id: Uint8Array;
1093 * The hash generated by [`ChannelManager::send_probe`].
1095 * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
1097 public payment_hash: Uint8Array;
1099 * The payment path that failed.
1101 public path: RouteHop[];
1103 * The channel responsible for the failed probe.
1105 * Note that for route hints or for the first hop in a path this may be an SCID alias and
1106 * may not refer to a channel in the public network graph. These aliases may also collide
1107 * with channels in the public network graph.
1109 public short_channel_id: Option_u64Z;
1111 public constructor(ptr: bigint) {
1113 const payment_id: number = bindings.LDKEvent_ProbeFailed_get_payment_id(ptr);
1114 const payment_id_conv: Uint8Array = bindings.decodeUint8Array(payment_id);
1115 this.payment_id = payment_id_conv;
1116 const payment_hash: number = bindings.LDKEvent_ProbeFailed_get_payment_hash(ptr);
1117 const payment_hash_conv: Uint8Array = bindings.decodeUint8Array(payment_hash);
1118 this.payment_hash = payment_hash_conv;
1119 const path: number = bindings.LDKEvent_ProbeFailed_get_path(ptr);
1120 const path_conv_10_len: number = bindings.getArrayLength(path);
1121 const path_conv_10_arr: RouteHop[] = new Array(path_conv_10_len).fill(null);
1122 for (var k = 0; k < path_conv_10_len; k++) {
1123 const path_conv_10: bigint = bindings.getU64ArrayElem(path, k);
1124 const path_conv_10_hu_conv: RouteHop = new RouteHop(null, path_conv_10);
1125 CommonBase.add_ref_from(path_conv_10_hu_conv, this);
1126 path_conv_10_arr[k] = path_conv_10_hu_conv;
1128 bindings.freeWasmMemory(path)
1129 this.path = path_conv_10_arr;
1130 const short_channel_id: bigint = bindings.LDKEvent_ProbeFailed_get_short_channel_id(ptr);
1131 const short_channel_id_hu_conv: Option_u64Z = Option_u64Z.constr_from_ptr(short_channel_id);
1132 CommonBase.add_ref_from(short_channel_id_hu_conv, this);
1133 this.short_channel_id = short_channel_id_hu_conv;
1136 /** A Event of type PendingHTLCsForwardable */
1137 export class Event_PendingHTLCsForwardable extends Event {
1139 * The minimum amount of time that should be waited prior to calling
1140 * process_pending_htlc_forwards. To increase the effort required to correlate payments,
1141 * you should wait a random amount of time in roughly the range (now + time_forwardable,
1142 * now + 5*time_forwardable).
1144 public time_forwardable: bigint;
1146 public constructor(ptr: bigint) {
1148 this.time_forwardable = bindings.LDKEvent_PendingHTLCsForwardable_get_time_forwardable(ptr);
1151 /** A Event of type HTLCIntercepted */
1152 export class Event_HTLCIntercepted extends Event {
1154 * An id to help LDK identify which HTLC is being forwarded or failed.
1156 public intercept_id: Uint8Array;
1158 * The fake scid that was programmed as the next hop's scid, generated using
1159 * [`ChannelManager::get_intercept_scid`].
1161 * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
1163 public requested_next_hop_scid: bigint;
1165 * The payment hash used for this HTLC.
1167 public payment_hash: Uint8Array;
1169 * How many msats were received on the inbound edge of this HTLC.
1171 public inbound_amount_msat: bigint;
1173 * How many msats the payer intended to route to the next node. Depending on the reason you are
1174 * intercepting this payment, you might take a fee by forwarding less than this amount.
1176 * Note that LDK will NOT check that expected fees were factored into this value. You MUST
1177 * check that whatever fee you want has been included here or subtract it as required. Further,
1178 * LDK will not stop you from forwarding more than you received.
1180 public expected_outbound_amount_msat: bigint;
1182 public constructor(ptr: bigint) {
1184 const intercept_id: number = bindings.LDKEvent_HTLCIntercepted_get_intercept_id(ptr);
1185 const intercept_id_conv: Uint8Array = bindings.decodeUint8Array(intercept_id);
1186 this.intercept_id = intercept_id_conv;
1187 this.requested_next_hop_scid = bindings.LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(ptr);
1188 const payment_hash: number = bindings.LDKEvent_HTLCIntercepted_get_payment_hash(ptr);
1189 const payment_hash_conv: Uint8Array = bindings.decodeUint8Array(payment_hash);
1190 this.payment_hash = payment_hash_conv;
1191 this.inbound_amount_msat = bindings.LDKEvent_HTLCIntercepted_get_inbound_amount_msat(ptr);
1192 this.expected_outbound_amount_msat = bindings.LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(ptr);
1195 /** A Event of type SpendableOutputs */
1196 export class Event_SpendableOutputs extends Event {
1198 * The outputs which you should store as spendable by you.
1200 public outputs: SpendableOutputDescriptor[];
1202 public constructor(ptr: bigint) {
1204 const outputs: number = bindings.LDKEvent_SpendableOutputs_get_outputs(ptr);
1205 const outputs_conv_27_len: number = bindings.getArrayLength(outputs);
1206 const outputs_conv_27_arr: SpendableOutputDescriptor[] = new Array(outputs_conv_27_len).fill(null);
1207 for (var b = 0; b < outputs_conv_27_len; b++) {
1208 const outputs_conv_27: bigint = bindings.getU64ArrayElem(outputs, b);
1209 const outputs_conv_27_hu_conv: SpendableOutputDescriptor = SpendableOutputDescriptor.constr_from_ptr(outputs_conv_27);
1210 CommonBase.add_ref_from(outputs_conv_27_hu_conv, this);
1211 outputs_conv_27_arr[b] = outputs_conv_27_hu_conv;
1213 bindings.freeWasmMemory(outputs)
1214 this.outputs = outputs_conv_27_arr;
1217 /** A Event of type PaymentForwarded */
1218 export class Event_PaymentForwarded extends Event {
1220 * The incoming channel between the previous node and us. This is only `None` for events
1221 * generated or serialized by versions prior to 0.0.107.
1223 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
1225 public prev_channel_id: Uint8Array;
1227 * The outgoing channel between the next node and us. This is only `None` for events
1228 * generated or serialized by versions prior to 0.0.107.
1230 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
1232 public next_channel_id: Uint8Array;
1234 * The fee, in milli-satoshis, which was earned as a result of the payment.
1236 * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
1237 * was pending, the amount the next hop claimed will have been rounded down to the nearest
1238 * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
1239 * claimed the full value in millisatoshis from the source. In this case,
1240 * `claim_from_onchain_tx` will be set.
1242 * If the channel which sent us the payment has been force-closed, we will claim the funds
1243 * via an on-chain transaction. In that case we do not yet know the on-chain transaction
1244 * fees which we will spend and will instead set this to `None`. It is possible duplicate
1245 * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
1248 public fee_earned_msat: Option_u64Z;
1250 * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
1253 public claim_from_onchain_tx: boolean;
1255 public constructor(ptr: bigint) {
1257 const prev_channel_id: number = bindings.LDKEvent_PaymentForwarded_get_prev_channel_id(ptr);
1258 const prev_channel_id_conv: Uint8Array = bindings.decodeUint8Array(prev_channel_id);
1259 this.prev_channel_id = prev_channel_id_conv;
1260 const next_channel_id: number = bindings.LDKEvent_PaymentForwarded_get_next_channel_id(ptr);
1261 const next_channel_id_conv: Uint8Array = bindings.decodeUint8Array(next_channel_id);
1262 this.next_channel_id = next_channel_id_conv;
1263 const fee_earned_msat: bigint = bindings.LDKEvent_PaymentForwarded_get_fee_earned_msat(ptr);
1264 const fee_earned_msat_hu_conv: Option_u64Z = Option_u64Z.constr_from_ptr(fee_earned_msat);
1265 CommonBase.add_ref_from(fee_earned_msat_hu_conv, this);
1266 this.fee_earned_msat = fee_earned_msat_hu_conv;
1267 this.claim_from_onchain_tx = bindings.LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(ptr);
1270 /** A Event of type ChannelReady */
1271 export class Event_ChannelReady extends Event {
1273 * The channel_id of the channel that is ready.
1275 public channel_id: Uint8Array;
1277 * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
1278 * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
1279 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
1280 * `user_channel_id` will be randomized for an inbound channel.
1282 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
1283 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1284 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
1286 public user_channel_id: bigint;
1288 * The node_id of the channel counterparty.
1290 public counterparty_node_id: Uint8Array;
1292 * The features that this channel will operate with.
1294 public channel_type: ChannelTypeFeatures;
1296 public constructor(ptr: bigint) {
1298 const channel_id: number = bindings.LDKEvent_ChannelReady_get_channel_id(ptr);
1299 const channel_id_conv: Uint8Array = bindings.decodeUint8Array(channel_id);
1300 this.channel_id = channel_id_conv;
1301 const user_channel_id: number = bindings.LDKEvent_ChannelReady_get_user_channel_id(ptr);
1302 const user_channel_id_conv: bigint = bindings.decodeUint128(user_channel_id);
1303 this.user_channel_id = user_channel_id_conv;
1304 const counterparty_node_id: number = bindings.LDKEvent_ChannelReady_get_counterparty_node_id(ptr);
1305 const counterparty_node_id_conv: Uint8Array = bindings.decodeUint8Array(counterparty_node_id);
1306 this.counterparty_node_id = counterparty_node_id_conv;
1307 const channel_type: bigint = bindings.LDKEvent_ChannelReady_get_channel_type(ptr);
1308 const channel_type_hu_conv: ChannelTypeFeatures = new ChannelTypeFeatures(null, channel_type);
1309 CommonBase.add_ref_from(channel_type_hu_conv, this);
1310 this.channel_type = channel_type_hu_conv;
1313 /** A Event of type ChannelClosed */
1314 export class Event_ChannelClosed extends Event {
1316 * The channel_id of the channel which has been closed. Note that on-chain transactions
1317 * resolving the channel are likely still awaiting confirmation.
1319 public channel_id: Uint8Array;
1321 * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
1322 * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
1323 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
1324 * `user_channel_id` will be randomized for inbound channels.
1325 * This may be zero for inbound channels serialized prior to 0.0.113 and will always be
1326 * zero for objects serialized with LDK versions prior to 0.0.102.
1328 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
1329 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1330 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
1332 public user_channel_id: bigint;
1334 * The reason the channel was closed.
1336 public reason: ClosureReason;
1338 public constructor(ptr: bigint) {
1340 const channel_id: number = bindings.LDKEvent_ChannelClosed_get_channel_id(ptr);
1341 const channel_id_conv: Uint8Array = bindings.decodeUint8Array(channel_id);
1342 this.channel_id = channel_id_conv;
1343 const user_channel_id: number = bindings.LDKEvent_ChannelClosed_get_user_channel_id(ptr);
1344 const user_channel_id_conv: bigint = bindings.decodeUint128(user_channel_id);
1345 this.user_channel_id = user_channel_id_conv;
1346 const reason: bigint = bindings.LDKEvent_ChannelClosed_get_reason(ptr);
1347 const reason_hu_conv: ClosureReason = ClosureReason.constr_from_ptr(reason);
1348 CommonBase.add_ref_from(reason_hu_conv, this);
1349 this.reason = reason_hu_conv;
1352 /** A Event of type DiscardFunding */
1353 export class Event_DiscardFunding extends Event {
1355 * The channel_id of the channel which has been closed.
1357 public channel_id: Uint8Array;
1359 * The full transaction received from the user
1361 public transaction: Uint8Array;
1363 public constructor(ptr: bigint) {
1365 const channel_id: number = bindings.LDKEvent_DiscardFunding_get_channel_id(ptr);
1366 const channel_id_conv: Uint8Array = bindings.decodeUint8Array(channel_id);
1367 this.channel_id = channel_id_conv;
1368 const transaction: number = bindings.LDKEvent_DiscardFunding_get_transaction(ptr);
1369 const transaction_conv: Uint8Array = bindings.decodeUint8Array(transaction);
1370 this.transaction = transaction_conv;
1373 /** A Event of type OpenChannelRequest */
1374 export class Event_OpenChannelRequest extends Event {
1376 * The temporary channel ID of the channel requested to be opened.
1378 * When responding to the request, the `temporary_channel_id` should be passed
1379 * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
1380 * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
1382 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1383 * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
1385 public temporary_channel_id: Uint8Array;
1387 * The node_id of the counterparty requesting to open the channel.
1389 * When responding to the request, the `counterparty_node_id` should be passed
1390 * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
1391 * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
1394 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1395 * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
1397 public counterparty_node_id: Uint8Array;
1399 * The channel value of the requested channel.
1401 public funding_satoshis: bigint;
1403 * Our starting balance in the channel if the request is accepted, in milli-satoshi.
1405 public push_msat: bigint;
1407 * The features that this channel will operate with. If you reject the channel, a
1408 * well-behaved counterparty may automatically re-attempt the channel with a new set of
1411 * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
1412 * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
1415 * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
1416 * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
1417 * 0.0.107. Channels setting this type also need to get manually accepted via
1418 * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
1419 * or will be rejected otherwise.
1421 * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
1423 public channel_type: ChannelTypeFeatures;
1425 public constructor(ptr: bigint) {
1427 const temporary_channel_id: number = bindings.LDKEvent_OpenChannelRequest_get_temporary_channel_id(ptr);
1428 const temporary_channel_id_conv: Uint8Array = bindings.decodeUint8Array(temporary_channel_id);
1429 this.temporary_channel_id = temporary_channel_id_conv;
1430 const counterparty_node_id: number = bindings.LDKEvent_OpenChannelRequest_get_counterparty_node_id(ptr);
1431 const counterparty_node_id_conv: Uint8Array = bindings.decodeUint8Array(counterparty_node_id);
1432 this.counterparty_node_id = counterparty_node_id_conv;
1433 this.funding_satoshis = bindings.LDKEvent_OpenChannelRequest_get_funding_satoshis(ptr);
1434 this.push_msat = bindings.LDKEvent_OpenChannelRequest_get_push_msat(ptr);
1435 const channel_type: bigint = bindings.LDKEvent_OpenChannelRequest_get_channel_type(ptr);
1436 const channel_type_hu_conv: ChannelTypeFeatures = new ChannelTypeFeatures(null, channel_type);
1437 CommonBase.add_ref_from(channel_type_hu_conv, this);
1438 this.channel_type = channel_type_hu_conv;
1441 /** A Event of type HTLCHandlingFailed */
1442 export class Event_HTLCHandlingFailed extends Event {
1444 * The channel over which the HTLC was received.
1446 public prev_channel_id: Uint8Array;
1448 * Destination of the HTLC that failed to be processed.
1450 public failed_next_destination: HTLCDestination;
1452 public constructor(ptr: bigint) {
1454 const prev_channel_id: number = bindings.LDKEvent_HTLCHandlingFailed_get_prev_channel_id(ptr);
1455 const prev_channel_id_conv: Uint8Array = bindings.decodeUint8Array(prev_channel_id);
1456 this.prev_channel_id = prev_channel_id_conv;
1457 const failed_next_destination: bigint = bindings.LDKEvent_HTLCHandlingFailed_get_failed_next_destination(ptr);
1458 const failed_next_destination_hu_conv: HTLCDestination = HTLCDestination.constr_from_ptr(failed_next_destination);
1459 CommonBase.add_ref_from(failed_next_destination_hu_conv, this);
1460 this.failed_next_destination = failed_next_destination_hu_conv;