@merkl/api 0.10.216 → 0.10.218

Sign up to get free protection for your applications and to get access to all the features.
@@ -1507,6 +1507,7 @@ declare const eden: {
1507
1507
  get: (options: {
1508
1508
  headers?: Record<string, unknown> | undefined;
1509
1509
  query: {
1510
+ reloadChainId?: number | undefined;
1510
1511
  chainId: number[];
1511
1512
  };
1512
1513
  fetch?: RequestInit | undefined;
@@ -4637,6 +4638,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
4637
4638
  address: string;
4638
4639
  };
4639
4640
  query: {
4641
+ reloadChainId?: number | undefined;
4640
4642
  chainId: number[];
4641
4643
  };
4642
4644
  headers: unknown;
@@ -7689,6 +7691,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
7689
7691
  get: (options: {
7690
7692
  headers?: Record<string, unknown> | undefined;
7691
7693
  query: {
7694
+ reloadChainId?: number | undefined;
7692
7695
  chainId: number[];
7693
7696
  };
7694
7697
  fetch?: RequestInit | undefined;
@@ -1899,6 +1899,7 @@ declare const app: Elysia<"", false, {
1899
1899
  address: string;
1900
1900
  };
1901
1901
  query: {
1902
+ reloadChainId?: number | undefined;
1902
1903
  chainId: number[];
1903
1904
  };
1904
1905
  headers: unknown;
@@ -186,7 +186,7 @@ function parseForBalancer(calls, index, targetToken, name) {
186
186
  function parseForStaking(campaign, calls, index, targetToken) {
187
187
  try {
188
188
  const whitelist = campaign.campaignParameters.whitelist;
189
- if (whitelist.length === 1) {
189
+ if (whitelist.length === 1 && campaign.chainId !== 42161) {
190
190
  const forwarders = campaign.campaignParameters.forwarders;
191
191
  if (forwarders.length === 1) {
192
192
  if (forwarders[0].sender === whitelist[0]) {
@@ -19,9 +19,6 @@ export declare const ChainUniqueDto: import("@sinclair/typebox").TObject<{
19
19
  export declare const ChainUniqueOptionalDto: import("@sinclair/typebox").TObject<{
20
20
  chainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
21
21
  }>;
22
- export declare const ChainArrayDto: import("@sinclair/typebox").TObject<{
23
- chainId: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>, number[]>;
24
- }>;
25
22
  export declare const ChainArrayOptionalDto: import("@sinclair/typebox").TObject<{
26
23
  chainIds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>, number[]>>;
27
24
  }>;
@@ -38,5 +35,4 @@ export declare const UpdateChainDto: import("@sinclair/typebox").TObject<{
38
35
  }>;
39
36
  export type ChainUniqueModel = typeof ChainUniqueDto.static;
40
37
  export type ChainSearchDto = typeof GetChainQueryDto.static;
41
- export type ChainsArrayModel = typeof ChainArrayDto.static;
42
38
  export type UpdateChainModel = typeof UpdateChainDto.static;
@@ -15,14 +15,6 @@ export const ChainUniqueDto = t.Object({
15
15
  export const ChainUniqueOptionalDto = t.Object({
16
16
  chainId: t.Optional(t.Numeric()),
17
17
  });
18
- export const ChainArrayDto = t.Object({
19
- chainId: t
20
- .Transform(t.Union([t.String(), t.Array(t.Numeric())]))
21
- .Decode(value => (typeof value === "string" ? value.split(",").map(v => Number.parseInt(v)) : value))
22
- .Encode(value => [...value]),
23
- }, {
24
- description: "A required comma separated list of chain ids.<br>You can get the list of all supported chains by calling [GET /v4/chains](#tag/chains/GET/v4/chains/)",
25
- });
26
18
  export const ChainArrayOptionalDto = t.Object({
27
19
  chainIds: t.Optional(t
28
20
  .Transform(t.Union([t.String(), t.Array(t.Numeric())]))
@@ -1777,6 +1777,7 @@ export declare const v4: Elysia<"/v4", false, {
1777
1777
  address: string;
1778
1778
  };
1779
1779
  query: {
1780
+ reloadChainId?: number | undefined;
1780
1781
  chainId: number[];
1781
1782
  };
1782
1783
  headers: unknown;
@@ -198,6 +198,7 @@ export declare const UserController: Elysia<"/users", false, {
198
198
  address: string;
199
199
  };
200
200
  query: {
201
+ reloadChainId?: number | undefined;
201
202
  chainId: number[];
202
203
  };
203
204
  headers: unknown;
@@ -1,9 +1,8 @@
1
1
  import { AuthorizationHeadersDto, BackOfficeGuard } from "../../../guards/BackOffice.guard";
2
2
  import { throwOnInvalidRequiredAddress, throwOnUnsupportedChainId } from "../../../utils/throw";
3
3
  import { Elysia, t } from "elysia";
4
- import { ChainArrayDto } from "../chain";
5
4
  import { RewardService } from "../reward";
6
- import { GetManyUserQuery, OptionalChainIdDto, UpdateUserTagsDto, UserDto, UserRewardsResourceDto, UserUniqueDto, } from "./user.model";
5
+ import { GetManyUserQuery, OptionalChainIdDto, UpdateUserTagsDto, UserDto, UserRewardRouteDto, UserRewardsResourceDto, UserUniqueDto, } from "./user.model";
7
6
  import { UserService } from "./user.service";
8
7
  // ─── Users Controller ────────────────────────────────────────────────────────
9
8
  export const UserController = new Elysia({ prefix: "/users", detail: { tags: ["Users"] } })
@@ -32,14 +31,15 @@ export const UserController = new Elysia({ prefix: "/users", detail: { tags: ["U
32
31
  throwOnUnsupportedChainId(chainId);
33
32
  }
34
33
  },
34
+ detail: { hide: true },
35
35
  })
36
36
  // ─── Get User's Rewards With Breakdown ──────────────────────────────
37
37
  .get("/:address/rewards", async ({ params, query }) => {
38
- const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, false, typeof query.chainId === "number" ? [query.chainId] : query.chainId);
38
+ const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, false, typeof query.chainId === "number" ? [query.chainId] : query.chainId, !!query.reloadChainId ? query.reloadChainId : null);
39
39
  return RewardService.removeOpportunityFromRewardBreakdown(rewardsByChain);
40
40
  }, {
41
41
  params: UserUniqueDto,
42
- query: ChainArrayDto,
42
+ query: UserRewardRouteDto,
43
43
  beforeHandle: ({ query, params }) => {
44
44
  params.address = throwOnInvalidRequiredAddress(params.address);
45
45
  if (typeof query.chainId === "number") {
@@ -50,6 +50,8 @@ export const UserController = new Elysia({ prefix: "/users", detail: { tags: ["U
50
50
  throwOnUnsupportedChainId(chainId);
51
51
  }
52
52
  }
53
+ if (!!query.reloadChainId)
54
+ throwOnUnsupportedChainId(query.reloadChainId);
53
55
  },
54
56
  response: t.Array(UserRewardsResourceDto),
55
57
  detail: { description: "Get the rewards associated to a user on a given chain." },
@@ -5,6 +5,10 @@ import type { Resource } from "../prisma";
5
5
  * @see {@link Resource}
6
6
  */
7
7
  export type User = Resource<"User">;
8
+ export declare const UserRewardRouteDto: import("@sinclair/typebox").TObject<{
9
+ chainId: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>, number[]>;
10
+ reloadChainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
11
+ }>;
8
12
  export declare const UserRewardsResourceDto: import("@sinclair/typebox").TObject<{
9
13
  chain: import("@sinclair/typebox").TObject<{
10
14
  id: import("@sinclair/typebox").TNumber;
@@ -1,6 +1,17 @@
1
1
  import { t } from "elysia";
2
2
  import { ChainResourceDto } from "../chain";
3
3
  // ─── Dtos ────────────────────────────────────────────────────────────────────
4
+ export const UserRewardRouteDto = t.Object({
5
+ chainId: t
6
+ .Transform(t.Union([t.String(), t.Array(t.Numeric())]))
7
+ .Decode(value => (typeof value === "string" ? value.split(",").map(v => Number.parseInt(v)) : value))
8
+ .Encode(value => [...value]),
9
+ reloadChainId: t.Optional(t.Numeric({
10
+ description: "An optional chainId to bypass the cache and check if there was very recently a claim on this chain",
11
+ })),
12
+ }, {
13
+ description: "A required comma separated list of chain ids.<br>You can get the list of all supported chains by calling [GET /v4/chains](#tag/chains/GET/v4/chains/)",
14
+ });
4
15
  export const UserRewardsResourceDto = t.Object({
5
16
  chain: ChainResourceDto,
6
17
  rewards: t.Array(t.Object({