@merkl/api 0.15.41 → 0.15.43

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.
@@ -31,7 +31,7 @@ export declare const DOPEX_OPTION_MARKET: {
31
31
  [market: string]: string;
32
32
  };
33
33
  export declare const constantChain: {
34
- [x: number]: {
34
+ [ChainId.MAINNET]: {
35
35
  apw: string;
36
36
  convexEndpoint: string;
37
37
  crv: string;
@@ -55,28 +55,8 @@ export declare const constantChain: {
55
55
  usdc: string;
56
56
  weth: string;
57
57
  wstETH: string;
58
- arb?: undefined;
59
- chr?: undefined;
60
- convexProxy?: undefined;
61
- crv2Pool?: undefined;
62
- jeur?: undefined;
63
- ram?: undefined;
64
- sliz?: undefined;
65
- mai?: undefined;
66
- op?: undefined;
67
- usdce?: undefined;
68
- velo?: undefined;
69
- veloV2?: undefined;
70
- aero?: undefined;
71
- am3CRV?: undefined;
72
- amDAI?: undefined;
73
- amUSDC?: undefined;
74
- amUSDT?: undefined;
75
- jrt?: undefined;
76
- oretro?: undefined;
77
- glcr?: undefined;
78
- cake?: undefined;
79
- } | {
58
+ };
59
+ [ChainId.ARBITRUM]: {
80
60
  arb: string;
81
61
  chr: string;
82
62
  convexProxy: string;
@@ -90,38 +70,8 @@ export declare const constantChain: {
90
70
  sliz: string;
91
71
  stakeEndpoint: string;
92
72
  usdc: string;
93
- apw?: undefined;
94
- convexEndpoint?: undefined;
95
- crv3?: undefined;
96
- crvANGLESDANGLE?: undefined;
97
- crvEURAEUROC?: undefined;
98
- crvEURAEURe?: undefined;
99
- crvEuropool?: undefined;
100
- crvFRAX?: undefined;
101
- crvFRAXEURA?: undefined;
102
- crvLUSD3CRV?: undefined;
103
- dai?: undefined;
104
- fxs?: undefined;
105
- morpho?: undefined;
106
- rKP3R?: undefined;
107
- sushi?: undefined;
108
- weth?: undefined;
109
- wstETH?: undefined;
110
- mai?: undefined;
111
- op?: undefined;
112
- usdce?: undefined;
113
- velo?: undefined;
114
- veloV2?: undefined;
115
- aero?: undefined;
116
- am3CRV?: undefined;
117
- amDAI?: undefined;
118
- amUSDC?: undefined;
119
- amUSDT?: undefined;
120
- jrt?: undefined;
121
- oretro?: undefined;
122
- glcr?: undefined;
123
- cake?: undefined;
124
- } | {
73
+ };
74
+ [ChainId.OPTIMISM]: {
125
75
  jeur: string;
126
76
  mai: string;
127
77
  op: string;
@@ -129,89 +79,12 @@ export declare const constantChain: {
129
79
  usdce: string;
130
80
  velo: string;
131
81
  veloV2: string;
132
- apw?: undefined;
133
- convexEndpoint?: undefined;
134
- crv?: undefined;
135
- crv3?: undefined;
136
- crvANGLESDANGLE?: undefined;
137
- crvEURAEUROC?: undefined;
138
- crvEURAEURe?: undefined;
139
- crvEuropool?: undefined;
140
- crvFRAX?: undefined;
141
- crvFRAXEURA?: undefined;
142
- crvLUSD3CRV?: undefined;
143
- cvx?: undefined;
144
- dai?: undefined;
145
- frax?: undefined;
146
- fxs?: undefined;
147
- morpho?: undefined;
148
- rKP3R?: undefined;
149
- sdt?: undefined;
150
- stakeEndpoint?: undefined;
151
- sushi?: undefined;
152
- weth?: undefined;
153
- wstETH?: undefined;
154
- arb?: undefined;
155
- chr?: undefined;
156
- convexProxy?: undefined;
157
- crv2Pool?: undefined;
158
- ram?: undefined;
159
- sliz?: undefined;
160
- aero?: undefined;
161
- am3CRV?: undefined;
162
- amDAI?: undefined;
163
- amUSDC?: undefined;
164
- amUSDT?: undefined;
165
- jrt?: undefined;
166
- oretro?: undefined;
167
- glcr?: undefined;
168
- cake?: undefined;
169
- } | {
82
+ };
83
+ [ChainId.BASE]: {
170
84
  aero: string;
171
85
  usdc: string;
172
- apw?: undefined;
173
- convexEndpoint?: undefined;
174
- crv?: undefined;
175
- crv3?: undefined;
176
- crvANGLESDANGLE?: undefined;
177
- crvEURAEUROC?: undefined;
178
- crvEURAEURe?: undefined;
179
- crvEuropool?: undefined;
180
- crvFRAX?: undefined;
181
- crvFRAXEURA?: undefined;
182
- crvLUSD3CRV?: undefined;
183
- cvx?: undefined;
184
- dai?: undefined;
185
- frax?: undefined;
186
- fxs?: undefined;
187
- morpho?: undefined;
188
- rKP3R?: undefined;
189
- sdt?: undefined;
190
- stakeEndpoint?: undefined;
191
- sushi?: undefined;
192
- weth?: undefined;
193
- wstETH?: undefined;
194
- arb?: undefined;
195
- chr?: undefined;
196
- convexProxy?: undefined;
197
- crv2Pool?: undefined;
198
- jeur?: undefined;
199
- ram?: undefined;
200
- sliz?: undefined;
201
- mai?: undefined;
202
- op?: undefined;
203
- usdce?: undefined;
204
- velo?: undefined;
205
- veloV2?: undefined;
206
- am3CRV?: undefined;
207
- amDAI?: undefined;
208
- amUSDC?: undefined;
209
- amUSDT?: undefined;
210
- jrt?: undefined;
211
- oretro?: undefined;
212
- glcr?: undefined;
213
- cake?: undefined;
214
- } | {
86
+ };
87
+ [ChainId.POLYGON]: {
215
88
  am3CRV: string;
216
89
  amDAI: string;
217
90
  amUSDC: string;
@@ -220,132 +93,13 @@ export declare const constantChain: {
220
93
  jrt: string;
221
94
  oretro: string;
222
95
  usdc: string;
223
- apw?: undefined;
224
- convexEndpoint?: undefined;
225
- crv?: undefined;
226
- crv3?: undefined;
227
- crvANGLESDANGLE?: undefined;
228
- crvEURAEUROC?: undefined;
229
- crvEURAEURe?: undefined;
230
- crvEuropool?: undefined;
231
- crvFRAX?: undefined;
232
- crvFRAXEURA?: undefined;
233
- crvLUSD3CRV?: undefined;
234
- cvx?: undefined;
235
- dai?: undefined;
236
- frax?: undefined;
237
- fxs?: undefined;
238
- morpho?: undefined;
239
- rKP3R?: undefined;
240
- sdt?: undefined;
241
- stakeEndpoint?: undefined;
242
- sushi?: undefined;
243
- weth?: undefined;
244
- wstETH?: undefined;
245
- arb?: undefined;
246
- chr?: undefined;
247
- convexProxy?: undefined;
248
- crv2Pool?: undefined;
249
- ram?: undefined;
250
- sliz?: undefined;
251
- mai?: undefined;
252
- op?: undefined;
253
- usdce?: undefined;
254
- velo?: undefined;
255
- veloV2?: undefined;
256
- aero?: undefined;
257
- glcr?: undefined;
258
- cake?: undefined;
259
- } | {
96
+ };
97
+ [ChainId.AVALANCHE]: {
260
98
  glcr: string;
261
99
  usdc: string;
262
- apw?: undefined;
263
- convexEndpoint?: undefined;
264
- crv?: undefined;
265
- crv3?: undefined;
266
- crvANGLESDANGLE?: undefined;
267
- crvEURAEUROC?: undefined;
268
- crvEURAEURe?: undefined;
269
- crvEuropool?: undefined;
270
- crvFRAX?: undefined;
271
- crvFRAXEURA?: undefined;
272
- crvLUSD3CRV?: undefined;
273
- cvx?: undefined;
274
- dai?: undefined;
275
- frax?: undefined;
276
- fxs?: undefined;
277
- morpho?: undefined;
278
- rKP3R?: undefined;
279
- sdt?: undefined;
280
- stakeEndpoint?: undefined;
281
- sushi?: undefined;
282
- weth?: undefined;
283
- wstETH?: undefined;
284
- arb?: undefined;
285
- chr?: undefined;
286
- convexProxy?: undefined;
287
- crv2Pool?: undefined;
288
- jeur?: undefined;
289
- ram?: undefined;
290
- sliz?: undefined;
291
- mai?: undefined;
292
- op?: undefined;
293
- usdce?: undefined;
294
- velo?: undefined;
295
- veloV2?: undefined;
296
- aero?: undefined;
297
- am3CRV?: undefined;
298
- amDAI?: undefined;
299
- amUSDC?: undefined;
300
- amUSDT?: undefined;
301
- jrt?: undefined;
302
- oretro?: undefined;
303
- cake?: undefined;
304
- } | {
100
+ };
101
+ [ChainId.BSC]: {
305
102
  cake: string;
306
- apw?: undefined;
307
- convexEndpoint?: undefined;
308
- crv?: undefined;
309
- crv3?: undefined;
310
- crvANGLESDANGLE?: undefined;
311
- crvEURAEUROC?: undefined;
312
- crvEURAEURe?: undefined;
313
- crvEuropool?: undefined;
314
- crvFRAX?: undefined;
315
- crvFRAXEURA?: undefined;
316
- crvLUSD3CRV?: undefined;
317
- cvx?: undefined;
318
- dai?: undefined;
319
- frax?: undefined;
320
- fxs?: undefined;
321
- morpho?: undefined;
322
- rKP3R?: undefined;
323
- sdt?: undefined;
324
- stakeEndpoint?: undefined;
325
- sushi?: undefined;
326
- usdc?: undefined;
327
- weth?: undefined;
328
- wstETH?: undefined;
329
- arb?: undefined;
330
- chr?: undefined;
331
- convexProxy?: undefined;
332
- crv2Pool?: undefined;
333
- jeur?: undefined;
334
- ram?: undefined;
335
- sliz?: undefined;
336
- mai?: undefined;
337
- op?: undefined;
338
- usdce?: undefined;
339
- velo?: undefined;
340
- veloV2?: undefined;
341
- aero?: undefined;
342
- am3CRV?: undefined;
343
- amDAI?: undefined;
344
- amUSDC?: undefined;
345
- amUSDT?: undefined;
346
- jrt?: undefined;
347
- oretro?: undefined;
348
- glcr?: undefined;
349
103
  };
350
104
  };
351
105
  export declare const MAVERICK_ZKSYNC_BP_LENS_ADDRESS = "0xd32CE31CaC98CAC0631764B8286358c0606D87F9";
@@ -1753,9 +1753,12 @@ declare const eden: {
1753
1753
  fetch?: RequestInit | undefined;
1754
1754
  }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
1755
1755
  200: {
1756
- name: string;
1757
- id: number;
1758
- icon: string;
1756
+ Explorer: {
1757
+ type: import("../../database/api/.generated").$Enums.ExplorerType;
1758
+ url: string;
1759
+ id: string;
1760
+ chainId: number;
1761
+ }[];
1759
1762
  };
1760
1763
  }>>;
1761
1764
  };
@@ -4872,9 +4875,12 @@ declare const eden: {
4872
4875
  fetch?: RequestInit | undefined;
4873
4876
  }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
4874
4877
  200: {
4875
- name: string;
4876
- id: number;
4877
- icon: string;
4878
+ Explorer: {
4879
+ type: import("../../database/api/.generated").$Enums.ExplorerType;
4880
+ url: string;
4881
+ id: string;
4882
+ chainId: number;
4883
+ }[];
4878
4884
  };
4879
4885
  }>>;
4880
4886
  };
@@ -9062,9 +9068,12 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
9062
9068
  };
9063
9069
  response: {
9064
9070
  200: {
9065
- name: string;
9066
- id: number;
9067
- icon: string;
9071
+ Explorer: {
9072
+ type: import("../../database/api/.generated").$Enums.ExplorerType;
9073
+ url: string;
9074
+ id: string;
9075
+ chainId: number;
9076
+ }[];
9068
9077
  };
9069
9078
  };
9070
9079
  };
@@ -13466,9 +13475,12 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
13466
13475
  fetch?: RequestInit | undefined;
13467
13476
  }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
13468
13477
  200: {
13469
- name: string;
13470
- id: number;
13471
- icon: string;
13478
+ Explorer: {
13479
+ type: import("../../database/api/.generated").$Enums.ExplorerType;
13480
+ url: string;
13481
+ id: string;
13482
+ chainId: number;
13483
+ }[];
13472
13484
  };
13473
13485
  }>>;
13474
13486
  };
@@ -16585,9 +16597,12 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
16585
16597
  fetch?: RequestInit | undefined;
16586
16598
  }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
16587
16599
  200: {
16588
- name: string;
16589
- id: number;
16590
- icon: string;
16600
+ Explorer: {
16601
+ type: import("../../database/api/.generated").$Enums.ExplorerType;
16602
+ url: string;
16603
+ id: string;
16604
+ chainId: number;
16605
+ }[];
16591
16606
  };
16592
16607
  }>>;
16593
16608
  };
@@ -2126,9 +2126,12 @@ declare const app: Elysia<"", false, {
2126
2126
  };
2127
2127
  response: {
2128
2128
  200: {
2129
- name: string;
2130
- id: number;
2131
- icon: string;
2129
+ Explorer: {
2130
+ type: import("../database/api/.generated").$Enums.ExplorerType;
2131
+ url: string;
2132
+ id: string;
2133
+ chainId: number;
2134
+ }[];
2132
2135
  };
2133
2136
  };
2134
2137
  };
@@ -1,9 +1,9 @@
1
1
  // ─── Reward Breakdowns ETL ───────────────────────────────────────────────────
2
- if (!process.env.ENV || !process.env.CHAIN_ID || !process.env.ROOT)
2
+ if (!process.env.DATABASE_API_URL || !process.env.ENV || !process.env.CHAIN_ID || !process.env.ROOT)
3
3
  throw new Error("[ENV]: missing variable");
4
+ import { BucketService } from "../../modules/v4/bucket/bucket.service";
4
5
  import { log } from "../../utils/logger";
5
6
  import { apiDbClient } from "../../utils/prisma";
6
- import { withRetry } from "@sdk";
7
7
  import { S3Client } from "bun";
8
8
  import moment from "moment";
9
9
  // ─── Global Variables ────────────────────────────────────────
@@ -13,10 +13,9 @@ const gcsClient = new S3Client({
13
13
  endpoint: process.env.GCS_ENDPOINT,
14
14
  bucket: `merkl-rewards-lake-${process.env.ENV}`,
15
15
  });
16
- let file = gcsClient.file(`breakdowns/${process.env.CHAIN_ID}-${process.env.ROOT}`);
17
- if (!(await file.exists()))
18
- file = gcsClient.file(`breakdowns/${process.env.CHAIN_ID}-${process.env.ROOT}.gz`);
16
+ const file = gcsClient.file(`breakdowns/${process.env.CHAIN_ID}-${process.env.ROOT}`);
19
17
  const failedBatches = [];
18
+ const missingCampaigns = [];
20
19
  // ─── Extract ─────────────────────────────────────────────────────────────────
21
20
  const extract = async () => {
22
21
  if (!file.exists())
@@ -30,106 +29,124 @@ const extract = async () => {
30
29
  buffer += textDecoder.decode(chunk);
31
30
  const lines = buffer.split("\n");
32
31
  buffer = lines.pop() || "";
33
- for (const line of lines)
34
- if (line.trim()) {
32
+ for (const line of lines) {
33
+ if (line.trim())
35
34
  data.push(...(await transform(JSON.parse(line))));
36
- }
35
+ }
37
36
  if (data.length < 30_000)
38
37
  continue;
39
38
  try {
40
- count += await withRetry(load, [data], 5, 60_000);
39
+ count += await load(data);
41
40
  data = [];
42
41
  }
43
42
  catch (err) {
44
- console.error(`Failed to insert a batch, adding it to the fail queue.\n${err}`);
43
+ // log.error("Failed to insert a batch, adding it to the fail queue.", err);
45
44
  failedBatches.push(data);
46
45
  data = [];
47
46
  }
48
47
  }
49
48
  try {
50
- count += await withRetry(load, [data], 5, 60_000);
49
+ count += await load(data);
51
50
  data = [];
52
51
  }
53
52
  catch (err) {
54
- console.error(`Failed to insert a batch, adding it to the fail queue.\n${err}`);
53
+ // log.error("Failed to insert a batch, adding it to the fail queue.", err);
55
54
  failedBatches.push(data);
56
55
  data = [];
57
56
  }
58
57
  return count;
59
58
  };
60
59
  // ─── Transform ───────────────────────────────────────────────────────────────
61
- const transform = async (rewardBreakdowns) => {
62
- const transformedRewardBreakdowns = [];
63
- for (const rewardBreakdown of rewardBreakdowns) {
64
- const rewardTokenId = Bun.hash(`${process.env.CHAIN_ID}${rewardBreakdown.token}`).toString();
65
- const rewardId = Bun.hash(`${process.env.ROOT}${rewardBreakdown.recipient}${rewardTokenId}`).toString();
66
- transformedRewardBreakdowns.push({
60
+ const transform = (rewardBreakdowns) => {
61
+ const transformedBreakdowns = Array(rewardBreakdowns.length);
62
+ let i = 0;
63
+ for (i; i < rewardBreakdowns.length; i++) {
64
+ const rewardTokenId = Bun.hash(`${process.env.CHAIN_ID}${rewardBreakdowns[i].token}`).toString();
65
+ const rewardId = Bun.hash(`${process.env.ROOT}${rewardBreakdowns[i].recipient}${rewardTokenId}`).toString();
66
+ const campaignId = Bun.hash(`${process.env.CHAIN_ID}${rewardBreakdowns[i].campaignId}`).toString();
67
+ transformedBreakdowns[i] = {
67
68
  rewardId,
68
- protocolId: rewardBreakdown.protocolId ? rewardBreakdown.protocolId : undefined,
69
- campaignId: rewardBreakdown.campaignId,
70
- reason: rewardBreakdown.reason ? rewardBreakdown.reason : "",
71
- amount: rewardBreakdown.amount,
72
- claimed: rewardBreakdown.claimed,
73
- pending: rewardBreakdown.pending,
74
- });
69
+ protocolId: rewardBreakdowns[i].protocolId ? rewardBreakdowns[i].protocolId : undefined,
70
+ campaignId,
71
+ reason: rewardBreakdowns[i].reason ? rewardBreakdowns[i].reason : "",
72
+ amount: rewardBreakdowns[i].amount,
73
+ claimed: rewardBreakdowns[i].claimed,
74
+ pending: rewardBreakdowns[i].pending,
75
+ merklCampaignId: rewardBreakdowns[i].campaignId,
76
+ };
75
77
  }
76
- return transformedRewardBreakdowns;
78
+ return transformedBreakdowns;
77
79
  };
78
80
  // ─── Load ────────────────────────────────────────────────────────────────────
79
81
  const load = async (rewardBreakdowns) => {
80
- log.info(`pushing ${rewardBreakdowns.length} rewardBreakdowns`);
81
- // const missingCampaigns: string[] = [];
82
- // const foundCampaigns: string[] = [];
83
- // const campaigns = rewardBreakdowns.reduce(
84
- // (acc, x) => {
85
- // const campaignUnique = {
86
- // campaignId: x.campaignId,
87
- // distributionChain: Number.parseInt(process.env.CHAIN_ID!),
88
- // };
89
- // if (!Object.keys(acc).includes(CampaignService.hashId(campaignUnique)))
90
- // acc[CampaignService.hashId(campaignUnique)] = {
91
- // campaignId: x.campaignId,
92
- // distributionChain: Number.parseInt(process.env.CHAIN_ID!),
93
- // };
94
- // return acc;
95
- // },
96
- // {} as Record<string, CampaignUnique>
97
- // );
98
- // for (const campaign of Object.values(campaigns)) {
99
- // const campaignExists = await CampaignService.checkIfExist(campaign);
100
- // if (!campaignExists) {
101
- // const { success, fail } = await CampaignService.fill([campaign]);
102
- // if (fail === 1 || success !== 1) {
103
- // missingCampaigns.push(CampaignService.hashId(campaign));
104
- // log.warn(`createManyBreakdown - Missing campaign: ${campaign.campaignId}`);
105
- // continue;
106
- // }
107
- // }
108
- // foundCampaigns.push(CampaignService.hashId(campaign));
109
- // }
110
- // if (missingCampaigns.length !== 0) {
111
- // log.warn(`createManyBreakdown - Missing ${missingCampaigns.length} campaigns: ${missingCampaigns.join(", ")}`);
112
- // }
113
- return (await apiDbClient.rewardBreakdown.createMany({
114
- data: rewardBreakdowns.map(x => {
115
- const campaignId = Bun.hash(`${process.env.CHAIN_ID}${x.campaignId}`).toString();
116
- return { ...x, campaignId };
117
- }),
118
- // .filter(x => !missingCampaigns.includes(x.campaignId)),
82
+ const count = (await apiDbClient.rewardBreakdown.createMany({
83
+ data: rewardBreakdowns.map(breakdown => ({
84
+ id: breakdown.id,
85
+ protocolId: breakdown.protocolId,
86
+ reason: breakdown.reason,
87
+ amount: breakdown.amount,
88
+ claimed: breakdown.claimed,
89
+ pending: breakdown.pending,
90
+ rewardId: breakdown.rewardId,
91
+ campaignId: breakdown.campaignId,
92
+ })),
119
93
  skipDuplicates: true,
120
94
  })).count;
95
+ log.info(`Successfully inserted ${rewardBreakdowns.length} reward breakdown(s).`);
96
+ return count;
97
+ };
98
+ // ─── Retry ───────────────────────────────────────────────────────────────────
99
+ // Using binary search
100
+ const retry = async (batches) => {
101
+ log.info(`Retrying ${batches.length} batch(es)...`);
102
+ let inserted = 0;
103
+ while (batches.length > 0) {
104
+ const currentBatch = batches.shift();
105
+ const firstHalf = currentBatch.splice(0, Math.ceil(currentBatch.length / 2));
106
+ const secondHalf = currentBatch;
107
+ // Process first half
108
+ try {
109
+ inserted += await load(firstHalf);
110
+ }
111
+ catch (err) {
112
+ log.error(JSON.stringify(firstHalf), err);
113
+ if (firstHalf.length > 1)
114
+ batches.push(firstHalf);
115
+ else
116
+ missingCampaigns.push(firstHalf[0].merklCampaignId);
117
+ }
118
+ // Process second half
119
+ try {
120
+ inserted += await load(secondHalf);
121
+ }
122
+ catch (err) {
123
+ log.error(JSON.stringify(secondHalf), err);
124
+ if (secondHalf.length > 1)
125
+ batches.push(secondHalf);
126
+ else
127
+ missingCampaigns.push(secondHalf[0].merklCampaignId);
128
+ }
129
+ }
130
+ return inserted;
121
131
  };
122
132
  // ─── Main ────────────────────────────────────────────────────────────────────
123
133
  export const main = async () => {
124
134
  const start = moment().unix();
125
135
  const count = await extract();
126
- log.info(`✅ Successfully created ${count} new records for ${process.env.CHAIN_ID}-${process.env.ROOT} in ${moment().unix() - start} sec`);
136
+ log.info(`✅ Successfully created ${count} new record(s) for ${process.env.CHAIN_ID}-${process.env.ROOT} in ${moment().unix() - start} sec.`);
127
137
  if (failedBatches.length !== 0) {
128
- log.error("breakdowns", `${failedBatches.length} batches failed.`);
129
- process.exit(1);
130
- }
131
- if (failedBatches.length === 0) {
132
- // await file.delete();
138
+ const inserted = await retry(failedBatches);
139
+ log.info(`Successfully inserted ${inserted} record(s) after retrying.`);
140
+ if (inserted !== failedBatches.length) {
141
+ log.error("breakdowns", `${failedBatches.length} breakdown(s) failed to insert.`);
142
+ // ─── Push Missing Campaigns To Bucket ────────────────
143
+ const bucket = new BucketService(`merkl-campaigns-lake-${process.env.ENV}`, `merkl-data-${process.env.ENV}`);
144
+ await bucket.push(`${process.env.CHAIN_ID}_missing_campaigns.json`, JSON.stringify(missingCampaigns), {
145
+ type: "application/json",
146
+ });
147
+ process.exit(1);
148
+ }
133
149
  }
150
+ // if (failedBatches.length === 0) await file.delete();
134
151
  };
135
152
  main();
@@ -4,7 +4,7 @@ export declare class BucketService {
4
4
  defaultUploadOptions: UploadOptions<unknown>;
5
5
  constructor(bucket: string, projectId: string);
6
6
  pushArray<T>(filename: string, arr: T[], options?: UploadOptions<T>): Promise<number>;
7
- push(filename: string, text: string, options?: Omit<UploadOptions<never>, "transform">): Promise<number>;
7
+ push(filename: string, text: string, options?: Omit<UploadOptions<never>, "transform" | "separator">): Promise<number>;
8
8
  pullArray<T>(filename: string, callback: (elem: string) => T, separator?: string): Promise<T[]>;
9
9
  pull(filename: string): Promise<string>;
10
10
  }
@@ -121,9 +121,12 @@ export declare const ChainController: Elysia<"/chains", false, {
121
121
  };
122
122
  response: {
123
123
  200: {
124
- name: string;
125
- id: number;
126
- icon: string;
124
+ Explorer: {
125
+ type: import("../../../../database/api/.generated").$Enums.ExplorerType;
126
+ url: string;
127
+ id: string;
128
+ chainId: number;
129
+ }[];
127
130
  };
128
131
  };
129
132
  };
@@ -46,15 +46,26 @@ export declare abstract class ChainRepository {
46
46
  * @returns
47
47
  */
48
48
  static create(data: CreateChainModel): Promise<{
49
- name: string;
50
- id: number;
51
- icon: string;
49
+ Explorer: {
50
+ type: import("../../../../database/api/.generated").$Enums.ExplorerType;
51
+ url: string;
52
+ id: string;
53
+ chainId: number;
54
+ }[];
52
55
  }>;
53
56
  static findMany(): Promise<{
54
57
  name: string;
55
58
  id: number;
56
59
  icon: string;
57
60
  }[]>;
61
+ static findUniqueOrThrow(id: number): Promise<{
62
+ Explorer: {
63
+ type: import("../../../../database/api/.generated").$Enums.ExplorerType;
64
+ url: string;
65
+ id: string;
66
+ chainId: number;
67
+ }[];
68
+ }>;
58
69
  /**
59
70
  * Fetches the campaign dynamic data for a v3 campaign onchain
60
71
  * @param chainId