import { TxOut } from '../structs/TxOut.mjs';
import { TxIn } from '../structs/TxIn.mjs';
import { BigEndianScalar } from '../structs/BigEndianScalar.mjs';
+import { WitnessProgram } from '../structs/WitnessProgram.mjs';
+import { BlindedFailure } from '../enums/BlindedFailure.mjs';
import { Bolt11SemanticError } from '../enums/Bolt11SemanticError.mjs';
import { Bolt12SemanticError } from '../enums/Bolt12SemanticError.mjs';
import { COption_NoneZ } from '../enums/COption_NoneZ.mjs';
import { SpendableOutputDescriptor } from '../structs/SpendableOutputDescriptor.mjs';
import { Result_SpendableOutputDescriptorDecodeErrorZ } from '../structs/Result_SpendableOutputDescriptorDecodeErrorZ.mjs';
import { Option_u32Z } from '../structs/Option_u32Z.mjs';
-import { TwoTuple_CVec_u8ZusizeZ } from '../structs/TwoTuple_CVec_u8ZusizeZ.mjs';
-import { Result_C2Tuple_CVec_u8ZusizeZNoneZ } from '../structs/Result_C2Tuple_CVec_u8ZusizeZNoneZ.mjs';
+import { TwoTuple_CVec_u8Zu64Z } from '../structs/TwoTuple_CVec_u8Zu64Z.mjs';
+import { Result_C2Tuple_CVec_u8Zu64ZNoneZ } from '../structs/Result_C2Tuple_CVec_u8Zu64ZNoneZ.mjs';
import { ChannelDerivationParameters } from '../structs/ChannelDerivationParameters.mjs';
import { Result_ChannelDerivationParametersDecodeErrorZ } from '../structs/Result_ChannelDerivationParametersDecodeErrorZ.mjs';
import { HTLCDescriptor } from '../structs/HTLCDescriptor.mjs';
import { Result_HTLCDescriptorDecodeErrorZ } from '../structs/Result_HTLCDescriptorDecodeErrorZ.mjs';
import { Result_NoneNoneZ } from '../structs/Result_NoneNoneZ.mjs';
-import { TwoTuple_ECDSASignatureCVec_ECDSASignatureZZ } from '../structs/TwoTuple_ECDSASignatureCVec_ECDSASignatureZZ.mjs';
-import { Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ } from '../structs/Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ.mjs';
-import { Result_ECDSASignatureNoneZ } from '../structs/Result_ECDSASignatureNoneZ.mjs';
import { Result_PublicKeyNoneZ } from '../structs/Result_PublicKeyNoneZ.mjs';
import { Option_BigEndianScalarZ } from '../structs/Option_BigEndianScalarZ.mjs';
import { Result_RecoverableSignatureNoneZ } from '../structs/Result_RecoverableSignatureNoneZ.mjs';
import { Result_SchnorrSignatureNoneZ } from '../structs/Result_SchnorrSignatureNoneZ.mjs';
+import { Result_ECDSASignatureNoneZ } from '../structs/Result_ECDSASignatureNoneZ.mjs';
+import { TwoTuple_ECDSASignatureCVec_ECDSASignatureZZ } from '../structs/TwoTuple_ECDSASignatureCVec_ECDSASignatureZZ.mjs';
+import { Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ } from '../structs/Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ.mjs';
import { CommitmentTransaction } from '../structs/CommitmentTransaction.mjs';
import { HolderCommitmentTransaction } from '../structs/HolderCommitmentTransaction.mjs';
import { HTLCOutputInCommitment } from '../structs/HTLCOutputInCommitment.mjs';
import { Result_ShutdownScriptNoneZ } from '../structs/Result_ShutdownScriptNoneZ.mjs';
import { Option_u16Z } from '../structs/Option_u16Z.mjs';
import { Option_boolZ } from '../structs/Option_boolZ.mjs';
-import { Result_CVec_CVec_u8ZZNoneZ } from '../structs/Result_CVec_CVec_u8ZZNoneZ.mjs';
+import { Result_WitnessNoneZ } from '../structs/Result_WitnessNoneZ.mjs';
import { InMemorySigner } from '../structs/InMemorySigner.mjs';
import { Result_InMemorySignerDecodeErrorZ } from '../structs/Result_InMemorySignerDecodeErrorZ.mjs';
import { Result_TransactionNoneZ } from '../structs/Result_TransactionNoneZ.mjs';
import { Route } from '../structs/Route.mjs';
import { LightningError } from '../structs/LightningError.mjs';
import { Result_RouteLightningErrorZ } from '../structs/Result_RouteLightningErrorZ.mjs';
+import { TwoTuple_BlindedPayInfoBlindedPathZ } from '../structs/TwoTuple_BlindedPayInfoBlindedPathZ.mjs';
+import { Result_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ } from '../structs/Result_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ.mjs';
+import { OnionMessagePath } from '../structs/OnionMessagePath.mjs';
+import { Result_OnionMessagePathNoneZ } from '../structs/Result_OnionMessagePathNoneZ.mjs';
+import { Result_CVec_BlindedPathZNoneZ } from '../structs/Result_CVec_BlindedPathZNoneZ.mjs';
import { InFlightHtlcs } from '../structs/InFlightHtlcs.mjs';
import { Result_InFlightHtlcsDecodeErrorZ } from '../structs/Result_InFlightHtlcsDecodeErrorZ.mjs';
import { RouteHop } from '../structs/RouteHop.mjs';
import { Result_RouteParametersDecodeErrorZ } from '../structs/Result_RouteParametersDecodeErrorZ.mjs';
import { PaymentParameters } from '../structs/PaymentParameters.mjs';
import { Result_PaymentParametersDecodeErrorZ } from '../structs/Result_PaymentParametersDecodeErrorZ.mjs';
-import { TwoTuple_BlindedPayInfoBlindedPathZ } from '../structs/TwoTuple_BlindedPayInfoBlindedPathZ.mjs';
import { RouteHint } from '../structs/RouteHint.mjs';
import { RouteHintHop } from '../structs/RouteHintHop.mjs';
import { Result_RouteHintDecodeErrorZ } from '../structs/Result_RouteHintDecodeErrorZ.mjs';
import { ProbabilisticScorer } from '../structs/ProbabilisticScorer.mjs';
import { Result_ProbabilisticScorerDecodeErrorZ } from '../structs/Result_ProbabilisticScorerDecodeErrorZ.mjs';
import { TwoTuple_usizeTransactionZ } from '../structs/TwoTuple_usizeTransactionZ.mjs';
-import { TwoTuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ } from '../structs/TwoTuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ.mjs';
+import { ThreeTuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ } from '../structs/ThreeTuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ.mjs';
import { Result_ChannelMonitorUpdateStatusNoneZ } from '../structs/Result_ChannelMonitorUpdateStatusNoneZ.mjs';
import { HTLCUpdate } from '../structs/HTLCUpdate.mjs';
import { MonitorEvent } from '../structs/MonitorEvent.mjs';
import { OpenChannelV2 } from '../structs/OpenChannelV2.mjs';
import { FundingCreated } from '../structs/FundingCreated.mjs';
import { FundingSigned } from '../structs/FundingSigned.mjs';
+import { Stfu } from '../structs/Stfu.mjs';
+import { Splice } from '../structs/Splice.mjs';
+import { SpliceAck } from '../structs/SpliceAck.mjs';
+import { SpliceLocked } from '../structs/SpliceLocked.mjs';
import { TxAddInput } from '../structs/TxAddInput.mjs';
import { TxAddOutput } from '../structs/TxAddOutput.mjs';
import { TxRemoveInput } from '../structs/TxRemoveInput.mjs';
import { Result_NodeInfoDecodeErrorZ } from '../structs/Result_NodeInfoDecodeErrorZ.mjs';
import { Result_NetworkGraphDecodeErrorZ } from '../structs/Result_NetworkGraphDecodeErrorZ.mjs';
import { Option_CVec_SocketAddressZZ } from '../structs/Option_CVec_SocketAddressZZ.mjs';
+import { PendingHTLCInfo } from '../structs/PendingHTLCInfo.mjs';
+import { InboundHTLCErr } from '../structs/InboundHTLCErr.mjs';
+import { Result_PendingHTLCInfoInboundHTLCErrZ } from '../structs/Result_PendingHTLCInfoInboundHTLCErrZ.mjs';
import { Utxo } from '../structs/Utxo.mjs';
import { Option_TxOutZ } from '../structs/Option_TxOutZ.mjs';
import { Input } from '../structs/Input.mjs';
import { Result_ChannelDetailsDecodeErrorZ } from '../structs/Result_ChannelDetailsDecodeErrorZ.mjs';
import { PhantomRouteHints } from '../structs/PhantomRouteHints.mjs';
import { Result_PhantomRouteHintsDecodeErrorZ } from '../structs/Result_PhantomRouteHintsDecodeErrorZ.mjs';
+import { BlindedForward } from '../structs/BlindedForward.mjs';
+import { Result_BlindedForwardDecodeErrorZ } from '../structs/Result_BlindedForwardDecodeErrorZ.mjs';
+import { OnionPacket } from '../structs/OnionPacket.mjs';
+import { FinalOnionHopData } from '../structs/FinalOnionHopData.mjs';
+import { PendingHTLCRouting } from '../structs/PendingHTLCRouting.mjs';
+import { Result_PendingHTLCRoutingDecodeErrorZ } from '../structs/Result_PendingHTLCRoutingDecodeErrorZ.mjs';
+import { Result_PendingHTLCInfoDecodeErrorZ } from '../structs/Result_PendingHTLCInfoDecodeErrorZ.mjs';
+import { Result_BlindedFailureDecodeErrorZ } from '../structs/Result_BlindedFailureDecodeErrorZ.mjs';
import { Result_ChannelShutdownStateDecodeErrorZ } from '../structs/Result_ChannelShutdownStateDecodeErrorZ.mjs';
import { ChannelMonitor } from '../structs/ChannelMonitor.mjs';
import { ChannelMonitorUpdate } from '../structs/ChannelMonitorUpdate.mjs';
import { NodeSigner, NodeSignerInterface } from '../structs/NodeSigner.mjs';
import { SignerProvider, SignerProviderInterface } from '../structs/SignerProvider.mjs';
import { FeeEstimator, FeeEstimatorInterface } from '../structs/FeeEstimator.mjs';
+import { ReceiveTlvs } from '../structs/ReceiveTlvs.mjs';
+import { MessageRouter, MessageRouterInterface } from '../structs/MessageRouter.mjs';
import { Router, RouterInterface } from '../structs/Router.mjs';
import { ChannelManager } from '../structs/ChannelManager.mjs';
import { TwoTuple_ThirtyTwoBytesChannelManagerZ } from '../structs/TwoTuple_ThirtyTwoBytesChannelManagerZ.mjs';
import { Result_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ } from '../structs/Result_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ.mjs';
import { Type, TypeInterface } from '../structs/Type.mjs';
import { TwoTuple_PublicKeyTypeZ } from '../structs/TwoTuple_PublicKeyTypeZ.mjs';
+import { TwoTuple_PublicKeyCVec_SocketAddressZZ } from '../structs/TwoTuple_PublicKeyCVec_SocketAddressZZ.mjs';
import { OnionMessageContents, OnionMessageContentsInterface } from '../structs/OnionMessageContents.mjs';
import { Option_OnionMessageContentsZ } from '../structs/Option_OnionMessageContentsZ.mjs';
import { Result_COption_OnionMessageContentsZDecodeErrorZ } from '../structs/Result_COption_OnionMessageContentsZDecodeErrorZ.mjs';
import { UpdateFailMalformedHTLC } from '../structs/UpdateFailMalformedHTLC.mjs';
import { Result_AcceptChannelDecodeErrorZ } from '../structs/Result_AcceptChannelDecodeErrorZ.mjs';
import { Result_AcceptChannelV2DecodeErrorZ } from '../structs/Result_AcceptChannelV2DecodeErrorZ.mjs';
+import { Result_StfuDecodeErrorZ } from '../structs/Result_StfuDecodeErrorZ.mjs';
+import { Result_SpliceDecodeErrorZ } from '../structs/Result_SpliceDecodeErrorZ.mjs';
+import { Result_SpliceAckDecodeErrorZ } from '../structs/Result_SpliceAckDecodeErrorZ.mjs';
+import { Result_SpliceLockedDecodeErrorZ } from '../structs/Result_SpliceLockedDecodeErrorZ.mjs';
import { Result_TxAddInputDecodeErrorZ } from '../structs/Result_TxAddInputDecodeErrorZ.mjs';
import { Result_TxAddOutputDecodeErrorZ } from '../structs/Result_TxAddOutputDecodeErrorZ.mjs';
import { Result_TxRemoveInputDecodeErrorZ } from '../structs/Result_TxRemoveInputDecodeErrorZ.mjs';
import { UpdateFee } from '../structs/UpdateFee.mjs';
import { Result_UpdateFeeDecodeErrorZ } from '../structs/Result_UpdateFeeDecodeErrorZ.mjs';
import { Result_UpdateFulfillHTLCDecodeErrorZ } from '../structs/Result_UpdateFulfillHTLCDecodeErrorZ.mjs';
+import { Result_OnionPacketDecodeErrorZ } from '../structs/Result_OnionPacketDecodeErrorZ.mjs';
import { Result_UpdateAddHTLCDecodeErrorZ } from '../structs/Result_UpdateAddHTLCDecodeErrorZ.mjs';
import { OnionMessage } from '../structs/OnionMessage.mjs';
import { Result_OnionMessageDecodeErrorZ } from '../structs/Result_OnionMessageDecodeErrorZ.mjs';
+import { Result_FinalOnionHopDataDecodeErrorZ } from '../structs/Result_FinalOnionHopDataDecodeErrorZ.mjs';
import { Ping } from '../structs/Ping.mjs';
import { Result_PingDecodeErrorZ } from '../structs/Result_PingDecodeErrorZ.mjs';
import { Pong } from '../structs/Pong.mjs';
import { Result_TransactionU16LenLimitedNoneZ } from '../structs/Result_TransactionU16LenLimitedNoneZ.mjs';
import { Result_TransactionU16LenLimitedDecodeErrorZ } from '../structs/Result_TransactionU16LenLimitedDecodeErrorZ.mjs';
import { Result_UntrustedStringDecodeErrorZ } from '../structs/Result_UntrustedStringDecodeErrorZ.mjs';
-import { ReceiveTlvs } from '../structs/ReceiveTlvs.mjs';
-import { Result_ReceiveTlvsDecodeErrorZ } from '../structs/Result_ReceiveTlvsDecodeErrorZ.mjs';
+import { TwoTuple__u832u16Z } from '../structs/TwoTuple__u832u16Z.mjs';
import { PaymentRelay } from '../structs/PaymentRelay.mjs';
import { Result_PaymentRelayDecodeErrorZ } from '../structs/Result_PaymentRelayDecodeErrorZ.mjs';
import { PaymentConstraints } from '../structs/PaymentConstraints.mjs';
import { Result_PaymentConstraintsDecodeErrorZ } from '../structs/Result_PaymentConstraintsDecodeErrorZ.mjs';
-import { PaymentError } from '../structs/PaymentError.mjs';
-import { Result_ThirtyTwoBytesPaymentErrorZ } from '../structs/Result_ThirtyTwoBytesPaymentErrorZ.mjs';
-import { Result_NonePaymentErrorZ } from '../structs/Result_NonePaymentErrorZ.mjs';
-import { ProbingError } from '../structs/ProbingError.mjs';
-import { Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ } from '../structs/Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ.mjs';
+import { ThreeTuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ } from '../structs/ThreeTuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ.mjs';
+import { Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ } from '../structs/Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ.mjs';
import { Result_StrSecp256k1ErrorZ } from '../structs/Result_StrSecp256k1ErrorZ.mjs';
-import { OnionMessagePath } from '../structs/OnionMessagePath.mjs';
-import { Result_OnionMessagePathNoneZ } from '../structs/Result_OnionMessagePathNoneZ.mjs';
-import { TwoTuple_PublicKeyOnionMessageZ } from '../structs/TwoTuple_PublicKeyOnionMessageZ.mjs';
+import { ThreeTuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ } from '../structs/ThreeTuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ.mjs';
import { SendError } from '../structs/SendError.mjs';
-import { Result_C2Tuple_PublicKeyOnionMessageZSendErrorZ } from '../structs/Result_C2Tuple_PublicKeyOnionMessageZSendErrorZ.mjs';
+import { Result_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ } from '../structs/Result_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ.mjs';
import { ParsedOnionMessageContents } from '../structs/ParsedOnionMessageContents.mjs';
import { PeeledOnion } from '../structs/PeeledOnion.mjs';
import { Result_PeeledOnionNoneZ } from '../structs/Result_PeeledOnionNoneZ.mjs';
-import { Result_NoneSendErrorZ } from '../structs/Result_NoneSendErrorZ.mjs';
+import { SendSuccess } from '../structs/SendSuccess.mjs';
+import { Result_SendSuccessSendErrorZ } from '../structs/Result_SendSuccessSendErrorZ.mjs';
import { Result_BlindedPathNoneZ } from '../structs/Result_BlindedPathNoneZ.mjs';
import { Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ } from '../structs/Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.mjs';
+import { ForwardNode } from '../structs/ForwardNode.mjs';
import { Result_BlindedPathDecodeErrorZ } from '../structs/Result_BlindedPathDecodeErrorZ.mjs';
import { Result_BlindedHopDecodeErrorZ } from '../structs/Result_BlindedHopDecodeErrorZ.mjs';
import { Result_InvoiceErrorDecodeErrorZ } from '../structs/Result_InvoiceErrorDecodeErrorZ.mjs';
+import { DelayedPaymentBasepoint } from '../structs/DelayedPaymentBasepoint.mjs';
+import { Result_DelayedPaymentBasepointDecodeErrorZ } from '../structs/Result_DelayedPaymentBasepointDecodeErrorZ.mjs';
+import { DelayedPaymentKey } from '../structs/DelayedPaymentKey.mjs';
+import { Result_DelayedPaymentKeyDecodeErrorZ } from '../structs/Result_DelayedPaymentKeyDecodeErrorZ.mjs';
+import { HtlcBasepoint } from '../structs/HtlcBasepoint.mjs';
+import { Result_HtlcBasepointDecodeErrorZ } from '../structs/Result_HtlcBasepointDecodeErrorZ.mjs';
+import { HtlcKey } from '../structs/HtlcKey.mjs';
+import { Result_HtlcKeyDecodeErrorZ } from '../structs/Result_HtlcKeyDecodeErrorZ.mjs';
+import { RevocationBasepoint } from '../structs/RevocationBasepoint.mjs';
+import { Result_RevocationBasepointDecodeErrorZ } from '../structs/Result_RevocationBasepointDecodeErrorZ.mjs';
+import { RevocationKey } from '../structs/RevocationKey.mjs';
+import { Result_RevocationKeyDecodeErrorZ } from '../structs/Result_RevocationKeyDecodeErrorZ.mjs';
import { WatchedOutput } from '../structs/WatchedOutput.mjs';
import { Filter, FilterInterface } from '../structs/Filter.mjs';
import { Option_FilterZ } from '../structs/Option_FilterZ.mjs';
import { MonitorUpdateId } from '../structs/MonitorUpdateId.mjs';
import { TwoTuple_OutPointCVec_MonitorUpdateIdZZ } from '../structs/TwoTuple_OutPointCVec_MonitorUpdateIdZZ.mjs';
import { KVStore, KVStoreInterface } from '../structs/KVStore.mjs';
+import { FirstHopCandidate } from '../structs/FirstHopCandidate.mjs';
+import { PublicHopCandidate } from '../structs/PublicHopCandidate.mjs';
+import { PrivateHopCandidate } from '../structs/PrivateHopCandidate.mjs';
+import { BlindedPathCandidate } from '../structs/BlindedPathCandidate.mjs';
+import { OneHopBlindedPathCandidate } from '../structs/OneHopBlindedPathCandidate.mjs';
+import { CandidateRouteHop } from '../structs/CandidateRouteHop.mjs';
import { ChannelUsage } from '../structs/ChannelUsage.mjs';
import { ProbabilisticScoringFeeParameters } from '../structs/ProbabilisticScoringFeeParameters.mjs';
import { ScoreLookUp, ScoreLookUpInterface } from '../structs/ScoreLookUp.mjs';
import { ProbabilisticScoringDecayParameters } from '../structs/ProbabilisticScoringDecayParameters.mjs';
import { KeysManager } from '../structs/KeysManager.mjs';
import { PhantomKeysManager } from '../structs/PhantomKeysManager.mjs';
-import { MessageRouter, MessageRouterInterface } from '../structs/MessageRouter.mjs';
import { OnionMessenger } from '../structs/OnionMessenger.mjs';
import { DefaultMessageRouter } from '../structs/DefaultMessageRouter.mjs';
-import { ForwardNode } from '../structs/ForwardNode.mjs';
import { ForwardTlvs } from '../structs/ForwardTlvs.mjs';
import { CoinSelectionSource, CoinSelectionSourceInterface } from '../structs/CoinSelectionSource.mjs';
import { WalletSource, WalletSourceInterface } from '../structs/WalletSource.mjs';
return ret_hu_conv;
}
+ /**
+ * Peel one layer off an incoming onion, returning a [`PendingHTLCInfo`] that contains information
+ * about the intended next-hop for the HTLC.
+ *
+ * This does all the relevant context-free checks that LDK requires for payment relay or
+ * acceptance. If the payment is to be received, and the amount matches the expected amount for
+ * a given invoice, this indicates the [`msgs::UpdateAddHTLC`], once fully committed in the
+ * channel, will generate an [`Event::PaymentClaimable`].
+ *
+ * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable
+ */
+ public static constructor_peel_payment_onion(msg: UpdateAddHTLC, node_signer: NodeSigner, logger: Logger, cur_height: number, accept_mpp_keysend: boolean, allow_skimmed_fees: boolean): Result_PendingHTLCInfoInboundHTLCErrZ {
+ const ret: bigint = bindings.peel_payment_onion(msg == null ? 0n : CommonBase.get_ptr_of(msg), CommonBase.get_ptr_of(node_signer), CommonBase.get_ptr_of(logger), cur_height, accept_mpp_keysend, allow_skimmed_fees);
+ const ret_hu_conv: Result_PendingHTLCInfoInboundHTLCErrZ = Result_PendingHTLCInfoInboundHTLCErrZ.constr_from_ptr(ret);
+ CommonBase.add_ref_from(ret_hu_conv, msg);
+ CommonBase.add_ref_from(ret_hu_conv, node_signer);
+ CommonBase.add_ref_from(ret_hu_conv, logger);
+ return ret_hu_conv;
+ }
+
/**
* Fetches the set of [`InitFeatures`] flags that are provided by or required by
* [`ChannelManager`].
return ret_conv;
}
- /**
- * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
- * from the base point and the per_commitment_key. This is the public equivalent of
- * derive_private_key - using only public keys to derive a public key instead of private keys.
- */
- public static constructor_derive_public_key(per_commitment_point: Uint8Array, base_point: Uint8Array): Uint8Array {
- const ret: number = bindings.derive_public_key(bindings.encodeUint8Array(bindings.check_arr_len(per_commitment_point, 33)), bindings.encodeUint8Array(bindings.check_arr_len(base_point, 33)));
- const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
- return ret_conv;
- }
-
/**
* Derives a per-commitment-transaction revocation key from its constituent parts.
*
return ret_conv;
}
- /**
- * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
- * the public equivalend of derive_private_revocation_key - using only public keys to derive a
- * public key instead of private keys.
- *
- * Only the cheating participant owns a valid witness to propagate a revoked
- * commitment transaction, thus per_commitment_point always come from cheater
- * and revocation_base_point always come from punisher, which is the broadcaster
- * of the transaction spending with this key knowledge.
- *
- * Note that this is infallible iff we trust that at least one of the two input keys are randomly
- * generated (ie our own).
- */
- public static constructor_derive_public_revocation_key(per_commitment_point: Uint8Array, countersignatory_revocation_base_point: Uint8Array): Uint8Array {
- const ret: number = bindings.derive_public_revocation_key(bindings.encodeUint8Array(bindings.check_arr_len(per_commitment_point, 33)), bindings.encodeUint8Array(bindings.check_arr_len(countersignatory_revocation_base_point, 33)));
- const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
- return ret_conv;
- }
-
/**
* A script either spendable by the revocation
* key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
* Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
*/
- public static constructor_get_revokeable_redeemscript(revocation_key: Uint8Array, contest_delay: number, broadcaster_delayed_payment_key: Uint8Array): Uint8Array {
- const ret: number = bindings.get_revokeable_redeemscript(bindings.encodeUint8Array(bindings.check_arr_len(revocation_key, 33)), contest_delay, bindings.encodeUint8Array(bindings.check_arr_len(broadcaster_delayed_payment_key, 33)));
+ public static constructor_get_revokeable_redeemscript(revocation_key: RevocationKey, contest_delay: number, broadcaster_delayed_payment_key: DelayedPaymentKey): Uint8Array {
+ const ret: number = bindings.get_revokeable_redeemscript(revocation_key == null ? 0n : CommonBase.get_ptr_of(revocation_key), contest_delay, broadcaster_delayed_payment_key == null ? 0n : CommonBase.get_ptr_of(broadcaster_delayed_payment_key));
const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
return ret_conv;
}
* Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
* commitment transaction).
*/
- public static constructor_build_htlc_transaction(commitment_txid: Uint8Array, feerate_per_kw: number, contest_delay: number, htlc: HTLCOutputInCommitment, channel_type_features: ChannelTypeFeatures, broadcaster_delayed_payment_key: Uint8Array, revocation_key: Uint8Array): Uint8Array {
- const ret: number = bindings.build_htlc_transaction(bindings.encodeUint8Array(bindings.check_arr_len(commitment_txid, 32)), feerate_per_kw, contest_delay, htlc == null ? 0n : CommonBase.get_ptr_of(htlc), channel_type_features == null ? 0n : CommonBase.get_ptr_of(channel_type_features), bindings.encodeUint8Array(bindings.check_arr_len(broadcaster_delayed_payment_key, 33)), bindings.encodeUint8Array(bindings.check_arr_len(revocation_key, 33)));
+ public static constructor_build_htlc_transaction(commitment_txid: Uint8Array, feerate_per_kw: number, contest_delay: number, htlc: HTLCOutputInCommitment, channel_type_features: ChannelTypeFeatures, broadcaster_delayed_payment_key: DelayedPaymentKey, revocation_key: RevocationKey): Uint8Array {
+ const ret: number = bindings.build_htlc_transaction(bindings.encodeUint8Array(bindings.check_arr_len(commitment_txid, 32)), feerate_per_kw, contest_delay, htlc == null ? 0n : CommonBase.get_ptr_of(htlc), channel_type_features == null ? 0n : CommonBase.get_ptr_of(channel_type_features), broadcaster_delayed_payment_key == null ? 0n : CommonBase.get_ptr_of(broadcaster_delayed_payment_key), revocation_key == null ? 0n : CommonBase.get_ptr_of(revocation_key));
const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
return ret_conv;
}
*
* We do not enforce that outputs meet the dust limit or that any output scripts are standard.
*/
- public static constructor_SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors: SpendableOutputDescriptor[], outputs: TxOut[], change_destination_script: Uint8Array, feerate_sat_per_1000_weight: number, locktime: Option_u32Z): Result_C2Tuple_CVec_u8ZusizeZNoneZ {
+ public static constructor_SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors: SpendableOutputDescriptor[], outputs: TxOut[], change_destination_script: Uint8Array, feerate_sat_per_1000_weight: number, locktime: Option_u32Z): Result_C2Tuple_CVec_u8Zu64ZNoneZ {
const ret: bigint = bindings.SpendableOutputDescriptor_create_spendable_outputs_psbt(bindings.encodeUint64Array(descriptors.map(descriptors_conv_27 => CommonBase.get_ptr_of(descriptors_conv_27))), bindings.encodeUint64Array(outputs.map(outputs_conv_7 => CommonBase.get_ptr_of(outputs_conv_7))), bindings.encodeUint8Array(change_destination_script), feerate_sat_per_1000_weight, CommonBase.get_ptr_of(locktime));
- const ret_hu_conv: Result_C2Tuple_CVec_u8ZusizeZNoneZ = Result_C2Tuple_CVec_u8ZusizeZNoneZ.constr_from_ptr(ret);
+ const ret_hu_conv: Result_C2Tuple_CVec_u8Zu64ZNoneZ = Result_C2Tuple_CVec_u8Zu64ZNoneZ.constr_from_ptr(ret);
descriptors.forEach((descriptors_conv_27: SpendableOutputDescriptor) => { CommonBase.add_ref_from(ret_hu_conv, descriptors_conv_27); });
CommonBase.add_ref_from(ret_hu_conv, locktime);
return ret_hu_conv;
* Creates an [`OnionMessage`] with the given `contents` for sending to the destination of
* `path`.
*
- * Returns both the node id of the peer to send the message to and the message itself.
+ * Returns the node id of the peer to send the message to, the message itself, and any addresses
+ * need to connect to the first node.
*
* Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- public static constructor_create_onion_message(entropy_source: EntropySource, node_signer: NodeSigner, path: OnionMessagePath, contents: OnionMessageContents, reply_path: BlindedPath|null): Result_C2Tuple_PublicKeyOnionMessageZSendErrorZ {
+ public static constructor_create_onion_message(entropy_source: EntropySource, node_signer: NodeSigner, path: OnionMessagePath, contents: OnionMessageContents, reply_path: BlindedPath|null): Result_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
const ret: bigint = bindings.create_onion_message(CommonBase.get_ptr_of(entropy_source), CommonBase.get_ptr_of(node_signer), path == null ? 0n : CommonBase.get_ptr_of(path), CommonBase.get_ptr_of(contents), reply_path == null ? 0n : CommonBase.get_ptr_of(reply_path));
- const ret_hu_conv: Result_C2Tuple_PublicKeyOnionMessageZSendErrorZ = Result_C2Tuple_PublicKeyOnionMessageZSendErrorZ.constr_from_ptr(ret);
+ const ret_hu_conv: Result_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ = Result_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ.constr_from_ptr(ret);
CommonBase.add_ref_from(ret_hu_conv, entropy_source);
CommonBase.add_ref_from(ret_hu_conv, node_signer);
CommonBase.add_ref_from(ret_hu_conv, path);
return ret_hu_conv;
}
+ /**
+ * Create a blinded path for a payment, to be forwarded along `intermediate_nodes`.
+ *
+ * Errors if:
+ * a provided node id is invalid
+ * [`BlindedPayInfo`] calculation results in an integer overflow
+ * any unknown features are required in the provided [`ForwardTlvs`]
+ *
+ * [`ForwardTlvs`]: crate::blinded_path::payment::ForwardTlvs
+ */
+ public static constructor_BlindedPath_new_for_payment(intermediate_nodes: ForwardNode[], payee_node_id: Uint8Array, payee_tlvs: ReceiveTlvs, htlc_maximum_msat: bigint, entropy_source: EntropySource): Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
+ const ret: bigint = bindings.BlindedPath_new_for_payment(bindings.encodeUint64Array(intermediate_nodes.map(intermediate_nodes_conv_13 => intermediate_nodes_conv_13 == null ? 0n : CommonBase.get_ptr_of(intermediate_nodes_conv_13))), bindings.encodeUint8Array(bindings.check_arr_len(payee_node_id, 33)), payee_tlvs == null ? 0n : CommonBase.get_ptr_of(payee_tlvs), htlc_maximum_msat, CommonBase.get_ptr_of(entropy_source));
+ const ret_hu_conv: Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ = Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.constr_from_ptr(ret);
+ intermediate_nodes.forEach((intermediate_nodes_conv_13: ForwardNode) => { CommonBase.add_ref_from(ret_hu_conv, intermediate_nodes_conv_13); });
+ CommonBase.add_ref_from(ret_hu_conv, payee_tlvs);
+ CommonBase.add_ref_from(ret_hu_conv, entropy_source);
+ return ret_hu_conv;
+ }
+
/**
* Read a PathFailure from a byte array, created by PathFailure_write
*/
}
/**
- * Pays the given [`Bolt11Invoice`], retrying if needed based on [`Retry`].
+ * Builds the necessary parameters to pay or pre-flight probe the given zero-amount
+ * [`Bolt11Invoice`] using [`ChannelManager::send_payment`] or
+ * [`ChannelManager::send_preflight_probes`].
*
- * [`Bolt11Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long
- * as the payment is still pending. If the payment succeeds, you must ensure that a second payment
- * with the same [`PaymentHash`] is never sent.
+ * Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the
+ * same [`PaymentHash`] has never been paid before.
*
- * If you wish to use a different payment idempotency token, see [`pay_invoice_with_id`].
- */
- public static constructor_pay_invoice(invoice: Bolt11Invoice, retry_strategy: Retry, channelmanager: ChannelManager): Result_ThirtyTwoBytesPaymentErrorZ {
- const ret: bigint = bindings.pay_invoice(invoice == null ? 0n : CommonBase.get_ptr_of(invoice), CommonBase.get_ptr_of(retry_strategy), channelmanager == null ? 0n : CommonBase.get_ptr_of(channelmanager));
- const ret_hu_conv: Result_ThirtyTwoBytesPaymentErrorZ = Result_ThirtyTwoBytesPaymentErrorZ.constr_from_ptr(ret);
- CommonBase.add_ref_from(ret_hu_conv, invoice);
- CommonBase.add_ref_from(ret_hu_conv, retry_strategy);
- CommonBase.add_ref_from(ret_hu_conv, channelmanager);
- return ret_hu_conv;
- }
-
- /**
- * Pays the given [`Bolt11Invoice`] with a custom idempotency key, retrying if needed based on
- * [`Retry`].
- *
- * Note that idempotency is only guaranteed as long as the payment is still pending. Once the
- * payment completes or fails, no idempotency guarantees are made.
- *
- * You should ensure that the [`Bolt11Invoice::payment_hash`] is unique and the same
- * [`PaymentHash`] has never been paid before.
+ * Will always succeed unless the invoice has an amount specified, in which case
+ * [`payment_parameters_from_invoice`] should be used.
*
- * See [`pay_invoice`] for a variant which uses the [`PaymentHash`] for the idempotency token.
+ * [`ChannelManager::send_payment`]: lightning::ln::channelmanager::ChannelManager::send_payment
+ * [`ChannelManager::send_preflight_probes`]: lightning::ln::channelmanager::ChannelManager::send_preflight_probes
*/
- public static constructor_pay_invoice_with_id(invoice: Bolt11Invoice, payment_id: Uint8Array, retry_strategy: Retry, channelmanager: ChannelManager): Result_NonePaymentErrorZ {
- const ret: bigint = bindings.pay_invoice_with_id(invoice == null ? 0n : CommonBase.get_ptr_of(invoice), bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32)), CommonBase.get_ptr_of(retry_strategy), channelmanager == null ? 0n : CommonBase.get_ptr_of(channelmanager));
- const ret_hu_conv: Result_NonePaymentErrorZ = Result_NonePaymentErrorZ.constr_from_ptr(ret);
+ public static constructor_payment_parameters_from_zero_amount_invoice(invoice: Bolt11Invoice, amount_msat: bigint): Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
+ const ret: bigint = bindings.payment_parameters_from_zero_amount_invoice(invoice == null ? 0n : CommonBase.get_ptr_of(invoice), amount_msat);
+ const ret_hu_conv: Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ = Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ.constr_from_ptr(ret);
CommonBase.add_ref_from(ret_hu_conv, invoice);
- CommonBase.add_ref_from(ret_hu_conv, retry_strategy);
- CommonBase.add_ref_from(ret_hu_conv, channelmanager);
return ret_hu_conv;
}
/**
- * Pays the given zero-value [`Bolt11Invoice`] using the given amount, retrying if needed based on
- * [`Retry`].
+ * Builds the necessary parameters to pay or pre-flight probe the given [`Bolt11Invoice`] using
+ * [`ChannelManager::send_payment`] or [`ChannelManager::send_preflight_probes`].
*
- * [`Bolt11Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long
- * as the payment is still pending. If the payment succeeds, you must ensure that a second payment
- * with the same [`PaymentHash`] is never sent.
+ * Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the
+ * same [`PaymentHash`] has never been paid before.
*
- * If you wish to use a different payment idempotency token, see
- * [`pay_zero_value_invoice_with_id`].
- */
- public static constructor_pay_zero_value_invoice(invoice: Bolt11Invoice, amount_msats: bigint, retry_strategy: Retry, channelmanager: ChannelManager): Result_ThirtyTwoBytesPaymentErrorZ {
- const ret: bigint = bindings.pay_zero_value_invoice(invoice == null ? 0n : CommonBase.get_ptr_of(invoice), amount_msats, CommonBase.get_ptr_of(retry_strategy), channelmanager == null ? 0n : CommonBase.get_ptr_of(channelmanager));
- const ret_hu_conv: Result_ThirtyTwoBytesPaymentErrorZ = Result_ThirtyTwoBytesPaymentErrorZ.constr_from_ptr(ret);
- CommonBase.add_ref_from(ret_hu_conv, invoice);
- CommonBase.add_ref_from(ret_hu_conv, retry_strategy);
- CommonBase.add_ref_from(ret_hu_conv, channelmanager);
- return ret_hu_conv;
- }
-
- /**
- * Pays the given zero-value [`Bolt11Invoice`] using the given amount and custom idempotency key,
- * retrying if needed based on [`Retry`].
- *
- * Note that idempotency is only guaranteed as long as the payment is still pending. Once the
- * payment completes or fails, no idempotency guarantees are made.
- *
- * You should ensure that the [`Bolt11Invoice::payment_hash`] is unique and the same
- * [`PaymentHash`] has never been paid before.
- *
- * See [`pay_zero_value_invoice`] for a variant which uses the [`PaymentHash`] for the
- * idempotency token.
- */
- public static constructor_pay_zero_value_invoice_with_id(invoice: Bolt11Invoice, amount_msats: bigint, payment_id: Uint8Array, retry_strategy: Retry, channelmanager: ChannelManager): Result_NonePaymentErrorZ {
- const ret: bigint = bindings.pay_zero_value_invoice_with_id(invoice == null ? 0n : CommonBase.get_ptr_of(invoice), amount_msats, bindings.encodeUint8Array(bindings.check_arr_len(payment_id, 32)), CommonBase.get_ptr_of(retry_strategy), channelmanager == null ? 0n : CommonBase.get_ptr_of(channelmanager));
- const ret_hu_conv: Result_NonePaymentErrorZ = Result_NonePaymentErrorZ.constr_from_ptr(ret);
- CommonBase.add_ref_from(ret_hu_conv, invoice);
- CommonBase.add_ref_from(ret_hu_conv, retry_strategy);
- CommonBase.add_ref_from(ret_hu_conv, channelmanager);
- return ret_hu_conv;
- }
-
- /**
- * Sends payment probes over all paths of a route that would be used to pay the given invoice.
+ * Will always succeed unless the invoice has no amount specified, in which case
+ * [`payment_parameters_from_zero_amount_invoice`] should be used.
*
- * See [`ChannelManager::send_preflight_probes`] for more information.
+ * [`ChannelManager::send_payment`]: lightning::ln::channelmanager::ChannelManager::send_payment
+ * [`ChannelManager::send_preflight_probes`]: lightning::ln::channelmanager::ChannelManager::send_preflight_probes
*/
- public static constructor_preflight_probe_invoice(invoice: Bolt11Invoice, channelmanager: ChannelManager, liquidity_limit_multiplier: Option_u64Z): Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
- const ret: bigint = bindings.preflight_probe_invoice(invoice == null ? 0n : CommonBase.get_ptr_of(invoice), channelmanager == null ? 0n : CommonBase.get_ptr_of(channelmanager), CommonBase.get_ptr_of(liquidity_limit_multiplier));
- const ret_hu_conv: Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ = Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ.constr_from_ptr(ret);
+ public static constructor_payment_parameters_from_invoice(invoice: Bolt11Invoice): Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
+ const ret: bigint = bindings.payment_parameters_from_invoice(invoice == null ? 0n : CommonBase.get_ptr_of(invoice));
+ const ret_hu_conv: Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ = Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ.constr_from_ptr(ret);
CommonBase.add_ref_from(ret_hu_conv, invoice);
- CommonBase.add_ref_from(ret_hu_conv, channelmanager);
- CommonBase.add_ref_from(ret_hu_conv, liquidity_limit_multiplier);
- return ret_hu_conv;
- }
-
- /**
- * Sends payment probes over all paths of a route that would be used to pay the given zero-value
- * invoice using the given amount.
- *
- * See [`ChannelManager::send_preflight_probes`] for more information.
- */
- public static constructor_preflight_probe_zero_value_invoice(invoice: Bolt11Invoice, amount_msat: bigint, channelmanager: ChannelManager, liquidity_limit_multiplier: Option_u64Z): Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ {
- const ret: bigint = bindings.preflight_probe_zero_value_invoice(invoice == null ? 0n : CommonBase.get_ptr_of(invoice), amount_msat, channelmanager == null ? 0n : CommonBase.get_ptr_of(channelmanager), CommonBase.get_ptr_of(liquidity_limit_multiplier));
- const ret_hu_conv: Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ = Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ.constr_from_ptr(ret);
- CommonBase.add_ref_from(ret_hu_conv, invoice);
- CommonBase.add_ref_from(ret_hu_conv, channelmanager);
- CommonBase.add_ref_from(ret_hu_conv, liquidity_limit_multiplier);
return ret_hu_conv;
}