executeCrossTokenPayment
@totemsdk/omnia-router / executeCrossTokenPayment
Function: executeCrossTokenPayment()
executeCrossTokenPayment(
ops,channels,route,paymentRequest,leaseProviders):Promise<PaymentResult>
Execute a cross-token payment atomically.
For each SwapHop:
- Lock the inbound HTLC (tokenIn side).
- Lock the outbound HTLC (tokenOut side). Both use the same hashlock — the intermediary can only claim by revealing the preimage on both sides simultaneously.
Then forward-locks all remaining non-swap hops, and reveals the preimage backwards across all locked channels.
Rollback fires on ANY failure (forward OR backward phase) by timing out all still-pending locked HTLCs.
Parameters
ops
channels
Map<string, RouterChannel>
route
paymentRequest
leaseProviders
Map<string, unknown>
Returns
Promise<PaymentResult>