@merkl/api 0.10.250 → 0.10.251

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.
@@ -560,6 +560,7 @@ declare const eden: {
560
560
  campaigns: {
561
561
  index: {
562
562
  post: (body: {
563
+ tags?: string[] | undefined;
563
564
  identifier?: string | undefined;
564
565
  subType?: number | undefined;
565
566
  type: number;
@@ -3403,6 +3404,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
3403
3404
  index: {
3404
3405
  post: {
3405
3406
  body: {
3407
+ tags?: string[] | undefined;
3406
3408
  identifier?: string | undefined;
3407
3409
  subType?: number | undefined;
3408
3410
  type: number;
@@ -6758,6 +6760,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
6758
6760
  campaigns: {
6759
6761
  index: {
6760
6762
  post: (body: {
6763
+ tags?: string[] | undefined;
6761
6764
  identifier?: string | undefined;
6762
6765
  subType?: number | undefined;
6763
6766
  type: number;
@@ -658,6 +658,7 @@ declare const app: Elysia<"", false, {
658
658
  index: {
659
659
  post: {
660
660
  body: {
661
+ tags?: string[] | undefined;
661
662
  identifier?: string | undefined;
662
663
  subType?: number | undefined;
663
664
  type: number;
@@ -16,6 +16,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
16
16
  index: {
17
17
  post: {
18
18
  body: {
19
+ tags?: string[] | undefined;
19
20
  identifier?: string | undefined;
20
21
  subType?: number | undefined;
21
22
  type: number;
@@ -100,6 +100,7 @@ export declare const CreateCampaignDto: import("@sinclair/typebox").TObject<{
100
100
  startTimestamp: import("@sinclair/typebox").TString;
101
101
  endTimestamp: import("@sinclair/typebox").TString;
102
102
  params: import("@sinclair/typebox").TString;
103
+ tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
103
104
  }>;
104
105
  export declare const GetCampaignQueryDto: import("@sinclair/typebox").TObject<{
105
106
  creatorTag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -61,6 +61,7 @@ export const CreateCampaignDto = t.Object({
61
61
  startTimestamp: t.String(),
62
62
  endTimestamp: t.String(),
63
63
  params: t.String(),
64
+ tags: t.Optional(t.Array(t.String())),
64
65
  });
65
66
  export const GetCampaignQueryDto = t.Object({
66
67
  creatorTag: t.Optional(t.String({ description: "Filter campaigns created by a user who has a specific tag" })),
@@ -106,6 +106,7 @@ export class CampaignRepository {
106
106
  connect: metadata.mainProtocol && { id: metadata.mainProtocol },
107
107
  },
108
108
  depositUrl: !!params.url ? params.url : undefined,
109
+ tags: metadata.tags,
109
110
  },
110
111
  },
111
112
  },
@@ -188,6 +189,7 @@ export class CampaignRepository {
188
189
  id: campaignToOpp[campaign.id].mainProtocol,
189
190
  },
190
191
  },
192
+ tags: campaignToOpp[campaign.id].tags,
191
193
  },
192
194
  },
193
195
  },
@@ -9,6 +9,7 @@ import { NETWORK_LABELS } from "@sdk";
9
9
  import moment from "moment";
10
10
  import { StatusService } from "../status";
11
11
  import { TokenService } from "../token";
12
+ import { UserService } from "../user";
12
13
  export class CampaignService {
13
14
  static hashId(campaign) {
14
15
  return Bun.hash(`${campaign.distributionChain}${campaign.campaignId}`).toString();
@@ -19,6 +20,10 @@ export class CampaignService {
19
20
  id,
20
21
  ...campaign,
21
22
  });
23
+ opportunityMetadata.tags = [
24
+ ...((await UserService.findUnique(campaign.creator))?.tags ?? []),
25
+ ...(campaign?.tags ?? []),
26
+ ];
22
27
  return await CampaignRepository.upsert({ id, ...campaign }, opportunityMetadata);
23
28
  }
24
29
  static async createMany(campaigns) {
@@ -33,6 +38,10 @@ export class CampaignService {
33
38
  id,
34
39
  ...campaign,
35
40
  });
41
+ oppMetadata.tags = [
42
+ ...((await UserService.findUnique(campaign.creator))?.tags ?? []),
43
+ ...(campaign?.tags ?? []),
44
+ ];
36
45
  campaignToOppMetadata[id] = oppMetadata;
37
46
  campaignsToInsert.push({ id, ...campaign });
38
47
  }
@@ -33,6 +33,7 @@ export type OpportunityMetadata = {
33
33
  address: string;
34
34
  }[];
35
35
  mainProtocol?: ProtocolId;
36
+ tags?: string[];
36
37
  };
37
38
  export type OpportunityUnique = {
38
39
  chainId: ChainId;
@@ -536,6 +536,7 @@ export declare const v4: Elysia<"/v4", false, {
536
536
  index: {
537
537
  post: {
538
538
  body: {
539
+ tags?: string[] | undefined;
539
540
  identifier?: string | undefined;
540
541
  subType?: number | undefined;
541
542
  type: number;
@@ -58,6 +58,7 @@ export class UserService {
58
58
  for (const opportunity of opportunities) {
59
59
  if (!user.tags.every(tag => opportunity.tags.includes(tag))) {
60
60
  log.local(`updating tags for opportunity ${opportunity.id}: adding ${user.tags.join(",")}`);
61
+ log.local(`opportunity tags: ${opportunity.tags.join(",")}`);
61
62
  await OpportunityService.update(opportunity.id, { tags: [...opportunity.tags, ...user.tags] });
62
63
  }
63
64
  }