diff --git a/package.json b/package.json index 718c48c..ba7e025 100644 --- a/package.json +++ b/package.json @@ -24,11 +24,11 @@ "@merkl/api": "0.10.307", "@radix-ui/react-accordion": "^1.2.1", "@radix-ui/react-scroll-area": "^1.2.0", - "@remix-run/dev": "^2.11.2", - "@remix-run/node": "^2.11.2", - "@remix-run/react": "^2.11.2", - "@remix-run/serve": "^2.11.2", - "@remixicon/react": "^4.2.0", + "@remix-run/dev": "^2.15.2", + "@remix-run/node": "^2.15.2", + "@remix-run/react": "^2.15.2", + "@remix-run/serve": "^2.15.2", + "@remixicon/react": "^4.6.0", "@svgr/rollup": "^8.1.0", "@tanstack/react-query": "^5.55.4", "@vitejs/plugin-react": "^4.3.1", diff --git a/packages/dappkit b/packages/dappkit index 74d48bc..fcb19b0 160000 --- a/packages/dappkit +++ b/packages/dappkit @@ -1 +1 @@ -Subproject commit 74d48bc2d2cd908ca76613ff476c4878b5946ad5 +Subproject commit fcb19b06aa1fbcd0196601f59e5c80746aedf7c8 diff --git a/src/modules/chain/routes/chain.$id.header.tsx b/src/modules/chain/routes/chain.$id.header.tsx index 0185ea0..a4de4f1 100644 --- a/src/modules/chain/routes/chain.$id.header.tsx +++ b/src/modules/chain/routes/chain.$id.header.tsx @@ -1,4 +1,4 @@ -import { type LoaderFunctionArgs, type MetaFunction, json } from "@remix-run/node"; +import type { LoaderFunctionArgs, MetaFunction } from "@remix-run/node"; import { Outlet, useLoaderData } from "@remix-run/react"; import Hero, { defaultHeroSideDatas } from "../../../components/composite/Hero"; import { Cache } from "../../../modules/cache/cache.service"; @@ -17,7 +17,7 @@ export async function loader({ params: { id } }: LoaderFunctionArgs) { const { sum: dailyRewards } = await OpportunityService.getAggregate({ chainId: chain.id.toString() }, "dailyRewards"); - return json({ chain, count, dailyRewards, maxApr: opportunitiesByApr?.[0]?.apr }); + return { chain, count, dailyRewards, maxApr: opportunitiesByApr?.[0]?.apr }; } export const clientLoader = Cache.wrap("chain", 300); diff --git a/src/modules/chain/routes/chain.$id.opportunities.tsx b/src/modules/chain/routes/chain.$id.opportunities.tsx index 5a2cba0..bf2c5b7 100644 --- a/src/modules/chain/routes/chain.$id.opportunities.tsx +++ b/src/modules/chain/routes/chain.$id.opportunities.tsx @@ -1,4 +1,4 @@ -import { type LoaderFunctionArgs, json } from "@remix-run/node"; +import type { LoaderFunctionArgs } from "@remix-run/node"; import { useLoaderData } from "@remix-run/react"; import { Container, Group, Space, Title } from "dappkit"; import OpportunityLibrary from "../../../components/element/opportunity/OpportunityLibrary"; @@ -19,7 +19,7 @@ export async function loader({ params: { id: chainId }, request }: LoaderFunctio const { protocols } = await ProtocolService.getManyFromRequest(request); - return json({ opportunities, count, protocols, featuredOpportunities }); + return { opportunities, count, protocols, featuredOpportunities }; } export const clientLoader = Cache.wrap("chain/opportunities", 300); diff --git a/src/modules/chain/routes/chains.list.tsx b/src/modules/chain/routes/chains.list.tsx index fac1175..0d1d062 100644 --- a/src/modules/chain/routes/chains.list.tsx +++ b/src/modules/chain/routes/chains.list.tsx @@ -1,5 +1,5 @@ import type { LoaderFunctionArgs } from "@remix-run/node"; -import { json, useLoaderData } from "@remix-run/react"; +import { useLoaderData } from "@remix-run/react"; import { useNavigate } from "@remix-run/react"; import { Container, Space } from "dappkit"; import { useEffect } from "react"; @@ -10,7 +10,7 @@ import { ChainService } from "../../../modules/chain/chain.service"; export async function loader(_args: LoaderFunctionArgs) { const chains = await ChainService.getAll(); - return json({ chains, count: chains.length }); + return { chains, count: chains.length }; } export const clientLoader = Cache.wrap("chains", 300); diff --git a/src/modules/interaction/routes/transaction.$name.tsx b/src/modules/interaction/routes/transaction.$name.tsx index 6b4c371..995ddcc 100644 --- a/src/modules/interaction/routes/transaction.$name.tsx +++ b/src/modules/interaction/routes/transaction.$name.tsx @@ -1,4 +1,4 @@ -import { type ActionFunctionArgs, json } from "@remix-run/node"; +import type { ActionFunctionArgs } from "@remix-run/node"; import { encodeFunctionData, parseAbi } from "viem"; import { api } from "../../../api/"; import { ZyfiService } from "../../../modules/zyfi/zyfi.service"; @@ -25,9 +25,9 @@ export const action = async ({ params: { name }, request }: ActionFunctionArgs) if (payload.sponsor) { const sponsoredTx = await ZyfiService.wrapAndPrepareTx(tx); - return json(sponsoredTx); + return sponsoredTx; } - return json(tx); + return tx; } case "supply": { try { @@ -49,7 +49,7 @@ export const action = async ({ params: { name }, request }: ActionFunctionArgs) }); } - return json(tx); + return tx; } catch (err) { console.error(err); diff --git a/src/modules/leaderboard/routes/leaderboard.($chain).($address).header.tsx b/src/modules/leaderboard/routes/leaderboard.($chain).($address).header.tsx index 2578a10..bbd313f 100644 --- a/src/modules/leaderboard/routes/leaderboard.($chain).($address).header.tsx +++ b/src/modules/leaderboard/routes/leaderboard.($chain).($address).header.tsx @@ -1,4 +1,4 @@ -import { type LoaderFunctionArgs, json } from "@remix-run/node"; +import type { LoaderFunctionArgs } from "@remix-run/node"; import type { MetaFunction } from "@remix-run/node"; import { Outlet, useLoaderData } from "@remix-run/react"; import { I18n } from "../../../I18n"; @@ -24,10 +24,10 @@ export const extractChainAndTokenFromParams = async (address: string | undefined export async function loader({ params: { address, chain: chainName } }: LoaderFunctionArgs) { const { chain, token } = await extractChainAndTokenFromParams(address, chainName); - return json({ + return { token, chain, - }); + }; } export const meta: MetaFunction = ({ data: _data }) => { diff --git a/src/modules/leaderboard/routes/leaderboard.($chain).($address).leaderboard.tsx b/src/modules/leaderboard/routes/leaderboard.($chain).($address).leaderboard.tsx index 3d8e6ce..3e69d28 100644 --- a/src/modules/leaderboard/routes/leaderboard.($chain).($address).leaderboard.tsx +++ b/src/modules/leaderboard/routes/leaderboard.($chain).($address).leaderboard.tsx @@ -1,4 +1,4 @@ -import { type LoaderFunctionArgs, json } from "@remix-run/node"; +import type { LoaderFunctionArgs } from "@remix-run/node"; import { useLoaderData } from "@remix-run/react"; import { Box, Container, Group, Space, Title, Value } from "dappkit"; import { Suspense, useMemo } from "react"; @@ -17,13 +17,13 @@ export async function loader({ params: { address, chain: chainName }, request }: address: token.address, }); - return json({ + return { rewards, token, chain, count, total, - }); + }; } export const clientLoader = Cache.wrap("leaderboard", 300); diff --git a/src/modules/opportunity/routes/opportunities.list.tsx b/src/modules/opportunity/routes/opportunities.list.tsx index 85f286f..ee94884 100644 --- a/src/modules/opportunity/routes/opportunities.list.tsx +++ b/src/modules/opportunity/routes/opportunities.list.tsx @@ -1,5 +1,5 @@ import type { LoaderFunctionArgs } from "@remix-run/node"; -import { json, useLoaderData } from "@remix-run/react"; +import { useLoaderData } from "@remix-run/react"; import { Container, Group, Space, Title } from "dappkit"; import OpportunityLibrary from "../../../components/element/opportunity/OpportunityLibrary"; import { ErrorContent } from "../../../components/layout/ErrorContent"; @@ -17,7 +17,7 @@ export async function loader({ request }: LoaderFunctionArgs) { const chains = await ChainService.getAll(); const { protocols } = await ProtocolService.getManyFromRequest(request); - return json({ opportunities, chains, count, protocols, featuredOpportunities }); + return { opportunities, chains, count, protocols, featuredOpportunities }; } export const clientLoader = Cache.wrap("opportunities", 300); diff --git a/src/modules/opportunity/routes/opportunity.$chain.$type.$id.header.tsx b/src/modules/opportunity/routes/opportunity.$chain.$type.$id.header.tsx index e7dbbfb..c2c958a 100644 --- a/src/modules/opportunity/routes/opportunity.$chain.$type.$id.header.tsx +++ b/src/modules/opportunity/routes/opportunity.$chain.$type.$id.header.tsx @@ -1,5 +1,5 @@ import type { Chain } from "@merkl/api"; -import { type LoaderFunctionArgs, type MetaFunction, json } from "@remix-run/node"; +import type { LoaderFunctionArgs, MetaFunction } from "@remix-run/node"; import { Meta, Outlet, useLoaderData } from "@remix-run/react"; import { Button, Group, Icon } from "dappkit"; import { useClipboard } from "dappkit"; @@ -26,7 +26,7 @@ export async function loader({ params: { id, type, chain: chainId } }: LoaderFun type: type, identifier: id, }); - return json({ rawOpportunity, chain }); + return { rawOpportunity, chain }; } export const clientLoader = Cache.wrap("opportunity", 300); diff --git a/src/modules/opportunity/routes/opportunity.$chain.$type.$id.leaderboard.tsx b/src/modules/opportunity/routes/opportunity.$chain.$type.$id.leaderboard.tsx index aa1ea46..94ce13d 100644 --- a/src/modules/opportunity/routes/opportunity.$chain.$type.$id.leaderboard.tsx +++ b/src/modules/opportunity/routes/opportunity.$chain.$type.$id.leaderboard.tsx @@ -1,5 +1,5 @@ import type { Campaign } from "@merkl/api"; -import { type LoaderFunctionArgs, json } from "@remix-run/node"; +import type { LoaderFunctionArgs } from "@remix-run/node"; import { useLoaderData } from "@remix-run/react"; import { Box, @@ -46,14 +46,14 @@ export async function loader({ params: { id, type, chain: chainId }, request }: campaignId: selectedCampaign.campaignId, }); - return json({ + return { computeChain, rewards, campaigns, count, total, selectedCampaign, - }); + }; } export default function Index() { diff --git a/src/modules/protocol/routes/protocol.$id.header.tsx b/src/modules/protocol/routes/protocol.$id.header.tsx index ce1b437..280e327 100644 --- a/src/modules/protocol/routes/protocol.$id.header.tsx +++ b/src/modules/protocol/routes/protocol.$id.header.tsx @@ -1,5 +1,5 @@ import type { Opportunity } from "@merkl/api"; -import { type LoaderFunctionArgs, type MetaFunction, json } from "@remix-run/node"; +import type { LoaderFunctionArgs, MetaFunction } from "@remix-run/node"; import { Outlet, useLoaderData } from "@remix-run/react"; import { Group } from "dappkit"; import { I18n } from "../../../I18n"; @@ -23,14 +23,14 @@ export async function loader({ params: { id }, request }: LoaderFunctionArgs) { const { sum } = await OpportunityService.getAggregate({ mainProtocolId: id }, "dailyRewards"); - return json({ + return { opportunities, count, protocol, liveOpportunityCount: liveCount, maxApr: opportunitiesByApr?.[0]?.apr, dailyRewards: sum, - }); + }; } export const clientLoader = Cache.wrap("protocol", 300); diff --git a/src/modules/protocol/routes/protocol.$id.opportunities.tsx b/src/modules/protocol/routes/protocol.$id.opportunities.tsx index 661957c..bbbf0cc 100644 --- a/src/modules/protocol/routes/protocol.$id.opportunities.tsx +++ b/src/modules/protocol/routes/protocol.$id.opportunities.tsx @@ -1,4 +1,4 @@ -import { type LoaderFunctionArgs, json } from "@remix-run/node"; +import type { LoaderFunctionArgs } from "@remix-run/node"; import { useLoaderData } from "@remix-run/react"; import { Container, Group, Space, Title } from "dappkit"; import { useWalletContext } from "dappkit"; @@ -16,7 +16,7 @@ export async function loader({ params: { id }, request }: LoaderFunctionArgs) { //TODO: embed this in client/service const { protocols } = await ProtocolService.getManyFromRequest(request); - return json({ opportunities, count, protocols, featuredOpportunities }); + return { opportunities, count, protocols, featuredOpportunities }; } export default function Index() { diff --git a/src/modules/protocol/routes/protocols.header.tsx b/src/modules/protocol/routes/protocols.header.tsx index 892b47b..bc185e7 100644 --- a/src/modules/protocol/routes/protocols.header.tsx +++ b/src/modules/protocol/routes/protocols.header.tsx @@ -4,7 +4,7 @@ import { v4 as uuidv4 } from "uuid"; import Hero from "../../../components/composite/Hero"; import { ProtocolService } from "../../../modules/protocol/protocol.service"; -import { Outlet, json, useLoaderData } from "@remix-run/react"; +import { Outlet, useLoaderData } from "@remix-run/react"; import { I18n } from "../../../I18n"; export const meta: MetaFunction = () => { @@ -14,7 +14,7 @@ export const meta: MetaFunction = () => { export async function loader({ request }: LoaderFunctionArgs) { const { protocols, count } = await ProtocolService.getManyFromRequest(request); - return json({ protocols, count }); + return { protocols, count }; } export default function Index() { diff --git a/src/modules/protocol/routes/protocols.list.tsx b/src/modules/protocol/routes/protocols.list.tsx index 412254e..bfe0774 100644 --- a/src/modules/protocol/routes/protocols.list.tsx +++ b/src/modules/protocol/routes/protocols.list.tsx @@ -1,4 +1,4 @@ -import { type LoaderFunctionArgs, json } from "@remix-run/node"; +import type { LoaderFunctionArgs } from "@remix-run/node"; import { useLoaderData } from "@remix-run/react"; import { Container, Space } from "dappkit"; import ProtocolLibrary from "../../../components/element/protocol/ProtocolLibrary"; @@ -8,7 +8,7 @@ import { ProtocolService } from "../../../modules/protocol/protocol.service"; export async function loader({ request }: LoaderFunctionArgs) { const { protocols, count } = await ProtocolService.getManyFromRequest(request); - return json({ protocols, count }); + return { protocols, count }; } export const clientLoader = Cache.wrap("protocols", 300); diff --git a/src/modules/token/routes/token.$symbol.header.tsx b/src/modules/token/routes/token.$symbol.header.tsx index eeea5fe..f8e694e 100644 --- a/src/modules/token/routes/token.$symbol.header.tsx +++ b/src/modules/token/routes/token.$symbol.header.tsx @@ -1,4 +1,4 @@ -import { type LoaderFunctionArgs, type MetaFunction, json } from "@remix-run/node"; +import type { LoaderFunctionArgs, MetaFunction } from "@remix-run/node"; import { Outlet, useLoaderData } from "@remix-run/react"; import { I18n } from "../../../I18n"; import Hero, { defaultHeroSideDatas } from "../../../components/composite/Hero"; @@ -20,13 +20,13 @@ export async function loader({ params: { symbol } }: LoaderFunctionArgs) { const { sum: dailyRewards } = await OpportunityService.getAggregate({ tokens: symbol }, "dailyRewards"); - return json({ + return { tokens, chains, dailyRewards, maxApr: opportunitiesByApr?.[0]?.apr, count, - }); + }; } export const clientLoader = Cache.wrap("token", 300); diff --git a/src/modules/token/routes/token.$symbol.opportunities.tsx b/src/modules/token/routes/token.$symbol.opportunities.tsx index 767dbd1..1b00dd8 100644 --- a/src/modules/token/routes/token.$symbol.opportunities.tsx +++ b/src/modules/token/routes/token.$symbol.opportunities.tsx @@ -1,4 +1,4 @@ -import { type LoaderFunctionArgs, json } from "@remix-run/node"; +import type { LoaderFunctionArgs } from "@remix-run/node"; import { useLoaderData } from "@remix-run/react"; import { Container, Group, Space, Title } from "dappkit"; import OpportunityLibrary from "../../../components/element/opportunity/OpportunityLibrary"; @@ -16,7 +16,7 @@ export async function loader({ params: { symbol }, request }: LoaderFunctionArgs //TODO: embed this in client/service const chains = await ChainService.getAll(); - return json({ opportunities, chains, count, featuredOpportunities }); + return { opportunities, chains, count, featuredOpportunities }; } export const clientLoader = Cache.wrap("token/opportunities", 300); diff --git a/src/modules/token/routes/tokens.list.tsx b/src/modules/token/routes/tokens.list.tsx index bb34528..3ae0ccd 100644 --- a/src/modules/token/routes/tokens.list.tsx +++ b/src/modules/token/routes/tokens.list.tsx @@ -1,5 +1,5 @@ import type { LoaderFunctionArgs } from "@remix-run/node"; -import { json, useLoaderData } from "@remix-run/react"; +import { useLoaderData } from "@remix-run/react"; import { useNavigate } from "@remix-run/react"; import { Container, Space } from "dappkit"; import { useEffect } from "react"; @@ -11,7 +11,7 @@ import { TokenService } from "../../../modules/token/token.service"; export async function loader({ request }: LoaderFunctionArgs) { const { tokens, count } = await TokenService.getManyFromRequest(request); - return json({ tokens, count }); + return { tokens, count }; } export const clientLoader = Cache.wrap("tokens", 300); diff --git a/src/modules/user/routes/user.$address.claims.tsx b/src/modules/user/routes/user.$address.claims.tsx index 9f693ca..abd0b44 100644 --- a/src/modules/user/routes/user.$address.claims.tsx +++ b/src/modules/user/routes/user.$address.claims.tsx @@ -1,5 +1,5 @@ import type { LoaderFunctionArgs } from "@remix-run/node"; -import { json, useLoaderData } from "@remix-run/react"; +import { useLoaderData } from "@remix-run/react"; import { Container, Space } from "dappkit"; import { isAddress } from "viem"; import HistoricalClaimsLibrary from "../../../components/element/historicalClaimsLibrary/HistoricalClaimsLibrary"; @@ -8,7 +8,7 @@ import { ClaimsService } from "../../../modules/claim/claim.service"; export async function loader({ params: { address } }: LoaderFunctionArgs) { if (!address || !isAddress(address)) throw ""; const claims = await ClaimsService.getForUser(address); - return json({ claims }); + return { claims }; } export default function Index() { const { claims } = useLoaderData(); diff --git a/src/modules/user/routes/user.$address.header.tsx b/src/modules/user/routes/user.$address.header.tsx index 1de2120..5592cfe 100644 --- a/src/modules/user/routes/user.$address.header.tsx +++ b/src/modules/user/routes/user.$address.header.tsx @@ -1,5 +1,5 @@ import type { LoaderFunctionArgs, MetaFunction } from "@remix-run/node"; -import { Outlet, json, useFetcher, useLoaderData } from "@remix-run/react"; +import { Outlet, useFetcher, useLoaderData } from "@remix-run/react"; import { Button, Divider, Dropdown, Group, Hash, Icon, Text, Value } from "dappkit"; import { TransactionButton, type TransactionButtonProps } from "dappkit"; import { useWalletContext } from "dappkit"; @@ -28,7 +28,7 @@ export async function loader({ params: { address }, request }: LoaderFunctionArg )?.[0] : null; - return json({ rewards, address, token }); + return { rewards, address, token }; } export const meta: MetaFunction = ({ data, error }) => { diff --git a/src/modules/user/routes/user.$address.liquidity.tsx b/src/modules/user/routes/user.$address.liquidity.tsx index 55056c7..0207989 100644 --- a/src/modules/user/routes/user.$address.liquidity.tsx +++ b/src/modules/user/routes/user.$address.liquidity.tsx @@ -1,5 +1,5 @@ import type { LoaderFunctionArgs } from "@remix-run/node"; -import { json, useLoaderData } from "@remix-run/react"; +import { useLoaderData } from "@remix-run/react"; import { Container } from "dappkit"; import { isAddress } from "viem"; import PositionLibrary from "../../../components/element/position/PositionLibrary"; @@ -16,7 +16,7 @@ export async function loader({ params: { address } }: LoaderFunctionArgs) { address, chainId: defaultChain, }); - return json({ positions }); + return { positions }; } export default function Index() { diff --git a/src/modules/user/routes/user.$address.rewards.tsx b/src/modules/user/routes/user.$address.rewards.tsx index 573f305..674e3ff 100644 --- a/src/modules/user/routes/user.$address.rewards.tsx +++ b/src/modules/user/routes/user.$address.rewards.tsx @@ -1,5 +1,5 @@ import type { LoaderFunctionArgs } from "@remix-run/node"; -import { json, useLoaderData, useOutletContext } from "@remix-run/react"; +import { useLoaderData, useOutletContext } from "@remix-run/react"; import { Container, Fmt, Group, Icon, Space, Text, useWalletContext } from "dappkit"; import { useMemo } from "react"; import { isAddress } from "viem"; @@ -12,7 +12,8 @@ import type { OutletContextRewards } from "./user.$address.header"; export async function loader({ params: { address } }: LoaderFunctionArgs) { if (!address || !isAddress(address)) throw ""; - return json({ address }); + + return { address }; } export default function Index() { diff --git a/src/root.tsx b/src/root.tsx index 0512271..2d65b60 100644 --- a/src/root.tsx +++ b/src/root.tsx @@ -6,7 +6,6 @@ import { Scripts, ScrollRestoration, isRouteErrorResponse, - json, useLoaderData, useNavigate, useRouteError, @@ -33,7 +32,7 @@ export async function loader(_args: LoaderFunctionArgs) { if (!chains) throw new Response("Unable to fetch chains", { status: 500 }); - return json({ ENV: { API_URL: process.env.API_URL }, chains }); + return { ENV: { API_URL: process.env.API_URL }, chains }; } export const clientLoader = Cache.wrap("root", 300);