@merkl/api 0.21.17 → 0.21.18

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.
@@ -3700,8 +3700,15 @@ declare const eden: {
3700
3700
  query?: Record<string, unknown> | undefined;
3701
3701
  fetch?: RequestInit | undefined;
3702
3702
  } | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
3703
- [x: string]: any;
3704
- 200: any;
3703
+ 200: {
3704
+ [x: number]: {
3705
+ live: string;
3706
+ tree: string;
3707
+ lastTree: string;
3708
+ endOfDisputePeriod: number;
3709
+ disputer: string;
3710
+ };
3711
+ };
3705
3712
  }>>;
3706
3713
  };
3707
3714
  engine: {
@@ -10045,8 +10052,15 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
10045
10052
  query: unknown;
10046
10053
  headers: unknown;
10047
10054
  response: {
10048
- [x: string]: any;
10049
- 200: any;
10055
+ 200: {
10056
+ [x: number]: {
10057
+ live: string;
10058
+ tree: string;
10059
+ lastTree: string;
10060
+ endOfDisputePeriod: number;
10061
+ disputer: string;
10062
+ };
10063
+ };
10050
10064
  };
10051
10065
  };
10052
10066
  };
@@ -16152,8 +16166,15 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
16152
16166
  query?: Record<string, unknown> | undefined;
16153
16167
  fetch?: RequestInit | undefined;
16154
16168
  } | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
16155
- [x: string]: any;
16156
- 200: any;
16169
+ 200: {
16170
+ [x: number]: {
16171
+ live: string;
16172
+ tree: string;
16173
+ lastTree: string;
16174
+ endOfDisputePeriod: number;
16175
+ disputer: string;
16176
+ };
16177
+ };
16157
16178
  }>>;
16158
16179
  };
16159
16180
  engine: {
@@ -4463,8 +4463,15 @@ declare const app: Elysia<"", false, {
4463
4463
  query: unknown;
4464
4464
  headers: unknown;
4465
4465
  response: {
4466
- [x: string]: any;
4467
- 200: any;
4466
+ 200: {
4467
+ [x: number]: {
4468
+ live: string;
4469
+ tree: string;
4470
+ lastTree: string;
4471
+ endOfDisputePeriod: number;
4472
+ disputer: string;
4473
+ };
4474
+ };
4468
4475
  };
4469
4476
  };
4470
4477
  };
@@ -43,8 +43,15 @@ export declare const MerklRootController: Elysia<"/roots", false, {
43
43
  query: unknown;
44
44
  headers: unknown;
45
45
  response: {
46
- [x: string]: any;
47
- 200: any;
46
+ 200: {
47
+ [x: number]: {
48
+ live: string;
49
+ tree: string;
50
+ lastTree: string;
51
+ endOfDisputePeriod: number;
52
+ disputer: string;
53
+ };
54
+ };
48
55
  };
49
56
  };
50
57
  };
@@ -19,7 +19,13 @@ export declare class MerklRootService {
19
19
  * @param chainIds to fetch roots for
20
20
  * @returns record of chains to object with live and last tree roots
21
21
  */
22
- static fetchAll(chainIds?: ChainId[]): Promise<any>;
22
+ static fetchAll(chainIds?: ChainId[]): Promise<Record<number, {
23
+ live: string;
24
+ tree: string;
25
+ lastTree: string;
26
+ endOfDisputePeriod: number;
27
+ disputer: string;
28
+ }>>;
23
29
  static create(x: CreateRootModel): Promise<{
24
30
  chainId: number;
25
31
  timestamp: bigint;
@@ -29,7 +29,7 @@ export class MerklRootService {
29
29
  */
30
30
  static async fetchAll(chainIds) {
31
31
  return await CacheService.wrap(TTLPresets.MIN_1, async () => {
32
- let ids = chainIds ?? (await ChainService.getIds());
32
+ let ids = chainIds ?? (await ChainService.findManyIds());
33
33
  /** Fetch current Merkle Roots */
34
34
  const merkleRootsPromises = await Promise.allSettled(ids.map(chainId => MerklRootService.fetchFromCache(chainId)));
35
35
  /** Filter out unsuccessful chainIds */
@@ -48,9 +48,10 @@ export class PriceService {
48
48
  }
49
49
  return price;
50
50
  }
51
- catch {
51
+ catch (e) {
52
+ console.error(e);
52
53
  await PriceRepository.deleteBySymbol(created.symbol);
53
- throw new UnableToFindPrice();
54
+ throw new UnableToFindPrice(e.toString());
54
55
  }
55
56
  }
56
57
  static async updatePriceSource(symbol, newPriceSource) {
@@ -4333,8 +4333,15 @@ export declare const v4: Elysia<"/v4", false, {
4333
4333
  query: unknown;
4334
4334
  headers: unknown;
4335
4335
  response: {
4336
- [x: string]: any;
4337
- 200: any;
4336
+ 200: {
4337
+ [x: number]: {
4338
+ live: string;
4339
+ tree: string;
4340
+ lastTree: string;
4341
+ endOfDisputePeriod: number;
4342
+ disputer: string;
4343
+ };
4344
+ };
4338
4345
  };
4339
4346
  };
4340
4347
  };
@@ -16,7 +16,8 @@ export default class OnChainCallService {
16
16
  return undefined;
17
17
  }
18
18
  try {
19
- const multiplicator = BN2Number(new Contract(args.address, args.abi, ChainInteractionService(args.chainId).provider())[args.call], args.decimals ?? 18);
19
+ const onChainCall = await new Contract(args.address, args.abi, ChainInteractionService(args.chainId).provider())[args.call]();
20
+ const multiplicator = BN2Number(onChainCall, args.decimals ?? 18);
20
21
  const base = await PriceService.fetchPriceBySymbol(args.base);
21
22
  const price = base * multiplicator;
22
23
  // 2 returned tokens as stUSD and STUSD (business requirement)