@merkl/api 0.10.187 → 0.10.188

Sign up to get free protection for your applications and to get access to all the features.
@@ -1283,11 +1283,13 @@ declare const eden: {
1283
1283
  }>>;
1284
1284
  rewards: {
1285
1285
  breakdowns: {
1286
- get: (options?: {
1286
+ get: (options: {
1287
1287
  headers?: Record<string, unknown> | undefined;
1288
- query?: Record<string, unknown> | undefined;
1288
+ query: {
1289
+ chainId?: number | undefined;
1290
+ };
1289
1291
  fetch?: RequestInit | undefined;
1290
- } | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
1292
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
1291
1293
  200: (Omit<{
1292
1294
  chain: import("../../database/api/.generated").Chain;
1293
1295
  rewards: Awaited<ReturnType<typeof import("../modules/v4/reward").RewardService["format"]>>;
@@ -3610,10 +3612,11 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
3610
3612
  get: {
3611
3613
  body: unknown;
3612
3614
  params: {
3613
- chainId?: number | undefined;
3614
3615
  address: string;
3615
3616
  };
3616
- query: unknown;
3617
+ query: {
3618
+ chainId?: number | undefined;
3619
+ };
3617
3620
  headers: unknown;
3618
3621
  response: {
3619
3622
  200: (Omit<{
@@ -5718,11 +5721,13 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
5718
5721
  }>>;
5719
5722
  rewards: {
5720
5723
  breakdowns: {
5721
- get: (options?: {
5724
+ get: (options: {
5722
5725
  headers?: Record<string, unknown> | undefined;
5723
- query?: Record<string, unknown> | undefined;
5726
+ query: {
5727
+ chainId?: number | undefined;
5728
+ };
5724
5729
  fetch?: RequestInit | undefined;
5725
- } | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
5730
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
5726
5731
  200: (Omit<{
5727
5732
  chain: import("../../database/api/.generated").Chain;
5728
5733
  rewards: Awaited<ReturnType<typeof import("../modules/v4/reward").RewardService["format"]>>;
@@ -1635,10 +1635,11 @@ declare const app: Elysia<"", false, {
1635
1635
  get: {
1636
1636
  body: unknown;
1637
1637
  params: {
1638
- chainId?: number | undefined;
1639
1638
  address: string;
1640
1639
  };
1641
- query: unknown;
1640
+ query: {
1641
+ chainId?: number | undefined;
1642
+ };
1642
1643
  headers: unknown;
1643
1644
  response: {
1644
1645
  200: (Omit<{
@@ -1617,10 +1617,11 @@ export declare const v4: Elysia<"/v4", false, {
1617
1617
  get: {
1618
1618
  body: unknown;
1619
1619
  params: {
1620
- chainId?: number | undefined;
1621
1620
  address: string;
1622
1621
  };
1623
- query: unknown;
1622
+ query: {
1623
+ chainId?: number | undefined;
1624
+ };
1624
1625
  headers: unknown;
1625
1626
  response: {
1626
1627
  200: (Omit<{
@@ -80,10 +80,11 @@ export declare const UserController: Elysia<"/users", false, {
80
80
  get: {
81
81
  body: unknown;
82
82
  params: {
83
- chainId?: number | undefined;
84
83
  address: string;
85
84
  };
86
- query: unknown;
85
+ query: {
86
+ chainId?: number | undefined;
87
+ };
87
88
  headers: unknown;
88
89
  response: {
89
90
  200: (Omit<{
@@ -3,7 +3,7 @@ import { throwOnInvalidRequiredAddress, throwOnUnsupportedChainId } from "../../
3
3
  import { Elysia } from "elysia";
4
4
  import { ChainArrayDto } from "../chain";
5
5
  import { RewardService } from "../reward";
6
- import { GetManyUserQuery, UpdateUserTagsDto, UserDto, UserUniqueDto, UserUniqueWithChainIdDto } from "./user.model";
6
+ import { GetManyUserQuery, OptionalChainIdDto, UpdateUserTagsDto, UserDto, UserUniqueDto } from "./user.model";
7
7
  import { UserService } from "./user.service";
8
8
  // ─── Users Controller ────────────────────────────────────────────────────────
9
9
  export const UserController = new Elysia({ prefix: "/users", detail: { tags: ["Users"] } })
@@ -20,13 +20,16 @@ export const UserController = new Elysia({ prefix: "/users", detail: { tags: ["U
20
20
  return await UserService.findUnique(params.address);
21
21
  })
22
22
  // ─── Get User's Rewards With Breakdown And Details for our FE ────────
23
- .get("/:address/rewards/breakdowns", async ({ params }) => {
24
- const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, true, [], params.chainId ?? null);
23
+ .get("/:address/rewards/breakdowns", async ({ params, query }) => {
24
+ const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, true, [], query.chainId ?? null);
25
25
  return RewardService.splitRewardsBreakdownByOpportunity(rewardsByChain);
26
26
  }, {
27
- params: UserUniqueWithChainIdDto,
28
- beforeHandle: ({ params }) => {
27
+ params: UserUniqueDto,
28
+ query: OptionalChainIdDto,
29
+ beforeHandle: ({ params, query }) => {
29
30
  params.address = throwOnInvalidRequiredAddress(params.address);
31
+ if (!!query.chainId)
32
+ throwOnUnsupportedChainId(query.chainId);
30
33
  },
31
34
  detail: { hide: true },
32
35
  })
@@ -8,8 +8,7 @@ export type User = Resource<"User">;
8
8
  export declare const UserUniqueDto: import("@sinclair/typebox").TObject<{
9
9
  address: import("@sinclair/typebox").TString;
10
10
  }>;
11
- export declare const UserUniqueWithChainIdDto: import("@sinclair/typebox").TObject<{
12
- address: import("@sinclair/typebox").TString;
11
+ export declare const OptionalChainIdDto: import("@sinclair/typebox").TObject<{
13
12
  chainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
14
13
  }>;
15
14
  export declare const UserDto: import("@sinclair/typebox").TObject<{
@@ -27,5 +26,5 @@ export declare const UpdateUserTagsDto: import("@sinclair/typebox").TObject<{
27
26
  }>;
28
27
  export type UserUniqueModel = typeof UserUniqueDto.static;
29
28
  export type UserModel = typeof UserDto.static;
30
- export type UserWithChainIdModel = typeof UserUniqueWithChainIdDto.static;
29
+ export type OptionalChainIdModel = typeof OptionalChainIdDto.static;
31
30
  export type GetManyUserModel = typeof GetManyUserQuery.static;
@@ -3,8 +3,7 @@ import { t } from "elysia";
3
3
  export const UserUniqueDto = t.Object({
4
4
  address: t.String(),
5
5
  });
6
- export const UserUniqueWithChainIdDto = t.Object({
7
- address: t.String(),
6
+ export const OptionalChainIdDto = t.Object({
8
7
  chainId: t.Optional(t.Numeric()),
9
8
  });
10
9
  export const UserDto = t.Object({
@@ -1641,10 +1641,11 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1641
1641
  get: {
1642
1642
  body: unknown;
1643
1643
  params: {
1644
- chainId?: number | undefined;
1645
1644
  address: string;
1646
1645
  };
1647
- query: unknown;
1646
+ query: {
1647
+ chainId?: number | undefined;
1648
+ };
1648
1649
  headers: unknown;
1649
1650
  response: {
1650
1651
  200: (Omit<{
@@ -1644,10 +1644,11 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1644
1644
  get: {
1645
1645
  body: unknown;
1646
1646
  params: {
1647
- chainId?: number | undefined;
1648
1647
  address: string;
1649
1648
  };
1650
- query: unknown;
1649
+ query: {
1650
+ chainId?: number | undefined;
1651
+ };
1651
1652
  headers: unknown;
1652
1653
  response: {
1653
1654
  200: (Omit<{
@@ -1635,10 +1635,11 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1635
1635
  get: {
1636
1636
  body: unknown;
1637
1637
  params: {
1638
- chainId?: number | undefined;
1639
1638
  address: string;
1640
1639
  };
1641
- query: unknown;
1640
+ query: {
1641
+ chainId?: number | undefined;
1642
+ };
1642
1643
  headers: unknown;
1643
1644
  response: {
1644
1645
  200: (Omit<{
@@ -1640,10 +1640,11 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1640
1640
  get: {
1641
1641
  body: unknown;
1642
1642
  params: {
1643
- chainId?: number | undefined;
1644
1643
  address: string;
1645
1644
  };
1646
- query: unknown;
1645
+ query: {
1646
+ chainId?: number | undefined;
1647
+ };
1647
1648
  headers: unknown;
1648
1649
  response: {
1649
1650
  200: (Omit<{
@@ -1658,10 +1658,11 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1658
1658
  get: {
1659
1659
  body: unknown;
1660
1660
  params: {
1661
- chainId?: number | undefined;
1662
1661
  address: string;
1663
1662
  };
1664
- query: unknown;
1663
+ query: {
1664
+ chainId?: number | undefined;
1665
+ };
1665
1666
  headers: unknown;
1666
1667
  response: {
1667
1668
  200: (Omit<{
@@ -1659,10 +1659,11 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1659
1659
  get: {
1660
1660
  body: unknown;
1661
1661
  params: {
1662
- chainId?: number | undefined;
1663
1662
  address: string;
1664
1663
  };
1665
- query: unknown;
1664
+ query: {
1665
+ chainId?: number | undefined;
1666
+ };
1666
1667
  headers: unknown;
1667
1668
  response: {
1668
1669
  200: (Omit<{
@@ -1641,10 +1641,11 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1641
1641
  get: {
1642
1642
  body: unknown;
1643
1643
  params: {
1644
- chainId?: number | undefined;
1645
1644
  address: string;
1646
1645
  };
1647
- query: unknown;
1646
+ query: {
1647
+ chainId?: number | undefined;
1648
+ };
1648
1649
  headers: unknown;
1649
1650
  response: {
1650
1651
  200: (Omit<{
@@ -1642,10 +1642,11 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1642
1642
  get: {
1643
1643
  body: unknown;
1644
1644
  params: {
1645
- chainId?: number | undefined;
1646
1645
  address: string;
1647
1646
  };
1648
- query: unknown;
1647
+ query: {
1648
+ chainId?: number | undefined;
1649
+ };
1649
1650
  headers: unknown;
1650
1651
  response: {
1651
1652
  200: (Omit<{
@@ -1644,10 +1644,11 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1644
1644
  get: {
1645
1645
  body: unknown;
1646
1646
  params: {
1647
- chainId?: number | undefined;
1648
1647
  address: string;
1649
1648
  };
1650
- query: unknown;
1649
+ query: {
1650
+ chainId?: number | undefined;
1651
+ };
1651
1652
  headers: unknown;
1652
1653
  response: {
1653
1654
  200: (Omit<{