UNPKG

lightningdevkit

Version:
95 lines (94 loc) 3.88 kB
import { RouteParameters } from '../structs/RouteParameters.mjs'; import { Path } from '../structs/Path.mjs'; import { Result_RouteDecodeErrorZ } from '../structs/Result_RouteDecodeErrorZ.mjs'; import { CommonBase } from './CommonBase.mjs'; /** * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP, * it can take multiple paths. Each path is composed of one or more hops through the network. */ export declare class Route extends CommonBase { /** * The list of [`Path`]s taken for a single (potentially-)multi-part payment. If no * [`BlindedTail`]s are present, then the pubkey of the last [`RouteHop`] in each path must be * the same. */ get_paths(): Path[]; /** * The list of [`Path`]s taken for a single (potentially-)multi-part payment. If no * [`BlindedTail`]s are present, then the pubkey of the last [`RouteHop`] in each path must be * the same. */ set_paths(val: Path[]): void; /** * The `route_params` parameter passed to [`find_route`]. * * This is used by `ChannelManager` to track information which may be required for retries. * * Will be `None` for objects serialized with LDK versions prior to 0.0.117. * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ get_route_params(): RouteParameters; /** * The `route_params` parameter passed to [`find_route`]. * * This is used by `ChannelManager` to track information which may be required for retries. * * Will be `None` for objects serialized with LDK versions prior to 0.0.117. * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ set_route_params(val: RouteParameters | null): void; /** * Constructs a new Route given each field * * Note that route_params_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ static constructor_new(paths_arg: Path[], route_params_arg: RouteParameters | null): Route; clone_ptr(): bigint; /** * Creates a copy of the Route */ clone(): Route; /** * Generates a non-cryptographic 64-bit hash of the Route. */ hash(): bigint; /** * Checks if two Routes contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. * Two objects with NULL inner values will be considered "equal" here. */ eq(b: Route): boolean; /** * Returns the total amount of fees paid on this [`Route`]. * * For objects serialized with LDK 0.0.117 and after, this includes any extra payment made to * the recipient, which can happen in excess of the amount passed to [`find_route`] via * [`RouteParameters::final_value_msat`], if we had to reach the [`htlc_minimum_msat`] limits. * * [`htlc_minimum_msat`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message */ get_total_fees(): bigint; /** * Returns the total amount paid on this [`Route`], excluding the fees. * * Might be more than requested as part of the given [`RouteParameters::final_value_msat`] if * we had to reach the [`htlc_minimum_msat`] limits. * * [`htlc_minimum_msat`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message */ get_total_amount(): bigint; /** * Get the string representation of a Route object */ to_str(): string; /** * Serialize the Route object into a byte array which can be read by Route_read */ write(): Uint8Array; /** * Read a Route from a byte array, created by Route_write */ static constructor_read(ser: Uint8Array): Result_RouteDecodeErrorZ; }