Skip to main content

findCrossTokenRoute

@totemsdk/omnia-router


@totemsdk/omnia-router / findCrossTokenRoute

Function: findCrossTokenRoute()

findCrossTokenRoute(graph, from, to, amountIn, tokenIn, tokenOut, opts?): CrossTokenRoute | null

Find a cross-token route where the sender spends tokenIn and the recipient receives tokenOut. The path may include one or more swap hops provided by bridging intermediaries registered via announceSwap.

Selection criteria: lowest total fee (including swap fee), then fewest hops, then fewest swap hops.

Parameters​

graph​

ChannelGraph

from​

string

to​

string

amountIn​

bigint

tokenIn​

string

tokenOut​

string

opts?​

RouteOptions

Returns​

CrossTokenRoute | null