@merkl/api 0.21.14 → 0.21.16

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.
@@ -72,7 +72,8 @@ export class CampaignService {
72
72
  if (dryRun)
73
73
  return opportunity;
74
74
  }
75
- catch (_err) {
75
+ catch (e) {
76
+ console.error(e);
76
77
  throw new CannotParseOpportunity(campaign.campaignId, campaign.distributionChainId, campaign.type);
77
78
  }
78
79
  return await CampaignRepository.upsert(campaign, body.opportunityIdentifier);
@@ -41,7 +41,7 @@ export class CreatorService {
41
41
  return await CreatorRepository.delete(id);
42
42
  }
43
43
  static async getCreatorIdFromAddress(address) {
44
- return await CacheService.wrap(TTLPresets.MIN_30, async () => (await UserService.findUnique(address)).creatorId);
44
+ return await CacheService.wrap(TTLPresets.MIN_30, async () => (await UserService.findUniqueOrThrow(address)).creatorId);
45
45
  }
46
46
  static async getCreatorAddresses(id) {
47
47
  const creator = await CreatorRepository.findUnique(id);
@@ -706,7 +706,7 @@ const CornInterfaceCampaigns = {
706
706
  },
707
707
  [cornCampaigns.Concrete_CornUSDT_Vault_Corn]: {
708
708
  campaignType: Campaign.ERC20,
709
- computeChainId: ChainId.CORN,
709
+ computeChainId: ChainId.MAINNET,
710
710
  hooks: [],
711
711
  targetToken: "0x3Eb6464A77D7B619AaAfa7e9FFC0fBe3ed7084B3",
712
712
  whitelist: [],
@@ -39,7 +39,7 @@ export const UserController = new Elysia({ prefix: "/users", detail: { tags: ["U
39
39
  // ─── Get Many Users ──────────────────────────────────────────────────
40
40
  .get("/", async ({ query }) => await UserService.findMany(query), { query: GetManyUserQuery })
41
41
  // ─── Get A User By Address ───────────────────────────────────────────
42
- .get("/:address", async ({ params }) => await UserService.findUnique(params.address))
42
+ .get("/:address", async ({ params }) => await UserService.findUniqueOrThrow(params.address))
43
43
  // ─── Get User's Rewards With Breakdown And Details for our FE ────────
44
44
  .get("/:address/rewards/breakdowns", async ({ params, query }) => {
45
45
  const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, true, query?.chainIds, query.reloadChainId ?? null, !!query.test ? query.test : false, !!query.claimableOnly);
@@ -4,6 +4,11 @@ export declare abstract class UserRepository {
4
4
  tags: string[];
5
5
  address: string;
6
6
  creatorId: string | null;
7
+ } | null>;
8
+ static findUniqueOrThrow(address: string): Promise<{
9
+ tags: string[];
10
+ address: string;
11
+ creatorId: string | null;
7
12
  }>;
8
13
  static findMany(query: GetManyUserModel): Promise<{
9
14
  tags: string[];
@@ -2,6 +2,9 @@ import { apiDbClient } from "@db";
2
2
  // ─── Users Repository ────────────────────────────────────────────────────────
3
3
  export class UserRepository {
4
4
  static async findUnique(address) {
5
+ return await apiDbClient.user.findUnique({ where: { address } });
6
+ }
7
+ static async findUniqueOrThrow(address) {
5
8
  return await apiDbClient.user.findUniqueOrThrow({ where: { address } });
6
9
  }
7
10
  static async findMany(query) {
@@ -4,6 +4,11 @@ export declare abstract class UserService {
4
4
  tags: string[];
5
5
  address: string;
6
6
  creatorId: string | null;
7
+ } | null>;
8
+ static findUniqueOrThrow(address: string): Promise<{
9
+ tags: string[];
10
+ address: string;
11
+ creatorId: string | null;
7
12
  }>;
8
13
  static findMany(query: GetManyUserModel): Promise<{
9
14
  tags: string[];
@@ -8,6 +8,9 @@ export class UserService {
8
8
  static async findUnique(address) {
9
9
  return await UserRepository.findUnique(address);
10
10
  }
11
+ static async findUniqueOrThrow(address) {
12
+ return await UserRepository.findUniqueOrThrow(address);
13
+ }
11
14
  static async findMany(query) {
12
15
  return await UserRepository.findMany(query);
13
16
  }