UNPKG

lightningdevkit

Version:
55 lines (54 loc) 2.99 kB
import { AsyncPaymentsContext } from '../structs/AsyncPaymentsContext.mjs'; import { ReleaseHeldHtlc } from '../structs/ReleaseHeldHtlc.mjs'; import { Option_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ } from '../structs/Option_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ.mjs'; import { HeldHtlcAvailable } from '../structs/HeldHtlcAvailable.mjs'; import { TwoTuple_AsyncPaymentsMessageMessageSendInstructionsZ } from '../structs/TwoTuple_AsyncPaymentsMessageMessageSendInstructionsZ.mjs'; import { Responder } from '../structs/Responder.mjs'; import { CommonBase } from './CommonBase.mjs'; /** An implementation of AsyncPaymentsMessageHandler */ export interface AsyncPaymentsMessageHandlerInterface { /**Handle a [`HeldHtlcAvailable`] message. A [`ReleaseHeldHtlc`] should be returned to release * the held funds. * * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None */ handle_held_htlc_available(message: HeldHtlcAvailable, responder: Responder): Option_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ; /**Handle a [`ReleaseHeldHtlc`] message. If authentication of the message succeeds, an HTLC * should be released to the corresponding payee. */ handle_release_held_htlc(message: ReleaseHeldHtlc, context: AsyncPaymentsContext): void; /**Release any [`AsyncPaymentsMessage`]s that need to be sent. * * Typically, this is used for messages initiating an async payment flow rather than in response * to another message. */ release_pending_messages(): TwoTuple_AsyncPaymentsMessageMessageSendInstructionsZ[]; } /** * A handler for an [`OnionMessage`] containing an async payments message as its payload. * * [`OnionMessage`]: crate::ln::msgs::OnionMessage */ export declare class AsyncPaymentsMessageHandler extends CommonBase { /** Creates a new instance of AsyncPaymentsMessageHandler from a given implementation */ static new_impl(arg: AsyncPaymentsMessageHandlerInterface): AsyncPaymentsMessageHandler; /** * Handle a [`HeldHtlcAvailable`] message. A [`ReleaseHeldHtlc`] should be returned to release * the held funds. * * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None */ handle_held_htlc_available(message: HeldHtlcAvailable, responder: Responder | null): Option_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ; /** * Handle a [`ReleaseHeldHtlc`] message. If authentication of the message succeeds, an HTLC * should be released to the corresponding payee. */ handle_release_held_htlc(message: ReleaseHeldHtlc, context: AsyncPaymentsContext): void; /** * Release any [`AsyncPaymentsMessage`]s that need to be sent. * * Typically, this is used for messages initiating an async payment flow rather than in response * to another message. */ release_pending_messages(): TwoTuple_AsyncPaymentsMessageMessageSendInstructionsZ[]; }