Skip to main content

findRoute

@totemsdk/omnia-router


@totemsdk/omnia-router / findRoute

Function: findRoute()

findRoute(graph, from, to, amount, tokenId, opts?): Route | null

Find the cheapest route (lowest total fee, then fewest hops) from from to to carrying amount of tokenId. Edges are filtered by tokenId and availableBalance.

Returns null if no path exists within maxHops.

Parameters

graph

ChannelGraph

from

string

to

string

amount

bigint

tokenId

string

opts?

RouteOptions

Returns

Route | null