Skip to content

Commit

Permalink
remove automatic ntt route always preferred special case (#2859)
Browse files Browse the repository at this point in the history
* remove automatic ntt route always preferred special case

* fix linter
  • Loading branch information
kev1n-peters authored Oct 17, 2024
1 parent a40a8d0 commit d89d701
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions wormhole-connect/src/hooks/useFetchSupportedRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const useFetchSupportedRoutes = (): void => {
let isActive = true;

const getSupportedRoutes = async () => {
let routes: RouteState[] = [];
const routes: RouteState[] = [];
await config.routes.forEach(async (name, route) => {
let supported = false;

Expand Down Expand Up @@ -56,21 +56,6 @@ const useFetchSupportedRoutes = (): void => {
routes.push({ name, supported });
});

// If automatic NTT is available, always prefer that
const autoNttRoute = routes.find(
(route) => route.supported && route.name === 'AutomaticNtt',
);
if (autoNttRoute) {
routes = [autoNttRoute];
} else {
// TODO figure out better approach to sorting routes... probably by ETA
routes = routes.sort((a, b) => {
const idxA = config.routes.preference.indexOf(a.name);
const idxB = config.routes.preference.indexOf(b.name);
return idxA - idxB;
});
}

if (isActive) {
dispatch(setRoutes(routes));
}
Expand Down

0 comments on commit d89d701

Please sign in to comment.