@merkl/api 0.20.166 → 0.20.167

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.
@@ -5,7 +5,7 @@ import { TokenService } from "@/modules/v4/token/token.service";
5
5
  import { CannotParseOpportunity, InvalidParameter } from "@/utils/error";
6
6
  import { log } from "@/utils/logger";
7
7
  import { parseDistributionType } from "@/utils/parseDistributionType";
8
- import { Campaign as CampaignType, NETWORK_LABELS, } from "@sdk";
8
+ import { Campaign as CampaignType, HOOK, NETWORK_LABELS, } from "@sdk";
9
9
  import { utils } from "ethers";
10
10
  import moment from "moment";
11
11
  import { ChainService } from "../chain/chain.service";
@@ -62,6 +62,10 @@ export class CampaignService {
62
62
  createdAt: new Date().toISOString(),
63
63
  chain,
64
64
  };
65
+ // Separate Worldchain ID only campaign opportunities
66
+ if (campaign.params.hooks?.some(hook => hook.hookType === HOOK.WORLDCHAINID)) {
67
+ body.opportunityIdentifier += "WORLDCHAINID";
68
+ }
65
69
  try {
66
70
  const opportunity = await OpportunityService.createFromCampaign(campaign, body.opportunityIdentifier, false, dryRun);
67
71
  if (dryRun)
@@ -7,7 +7,7 @@ import { TokenService } from "@/modules/v4/token/token.service";
7
7
  import { UserService } from "@/modules/v4/user/user.service";
8
8
  import { log } from "@/utils/logger";
9
9
  import { AprType, Status } from "@db/api";
10
- import { Campaign as CampaignType, HOOK, numberToBigInt } from "@sdk";
10
+ import { Campaign as CampaignType, numberToBigInt } from "@sdk";
11
11
  import moment from "moment";
12
12
  import { metadataBuilderFactory } from "../../../engine/metadata/factory";
13
13
  import { ChainService } from "../chain/chain.service";
@@ -55,10 +55,6 @@ export class OpportunityService {
55
55
  static async createFromCampaign(campaign, opportunityIdentifier, upsert = false, dryRun = false) {
56
56
  if (dryRun)
57
57
  log.info(`opportunity creation dry run for ${campaign.campaignId} of type ${campaign.type}`);
58
- // Separate Worldchain ID only campaign opportunities
59
- if (campaign.params.hooks?.some(hook => hook.hookType === HOOK.WORLDCHAINID)) {
60
- opportunityIdentifier += "WORLDCHAINID";
61
- }
62
58
  const metadata = await OpportunityService.#getMetadata(campaign, opportunityIdentifier);
63
59
  const tags = (await UserService.findUnique(campaign.creatorAddress))?.tags ?? [];
64
60
  const opportunityId = OpportunityService.hashId({