@merkl/api 0.15.40 → 0.15.41
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.
- package/dist/src/eden/index.d.ts +102 -0
- package/dist/src/index.d.ts +26 -0
- package/dist/src/modules/v4/chain/chain.controller.d.ts +26 -0
- package/dist/src/modules/v4/chain/chain.controller.js +7 -1
- package/dist/src/modules/v4/chain/chain.model.d.ts +11 -0
- package/dist/src/modules/v4/chain/chain.model.js +8 -0
- package/dist/src/modules/v4/chain/chain.repository.d.ts +2 -2
- package/dist/src/modules/v4/chain/chain.repository.js +11 -2
- package/dist/src/modules/v4/chain/chain.service.d.ts +6 -1
- package/dist/src/modules/v4/chain/chain.service.js +3 -4
- package/dist/src/modules/v4/router.d.ts +26 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -1739,6 +1739,25 @@ declare const eden: {
|
|
1739
1739
|
}[];
|
1740
1740
|
}[];
|
1741
1741
|
}>>;
|
1742
|
+
post: (body: {
|
1743
|
+
name: string;
|
1744
|
+
id: number;
|
1745
|
+
icon: string;
|
1746
|
+
explorerType: "ETHERSCAN" | "BLOCKSCOUT";
|
1747
|
+
explorerUrl: string;
|
1748
|
+
}, options: {
|
1749
|
+
headers: {
|
1750
|
+
authorization: string;
|
1751
|
+
};
|
1752
|
+
query?: Record<string, unknown> | undefined;
|
1753
|
+
fetch?: RequestInit | undefined;
|
1754
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
1755
|
+
200: {
|
1756
|
+
name: string;
|
1757
|
+
id: number;
|
1758
|
+
icon: string;
|
1759
|
+
};
|
1760
|
+
}>>;
|
1742
1761
|
};
|
1743
1762
|
count: {
|
1744
1763
|
get: (options: {
|
@@ -4839,6 +4858,25 @@ declare const eden: {
|
|
4839
4858
|
}[];
|
4840
4859
|
}[];
|
4841
4860
|
}>>;
|
4861
|
+
post: (body: {
|
4862
|
+
name: string;
|
4863
|
+
id: number;
|
4864
|
+
icon: string;
|
4865
|
+
explorerType: "ETHERSCAN" | "BLOCKSCOUT";
|
4866
|
+
explorerUrl: string;
|
4867
|
+
}, options: {
|
4868
|
+
headers: {
|
4869
|
+
authorization: string;
|
4870
|
+
};
|
4871
|
+
query?: Record<string, unknown> | undefined;
|
4872
|
+
fetch?: RequestInit | undefined;
|
4873
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
4874
|
+
200: {
|
4875
|
+
name: string;
|
4876
|
+
id: number;
|
4877
|
+
icon: string;
|
4878
|
+
};
|
4879
|
+
}>>;
|
4842
4880
|
};
|
4843
4881
|
count: {
|
4844
4882
|
get: (options: {
|
@@ -9006,6 +9044,32 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
9006
9044
|
};
|
9007
9045
|
};
|
9008
9046
|
};
|
9047
|
+
} & {
|
9048
|
+
chains: {
|
9049
|
+
index: {
|
9050
|
+
post: {
|
9051
|
+
body: {
|
9052
|
+
name: string;
|
9053
|
+
id: number;
|
9054
|
+
icon: string;
|
9055
|
+
explorerType: "ETHERSCAN" | "BLOCKSCOUT";
|
9056
|
+
explorerUrl: string;
|
9057
|
+
};
|
9058
|
+
params: {};
|
9059
|
+
query: unknown;
|
9060
|
+
headers: {
|
9061
|
+
authorization: string;
|
9062
|
+
};
|
9063
|
+
response: {
|
9064
|
+
200: {
|
9065
|
+
name: string;
|
9066
|
+
id: number;
|
9067
|
+
icon: string;
|
9068
|
+
};
|
9069
|
+
};
|
9070
|
+
};
|
9071
|
+
};
|
9072
|
+
};
|
9009
9073
|
};
|
9010
9074
|
} & {
|
9011
9075
|
v4: {
|
@@ -13388,6 +13452,25 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
13388
13452
|
}[];
|
13389
13453
|
}[];
|
13390
13454
|
}>>;
|
13455
|
+
post: (body: {
|
13456
|
+
name: string;
|
13457
|
+
id: number;
|
13458
|
+
icon: string;
|
13459
|
+
explorerType: "ETHERSCAN" | "BLOCKSCOUT";
|
13460
|
+
explorerUrl: string;
|
13461
|
+
}, options: {
|
13462
|
+
headers: {
|
13463
|
+
authorization: string;
|
13464
|
+
};
|
13465
|
+
query?: Record<string, unknown> | undefined;
|
13466
|
+
fetch?: RequestInit | undefined;
|
13467
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
13468
|
+
200: {
|
13469
|
+
name: string;
|
13470
|
+
id: number;
|
13471
|
+
icon: string;
|
13472
|
+
};
|
13473
|
+
}>>;
|
13391
13474
|
};
|
13392
13475
|
count: {
|
13393
13476
|
get: (options: {
|
@@ -16488,6 +16571,25 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
16488
16571
|
}[];
|
16489
16572
|
}[];
|
16490
16573
|
}>>;
|
16574
|
+
post: (body: {
|
16575
|
+
name: string;
|
16576
|
+
id: number;
|
16577
|
+
icon: string;
|
16578
|
+
explorerType: "ETHERSCAN" | "BLOCKSCOUT";
|
16579
|
+
explorerUrl: string;
|
16580
|
+
}, options: {
|
16581
|
+
headers: {
|
16582
|
+
authorization: string;
|
16583
|
+
};
|
16584
|
+
query?: Record<string, unknown> | undefined;
|
16585
|
+
fetch?: RequestInit | undefined;
|
16586
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
16587
|
+
200: {
|
16588
|
+
name: string;
|
16589
|
+
id: number;
|
16590
|
+
icon: string;
|
16591
|
+
};
|
16592
|
+
}>>;
|
16491
16593
|
};
|
16492
16594
|
count: {
|
16493
16595
|
get: (options: {
|
package/dist/src/index.d.ts
CHANGED
@@ -2108,6 +2108,32 @@ declare const app: Elysia<"", false, {
|
|
2108
2108
|
};
|
2109
2109
|
};
|
2110
2110
|
};
|
2111
|
+
} & {
|
2112
|
+
chains: {
|
2113
|
+
index: {
|
2114
|
+
post: {
|
2115
|
+
body: {
|
2116
|
+
name: string;
|
2117
|
+
id: number;
|
2118
|
+
icon: string;
|
2119
|
+
explorerType: "ETHERSCAN" | "BLOCKSCOUT";
|
2120
|
+
explorerUrl: string;
|
2121
|
+
};
|
2122
|
+
params: {};
|
2123
|
+
query: unknown;
|
2124
|
+
headers: {
|
2125
|
+
authorization: string;
|
2126
|
+
};
|
2127
|
+
response: {
|
2128
|
+
200: {
|
2129
|
+
name: string;
|
2130
|
+
id: number;
|
2131
|
+
icon: string;
|
2132
|
+
};
|
2133
|
+
};
|
2134
|
+
};
|
2135
|
+
};
|
2136
|
+
};
|
2111
2137
|
};
|
2112
2138
|
} & {
|
2113
2139
|
v4: {
|
@@ -103,6 +103,32 @@ export declare const ChainController: Elysia<"/chains", false, {
|
|
103
103
|
};
|
104
104
|
};
|
105
105
|
};
|
106
|
+
} & {
|
107
|
+
chains: {
|
108
|
+
index: {
|
109
|
+
post: {
|
110
|
+
body: {
|
111
|
+
name: string;
|
112
|
+
id: number;
|
113
|
+
icon: string;
|
114
|
+
explorerType: "ETHERSCAN" | "BLOCKSCOUT";
|
115
|
+
explorerUrl: string;
|
116
|
+
};
|
117
|
+
params: {};
|
118
|
+
query: unknown;
|
119
|
+
headers: {
|
120
|
+
authorization: string;
|
121
|
+
};
|
122
|
+
response: {
|
123
|
+
200: {
|
124
|
+
name: string;
|
125
|
+
id: number;
|
126
|
+
icon: string;
|
127
|
+
};
|
128
|
+
};
|
129
|
+
};
|
130
|
+
};
|
131
|
+
};
|
106
132
|
}, {
|
107
133
|
derive: {};
|
108
134
|
resolve: {};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { AuthorizationHeadersDto, BackOfficeGuard } from "../../../guards/BackOffice.guard";
|
2
2
|
import Elysia, { t } from "elysia";
|
3
|
-
import { ChainResourceDto, ChainUniqueDto, GetChainQueryDto, UpdateChainDto } from "./chain.model";
|
3
|
+
import { ChainResourceDto, ChainUniqueDto, CreateChainDto, GetChainQueryDto, UpdateChainDto, } from "./chain.model";
|
4
4
|
import { ChainService } from "./chain.service";
|
5
5
|
// ─── Chains Controller ───────────────────────────────────────────────────────
|
6
6
|
export const ChainController = new Elysia({ prefix: "/chains", detail: { tags: ["Chains"] } })
|
@@ -35,4 +35,10 @@ export const ChainController = new Elysia({ prefix: "/chains", detail: { tags: [
|
|
35
35
|
headers: AuthorizationHeadersDto,
|
36
36
|
beforeHandle: BackOfficeGuard,
|
37
37
|
detail: { hide: true },
|
38
|
+
})
|
39
|
+
.post("/", async ({ body }) => await ChainService.create(body), {
|
40
|
+
body: CreateChainDto,
|
41
|
+
headers: AuthorizationHeadersDto,
|
42
|
+
beforeHandle: BackOfficeGuard,
|
43
|
+
detail: { hide: true },
|
38
44
|
});
|
@@ -25,6 +25,17 @@ export declare const ChainArrayOptionalDto: import("@sinclair/typebox").TObject<
|
|
25
25
|
export declare const UpdateChainDto: import("@sinclair/typebox").TObject<{
|
26
26
|
icon: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
27
27
|
}>;
|
28
|
+
export declare const CreateChainDto: import("@sinclair/typebox").TObject<{
|
29
|
+
id: import("@sinclair/typebox").TNumber;
|
30
|
+
name: import("@sinclair/typebox").TString;
|
31
|
+
icon: import("@sinclair/typebox").TString;
|
32
|
+
explorerType: import("@sinclair/typebox").TEnum<{
|
33
|
+
ETHERSCAN: "ETHERSCAN";
|
34
|
+
BLOCKSCOUT: "BLOCKSCOUT";
|
35
|
+
}>;
|
36
|
+
explorerUrl: import("@sinclair/typebox").TString;
|
37
|
+
}>;
|
28
38
|
export type ChainUniqueModel = typeof ChainUniqueDto.static;
|
29
39
|
export type ChainSearchDto = typeof GetChainQueryDto.static;
|
30
40
|
export type UpdateChainModel = typeof UpdateChainDto.static;
|
41
|
+
export type CreateChainModel = typeof CreateChainDto.static;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { ExplorerType } from "../../../../database/api/.generated";
|
1
2
|
import { t } from "elysia";
|
2
3
|
// ─── DTOs ────────────────────────────────────────────────────────────────────
|
3
4
|
export const ChainResourceDto = t.Object({
|
@@ -26,3 +27,10 @@ export const UpdateChainDto = t.Object({
|
|
26
27
|
icon: t.Optional(t.String({ format: "uri" })),
|
27
28
|
// iconFile: t.Optional(t.File()),
|
28
29
|
});
|
30
|
+
export const CreateChainDto = t.Object({
|
31
|
+
id: t.Numeric(),
|
32
|
+
name: t.String(),
|
33
|
+
icon: t.String({ format: "uri" }),
|
34
|
+
explorerType: t.Enum(ExplorerType),
|
35
|
+
explorerUrl: t.String({ format: "uri" }),
|
36
|
+
});
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Campaign, CampaignParameters } from "@sdk";
|
2
|
-
import type {
|
2
|
+
import type { ChainSearchDto, CreateChainModel, UpdateChainModel } from "./chain.model";
|
3
3
|
export declare abstract class ChainRepository {
|
4
4
|
#private;
|
5
5
|
/**
|
@@ -45,7 +45,7 @@ export declare abstract class ChainRepository {
|
|
45
45
|
* @param template for chain creation
|
46
46
|
* @returns
|
47
47
|
*/
|
48
|
-
static create(
|
48
|
+
static create(data: CreateChainModel): Promise<{
|
49
49
|
name: string;
|
50
50
|
id: number;
|
51
51
|
icon: string;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { campaignsDynamicData } from "../../../libs/campaigns/campaignsDynamicData";
|
2
2
|
import { executeSimple } from "../../../utils/execute";
|
3
3
|
import { apiDbClient } from "../../../utils/prisma";
|
4
|
+
import { ExplorerRepository } from "../explorer/explorer.repository";
|
4
5
|
export class ChainRepository {
|
5
6
|
/**
|
6
7
|
* @param id ChainId
|
@@ -44,8 +45,16 @@ export class ChainRepository {
|
|
44
45
|
* @param template for chain creation
|
45
46
|
* @returns
|
46
47
|
*/
|
47
|
-
static async create(
|
48
|
-
|
48
|
+
static async create(data) {
|
49
|
+
const explorerId = await ExplorerRepository.create(data.id, data.explorerType, data.explorerUrl);
|
50
|
+
return apiDbClient.chain.create({
|
51
|
+
data: {
|
52
|
+
id: data.id,
|
53
|
+
icon: data.icon,
|
54
|
+
name: data.name,
|
55
|
+
Explorer: { connect: { id: explorerId.id } },
|
56
|
+
},
|
57
|
+
});
|
49
58
|
}
|
50
59
|
static async findMany() {
|
51
60
|
return apiDbClient.chain.findMany();
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { ChainSearchDto, UpdateChainModel } from "./chain.model";
|
1
|
+
import type { ChainSearchDto, CreateChainModel, UpdateChainModel } from "./chain.model";
|
2
2
|
export declare abstract class ChainService {
|
3
3
|
static get(chainId: number): Promise<({
|
4
4
|
Explorer: {
|
@@ -39,6 +39,11 @@ export declare abstract class ChainService {
|
|
39
39
|
* @returns an array of chainId
|
40
40
|
*/
|
41
41
|
static getSupportedIds(): Promise<number[]>;
|
42
|
+
static create(chain: CreateChainModel): Promise<{
|
43
|
+
name: string;
|
44
|
+
id: number;
|
45
|
+
icon: string;
|
46
|
+
}>;
|
42
47
|
static update(id: number, data: UpdateChainModel): Promise<{
|
43
48
|
name: string;
|
44
49
|
id: number;
|
@@ -39,11 +39,10 @@ export class ChainService {
|
|
39
39
|
}
|
40
40
|
return supportedIds;
|
41
41
|
}
|
42
|
+
static async create(chain) {
|
43
|
+
return await ChainRepository.create(chain);
|
44
|
+
}
|
42
45
|
static async update(id, data) {
|
43
|
-
// let iconUri = data.icon;
|
44
|
-
// if (data.iconFile) {
|
45
|
-
// iconUri = await BucketService.upload("merkl-assets", `/chains/${id}`, data.iconFile.stream(), true);
|
46
|
-
// }
|
47
46
|
return await ChainRepository.update(id, data);
|
48
47
|
}
|
49
48
|
}
|
@@ -1978,6 +1978,32 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1978
1978
|
};
|
1979
1979
|
};
|
1980
1980
|
};
|
1981
|
+
} & {
|
1982
|
+
chains: {
|
1983
|
+
index: {
|
1984
|
+
post: {
|
1985
|
+
body: {
|
1986
|
+
name: string;
|
1987
|
+
id: number;
|
1988
|
+
icon: string;
|
1989
|
+
explorerType: "ETHERSCAN" | "BLOCKSCOUT";
|
1990
|
+
explorerUrl: string;
|
1991
|
+
};
|
1992
|
+
params: {};
|
1993
|
+
query: unknown;
|
1994
|
+
headers: {
|
1995
|
+
authorization: string;
|
1996
|
+
};
|
1997
|
+
response: {
|
1998
|
+
200: {
|
1999
|
+
name: string;
|
2000
|
+
id: number;
|
2001
|
+
icon: string;
|
2002
|
+
};
|
2003
|
+
};
|
2004
|
+
};
|
2005
|
+
};
|
2006
|
+
};
|
1981
2007
|
};
|
1982
2008
|
} & {
|
1983
2009
|
v4: {
|