executeMultiHopPayment
@totemsdk/omnia-router / executeMultiHopPayment
Function: executeMultiHopPayment()
executeMultiHopPayment(
ops,channels,route,paymentRequest,leaseProviders):Promise<PaymentResult>
Execute a single-token multi-hop payment atomically:
- Forward phase — lock HTLCs across each hop in route.hops.
- Reveal phase — reveal preimage via fulfillHTLC in reverse order.
Rollback (best-effort timeoutHTLC on all still-pending locks) fires on ANY failure, including failures that occur during the reveal phase — so stranded HTLCs are never left behind silently.
paymentRequest.preimage MUST be set (buildPaymentRequest sets it).
The channels map is updated in-place after each HTLC operation.
Parameters
ops
channels
Map<string, RouterChannel>
route
paymentRequest
leaseProviders
Map<string, unknown>
Returns
Promise<PaymentResult>