@merkl/api 0.10.184 → 0.10.185

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.
@@ -1580,6 +1580,25 @@ declare const eden: {
1580
1580
  epoch: number;
1581
1581
  }[];
1582
1582
  }>>;
1583
+ post: (body: {
1584
+ timestamp: number;
1585
+ chainId: number;
1586
+ root: string;
1587
+ epoch: number;
1588
+ }, options: {
1589
+ headers: {
1590
+ authorization: string;
1591
+ };
1592
+ query?: Record<string, unknown> | undefined;
1593
+ fetch?: RequestInit | undefined;
1594
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
1595
+ 200: {
1596
+ timestamp: bigint;
1597
+ chainId: number;
1598
+ root: string;
1599
+ epoch: number;
1600
+ };
1601
+ }>>;
1583
1602
  };
1584
1603
  live: {
1585
1604
  get: (options?: {
@@ -3913,6 +3932,32 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
3913
3932
  };
3914
3933
  };
3915
3934
  };
3935
+ } & {
3936
+ roots: {
3937
+ index: {
3938
+ post: {
3939
+ body: {
3940
+ timestamp: number;
3941
+ chainId: number;
3942
+ root: string;
3943
+ epoch: number;
3944
+ };
3945
+ params: {};
3946
+ query: unknown;
3947
+ headers: {
3948
+ authorization: string;
3949
+ };
3950
+ response: {
3951
+ 200: {
3952
+ timestamp: bigint;
3953
+ chainId: number;
3954
+ root: string;
3955
+ epoch: number;
3956
+ };
3957
+ };
3958
+ };
3959
+ };
3960
+ };
3916
3961
  };
3917
3962
  } & {
3918
3963
  v4: {
@@ -5967,6 +6012,25 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
5967
6012
  epoch: number;
5968
6013
  }[];
5969
6014
  }>>;
6015
+ post: (body: {
6016
+ timestamp: number;
6017
+ chainId: number;
6018
+ root: string;
6019
+ epoch: number;
6020
+ }, options: {
6021
+ headers: {
6022
+ authorization: string;
6023
+ };
6024
+ query?: Record<string, unknown> | undefined;
6025
+ fetch?: RequestInit | undefined;
6026
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
6027
+ 200: {
6028
+ timestamp: bigint;
6029
+ chainId: number;
6030
+ root: string;
6031
+ epoch: number;
6032
+ };
6033
+ }>>;
5970
6034
  };
5971
6035
  live: {
5972
6036
  get: (options?: {
@@ -1959,6 +1959,32 @@ declare const app: Elysia<"", false, {
1959
1959
  };
1960
1960
  };
1961
1961
  };
1962
+ } & {
1963
+ roots: {
1964
+ index: {
1965
+ post: {
1966
+ body: {
1967
+ timestamp: number;
1968
+ chainId: number;
1969
+ root: string;
1970
+ epoch: number;
1971
+ };
1972
+ params: {};
1973
+ query: unknown;
1974
+ headers: {
1975
+ authorization: string;
1976
+ };
1977
+ response: {
1978
+ 200: {
1979
+ timestamp: bigint;
1980
+ chainId: number;
1981
+ root: string;
1982
+ epoch: number;
1983
+ };
1984
+ };
1985
+ };
1986
+ };
1987
+ };
1962
1988
  };
1963
1989
  } & {
1964
1990
  v4: {
@@ -52,6 +52,32 @@ export declare const MerklRootController: Elysia<"/roots", false, {
52
52
  };
53
53
  };
54
54
  };
55
+ } & {
56
+ roots: {
57
+ index: {
58
+ post: {
59
+ body: {
60
+ timestamp: number;
61
+ chainId: number;
62
+ root: string;
63
+ epoch: number;
64
+ };
65
+ params: {};
66
+ query: unknown;
67
+ headers: {
68
+ authorization: string;
69
+ };
70
+ response: {
71
+ 200: {
72
+ timestamp: bigint;
73
+ chainId: number;
74
+ root: string;
75
+ epoch: number;
76
+ };
77
+ };
78
+ };
79
+ };
80
+ };
55
81
  }, {
56
82
  derive: {};
57
83
  resolve: {};
@@ -1,8 +1,9 @@
1
+ import { AuthorizationHeadersDto, EngineGuard } from "../../../guards/Engine.guard";
1
2
  import { throwOnUnsupportedChainId } from "../../../utils/throw";
2
3
  import Elysia from "elysia";
3
- import { RootByTimestampsDto } from "./merklRoot.model";
4
+ import { CreateRootDto, RootByTimestampsDto } from "./merklRoot.model";
4
5
  import { MerklRootService } from "./merklRoot.service";
5
- // ─── Merkl Roots Controller ──────────────────────────────────────────────────
6
+ // ─── Merkl Roots Controller ─────────────────────────────────────────────
6
7
  export const MerklRootController = new Elysia({ prefix: "/roots", detail: { tags: ["Roots"] } })
7
8
  // ─── Get Merkl Root By Timestamp ─────────────────────────────────────
8
9
  .get("/", async ({ query }) => await MerklRootService.rootForTimestamp(query), {
@@ -12,4 +13,16 @@ export const MerklRootController = new Elysia({ prefix: "/roots", detail: { tags
12
13
  },
13
14
  })
14
15
  // ─── Get all live Merkl Roots ─────────────────────────────────────────
15
- .get("/live", async () => await MerklRootService.fetchAll());
16
+ .get("/live", async () => await MerklRootService.fetchAll())
17
+ // ─── Create a Merkl Root Entry ────────────────────────────────────────
18
+ .post("/", async ({ body }) => {
19
+ return await MerklRootService.create(body);
20
+ }, {
21
+ headers: AuthorizationHeadersDto,
22
+ body: CreateRootDto,
23
+ beforeHandle: ({ headers, body }) => {
24
+ EngineGuard({ headers });
25
+ throwOnUnsupportedChainId(body.chainId);
26
+ },
27
+ detail: { hide: true },
28
+ });
@@ -3,4 +3,11 @@ export declare const RootByTimestampsDto: import("@sinclair/typebox").TObject<{
3
3
  fromTimestamp: import("@sinclair/typebox").TString;
4
4
  toTimestamp: import("@sinclair/typebox").TString;
5
5
  }>;
6
+ export declare const CreateRootDto: import("@sinclair/typebox").TObject<{
7
+ chainId: import("@sinclair/typebox").TNumber;
8
+ root: import("@sinclair/typebox").TString;
9
+ timestamp: import("@sinclair/typebox").TNumber;
10
+ epoch: import("@sinclair/typebox").TNumber;
11
+ }>;
6
12
  export type RootByTimestampModel = typeof RootByTimestampsDto.static;
13
+ export type CreateRootModel = typeof CreateRootDto.static;
@@ -4,3 +4,9 @@ export const RootByTimestampsDto = t.Object({
4
4
  fromTimestamp: t.String(),
5
5
  toTimestamp: t.String(),
6
6
  });
7
+ export const CreateRootDto = t.Object({
8
+ chainId: t.Numeric(),
9
+ root: t.String(),
10
+ timestamp: t.Numeric(),
11
+ epoch: t.Numeric(),
12
+ });
@@ -1,5 +1,5 @@
1
1
  import { type ChainId } from "@sdk";
2
- import type { RootByTimestampModel } from "./merklRoot.model";
2
+ import type { CreateRootModel, RootByTimestampModel } from "./merklRoot.model";
3
3
  export declare class MerklRootRepository {
4
4
  static firstRoot(chainId: ChainId): Promise<{
5
5
  timestamp: bigint;
@@ -18,4 +18,10 @@ export declare class MerklRootRepository {
18
18
  tree: any;
19
19
  lastTree: any;
20
20
  }>;
21
+ static create(x: CreateRootModel): Promise<{
22
+ timestamp: bigint;
23
+ chainId: number;
24
+ root: string;
25
+ epoch: number;
26
+ }>;
21
27
  }
@@ -28,4 +28,9 @@ export class MerklRootRepository {
28
28
  const [tree, lastTree] = await DistributorService(chainId).fetchTreeAndLastTreeMerklRoots();
29
29
  return { live, tree, lastTree };
30
30
  }
31
+ static async create(x) {
32
+ return await apiDbClient.merklRoot.create({
33
+ data: x,
34
+ });
35
+ }
31
36
  }
@@ -1,6 +1,6 @@
1
1
  import type { CacheKeys } from "../../../cache/keys";
2
2
  import type { ChainId } from "@sdk";
3
- import type { RootByTimestampModel } from "./merklRoot.model";
3
+ import type { CreateRootModel, RootByTimestampModel } from "./merklRoot.model";
4
4
  export declare class MerklRootService {
5
5
  static firstRoot(chainId: ChainId): Promise<{
6
6
  timestamp: bigint;
@@ -30,4 +30,10 @@ export declare class MerklRootService {
30
30
  tree: string;
31
31
  lastTree: string;
32
32
  }[]>;
33
+ static create(x: CreateRootModel): Promise<{
34
+ timestamp: bigint;
35
+ chainId: number;
36
+ root: string;
37
+ epoch: number;
38
+ }>;
33
39
  }
@@ -35,4 +35,7 @@ export class MerklRootService {
35
35
  return roots;
36
36
  });
37
37
  }
38
+ static async create(x) {
39
+ return await MerklRootRepository.create(x);
40
+ }
38
41
  }
@@ -1941,6 +1941,32 @@ export declare const v4: Elysia<"/v4", false, {
1941
1941
  };
1942
1942
  };
1943
1943
  };
1944
+ } & {
1945
+ roots: {
1946
+ index: {
1947
+ post: {
1948
+ body: {
1949
+ timestamp: number;
1950
+ chainId: number;
1951
+ root: string;
1952
+ epoch: number;
1953
+ };
1954
+ params: {};
1955
+ query: unknown;
1956
+ headers: {
1957
+ authorization: string;
1958
+ };
1959
+ response: {
1960
+ 200: {
1961
+ timestamp: bigint;
1962
+ chainId: number;
1963
+ root: string;
1964
+ epoch: number;
1965
+ };
1966
+ };
1967
+ };
1968
+ };
1969
+ };
1944
1970
  };
1945
1971
  } & {
1946
1972
  v4: {
@@ -1965,6 +1965,32 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1965
1965
  };
1966
1966
  };
1967
1967
  };
1968
+ } & {
1969
+ roots: {
1970
+ index: {
1971
+ post: {
1972
+ body: {
1973
+ timestamp: number;
1974
+ chainId: number;
1975
+ root: string;
1976
+ epoch: number;
1977
+ };
1978
+ params: {};
1979
+ query: unknown;
1980
+ headers: {
1981
+ authorization: string;
1982
+ };
1983
+ response: {
1984
+ 200: {
1985
+ timestamp: bigint;
1986
+ chainId: number;
1987
+ root: string;
1988
+ epoch: number;
1989
+ };
1990
+ };
1991
+ };
1992
+ };
1993
+ };
1968
1994
  };
1969
1995
  } & {
1970
1996
  v4: {
@@ -1968,6 +1968,32 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1968
1968
  };
1969
1969
  };
1970
1970
  };
1971
+ } & {
1972
+ roots: {
1973
+ index: {
1974
+ post: {
1975
+ body: {
1976
+ timestamp: number;
1977
+ chainId: number;
1978
+ root: string;
1979
+ epoch: number;
1980
+ };
1981
+ params: {};
1982
+ query: unknown;
1983
+ headers: {
1984
+ authorization: string;
1985
+ };
1986
+ response: {
1987
+ 200: {
1988
+ timestamp: bigint;
1989
+ chainId: number;
1990
+ root: string;
1991
+ epoch: number;
1992
+ };
1993
+ };
1994
+ };
1995
+ };
1996
+ };
1971
1997
  };
1972
1998
  } & {
1973
1999
  v4: {
@@ -1959,6 +1959,32 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1959
1959
  };
1960
1960
  };
1961
1961
  };
1962
+ } & {
1963
+ roots: {
1964
+ index: {
1965
+ post: {
1966
+ body: {
1967
+ timestamp: number;
1968
+ chainId: number;
1969
+ root: string;
1970
+ epoch: number;
1971
+ };
1972
+ params: {};
1973
+ query: unknown;
1974
+ headers: {
1975
+ authorization: string;
1976
+ };
1977
+ response: {
1978
+ 200: {
1979
+ timestamp: bigint;
1980
+ chainId: number;
1981
+ root: string;
1982
+ epoch: number;
1983
+ };
1984
+ };
1985
+ };
1986
+ };
1987
+ };
1962
1988
  };
1963
1989
  } & {
1964
1990
  v4: {
@@ -1964,6 +1964,32 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1964
1964
  };
1965
1965
  };
1966
1966
  };
1967
+ } & {
1968
+ roots: {
1969
+ index: {
1970
+ post: {
1971
+ body: {
1972
+ timestamp: number;
1973
+ chainId: number;
1974
+ root: string;
1975
+ epoch: number;
1976
+ };
1977
+ params: {};
1978
+ query: unknown;
1979
+ headers: {
1980
+ authorization: string;
1981
+ };
1982
+ response: {
1983
+ 200: {
1984
+ timestamp: bigint;
1985
+ chainId: number;
1986
+ root: string;
1987
+ epoch: number;
1988
+ };
1989
+ };
1990
+ };
1991
+ };
1992
+ };
1967
1993
  };
1968
1994
  } & {
1969
1995
  v4: {
@@ -1982,6 +1982,32 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1982
1982
  };
1983
1983
  };
1984
1984
  };
1985
+ } & {
1986
+ roots: {
1987
+ index: {
1988
+ post: {
1989
+ body: {
1990
+ timestamp: number;
1991
+ chainId: number;
1992
+ root: string;
1993
+ epoch: number;
1994
+ };
1995
+ params: {};
1996
+ query: unknown;
1997
+ headers: {
1998
+ authorization: string;
1999
+ };
2000
+ response: {
2001
+ 200: {
2002
+ timestamp: bigint;
2003
+ chainId: number;
2004
+ root: string;
2005
+ epoch: number;
2006
+ };
2007
+ };
2008
+ };
2009
+ };
2010
+ };
1985
2011
  };
1986
2012
  } & {
1987
2013
  v4: {
@@ -1983,6 +1983,32 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1983
1983
  };
1984
1984
  };
1985
1985
  };
1986
+ } & {
1987
+ roots: {
1988
+ index: {
1989
+ post: {
1990
+ body: {
1991
+ timestamp: number;
1992
+ chainId: number;
1993
+ root: string;
1994
+ epoch: number;
1995
+ };
1996
+ params: {};
1997
+ query: unknown;
1998
+ headers: {
1999
+ authorization: string;
2000
+ };
2001
+ response: {
2002
+ 200: {
2003
+ timestamp: bigint;
2004
+ chainId: number;
2005
+ root: string;
2006
+ epoch: number;
2007
+ };
2008
+ };
2009
+ };
2010
+ };
2011
+ };
1986
2012
  };
1987
2013
  } & {
1988
2014
  v4: {
@@ -1965,6 +1965,32 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1965
1965
  };
1966
1966
  };
1967
1967
  };
1968
+ } & {
1969
+ roots: {
1970
+ index: {
1971
+ post: {
1972
+ body: {
1973
+ timestamp: number;
1974
+ chainId: number;
1975
+ root: string;
1976
+ epoch: number;
1977
+ };
1978
+ params: {};
1979
+ query: unknown;
1980
+ headers: {
1981
+ authorization: string;
1982
+ };
1983
+ response: {
1984
+ 200: {
1985
+ timestamp: bigint;
1986
+ chainId: number;
1987
+ root: string;
1988
+ epoch: number;
1989
+ };
1990
+ };
1991
+ };
1992
+ };
1993
+ };
1968
1994
  };
1969
1995
  } & {
1970
1996
  v4: {
@@ -1966,6 +1966,32 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1966
1966
  };
1967
1967
  };
1968
1968
  };
1969
+ } & {
1970
+ roots: {
1971
+ index: {
1972
+ post: {
1973
+ body: {
1974
+ timestamp: number;
1975
+ chainId: number;
1976
+ root: string;
1977
+ epoch: number;
1978
+ };
1979
+ params: {};
1980
+ query: unknown;
1981
+ headers: {
1982
+ authorization: string;
1983
+ };
1984
+ response: {
1985
+ 200: {
1986
+ timestamp: bigint;
1987
+ chainId: number;
1988
+ root: string;
1989
+ epoch: number;
1990
+ };
1991
+ };
1992
+ };
1993
+ };
1994
+ };
1969
1995
  };
1970
1996
  } & {
1971
1997
  v4: {
@@ -1968,6 +1968,32 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1968
1968
  };
1969
1969
  };
1970
1970
  };
1971
+ } & {
1972
+ roots: {
1973
+ index: {
1974
+ post: {
1975
+ body: {
1976
+ timestamp: number;
1977
+ chainId: number;
1978
+ root: string;
1979
+ epoch: number;
1980
+ };
1981
+ params: {};
1982
+ query: unknown;
1983
+ headers: {
1984
+ authorization: string;
1985
+ };
1986
+ response: {
1987
+ 200: {
1988
+ timestamp: bigint;
1989
+ chainId: number;
1990
+ root: string;
1991
+ epoch: number;
1992
+ };
1993
+ };
1994
+ };
1995
+ };
1996
+ };
1971
1997
  };
1972
1998
  } & {
1973
1999
  v4: {