From e644826b46101fcf42cee072eb1b412dde17972f Mon Sep 17 00:00:00 2001 From: Deividas Petraitis Date: Mon, 9 Dec 2024 15:19:54 +0200 Subject: [PATCH 1/2] FE-1281 | Move pools router into local tRPC router Moves pools router into local tRPC router for following methods: - getUserPools - getPools - getPool --- packages/web/components/complex/add-conc-liquidity.tsx | 2 +- packages/web/components/complex/pools-table.tsx | 2 +- packages/web/components/complex/portfolio/user-positions.tsx | 2 +- .../hooks/ui-config/use-add-concentrated-liquidity-config.ts | 2 +- packages/web/hooks/ui-config/use-historical-and-depth-data.ts | 2 +- packages/web/modals/add-liquidity.tsx | 2 +- packages/web/pages/pool/[id].tsx | 2 +- packages/web/server/api/local-router.ts | 2 ++ 8 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/web/components/complex/add-conc-liquidity.tsx b/packages/web/components/complex/add-conc-liquidity.tsx index ce4c82e344..fc2b09c8d4 100644 --- a/packages/web/components/complex/add-conc-liquidity.tsx +++ b/packages/web/components/complex/add-conc-liquidity.tsx @@ -76,7 +76,7 @@ export const AddConcLiquidity: FunctionComponent< const { queryQuasarVaults } = queriesExternalStore; const { vaults: quasarVaults } = queryQuasarVaults.get(poolId); - const { data: pool } = api.edge.pools.getPool.useQuery({ + const { data: pool } = api.local.pools.getPool.useQuery({ poolId, }); diff --git a/packages/web/components/complex/pools-table.tsx b/packages/web/components/complex/pools-table.tsx index 531fc1894a..a7dfdbe66f 100644 --- a/packages/web/components/complex/pools-table.tsx +++ b/packages/web/components/complex/pools-table.tsx @@ -129,7 +129,7 @@ export const PoolsTable = (props: PropsWithChildren) => { isFetchingNextPage, hasNextPage, fetchNextPage, - } = api.edge.pools.getPools.useInfiniteQuery( + } = api.local.pools.getPools.useInfiniteQuery( { limit, search: filters.searchQuery diff --git a/packages/web/components/complex/portfolio/user-positions.tsx b/packages/web/components/complex/portfolio/user-positions.tsx index d8940c9127..f41e3b9177 100644 --- a/packages/web/components/complex/portfolio/user-positions.tsx +++ b/packages/web/components/complex/portfolio/user-positions.tsx @@ -96,7 +96,7 @@ function useUserPositionsData(address: string | undefined) { const hasPositions = Boolean(positions?.length); const { data: allMyPoolDetails, isLoading: isLoadingMyPoolDetails } = - api.edge.pools.getUserPools.useQuery( + api.local.pools.getUserPools.useQuery( { userOsmoAddress: address ?? "", }, diff --git a/packages/web/hooks/ui-config/use-add-concentrated-liquidity-config.ts b/packages/web/hooks/ui-config/use-add-concentrated-liquidity-config.ts index 04d847f128..a6cbba7271 100644 --- a/packages/web/hooks/ui-config/use-add-concentrated-liquidity-config.ts +++ b/packages/web/hooks/ui-config/use-add-concentrated-liquidity-config.ts @@ -61,7 +61,7 @@ export function useAddConcentratedLiquidityConfig( const address = account?.address ?? ""; const { data: pool, isFetched: isPoolFetched } = - api.edge.pools.getPool.useQuery( + api.local.pools.getPool.useQuery( { poolId }, { refetchInterval: 5_000, // 5 seconds diff --git a/packages/web/hooks/ui-config/use-historical-and-depth-data.ts b/packages/web/hooks/ui-config/use-historical-and-depth-data.ts index 07cb1a97c2..c83bfed03c 100644 --- a/packages/web/hooks/ui-config/use-historical-and-depth-data.ts +++ b/packages/web/hooks/ui-config/use-historical-and-depth-data.ts @@ -33,7 +33,7 @@ export function useHistoricalAndLiquidityData( [config] ); - const { data: pool } = api.edge.pools.getPool.useQuery( + const { data: pool } = api.local.pools.getPool.useQuery( { poolId, }, diff --git a/packages/web/modals/add-liquidity.tsx b/packages/web/modals/add-liquidity.tsx index e4658e6cc0..5374b90c8c 100644 --- a/packages/web/modals/add-liquidity.tsx +++ b/packages/web/modals/add-liquidity.tsx @@ -49,7 +49,7 @@ export const AddLiquidityModal: FunctionComponent< useAddConcentratedLiquidityConfig(chainStore, chainId, poolId); // initialize pool data stores once root pool store is loaded - const { data: pool } = api.edge.pools.getPool.useQuery({ poolId }); + const { data: pool } = api.local.pools.getPool.useQuery({ poolId }); const config = pool?.type === "concentrated" ? addConliqConfig : addLiquidityConfig; diff --git a/packages/web/pages/pool/[id].tsx b/packages/web/pages/pool/[id].tsx index 8de838c8f1..dddc74bb04 100644 --- a/packages/web/pages/pool/[id].tsx +++ b/packages/web/pages/pool/[id].tsx @@ -26,7 +26,7 @@ const Pool: FunctionComponent = ({ const { t } = useTranslation(); const { isMobile } = useWindowSize(); - const { data: pool, isError } = api.edge.pools.getPool.useQuery({ poolId }); + const { data: pool, isError } = api.local.pools.getPool.useQuery({ poolId }); const [showTradeModal, setShowTradeModal] = useState(false); diff --git a/packages/web/server/api/local-router.ts b/packages/web/server/api/local-router.ts index cb4134091f..fa9f5b9bc0 100644 --- a/packages/web/server/api/local-router.ts +++ b/packages/web/server/api/local-router.ts @@ -8,6 +8,7 @@ import { paramsRouter, portfolioRouter, swapRouter, + poolsRouter, } from "@osmosis-labs/trpc"; import { localBridgeTransferRouter } from "~/server/api/routers/local-bridge-transfer"; @@ -25,4 +26,5 @@ export const localRouter = createTRPCRouter({ portfolio: portfolioRouter, params: paramsRouter, orderbooks: orderbookRouter, + pools: poolsRouter, }); From cf93e4137421f5ef2203a766ba107c596d0454d4 Mon Sep 17 00:00:00 2001 From: Deividas Petraitis Date: Mon, 9 Dec 2024 15:37:25 +0200 Subject: [PATCH 2/2] FE-1281 | Move getUserPools back to edge --- packages/web/components/complex/portfolio/user-positions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web/components/complex/portfolio/user-positions.tsx b/packages/web/components/complex/portfolio/user-positions.tsx index f41e3b9177..d8940c9127 100644 --- a/packages/web/components/complex/portfolio/user-positions.tsx +++ b/packages/web/components/complex/portfolio/user-positions.tsx @@ -96,7 +96,7 @@ function useUserPositionsData(address: string | undefined) { const hasPositions = Boolean(positions?.length); const { data: allMyPoolDetails, isLoading: isLoadingMyPoolDetails } = - api.local.pools.getUserPools.useQuery( + api.edge.pools.getUserPools.useQuery( { userOsmoAddress: address ?? "", },