@merkl/api 0.20.2 → 0.20.4

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.
@@ -136,6 +136,7 @@ export declare abstract class RewardService {
136
136
  }[] | undefined;
137
137
  id: string;
138
138
  depositUrl: string | undefined;
139
+ explorerAddress: string | undefined;
139
140
  tokens: ({
140
141
  symbol: string;
141
142
  id: string;
@@ -171,7 +172,6 @@ export declare abstract class RewardService {
171
172
  identifier: string;
172
173
  action: import("@db/api").$Enums.OpportunityAction;
173
174
  chainId: number;
174
- explorerAddress: string | null;
175
175
  tvl: number;
176
176
  dailyRewards: number;
177
177
  }, number>>;
@@ -149,136 +149,44 @@ export declare const v4: Elysia<"/v4", false, {
149
149
  };
150
150
  headers: unknown;
151
151
  response: {
152
- 200: ({
153
- protocol?: {
154
- id: string;
155
- name: string;
156
- url: string;
157
- description: string;
158
- tags: string[];
159
- icon: string;
160
- } | null | undefined;
161
- depositUrl?: string | undefined;
162
- explorerAddress?: string | undefined;
163
- aprRecord?: {
164
- timestamp: string | bigint;
152
+ 200: {
153
+ apr: number;
154
+ aprRecord: {
165
155
  cumulated: number;
156
+ timestamp: bigint;
166
157
  breakdowns: {
167
158
  id: number;
168
- type: "CAMPAIGN" | "TOKEN" | "PROTOCOL";
159
+ type: import("@db/api").$Enums.AprType;
160
+ uuid: string;
169
161
  identifier: string;
170
162
  value: number;
171
163
  aprRecordId: string;
172
164
  }[];
173
- } | undefined;
174
- tvlRecord?: {
165
+ };
166
+ tvlRecord: {
167
+ id: string;
175
168
  total: number;
176
- timestamp: string | bigint;
169
+ timestamp: bigint;
177
170
  breakdowns: {
178
171
  id: number;
179
- type: "TOKEN" | "PROTOCOL";
172
+ type: import("@db/api").$Enums.TvlType;
173
+ uuid: string;
180
174
  identifier: string;
181
175
  value: number;
182
176
  tvlRecordId: string;
183
177
  }[];
184
- } | undefined;
185
- rewardsRecord?: {
178
+ };
179
+ rewardsRecord: {
186
180
  id: string;
187
181
  total: number;
188
- timestamp: string | bigint;
182
+ timestamp: bigint;
189
183
  breakdowns: {
190
184
  id: number;
191
- token: {
192
- price?: number | null | undefined;
193
- symbol: string;
194
- id: string;
195
- name: string | null;
196
- icon: string;
197
- address: string;
198
- chainId: number;
199
- decimals: number;
200
- verified: boolean;
201
- isTest: boolean;
202
- };
185
+ uuid: string;
203
186
  value: number;
204
187
  campaignId: string;
205
- amount: string | bigint;
206
188
  dailyRewardsRecordId: string;
207
- }[];
208
- } | undefined;
209
- id: string;
210
- name: string;
211
- type: string;
212
- status: string;
213
- tokens: {
214
- price?: number | null | undefined;
215
- symbol: string;
216
- id: string;
217
- name: string | null;
218
- icon: string;
219
- address: string;
220
- chainId: number;
221
- decimals: number;
222
- verified: boolean;
223
- isTest: boolean;
224
- }[];
225
- tags: string[];
226
- identifier: string;
227
- chain: {
228
- id: number;
229
- name: string;
230
- icon: string;
231
- };
232
- action: string;
233
- chainId: number;
234
- tvl: number;
235
- apr: number;
236
- dailyRewards: number;
237
- } | null)[];
238
- } | {
239
- 200: never;
240
- } | {
241
- 200: (Response | ({
242
- protocol?: {
243
- id: string;
244
- name: string;
245
- url: string;
246
- description: string;
247
- tags: string[];
248
- icon: string;
249
- } | null | undefined;
250
- depositUrl?: string | undefined;
251
- explorerAddress?: string | undefined;
252
- aprRecord?: {
253
- timestamp: string | bigint;
254
- cumulated: number;
255
- breakdowns: {
256
- id: number;
257
- type: "CAMPAIGN" | "TOKEN" | "PROTOCOL";
258
- identifier: string;
259
- value: number;
260
- aprRecordId: string;
261
- }[];
262
- } | undefined;
263
- tvlRecord?: {
264
- total: number;
265
- timestamp: string | bigint;
266
- breakdowns: {
267
- id: number;
268
- type: "TOKEN" | "PROTOCOL";
269
- identifier: string;
270
- value: number;
271
- tvlRecordId: string;
272
- }[];
273
- } | undefined;
274
- rewardsRecord?: {
275
- id: string;
276
- total: number;
277
- timestamp: string | bigint;
278
- breakdowns: {
279
- id: number;
280
189
  token: {
281
- price?: number | null | undefined;
282
190
  symbol: string;
283
191
  id: string;
284
192
  name: string | null;
@@ -286,107 +194,26 @@ export declare const v4: Elysia<"/v4", false, {
286
194
  address: string;
287
195
  chainId: number;
288
196
  decimals: number;
197
+ displaySymbol: string;
289
198
  verified: boolean;
290
199
  isTest: boolean;
200
+ isPoint: boolean;
201
+ isNative: boolean;
202
+ price: number | null;
291
203
  };
292
- value: number;
293
- campaignId: string;
294
- amount: string | bigint;
295
- dailyRewardsRecordId: string;
204
+ amount: bigint;
296
205
  }[];
297
- } | undefined;
298
- id: string;
299
- name: string;
300
- type: string;
301
- status: string;
302
- tokens: {
303
- price?: number | null | undefined;
304
- symbol: string;
305
- id: string;
306
- name: string | null;
307
- icon: string;
308
- address: string;
309
- chainId: number;
310
- decimals: number;
311
- verified: boolean;
312
- isTest: boolean;
313
- }[];
314
- tags: string[];
315
- identifier: string;
316
- chain: {
317
- id: number;
318
- name: string;
319
- icon: string;
320
206
  };
321
- action: string;
322
- chainId: number;
323
- tvl: number;
324
- apr: number;
325
- dailyRewards: number;
326
- } | null)[] | {
327
- 200: ({
328
- protocol?: {
329
- id: string;
207
+ campaigns: {
208
+ params: any;
209
+ chain: {
210
+ id: number;
330
211
  name: string;
331
- url: string;
332
- description: string;
333
- tags: string[];
334
212
  icon: string;
335
- } | null | undefined;
336
- depositUrl?: string | undefined;
337
- explorerAddress?: string | undefined;
338
- aprRecord?: {
339
- timestamp: string | bigint;
340
- cumulated: number;
341
- breakdowns: {
342
- id: number;
343
- type: "CAMPAIGN" | "TOKEN" | "PROTOCOL";
344
- identifier: string;
345
- value: number;
346
- aprRecordId: string;
347
- }[];
348
- } | undefined;
349
- tvlRecord?: {
350
- total: number;
351
- timestamp: string | bigint;
352
- breakdowns: {
353
- id: number;
354
- type: "TOKEN" | "PROTOCOL";
355
- identifier: string;
356
- value: number;
357
- tvlRecordId: string;
358
- }[];
359
- } | undefined;
360
- rewardsRecord?: {
361
- id: string;
362
- total: number;
363
- timestamp: string | bigint;
364
- breakdowns: {
365
- id: number;
366
- token: {
367
- price?: number | null | undefined;
368
- symbol: string;
369
- id: string;
370
- name: string | null;
371
- icon: string;
372
- address: string;
373
- chainId: number;
374
- decimals: number;
375
- verified: boolean;
376
- isTest: boolean;
377
- };
378
- value: number;
379
- campaignId: string;
380
- amount: string | bigint;
381
- dailyRewardsRecordId: string;
382
- }[];
383
- } | undefined;
384
- id: string;
385
- name: string;
386
- type: string;
387
- status: string;
388
- tokens: {
389
- price?: number | null | undefined;
213
+ };
214
+ endTimestamp: number;
215
+ startTimestamp: number;
216
+ rewardToken: {
390
217
  symbol: string;
391
218
  id: string;
392
219
  name: string | null;
@@ -396,83 +223,61 @@ export declare const v4: Elysia<"/v4", false, {
396
223
  decimals: number;
397
224
  verified: boolean;
398
225
  isTest: boolean;
399
- }[];
400
- tags: string[];
401
- identifier: string;
402
- chain: {
226
+ isPoint: boolean;
227
+ isNative: boolean;
228
+ } & {
229
+ price?: number | null | undefined;
230
+ };
231
+ distributionChain: {
403
232
  id: number;
404
233
  name: string;
405
234
  icon: string;
235
+ } | undefined;
236
+ campaignStatus: {
237
+ computedUntil: number;
238
+ processingStarted: number;
239
+ error: string;
240
+ status: import("@db/api").$Enums.RunStatus;
241
+ details: import("database/api/.generated/runtime/library").JsonValue;
242
+ campaignId: string;
243
+ } | undefined;
244
+ creatorAddress: string;
245
+ creator: {
246
+ tags: string[];
247
+ address: string;
248
+ creatorId: string | null;
406
249
  };
407
- action: string;
408
- chainId: number;
409
- tvl: number;
410
- apr: number;
411
- dailyRewards: number;
412
- } | null)[];
413
- }) & ({
414
- protocol?: {
415
- id: string;
416
- name: string;
417
- url: string;
418
- description: string;
419
- tags: string[];
420
- icon: string;
421
- } | null | undefined;
422
- depositUrl?: string | undefined;
423
- explorerAddress?: string | undefined;
424
- aprRecord?: {
425
- timestamp: string | bigint;
426
- cumulated: number;
427
- breakdowns: {
428
- id: number;
429
- type: "CAMPAIGN" | "TOKEN" | "PROTOCOL";
430
- identifier: string;
431
- value: number;
432
- aprRecordId: string;
433
- }[];
434
- } | undefined;
435
- tvlRecord?: {
436
- total: number;
437
- timestamp: string | bigint;
438
- breakdowns: {
439
- id: number;
440
- type: "TOKEN" | "PROTOCOL";
250
+ createdAt: string;
251
+ Opportunity: {
252
+ id: string;
253
+ name: string;
254
+ type: string;
255
+ status: import("@db/api").$Enums.Status;
256
+ tags: string[];
441
257
  identifier: string;
442
- value: number;
443
- tvlRecordId: string;
444
- }[];
445
- } | undefined;
446
- rewardsRecord?: {
258
+ action: import("@db/api").$Enums.OpportunityAction;
259
+ chainId: number;
260
+ depositUrl: string | null;
261
+ explorerAddress: string | null;
262
+ mainProtocolId: string | null;
263
+ tvl: number;
264
+ apr: number;
265
+ dailyRewards: number;
266
+ };
447
267
  id: string;
448
- total: number;
449
- timestamp: string | bigint;
450
- breakdowns: {
451
- id: number;
452
- token: {
453
- price?: number | null | undefined;
454
- symbol: string;
455
- id: string;
456
- name: string | null;
457
- icon: string;
458
- address: string;
459
- chainId: number;
460
- decimals: number;
461
- verified: boolean;
462
- isTest: boolean;
463
- };
464
- value: number;
465
- campaignId: string;
466
- amount: string | bigint;
467
- dailyRewardsRecordId: string;
468
- }[];
469
- } | undefined;
268
+ type: string;
269
+ subType: number | null;
270
+ computeChainId: number;
271
+ distributionChainId: number;
272
+ campaignId: string;
273
+ rewardTokenId: string;
274
+ amount: string;
275
+ opportunityId: string;
276
+ }[] | undefined;
470
277
  id: string;
471
- name: string;
472
- type: string;
473
- status: string;
474
- tokens: {
475
- price?: number | null | undefined;
278
+ depositUrl: string | undefined;
279
+ explorerAddress: string | undefined;
280
+ tokens: ({
476
281
  symbol: string;
477
282
  id: string;
478
283
  name: string | null;
@@ -482,109 +287,34 @@ export declare const v4: Elysia<"/v4", false, {
482
287
  decimals: number;
483
288
  verified: boolean;
484
289
  isTest: boolean;
485
- }[];
486
- tags: string[];
487
- identifier: string;
290
+ isPoint: boolean;
291
+ isNative: boolean;
292
+ } & {
293
+ price?: number | null | undefined;
294
+ })[];
488
295
  chain: {
489
296
  id: number;
490
297
  name: string;
491
298
  icon: string;
492
299
  };
493
- action: string;
494
- chainId: number;
495
- tvl: number;
496
- apr: number;
497
- dailyRewards: number;
498
- } | null)[];
499
- } | {
500
- 200: {
501
- 200: ({
502
- protocol?: {
503
- id: string;
504
- name: string;
505
- url: string;
506
- description: string;
507
- tags: string[];
508
- icon: string;
509
- } | null | undefined;
510
- depositUrl?: string | undefined;
511
- explorerAddress?: string | undefined;
512
- aprRecord?: {
513
- timestamp: string | bigint;
514
- cumulated: number;
515
- breakdowns: {
516
- id: number;
517
- type: "CAMPAIGN" | "TOKEN" | "PROTOCOL";
518
- identifier: string;
519
- value: number;
520
- aprRecordId: string;
521
- }[];
522
- } | undefined;
523
- tvlRecord?: {
524
- total: number;
525
- timestamp: string | bigint;
526
- breakdowns: {
527
- id: number;
528
- type: "TOKEN" | "PROTOCOL";
529
- identifier: string;
530
- value: number;
531
- tvlRecordId: string;
532
- }[];
533
- } | undefined;
534
- rewardsRecord?: {
535
- id: string;
536
- total: number;
537
- timestamp: string | bigint;
538
- breakdowns: {
539
- id: number;
540
- token: {
541
- price?: number | null | undefined;
542
- symbol: string;
543
- id: string;
544
- name: string | null;
545
- icon: string;
546
- address: string;
547
- chainId: number;
548
- decimals: number;
549
- verified: boolean;
550
- isTest: boolean;
551
- };
552
- value: number;
553
- campaignId: string;
554
- amount: string | bigint;
555
- dailyRewardsRecordId: string;
556
- }[];
557
- } | undefined;
300
+ protocol: {
558
301
  id: string;
559
302
  name: string;
560
- type: string;
561
- status: string;
562
- tokens: {
563
- price?: number | null | undefined;
564
- symbol: string;
565
- id: string;
566
- name: string | null;
567
- icon: string;
568
- address: string;
569
- chainId: number;
570
- decimals: number;
571
- verified: boolean;
572
- isTest: boolean;
573
- }[];
303
+ url: string;
304
+ description: string;
574
305
  tags: string[];
575
- identifier: string;
576
- chain: {
577
- id: number;
578
- name: string;
579
- icon: string;
580
- };
581
- action: string;
582
- chainId: number;
583
- tvl: number;
584
- apr: number;
585
- dailyRewards: number;
586
- } | null)[];
587
- };
306
+ icon: string;
307
+ } | undefined;
308
+ name: string;
309
+ type: string;
310
+ status: import("@db/api").$Enums.Status;
311
+ tags: string[];
312
+ identifier: string;
313
+ action: import("@db/api").$Enums.OpportunityAction;
314
+ chainId: number;
315
+ tvl: number;
316
+ dailyRewards: number;
317
+ }[];
588
318
  };
589
319
  };
590
320
  };
@@ -10,6 +10,7 @@ import { getAddress, parseUnits } from "viem";
10
10
  import { BucketService } from "../bucket/bucket.service";
11
11
  import { CacheService } from "../cache";
12
12
  import { TTLPresets } from "../cache/cache.model";
13
+ import { IconService } from "../icon/icon.service";
13
14
  import { PriceService } from "../price";
14
15
  import { TokenRepository } from "./token.repository";
15
16
  export class TokenService {
@@ -291,9 +292,9 @@ export class TokenService {
291
292
  const bucket = new BucketService(`merkl-${env}-tokens`, `angle-${env}-1`);
292
293
  const properties = body.data.properties;
293
294
  const file = properties["Icon (Required)"].files[0];
294
- const icon = "external" in file ? file.external.url : file.file.url;
295
- const iconFile = await fetch(icon);
296
- const mimeType = iconFile.headers.get("content-type");
295
+ const iconURL = "external" in file ? file.external.url : file.file.url;
296
+ const icon = await fetch(iconURL);
297
+ const mimeType = icon.headers.get("content-type");
297
298
  const extension = mimeType.split("/")[1].split("+")[0];
298
299
  const address = throwOnInvalidRequiredAddress(properties["Address (in checksum format) (Required)"].rich_text[0].plain_text);
299
300
  const chainId = properties["Chain ID (Required)"].number;
@@ -301,7 +302,6 @@ export class TokenService {
301
302
  const displaySymbol = properties["Symbol (Optional)"].rich_text[0]?.plain_text;
302
303
  const isVerified = properties.Verified.checkbox;
303
304
  const coingeckoApiId = properties["CoinGecko API ID (Recommended)"].rich_text[0]?.plain_text;
304
- const byteArray = await iconFile.bytes(); // Unknown type error here probably due to bun/types
305
305
  const [token] = await TokenService.findManyOrCreate([
306
306
  {
307
307
  chainId,
@@ -311,15 +311,12 @@ export class TokenService {
311
311
  if (!token || !token.name)
312
312
  throw new HttpError(`Failed to fetch on-chain data for token ${token?.symbol} (${address} on chainId ${chainId}).`);
313
313
  try {
314
- await bucket.pushRaw(`${chainId}/${address}.${extension}`, byteArray, {
315
- type: mimeType,
316
- isPublic: true,
317
- });
314
+ await IconService.pullPush(iconURL, bucket, { name: `${chainId}/${address}` });
318
315
  token.icon = `${process.env.GCS_ENDPOINT}/merkl-${env}-tokens/${chainId}/${address}.${extension}`;
319
316
  }
320
317
  catch (err) {
321
318
  console.error(err);
322
- token.icon = icon;
319
+ token.icon = iconURL;
323
320
  }
324
321
  if (coingeckoApiId) {
325
322
  try {
@@ -1,10 +1,4 @@
1
1
  import { type Elysia } from "elysia";
2
- export declare const response: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
3
- address: import("@sinclair/typebox").TString;
4
- asset: import("@sinclair/typebox").TString;
5
- chaind: import("@sinclair/typebox").TNumber;
6
- debtTokenAddress: import("@sinclair/typebox").TString;
7
- }>>;
8
2
  declare const _default: (app: Elysia) => Elysia<"", false, {
9
3
  decorator: {};
10
4
  store: {};
@@ -1,9 +1,9 @@
1
- import { getEulerV2VaultsWithCache, updateEulerVaultsCollatInDatabase, } from "@/engine/dynamicData/utils/getEulerV2Vaults";
1
+ import { Redis } from "@/cache";
2
+ import { getEulerV2Vaults, updateEulerVaultsCollatInDatabase } from "@/engine/dynamicData/utils/getEulerV2Vaults";
2
3
  import { t } from "elysia";
3
- export const response = t.Array(t.Object({ address: t.String(), asset: t.String(), chaind: t.Number(), debtTokenAddress: t.String() }));
4
4
  export default (app) => app
5
5
  .get("/euler", async () => {
6
- return await getEulerV2VaultsWithCache();
6
+ return await Redis.getOrSet("EulerV2Vaults", getEulerV2Vaults);
7
7
  }, {
8
8
  query: t.Object({}),
9
9
  tags: ["euler"],