@merkl/api 0.16.41 → 0.16.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ import { NotFoundError } from "../../errors";
1
2
  import { OpportunityService } from "../../modules/v4/opportunity";
2
3
  import { BN2Number, Campaign as CampaignEnum } from "@sdk";
3
4
  import { t } from "elysia";
@@ -12,6 +13,9 @@ export default (app) => app.use(checkQueryChainIdValidity()).get("/campaignsForM
12
13
  chainId: chainId.toString(),
13
14
  identifier: query.mainParameter,
14
15
  }))?.[0]?.id;
16
+ if (!opportunityId) {
17
+ throw new NotFoundError(`Opportunity not found for identifier: ${query.mainParameter} and chainId: ${chainId}`);
18
+ }
15
19
  return (await OpportunityService.getUniqueWithCampaignsOrThrow(opportunityId))?.campaigns
16
20
  ?.map(c => ({
17
21
  campaignId: c.campaignId,