@merkl/api 0.13.4 → 0.13.6

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.
@@ -2391,7 +2391,13 @@ declare const eden: {
2391
2391
  fetch?: RequestInit | undefined;
2392
2392
  }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
2393
2393
  200: {
2394
- totalAmount: number;
2394
+ total: number;
2395
+ breakdown: {
2396
+ [key: number]: {
2397
+ chainAmount: number;
2398
+ percentage: number;
2399
+ };
2400
+ };
2395
2401
  from: string;
2396
2402
  to: string;
2397
2403
  };
@@ -5394,7 +5400,13 @@ declare const eden: {
5394
5400
  fetch?: RequestInit | undefined;
5395
5401
  }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
5396
5402
  200: {
5397
- totalAmount: number;
5403
+ total: number;
5404
+ breakdown: {
5405
+ [key: number]: {
5406
+ chainAmount: number;
5407
+ percentage: number;
5408
+ };
5409
+ };
5398
5410
  from: string;
5399
5411
  to: string;
5400
5412
  };
@@ -9629,7 +9641,13 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
9629
9641
  };
9630
9642
  response: {
9631
9643
  200: {
9632
- totalAmount: number;
9644
+ total: number;
9645
+ breakdown: {
9646
+ [key: number]: {
9647
+ chainAmount: number;
9648
+ percentage: number;
9649
+ };
9650
+ };
9633
9651
  from: string;
9634
9652
  to: string;
9635
9653
  };
@@ -13704,7 +13722,13 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
13704
13722
  fetch?: RequestInit | undefined;
13705
13723
  }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
13706
13724
  200: {
13707
- totalAmount: number;
13725
+ total: number;
13726
+ breakdown: {
13727
+ [key: number]: {
13728
+ chainAmount: number;
13729
+ percentage: number;
13730
+ };
13731
+ };
13708
13732
  from: string;
13709
13733
  to: string;
13710
13734
  };
@@ -16707,7 +16731,13 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
16707
16731
  fetch?: RequestInit | undefined;
16708
16732
  }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
16709
16733
  200: {
16710
- totalAmount: number;
16734
+ total: number;
16735
+ breakdown: {
16736
+ [key: number]: {
16737
+ chainAmount: number;
16738
+ percentage: number;
16739
+ };
16740
+ };
16711
16741
  from: string;
16712
16742
  to: string;
16713
16743
  };
@@ -2934,7 +2934,13 @@ declare const app: Elysia<"", false, {
2934
2934
  };
2935
2935
  response: {
2936
2936
  200: {
2937
- totalAmount: number;
2937
+ total: number;
2938
+ breakdown: {
2939
+ [key: number]: {
2940
+ chainAmount: number;
2941
+ percentage: number;
2942
+ };
2943
+ };
2938
2944
  from: string;
2939
2945
  to: string;
2940
2946
  };
@@ -79,7 +79,13 @@ export declare const AccountingController: Elysia<"/accounting", false, {
79
79
  };
80
80
  response: {
81
81
  200: {
82
- totalAmount: number;
82
+ total: number;
83
+ breakdown: {
84
+ [key: number]: {
85
+ chainAmount: number;
86
+ percentage: number;
87
+ };
88
+ };
83
89
  from: string;
84
90
  to: string;
85
91
  };
@@ -31,7 +31,13 @@ export declare class AccountingService {
31
31
  };
32
32
  }>;
33
33
  static getMonthlyRevenue(year: number, month: number): Promise<{
34
- totalAmount: number;
34
+ total: number;
35
+ breakdown: {
36
+ [key: number]: {
37
+ chainAmount: number;
38
+ percentage: number;
39
+ };
40
+ };
35
41
  from: string;
36
42
  to: string;
37
43
  }>;
@@ -48,12 +48,22 @@ export class AccountingService {
48
48
  static async getMonthlyRevenue(year, month) {
49
49
  const startDate = new Date(year, month - 1, 1);
50
50
  const endDate = new Date(year, month, 0, 23, 59, 59);
51
- const monthlyData = await AccountingRepository.getForMultisigBetweenDates(startDate, endDate);
52
- let totalAmount = 0;
53
- for (const tx of monthlyData) {
54
- totalAmount += Number(tx.amountIn);
51
+ const breakdown = {};
52
+ let consolidatedAmount = 0;
53
+ for (const chainId of Object.values(ChainId).filter(id => typeof id === "number")) {
54
+ const monthlyData = await AccountingRepository.getForMultisigBetweenDates(startDate, endDate);
55
+ let totalAmount = 0;
56
+ for (const tx of monthlyData) {
57
+ totalAmount += Number(tx.amountIn);
58
+ }
59
+ breakdown[chainId] = { chainAmount: totalAmount, percentage: 0 };
60
+ consolidatedAmount += totalAmount;
55
61
  }
56
- return { totalAmount, from: startDate.toDateString(), to: endDate.toDateString() };
62
+ for (const chainId of Object.values(ChainId).filter(id => typeof id === "number")) {
63
+ const totalAmount = breakdown[chainId].chainAmount;
64
+ breakdown[chainId] = { chainAmount: totalAmount, percentage: (totalAmount * 100) / consolidatedAmount };
65
+ }
66
+ return { total: consolidatedAmount, breakdown, from: startDate.toDateString(), to: endDate.toDateString() };
57
67
  }
58
68
  static async getMonthlyRevenueByChain(chainId, year, month) {
59
69
  const startDate = new Date(year, month - 1, 1);
@@ -2804,7 +2804,13 @@ export declare const v4: Elysia<"/v4", false, {
2804
2804
  };
2805
2805
  response: {
2806
2806
  200: {
2807
- totalAmount: number;
2807
+ total: number;
2808
+ breakdown: {
2809
+ [key: number]: {
2810
+ chainAmount: number;
2811
+ percentage: number;
2812
+ };
2813
+ };
2808
2814
  from: string;
2809
2815
  to: string;
2810
2816
  };
@@ -53,7 +53,7 @@ export class StatusRepository {
53
53
  data: {
54
54
  computedUntil,
55
55
  status: "SUCCESS",
56
- error: undefined,
56
+ error: "",
57
57
  details: "{}",
58
58
  },
59
59
  });
@@ -78,7 +78,7 @@ export class StatusRepository {
78
78
  data: {
79
79
  status: "PROCESSING",
80
80
  processingStarted: moment().unix(),
81
- error: undefined,
81
+ error: "",
82
82
  details: "{}",
83
83
  },
84
84
  });