Skip to content

Commit

Permalink
Unwire the legacy router (#3757)
Browse files Browse the repository at this point in the history
* Begin removing legacy router

* update e2e test

* test updates

* fix build

* fix build

* fix build

* simplify web hook

* build

* Update packages/web/hooks/use-swap.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* remove feature flags

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Jon Ator <jonathanator0@gmail.com>
  • Loading branch information
3 people authored Aug 19, 2024
1 parent 3656944 commit fa5fa80
Show file tree
Hide file tree
Showing 21 changed files with 99 additions and 1,417 deletions.
11 changes: 2 additions & 9 deletions packages/pools/src/router/__tests__/pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
RoutablePool,
Route,
RouteWithInAmount,
TokenOutGivenInRouter,
} from "..";

// Mock RoutablePool for testing purposes
Expand Down Expand Up @@ -82,10 +81,7 @@ export const makeMockRoutablePool = (
*/

// Mock OptimizedRoutes for testing purposes to get access to protected methods
export class TestOptimizedRoutes
extends OptimizedRoutes
implements TokenOutGivenInRouter
{
export class TestOptimizedRoutes extends OptimizedRoutes {
constructor(...args: ConstructorParameters<typeof OptimizedRoutes>) {
super(...args);
}
Expand Down Expand Up @@ -125,10 +121,7 @@ export function makeDefaultTestRouterParams(
return new TestOptimizedRoutes(params);
}

export class RoutesTestOptimizedRoutes
extends OptimizedRoutes
implements TokenOutGivenInRouter
{
export class RoutesTestOptimizedRoutes extends OptimizedRoutes {
private testRoutes: Route[];

constructor(
Expand Down
11 changes: 2 additions & 9 deletions packages/pools/src/router/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,7 @@ import {
RouteWithInAmount,
validateRoute,
} from "./route";
import {
Logger,
Quote,
RoutablePool,
SplitTokenInQuote,
Token,
TokenOutGivenInRouter,
} from "./types";
import { Logger, Quote, RoutablePool, SplitTokenInQuote, Token } from "./types";
import {
cacheKeyForTokenOutGivenIn,
invertRoute,
Expand Down Expand Up @@ -60,7 +53,7 @@ export type OptimizedRoutesParams = {
* @throws NotEnoughLiquidityError if there is not enough liquidity in a route.
* @throws NoRouteError if there is no route between the tokens.
*/
export class OptimizedRoutes implements TokenOutGivenInRouter {
export class OptimizedRoutes {
protected readonly _sortedPools: RoutablePool[];
protected readonly _preferredPoolIds?: string[];
protected readonly _getPoolTotalValueLocked: (poolId: string) => Dec;
Expand Down
9 changes: 0 additions & 9 deletions packages/pools/src/router/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@ export type Token = {
amount: Int;
};

export interface TokenOutGivenInRouter {
/** Route, with splits, given an in token and out denom. */
routeByTokenIn(
tokenIn: Token,
tokenOutDenom: string,
forcePoolId?: string
): Promise<SplitTokenInQuote>;
}

export interface RoutablePool {
/** Unique identifier across pools. */
id: string;
Expand Down
1 change: 0 additions & 1 deletion packages/server/src/queries/complex/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ export * from "./osmosis";
export * from "./pools";
export * from "./portfolio";
export * from "./staking";
export * from "./swap-routers";
export * from "./transactions";
1 change: 0 additions & 1 deletion packages/server/src/queries/complex/pools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ export * from "./bonding";
export * from "./env";
export * from "./incentives";
export * from "./providers";
export * from "./route-token-out-given-in";
export * from "./share";
export * from "./superfluid";
export * from "./transmuter";
Expand Down
Loading

0 comments on commit fa5fa80

Please sign in to comment.