UNPKG

lightningdevkit

Version:
69 lines (68 loc) 4.06 kB
import { RouteParameters } from '../structs/RouteParameters.mjs'; import { ChannelDetails } from '../structs/ChannelDetails.mjs'; import { Result_RouteLightningErrorZ } from '../structs/Result_RouteLightningErrorZ.mjs'; import { Result_CVec_BlindedPaymentPathZNoneZ } from '../structs/Result_CVec_BlindedPaymentPathZNoneZ.mjs'; import { InFlightHtlcs } from '../structs/InFlightHtlcs.mjs'; import { ReceiveTlvs } from '../structs/ReceiveTlvs.mjs'; import { CommonBase } from './CommonBase.mjs'; /** An implementation of Router */ export interface RouterInterface { /**Finds a [`Route`] for a payment between the given `payer` and a payee. * * The `payee` and the payment's value are given in [`RouteParameters::payment_params`] * and [`RouteParameters::final_value_msat`], respectively. * * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ find_route(payer: Uint8Array, route_params: RouteParameters, first_hops: ChannelDetails[], inflight_htlcs: InFlightHtlcs): Result_RouteLightningErrorZ; /**Finds a [`Route`] for a payment between the given `payer` and a payee. * * The `payee` and the payment's value are given in [`RouteParameters::payment_params`] * and [`RouteParameters::final_value_msat`], respectively. * * Includes a [`PaymentHash`] and a [`PaymentId`] to be able to correlate the request with a specific * payment. * * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ find_route_with_id(payer: Uint8Array, route_params: RouteParameters, first_hops: ChannelDetails[], inflight_htlcs: InFlightHtlcs, _payment_hash: Uint8Array, _payment_id: Uint8Array): Result_RouteLightningErrorZ; /**Creates [`BlindedPaymentPath`]s for payment to the `recipient` node. The channels in `first_hops` * are assumed to be with the `recipient`'s peers. The payment secret and any constraints are * given in `tlvs`. */ create_blinded_payment_paths(recipient: Uint8Array, first_hops: ChannelDetails[], tlvs: ReceiveTlvs, amount_msats: bigint): Result_CVec_BlindedPaymentPathZNoneZ; } /** * A trait defining behavior for routing a payment. */ export declare class Router extends CommonBase { /** Creates a new instance of Router from a given implementation */ static new_impl(arg: RouterInterface): Router; /** * Finds a [`Route`] for a payment between the given `payer` and a payee. * * The `payee` and the payment's value are given in [`RouteParameters::payment_params`] * and [`RouteParameters::final_value_msat`], respectively. * * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ find_route(payer: Uint8Array, route_params: RouteParameters, first_hops: ChannelDetails[] | null, inflight_htlcs: InFlightHtlcs): Result_RouteLightningErrorZ; /** * Finds a [`Route`] for a payment between the given `payer` and a payee. * * The `payee` and the payment's value are given in [`RouteParameters::payment_params`] * and [`RouteParameters::final_value_msat`], respectively. * * Includes a [`PaymentHash`] and a [`PaymentId`] to be able to correlate the request with a specific * payment. * * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ find_route_with_id(payer: Uint8Array, route_params: RouteParameters, first_hops: ChannelDetails[] | null, inflight_htlcs: InFlightHtlcs, _payment_hash: Uint8Array, _payment_id: Uint8Array): Result_RouteLightningErrorZ; /** * Creates [`BlindedPaymentPath`]s for payment to the `recipient` node. The channels in `first_hops` * are assumed to be with the `recipient`'s peers. The payment secret and any constraints are * given in `tlvs`. */ create_blinded_payment_paths(recipient: Uint8Array, first_hops: ChannelDetails[], tlvs: ReceiveTlvs, amount_msats: bigint): Result_CVec_BlindedPaymentPathZNoneZ; }