@merkl/api 0.10.280 → 0.10.282
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 +68 -65
- package/dist/src/index.d.ts +30 -25
- package/dist/src/libs/campaigns/campaignTypes/CLAMMDynamicData.js +2 -8
- package/dist/src/modules/v4/boost/boost.controller.d.ts +44 -0
- package/dist/src/modules/v4/boost/boost.controller.js +14 -0
- package/dist/src/modules/v4/boost/boost.model.d.ts +6 -0
- package/dist/src/modules/v4/boost/boost.model.js +10 -0
- package/dist/src/modules/v4/boost/boost.service.d.ts +3 -0
- package/dist/src/modules/v4/boost/boost.service.js +6 -0
- package/dist/src/modules/v4/boost/index.d.ts +2 -0
- package/dist/src/modules/v4/boost/index.js +2 -0
- package/dist/src/modules/v4/chain/chain.controller.d.ts +6 -25
- package/dist/src/modules/v4/chain/chain.controller.js +1 -12
- package/dist/src/modules/v4/chain/chain.model.d.ts +0 -8
- package/dist/src/modules/v4/chain/chain.model.js +0 -6
- package/dist/src/modules/v4/explorer/explorer.controller.d.ts +45 -0
- package/dist/src/modules/v4/explorer/explorer.controller.js +13 -0
- package/dist/src/modules/v4/explorer/explorer.model.d.ts +9 -0
- package/dist/src/modules/v4/explorer/explorer.model.js +7 -1
- package/dist/src/modules/v4/explorer/explorer.service.d.ts +2 -2
- package/dist/src/modules/v4/explorer/explorer.service.js +2 -2
- package/dist/src/modules/v4/reward/reward.service.js +1 -1
- package/dist/src/modules/v4/router.d.ts +30 -25
- package/dist/src/modules/v4/router.js +3 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -1265,26 +1265,6 @@ declare const eden: {
|
|
1265
1265
|
200: number;
|
1266
1266
|
}>>;
|
1267
1267
|
};
|
1268
|
-
explorers: {
|
1269
|
-
post: (body: {
|
1270
|
-
type: "ETHERSCAN" | "BLOCKSCOUT";
|
1271
|
-
url: string;
|
1272
|
-
chainId: number;
|
1273
|
-
}, options: {
|
1274
|
-
headers: {
|
1275
|
-
authorization: string;
|
1276
|
-
};
|
1277
|
-
query?: Record<string, unknown> | undefined;
|
1278
|
-
fetch?: RequestInit | undefined;
|
1279
|
-
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
1280
|
-
200: {
|
1281
|
-
type: import("../../database/api/.generated").$Enums.ExplorerType;
|
1282
|
-
url: string;
|
1283
|
-
id: string;
|
1284
|
-
chainId: number;
|
1285
|
-
};
|
1286
|
-
}>>;
|
1287
|
-
};
|
1288
1268
|
};
|
1289
1269
|
prices: {
|
1290
1270
|
index: {
|
@@ -2210,6 +2190,25 @@ declare const eden: {
|
|
2210
2190
|
}>>;
|
2211
2191
|
};
|
2212
2192
|
};
|
2193
|
+
boosts: {
|
2194
|
+
euler: {
|
2195
|
+
post: (body: {
|
2196
|
+
address: string;
|
2197
|
+
score: string;
|
2198
|
+
}[] | {
|
2199
|
+
addresses: string[];
|
2200
|
+
}, options: {
|
2201
|
+
headers: {
|
2202
|
+
authorization: string;
|
2203
|
+
};
|
2204
|
+
query?: Record<string, unknown> | undefined;
|
2205
|
+
fetch?: RequestInit | undefined;
|
2206
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
2207
|
+
[x: string]: any;
|
2208
|
+
200: any;
|
2209
|
+
}>>;
|
2210
|
+
};
|
2211
|
+
};
|
2213
2212
|
};
|
2214
2213
|
v3: {
|
2215
2214
|
app: {
|
@@ -4252,7 +4251,9 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4252
4251
|
};
|
4253
4252
|
};
|
4254
4253
|
};
|
4255
|
-
}
|
4254
|
+
};
|
4255
|
+
} & {
|
4256
|
+
chains: {
|
4256
4257
|
index: {
|
4257
4258
|
get: {
|
4258
4259
|
body: unknown;
|
@@ -4276,7 +4277,9 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4276
4277
|
};
|
4277
4278
|
};
|
4278
4279
|
};
|
4279
|
-
}
|
4280
|
+
};
|
4281
|
+
} & {
|
4282
|
+
chains: {
|
4280
4283
|
count: {
|
4281
4284
|
get: {
|
4282
4285
|
body: unknown;
|
@@ -4290,29 +4293,6 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4290
4293
|
};
|
4291
4294
|
};
|
4292
4295
|
};
|
4293
|
-
} & {
|
4294
|
-
explorers: {
|
4295
|
-
post: {
|
4296
|
-
body: {
|
4297
|
-
type: "ETHERSCAN" | "BLOCKSCOUT";
|
4298
|
-
url: string;
|
4299
|
-
chainId: number;
|
4300
|
-
};
|
4301
|
-
params: {};
|
4302
|
-
query: unknown;
|
4303
|
-
headers: {
|
4304
|
-
authorization: string;
|
4305
|
-
};
|
4306
|
-
response: {
|
4307
|
-
200: {
|
4308
|
-
type: import("../../database/api/.generated").$Enums.ExplorerType;
|
4309
|
-
url: string;
|
4310
|
-
id: string;
|
4311
|
-
chainId: number;
|
4312
|
-
};
|
4313
|
-
};
|
4314
|
-
};
|
4315
|
-
};
|
4316
4296
|
};
|
4317
4297
|
} & {
|
4318
4298
|
chains: {
|
@@ -5545,6 +5525,30 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
5545
5525
|
};
|
5546
5526
|
};
|
5547
5527
|
};
|
5528
|
+
} & {
|
5529
|
+
v4: {
|
5530
|
+
boosts: {
|
5531
|
+
euler: {
|
5532
|
+
post: {
|
5533
|
+
body: {
|
5534
|
+
addresses: string[];
|
5535
|
+
} | {
|
5536
|
+
address: string;
|
5537
|
+
score: string;
|
5538
|
+
}[];
|
5539
|
+
params: {};
|
5540
|
+
query: unknown;
|
5541
|
+
headers: {
|
5542
|
+
authorization: string;
|
5543
|
+
};
|
5544
|
+
response: {
|
5545
|
+
[x: string]: any;
|
5546
|
+
200: any;
|
5547
|
+
};
|
5548
|
+
};
|
5549
|
+
};
|
5550
|
+
};
|
5551
|
+
};
|
5548
5552
|
} & {
|
5549
5553
|
v3: {
|
5550
5554
|
app: {
|
@@ -7570,26 +7574,6 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
7570
7574
|
200: number;
|
7571
7575
|
}>>;
|
7572
7576
|
};
|
7573
|
-
explorers: {
|
7574
|
-
post: (body: {
|
7575
|
-
type: "ETHERSCAN" | "BLOCKSCOUT";
|
7576
|
-
url: string;
|
7577
|
-
chainId: number;
|
7578
|
-
}, options: {
|
7579
|
-
headers: {
|
7580
|
-
authorization: string;
|
7581
|
-
};
|
7582
|
-
query?: Record<string, unknown> | undefined;
|
7583
|
-
fetch?: RequestInit | undefined;
|
7584
|
-
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
7585
|
-
200: {
|
7586
|
-
type: import("../../database/api/.generated").$Enums.ExplorerType;
|
7587
|
-
url: string;
|
7588
|
-
id: string;
|
7589
|
-
chainId: number;
|
7590
|
-
};
|
7591
|
-
}>>;
|
7592
|
-
};
|
7593
7577
|
};
|
7594
7578
|
prices: {
|
7595
7579
|
index: {
|
@@ -8515,6 +8499,25 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
8515
8499
|
}>>;
|
8516
8500
|
};
|
8517
8501
|
};
|
8502
|
+
boosts: {
|
8503
|
+
euler: {
|
8504
|
+
post: (body: {
|
8505
|
+
address: string;
|
8506
|
+
score: string;
|
8507
|
+
}[] | {
|
8508
|
+
addresses: string[];
|
8509
|
+
}, options: {
|
8510
|
+
headers: {
|
8511
|
+
authorization: string;
|
8512
|
+
};
|
8513
|
+
query?: Record<string, unknown> | undefined;
|
8514
|
+
fetch?: RequestInit | undefined;
|
8515
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
8516
|
+
[x: string]: any;
|
8517
|
+
200: any;
|
8518
|
+
}>>;
|
8519
|
+
};
|
8520
|
+
};
|
8518
8521
|
};
|
8519
8522
|
v3: {
|
8520
8523
|
app: {
|
package/dist/src/index.d.ts
CHANGED
@@ -1457,7 +1457,9 @@ declare const app: Elysia<"", false, {
|
|
1457
1457
|
};
|
1458
1458
|
};
|
1459
1459
|
};
|
1460
|
-
}
|
1460
|
+
};
|
1461
|
+
} & {
|
1462
|
+
chains: {
|
1461
1463
|
index: {
|
1462
1464
|
get: {
|
1463
1465
|
body: unknown;
|
@@ -1481,7 +1483,9 @@ declare const app: Elysia<"", false, {
|
|
1481
1483
|
};
|
1482
1484
|
};
|
1483
1485
|
};
|
1484
|
-
}
|
1486
|
+
};
|
1487
|
+
} & {
|
1488
|
+
chains: {
|
1485
1489
|
count: {
|
1486
1490
|
get: {
|
1487
1491
|
body: unknown;
|
@@ -1495,29 +1499,6 @@ declare const app: Elysia<"", false, {
|
|
1495
1499
|
};
|
1496
1500
|
};
|
1497
1501
|
};
|
1498
|
-
} & {
|
1499
|
-
explorers: {
|
1500
|
-
post: {
|
1501
|
-
body: {
|
1502
|
-
type: "ETHERSCAN" | "BLOCKSCOUT";
|
1503
|
-
url: string;
|
1504
|
-
chainId: number;
|
1505
|
-
};
|
1506
|
-
params: {};
|
1507
|
-
query: unknown;
|
1508
|
-
headers: {
|
1509
|
-
authorization: string;
|
1510
|
-
};
|
1511
|
-
response: {
|
1512
|
-
200: {
|
1513
|
-
type: import("../database/api/.generated").$Enums.ExplorerType;
|
1514
|
-
url: string;
|
1515
|
-
id: string;
|
1516
|
-
chainId: number;
|
1517
|
-
};
|
1518
|
-
};
|
1519
|
-
};
|
1520
|
-
};
|
1521
1502
|
};
|
1522
1503
|
} & {
|
1523
1504
|
chains: {
|
@@ -2750,6 +2731,30 @@ declare const app: Elysia<"", false, {
|
|
2750
2731
|
};
|
2751
2732
|
};
|
2752
2733
|
};
|
2734
|
+
} & {
|
2735
|
+
v4: {
|
2736
|
+
boosts: {
|
2737
|
+
euler: {
|
2738
|
+
post: {
|
2739
|
+
body: {
|
2740
|
+
addresses: string[];
|
2741
|
+
} | {
|
2742
|
+
address: string;
|
2743
|
+
score: string;
|
2744
|
+
}[];
|
2745
|
+
params: {};
|
2746
|
+
query: unknown;
|
2747
|
+
headers: {
|
2748
|
+
authorization: string;
|
2749
|
+
};
|
2750
|
+
response: {
|
2751
|
+
[x: string]: any;
|
2752
|
+
200: any;
|
2753
|
+
};
|
2754
|
+
};
|
2755
|
+
};
|
2756
|
+
};
|
2757
|
+
};
|
2753
2758
|
} & {
|
2754
2759
|
v3: {
|
2755
2760
|
app: {
|
@@ -67,10 +67,7 @@ export async function CLAMMDynamicData(chainId, campaigns) {
|
|
67
67
|
A51Strategies = await fetchA51Strategies(chainId, [...new Set(A51Pools)]);
|
68
68
|
}
|
69
69
|
for (const pool of poolList) {
|
70
|
-
|
71
|
-
if (pool.amm === AMM.SyncswapV3) {
|
72
|
-
poolInterface = PoolInterface[AMMAlgorithm.Neptune];
|
73
|
-
}
|
70
|
+
const poolInterface = PoolInterface[AMMAlgorithmMapping[pool.amm]];
|
74
71
|
const d = campaigns?.filter(campaign => campaign.mainParameter.toLowerCase() === pool.mainParameter.toLowerCase())[0];
|
75
72
|
calls.push({
|
76
73
|
allowFailure: true,
|
@@ -287,10 +284,7 @@ export async function CLAMMDynamicData(chainId, campaigns) {
|
|
287
284
|
let i = 0;
|
288
285
|
if (!!poolList) {
|
289
286
|
for (const pool of poolList) {
|
290
|
-
|
291
|
-
if (pool.amm === AMM.SyncswapV3) {
|
292
|
-
poolInterface = PoolInterface[AMMAlgorithm.Neptune];
|
293
|
-
}
|
287
|
+
const poolInterface = PoolInterface[AMMAlgorithmMapping[pool.amm]];
|
294
288
|
// This liquidity call gives the active liquidity on the pool. To get the total liquidity we would need to loop over all positions
|
295
289
|
let poolTotalLiquidity;
|
296
290
|
let sqrtPrice;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import Elysia from "elysia";
|
2
|
+
export declare const BoostController: Elysia<"/boosts", false, {
|
3
|
+
decorator: {};
|
4
|
+
store: {};
|
5
|
+
derive: {};
|
6
|
+
resolve: {};
|
7
|
+
}, {
|
8
|
+
type: {};
|
9
|
+
error: {};
|
10
|
+
}, {
|
11
|
+
schema: {};
|
12
|
+
macro: {};
|
13
|
+
macroFn: {};
|
14
|
+
}, {
|
15
|
+
boosts: {
|
16
|
+
euler: {
|
17
|
+
post: {
|
18
|
+
body: {
|
19
|
+
addresses: string[];
|
20
|
+
} | {
|
21
|
+
address: string;
|
22
|
+
score: string;
|
23
|
+
}[];
|
24
|
+
params: {};
|
25
|
+
query: unknown;
|
26
|
+
headers: {
|
27
|
+
authorization: string;
|
28
|
+
};
|
29
|
+
response: {
|
30
|
+
[x: string]: any;
|
31
|
+
200: any;
|
32
|
+
};
|
33
|
+
};
|
34
|
+
};
|
35
|
+
};
|
36
|
+
}, {
|
37
|
+
derive: {};
|
38
|
+
resolve: {};
|
39
|
+
schema: {};
|
40
|
+
}, {
|
41
|
+
derive: {};
|
42
|
+
resolve: {};
|
43
|
+
schema: {};
|
44
|
+
}>;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { AuthorizationHeadersDto, BackOfficeGuard } from "../../../guards/BackOffice.guard";
|
2
|
+
import Elysia from "elysia";
|
3
|
+
import { getEulerBoostBody } from "./boost.model";
|
4
|
+
import { BoostService } from "./boost.service";
|
5
|
+
export const BoostController = new Elysia({ prefix: "/boosts", detail: { tags: ["Boosts"], hide: true } })
|
6
|
+
// ─── Get Euler Boost ─────────────────────────────────────────────────
|
7
|
+
.post("/euler", async ({ body }) => await BoostService.getEulerBoost(), {
|
8
|
+
body: getEulerBoostBody,
|
9
|
+
headers: AuthorizationHeadersDto,
|
10
|
+
beforeHandle: async ({ headers }) => {
|
11
|
+
await BackOfficeGuard({ headers });
|
12
|
+
},
|
13
|
+
detail: { hide: true },
|
14
|
+
});
|
@@ -0,0 +1,6 @@
|
|
1
|
+
export declare const getEulerBoostBody: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
2
|
+
addresses: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
3
|
+
}>, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
4
|
+
address: import("@sinclair/typebox").TString;
|
5
|
+
score: import("@sinclair/typebox").TString;
|
6
|
+
}>>]>;
|
@@ -36,7 +36,9 @@ export declare const ChainController: Elysia<"/chains", false, {
|
|
36
36
|
};
|
37
37
|
};
|
38
38
|
};
|
39
|
-
}
|
39
|
+
};
|
40
|
+
} & {
|
41
|
+
chains: {
|
40
42
|
index: {
|
41
43
|
get: {
|
42
44
|
body: unknown;
|
@@ -60,7 +62,9 @@ export declare const ChainController: Elysia<"/chains", false, {
|
|
60
62
|
};
|
61
63
|
};
|
62
64
|
};
|
63
|
-
}
|
65
|
+
};
|
66
|
+
} & {
|
67
|
+
chains: {
|
64
68
|
count: {
|
65
69
|
get: {
|
66
70
|
body: unknown;
|
@@ -74,29 +78,6 @@ export declare const ChainController: Elysia<"/chains", false, {
|
|
74
78
|
};
|
75
79
|
};
|
76
80
|
};
|
77
|
-
} & {
|
78
|
-
explorers: {
|
79
|
-
post: {
|
80
|
-
body: {
|
81
|
-
type: "ETHERSCAN" | "BLOCKSCOUT";
|
82
|
-
url: string;
|
83
|
-
chainId: number;
|
84
|
-
};
|
85
|
-
params: {};
|
86
|
-
query: unknown;
|
87
|
-
headers: {
|
88
|
-
authorization: string;
|
89
|
-
};
|
90
|
-
response: {
|
91
|
-
200: {
|
92
|
-
type: import("../../../../database/api/.generated").$Enums.ExplorerType;
|
93
|
-
url: string;
|
94
|
-
id: string;
|
95
|
-
chainId: number;
|
96
|
-
};
|
97
|
-
};
|
98
|
-
};
|
99
|
-
};
|
100
81
|
};
|
101
82
|
} & {
|
102
83
|
chains: {
|
@@ -1,8 +1,6 @@
|
|
1
1
|
import { AuthorizationHeadersDto, BackOfficeGuard } from "../../../guards/BackOffice.guard";
|
2
|
-
import { TokenAuthGuard } from "../../../guards/TokenAuth.guard";
|
3
2
|
import Elysia, { t } from "elysia";
|
4
|
-
import {
|
5
|
-
import { ChainResourceDto, ChainUniqueDto, CreateChainExplorerDto, GetChainQueryDto, UpdateChainDto, } from "./chain.model";
|
3
|
+
import { ChainResourceDto, ChainUniqueDto, GetChainQueryDto, UpdateChainDto } from "./chain.model";
|
6
4
|
import { ChainService } from "./chain.service";
|
7
5
|
// ─── Chains Controller ───────────────────────────────────────────────────────
|
8
6
|
export const ChainController = new Elysia({ prefix: "/chains", detail: { tags: ["Chains"] } })
|
@@ -30,15 +28,6 @@ export const ChainController = new Elysia({ prefix: "/chains", detail: { tags: [
|
|
30
28
|
.get("/count", async ({ query }) => await ChainService.countMany(query), {
|
31
29
|
query: GetChainQueryDto,
|
32
30
|
detail: { hide: true },
|
33
|
-
})
|
34
|
-
.group("/explorers", app => {
|
35
|
-
// ─── Create An Explorer ──────────────────────────────────────
|
36
|
-
return app.post("", async ({ body: { chainId, type, url } }) => await ExplorerService.create(chainId, type, url), {
|
37
|
-
beforeHandle: TokenAuthGuard,
|
38
|
-
headers: AuthorizationHeadersDto,
|
39
|
-
body: CreateChainExplorerDto,
|
40
|
-
detail: { hide: true },
|
41
|
-
});
|
42
31
|
})
|
43
32
|
.patch("/:chainId", async ({ params, body }) => await ChainService.update(params.chainId, body), {
|
44
33
|
params: ChainUniqueDto,
|
@@ -22,14 +22,6 @@ export declare const ChainUniqueOptionalDto: import("@sinclair/typebox").TObject
|
|
22
22
|
export declare const ChainArrayOptionalDto: import("@sinclair/typebox").TObject<{
|
23
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[]>>;
|
24
24
|
}>;
|
25
|
-
export declare const CreateChainExplorerDto: import("@sinclair/typebox").TObject<{
|
26
|
-
type: import("@sinclair/typebox").TEnum<{
|
27
|
-
ETHERSCAN: "ETHERSCAN";
|
28
|
-
BLOCKSCOUT: "BLOCKSCOUT";
|
29
|
-
}>;
|
30
|
-
chainId: import("@sinclair/typebox").TNumber;
|
31
|
-
url: import("@sinclair/typebox").TString;
|
32
|
-
}>;
|
33
25
|
export declare const UpdateChainDto: import("@sinclair/typebox").TObject<{
|
34
26
|
icon: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
35
27
|
}>;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { ExplorerType } from "../../../../database/api/.generated";
|
2
1
|
import { t } from "elysia";
|
3
2
|
// ─── DTOs ────────────────────────────────────────────────────────────────────
|
4
3
|
export const ChainResourceDto = t.Object({
|
@@ -23,11 +22,6 @@ export const ChainArrayOptionalDto = t.Object({
|
|
23
22
|
}, {
|
24
23
|
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
24
|
});
|
26
|
-
export const CreateChainExplorerDto = t.Object({
|
27
|
-
type: t.Enum(ExplorerType),
|
28
|
-
chainId: t.Number(),
|
29
|
-
url: t.String(),
|
30
|
-
});
|
31
25
|
export const UpdateChainDto = t.Object({
|
32
26
|
icon: t.Optional(t.String({ format: "uri" })),
|
33
27
|
// iconFile: t.Optional(t.File()),
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import Elysia from "elysia";
|
2
|
+
export declare const ExplorerController: Elysia<"/explorers", false, {
|
3
|
+
decorator: {};
|
4
|
+
store: {};
|
5
|
+
derive: {};
|
6
|
+
resolve: {};
|
7
|
+
}, {
|
8
|
+
type: {};
|
9
|
+
error: {};
|
10
|
+
}, {
|
11
|
+
schema: {};
|
12
|
+
macro: {};
|
13
|
+
macroFn: {};
|
14
|
+
}, {
|
15
|
+
explorers: {
|
16
|
+
post: {
|
17
|
+
body: {
|
18
|
+
type: "ETHERSCAN" | "BLOCKSCOUT";
|
19
|
+
url: string;
|
20
|
+
chainId: number;
|
21
|
+
};
|
22
|
+
params: {};
|
23
|
+
query: unknown;
|
24
|
+
headers: {
|
25
|
+
authorization: string;
|
26
|
+
};
|
27
|
+
response: {
|
28
|
+
200: {
|
29
|
+
type: import("../../../../database/api/.generated").$Enums.ExplorerType;
|
30
|
+
url: string;
|
31
|
+
id: string;
|
32
|
+
chainId: number;
|
33
|
+
};
|
34
|
+
};
|
35
|
+
};
|
36
|
+
};
|
37
|
+
}, {
|
38
|
+
derive: {};
|
39
|
+
resolve: {};
|
40
|
+
schema: {};
|
41
|
+
}, {
|
42
|
+
derive: {};
|
43
|
+
resolve: {};
|
44
|
+
schema: {};
|
45
|
+
}>;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { AuthorizationHeadersDto, BackOfficeGuard } from "../../../guards/BackOffice.guard";
|
2
|
+
import Elysia from "elysia";
|
3
|
+
import { ExplorerService } from ".";
|
4
|
+
import { CreateExplorerDto } from "./explorer.model";
|
5
|
+
// ─── Explorer Controller ───────────────────────────────────────────────────────
|
6
|
+
export const ExplorerController = new Elysia({ prefix: "/explorers", detail: { tags: ["Explorers"] } })
|
7
|
+
// ─── Create An Explorer ──────────────────────────────────────
|
8
|
+
.post("", async ({ body }) => await ExplorerService.create(body), {
|
9
|
+
beforeHandle: BackOfficeGuard,
|
10
|
+
headers: AuthorizationHeadersDto,
|
11
|
+
body: CreateExplorerDto,
|
12
|
+
detail: { hide: true },
|
13
|
+
});
|
@@ -5,3 +5,12 @@ import type { Resource } from "../prisma";
|
|
5
5
|
* @see {@link Resource}
|
6
6
|
*/
|
7
7
|
export type Explorer = Resource<"Explorer", "id">;
|
8
|
+
export declare const CreateExplorerDto: import("@sinclair/typebox").TObject<{
|
9
|
+
chainId: import("@sinclair/typebox").TNumber;
|
10
|
+
type: import("@sinclair/typebox").TEnum<{
|
11
|
+
ETHERSCAN: "ETHERSCAN";
|
12
|
+
BLOCKSCOUT: "BLOCKSCOUT";
|
13
|
+
}>;
|
14
|
+
url: import("@sinclair/typebox").TString;
|
15
|
+
}>;
|
16
|
+
export type CreateExplorerDto = typeof CreateExplorerDto.static;
|
@@ -1,2 +1,8 @@
|
|
1
1
|
// ─── Schemas ─────────────────────────────────────────────────────────────────
|
2
|
-
|
2
|
+
import { ExplorerType } from "../../../../database/api/.generated";
|
3
|
+
import { t } from "elysia";
|
4
|
+
export const CreateExplorerDto = t.Object({
|
5
|
+
chainId: t.Numeric(),
|
6
|
+
type: t.Enum(ExplorerType),
|
7
|
+
url: t.String(),
|
8
|
+
});
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { ExplorerType } from "../../../../database/api/.generated";
|
2
|
-
import type { Explorer } from "./explorer.model";
|
2
|
+
import type { CreateExplorerDto, Explorer } from "./explorer.model";
|
3
3
|
export declare abstract class ExplorerService {
|
4
4
|
static hashId(type: ExplorerType, chainId: number): string;
|
5
5
|
static getByChainId(chainId: number): Promise<{
|
@@ -19,7 +19,7 @@ export declare abstract class ExplorerService {
|
|
19
19
|
* @param type that defines the subsequents links for transactions, addresses...
|
20
20
|
* @param url base url without / suffix
|
21
21
|
*/
|
22
|
-
static create(
|
22
|
+
static create(data: CreateExplorerDto): Promise<{
|
23
23
|
type: import("../../../../database/api/.generated").$Enums.ExplorerType;
|
24
24
|
url: string;
|
25
25
|
id: string;
|
@@ -18,7 +18,7 @@ export class ExplorerService {
|
|
18
18
|
* @param type that defines the subsequents links for transactions, addresses...
|
19
19
|
* @param url base url without / suffix
|
20
20
|
*/
|
21
|
-
static async create(
|
22
|
-
return
|
21
|
+
static async create(data) {
|
22
|
+
return ExplorerRepository.create(data.chainId, data.type, data.url);
|
23
23
|
}
|
24
24
|
}
|
@@ -238,7 +238,7 @@ export class RewardService {
|
|
238
238
|
distributionChain: data.distributionChainId,
|
239
239
|
campaignId: data.campaignId,
|
240
240
|
});
|
241
|
-
const ids = (await RewardRepository.findManyBreakdownUniques(rewardTokenId,
|
241
|
+
const ids = (await RewardRepository.findManyBreakdownUniques(rewardTokenId, data.root, campaignId)).map(({ Reward, reason }) => Bun.hash(`${Reward.recipient}${reason}`).toString());
|
242
242
|
const toUpdate = [];
|
243
243
|
const toCreate = [];
|
244
244
|
for (const point of data.data) {
|