Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ import { api } from "@core/api";
import type { MerklServerContext } from "@core/app/server/context";
import { ErrorContent } from "@core/components/layout/ErrorContent";
import { ChainService } from "@core/modules/chain/chain.service";
import { InteractionService } from "@core/modules/interaction/interaction.service";
import type { OutletContextOpportunity } from "@core/modules/opportunity/routes/opportunity.$chain.$type.$id.header";
import type { Opportunity } from "@merkl/api";
import { Container, Group } from "dappkit";
import { Outlet, useLoaderData, useOutletContext } from "react-router";
import type { LoaderFunctionArgs } from "react-router";
import OpportunityBoxParticipate from "../components/element/OpportunityBoxParticipate";
import { OpportunityService } from "../opportunity.service";

export async function loader({
context: { backend },
Expand All @@ -19,16 +16,16 @@ export async function loader({
if (!chainId || !id || !type) throw "";

const chain = await ChainService({ api, request, backend }).get({ name: chainId });
const opportunity = (await OpportunityService({ api, request, backend }).getCampaignsByParams({
chainId: chain.id,
type: type,
identifier: id,
})) as unknown as Opportunity;

const targets = await InteractionService({ api, backend }).getTargetsByOpportunity(opportunity as Opportunity);
// DISABLED FOR NOW (Crashing on opp identifier different from blockchain address)
// const opportunity = (await OpportunityService({ api, request, backend }).getCampaignsByParams({
// chainId: chain.id,
// type: type,
// identifier: id,
// })) as unknown as Opportunity;
// const targets = await InteractionService({ api, backend }).getTargetsByOpportunity(opportunity as Opportunity);

return {
targets,
targets: [],
};
}

Expand Down