Skip to content

Commit

Permalink
remove: deprecated json
Browse files Browse the repository at this point in the history
  • Loading branch information
clmntsnr committed Jan 16, 2025
1 parent f4bcaf1 commit 7ff0af7
Show file tree
Hide file tree
Showing 22 changed files with 33 additions and 32 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/dappkit
2 changes: 1 addition & 1 deletion src/modules/chain/routes/chain.$id.header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/chain/routes/chain.$id.opportunities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/chain/routes/chains.list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/modules/interaction/routes/transaction.$name.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -49,7 +49,7 @@ export const action = async ({ params: { name }, request }: ActionFunctionArgs)
});
}

return json(tx);
return tx;
} catch (err) {
console.error(err);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/opportunity/routes/opportunities.list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions src/modules/protocol/routes/protocol.$id.header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/protocol/routes/protocol.$id.opportunities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/protocol/routes/protocols.header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/protocol/routes/protocols.list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/modules/token/routes/token.$symbol.header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/token/routes/token.$symbol.opportunities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/token/routes/tokens.list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/user/routes/user.$address.claims.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof loader>();
Expand Down
2 changes: 1 addition & 1 deletion src/modules/user/routes/user.$address.header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof loader> = ({ data, error }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/user/routes/user.$address.liquidity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export async function loader({ params: { address } }: LoaderFunctionArgs) {
address,
chainId: defaultChain,
});
return json({ positions });
return { positions };
}

export default function Index() {
Expand Down
3 changes: 2 additions & 1 deletion src/modules/user/routes/user.$address.rewards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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);
Expand Down

0 comments on commit 7ff0af7

Please sign in to comment.