@centrifuge/sdk 0.55.2 → 0.55.3

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.
Files changed (99) hide show
  1. package/dist/entities/BalanceSheet.js +3 -3
  2. package/dist/entities/BalanceSheet.js.map +1 -1
  3. package/dist/entities/IndexerQueries/assetSnapshots.d.ts +69 -0
  4. package/dist/entities/IndexerQueries/assetSnapshots.d.ts.map +1 -0
  5. package/dist/entities/IndexerQueries/assetSnapshots.js +91 -0
  6. package/dist/entities/IndexerQueries/assetSnapshots.js.map +1 -0
  7. package/dist/entities/IndexerQueries/assetTransactions.d.ts +93 -0
  8. package/dist/entities/IndexerQueries/assetTransactions.d.ts.map +1 -0
  9. package/dist/entities/IndexerQueries/assetTransactions.js +75 -0
  10. package/dist/entities/IndexerQueries/assetTransactions.js.map +1 -0
  11. package/dist/entities/IndexerQueries/epochs.d.ts +45 -0
  12. package/dist/entities/IndexerQueries/epochs.d.ts.map +1 -0
  13. package/dist/entities/IndexerQueries/epochs.js +51 -0
  14. package/dist/entities/IndexerQueries/epochs.js.map +1 -0
  15. package/dist/entities/IndexerQueries/index.d.ts +40 -0
  16. package/dist/entities/IndexerQueries/index.d.ts.map +1 -0
  17. package/dist/entities/IndexerQueries/index.js +45 -0
  18. package/dist/entities/IndexerQueries/index.js.map +1 -0
  19. package/dist/entities/IndexerQueries/investorTransactions.d.ts +50 -0
  20. package/dist/entities/IndexerQueries/investorTransactions.d.ts.map +1 -0
  21. package/dist/entities/IndexerQueries/investorTransactions.js +55 -0
  22. package/dist/entities/IndexerQueries/investorTransactions.js.map +1 -0
  23. package/dist/entities/IndexerQueries/poolFeeSnapshots.d.ts +48 -0
  24. package/dist/entities/IndexerQueries/poolFeeSnapshots.d.ts.map +1 -0
  25. package/dist/entities/IndexerQueries/poolFeeSnapshots.js +62 -0
  26. package/dist/entities/IndexerQueries/poolFeeSnapshots.js.map +1 -0
  27. package/dist/entities/IndexerQueries/poolFeeTransactions.d.ts +34 -0
  28. package/dist/entities/IndexerQueries/poolFeeTransactions.d.ts.map +1 -0
  29. package/dist/entities/IndexerQueries/poolFeeTransactions.js +37 -0
  30. package/dist/entities/IndexerQueries/poolFeeTransactions.js.map +1 -0
  31. package/dist/entities/IndexerQueries/poolSnapshots.d.ts +79 -0
  32. package/dist/entities/IndexerQueries/poolSnapshots.d.ts.map +1 -0
  33. package/dist/entities/IndexerQueries/poolSnapshots.js +112 -0
  34. package/dist/entities/IndexerQueries/poolSnapshots.js.map +1 -0
  35. package/dist/entities/IndexerQueries/trancheCurrencyBalance.d.ts +76 -0
  36. package/dist/entities/IndexerQueries/trancheCurrencyBalance.d.ts.map +1 -0
  37. package/dist/entities/IndexerQueries/trancheCurrencyBalance.js +63 -0
  38. package/dist/entities/IndexerQueries/trancheCurrencyBalance.js.map +1 -0
  39. package/dist/entities/IndexerQueries/trancheSnapshots.d.ts +70 -0
  40. package/dist/entities/IndexerQueries/trancheSnapshots.d.ts.map +1 -0
  41. package/dist/entities/IndexerQueries/trancheSnapshots.js +76 -0
  42. package/dist/entities/IndexerQueries/trancheSnapshots.js.map +1 -0
  43. package/dist/entities/Reports/Processor.d.ts +46 -0
  44. package/dist/entities/Reports/Processor.d.ts.map +1 -0
  45. package/dist/entities/Reports/Processor.js +471 -0
  46. package/dist/entities/Reports/Processor.js.map +1 -0
  47. package/dist/entities/Reports/Processor.test.d.ts +2 -0
  48. package/dist/entities/Reports/Processor.test.d.ts.map +1 -0
  49. package/dist/entities/Reports/Processor.test.js +767 -0
  50. package/dist/entities/Reports/Processor.test.js.map +1 -0
  51. package/dist/entities/Reports/Reports.test.d.ts +2 -0
  52. package/dist/entities/Reports/Reports.test.d.ts.map +1 -0
  53. package/dist/entities/Reports/Reports.test.js +559 -0
  54. package/dist/entities/Reports/Reports.test.js.map +1 -0
  55. package/dist/entities/Reports/index.d.ts +21 -0
  56. package/dist/entities/Reports/index.d.ts.map +1 -0
  57. package/dist/entities/Reports/index.js +144 -0
  58. package/dist/entities/Reports/index.js.map +1 -0
  59. package/dist/tests/mocks/mockAssetSnapshots.d.ts +3 -0
  60. package/dist/tests/mocks/mockAssetSnapshots.d.ts.map +1 -0
  61. package/dist/tests/mocks/mockAssetSnapshots.js +56 -0
  62. package/dist/tests/mocks/mockAssetSnapshots.js.map +1 -0
  63. package/dist/tests/mocks/mockAssetTransactions.d.ts +3 -0
  64. package/dist/tests/mocks/mockAssetTransactions.d.ts.map +1 -0
  65. package/dist/tests/mocks/mockAssetTransactions.js +86 -0
  66. package/dist/tests/mocks/mockAssetTransactions.js.map +1 -0
  67. package/dist/tests/mocks/mockEpochs.d.ts +3 -0
  68. package/dist/tests/mocks/mockEpochs.d.ts.map +1 -0
  69. package/dist/tests/mocks/mockEpochs.js +26 -0
  70. package/dist/tests/mocks/mockEpochs.js.map +1 -0
  71. package/dist/tests/mocks/mockInvestorCurrencyBalance.d.ts +3 -0
  72. package/dist/tests/mocks/mockInvestorCurrencyBalance.d.ts.map +1 -0
  73. package/dist/tests/mocks/mockInvestorCurrencyBalance.js +29 -0
  74. package/dist/tests/mocks/mockInvestorCurrencyBalance.js.map +1 -0
  75. package/dist/tests/mocks/mockInvestorTransactions.d.ts +3 -0
  76. package/dist/tests/mocks/mockInvestorTransactions.d.ts.map +1 -0
  77. package/dist/tests/mocks/mockInvestorTransactions.js +35 -0
  78. package/dist/tests/mocks/mockInvestorTransactions.js.map +1 -0
  79. package/dist/tests/mocks/mockPoolFeeSnapshot.d.ts +3 -0
  80. package/dist/tests/mocks/mockPoolFeeSnapshot.d.ts.map +1 -0
  81. package/dist/tests/mocks/mockPoolFeeSnapshot.js +68 -0
  82. package/dist/tests/mocks/mockPoolFeeSnapshot.js.map +1 -0
  83. package/dist/tests/mocks/mockPoolFeeTransactions.d.ts +11 -0
  84. package/dist/tests/mocks/mockPoolFeeTransactions.d.ts.map +1 -0
  85. package/dist/tests/mocks/mockPoolFeeTransactions.js +20 -0
  86. package/dist/tests/mocks/mockPoolFeeTransactions.js.map +1 -0
  87. package/dist/tests/mocks/mockPoolSnapshots.d.ts +3 -0
  88. package/dist/tests/mocks/mockPoolSnapshots.d.ts.map +1 -0
  89. package/dist/tests/mocks/mockPoolSnapshots.js +66 -0
  90. package/dist/tests/mocks/mockPoolSnapshots.js.map +1 -0
  91. package/dist/tests/mocks/mockTrancheSnapshots.d.ts +3 -0
  92. package/dist/tests/mocks/mockTrancheSnapshots.d.ts.map +1 -0
  93. package/dist/tests/mocks/mockTrancheSnapshots.js +112 -0
  94. package/dist/tests/mocks/mockTrancheSnapshots.js.map +1 -0
  95. package/dist/types/reports.d.ts +336 -0
  96. package/dist/types/reports.d.ts.map +1 -0
  97. package/dist/types/reports.js +2 -0
  98. package/dist/types/reports.js.map +1 -0
  99. package/package.json +1 -1
@@ -0,0 +1,63 @@
1
+ import { Balance } from '../../utils/BigInt.js';
2
+ export function trancheCurrencyBalancePostProcessor(data) {
3
+ const currencyBalancesByAccountId = {};
4
+ data.currencyBalances.nodes.forEach((balance) => {
5
+ const trancheId = balance.currency.trancheId?.split('-')[1] ?? '';
6
+ currencyBalancesByAccountId[`${balance.accountId}-${trancheId}`] = balance;
7
+ });
8
+ return data.trancheBalances.nodes.map((balance) => {
9
+ const currencyDecimals = balance.pool.currency.decimals;
10
+ return {
11
+ accountId: balance.accountId,
12
+ chainId: balance.account?.chainId !== '0' ? Number(balance.account?.chainId) : 'centrifuge',
13
+ trancheId: balance.trancheId.split('-')[1] ?? '',
14
+ evmAddress: balance.account?.evmAddress,
15
+ balance: new Balance(currencyBalancesByAccountId[`${balance.accountId}-${balance.trancheId.split('-')[1]}`]?.amount ?? 0, currencyDecimals),
16
+ pendingInvestCurrency: new Balance(balance.pendingInvestCurrency, currencyDecimals),
17
+ claimableTrancheTokens: new Balance(balance.claimableTrancheTokens, currencyDecimals),
18
+ sumClaimedTrancheTokens: new Balance(balance.sumClaimedTrancheTokens, currencyDecimals),
19
+ pendingRedeemTrancheTokens: new Balance(balance.pendingRedeemTrancheTokens, currencyDecimals),
20
+ claimableCurrency: new Balance(balance.claimableCurrency, currencyDecimals),
21
+ sumClaimedCurrency: new Balance(balance.sumClaimedCurrency, currencyDecimals),
22
+ };
23
+ });
24
+ }
25
+ export const trancheCurrencyBalanceQuery = `
26
+ query($filterTranches: TrancheBalanceFilter, $filterCurrencies: CurrencyBalanceFilter) {
27
+ trancheBalances(filter: $filterTranches) {
28
+ nodes {
29
+ accountId
30
+ trancheId
31
+ account {
32
+ chainId
33
+ evmAddress
34
+ }
35
+ pool {
36
+ currency {
37
+ decimals
38
+ }
39
+ }
40
+ pendingInvestCurrency
41
+ claimableTrancheTokens
42
+ sumClaimedTrancheTokens
43
+ pendingRedeemTrancheTokens
44
+ claimableCurrency
45
+ sumClaimedCurrency
46
+ }
47
+ }
48
+ currencyBalances(filter: $filterCurrencies) {
49
+ nodes {
50
+ accountId
51
+ account {
52
+ chainId
53
+ evmAddress
54
+ }
55
+ currency {
56
+ trancheId
57
+ }
58
+ amount
59
+ }
60
+ }
61
+ }
62
+ `;
63
+ //# sourceMappingURL=trancheCurrencyBalance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trancheCurrencyBalance.js","sourceRoot":"","sources":["../../../src/entities/IndexerQueries/trancheCurrencyBalance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAS/C,MAAM,UAAU,mCAAmC,CAAC,IAAwD;IAC1G,MAAM,2BAA2B,GAA6E,EAAE,CAAA;IAChH,IAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC/C,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;QACjE,2BAA2B,CAAC,GAAG,OAAO,CAAC,SAAS,IAAI,SAAS,EAAE,CAAC,GAAG,OAAO,CAAA;IAC5E,CAAC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AAA;AACJ,CAAC;AA8DD,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqC1C,CAAA"}
@@ -0,0 +1,70 @@
1
+ import { Balance, Perquintill, Price } from '../../utils/BigInt.js';
2
+ export type TrancheSnapshotFilter = Partial<Record<keyof SubqueryTrancheSnapshot['trancheSnapshots']['nodes'][0], any>>;
3
+ export declare const trancheSnapshotsQuery = "\nquery($filter: TrancheSnapshotFilter) {\n trancheSnapshots(\n orderBy: BLOCK_NUMBER_ASC,\n filter: $filter\n) {\n nodes {\n tranche {\n poolId\n trancheId\n pool {\n currency {\n decimals\n symbol\n }\n }\n }\n timestamp\n tokenSupply\n tokenPrice\n sumOutstandingInvestOrdersByPeriod\n sumOutstandingRedeemOrdersByPeriod\n sumFulfilledInvestOrdersByPeriod\n sumFulfilledRedeemOrdersByPeriod\n yield7DaysAnnualized\n yield30DaysAnnualized\n yield90DaysAnnualized\n yieldSinceInception\n yieldMTD\n yieldQTD\n yieldYTD\n yieldSinceLastPeriod\n }\n }\n}\n";
4
+ export type SubqueryTrancheSnapshot = {
5
+ trancheSnapshots: {
6
+ nodes: {
7
+ id: string;
8
+ tokenPrice: string;
9
+ blockNumber: number;
10
+ timestamp: string;
11
+ trancheId: string;
12
+ tranche: {
13
+ poolId: string;
14
+ trancheId: string;
15
+ pool: {
16
+ currency: {
17
+ decimals: number;
18
+ symbol: string;
19
+ };
20
+ };
21
+ };
22
+ tokenSupply: string;
23
+ sumOutstandingInvestOrdersByPeriod: string;
24
+ sumOutstandingRedeemOrdersByPeriod: string;
25
+ sumFulfilledInvestOrdersByPeriod: string;
26
+ sumFulfilledRedeemOrdersByPeriod: string;
27
+ yield7DaysAnnualized: string;
28
+ yield30DaysAnnualized: string;
29
+ yield90DaysAnnualized: string;
30
+ yieldSinceInception: string;
31
+ yieldMTD: string;
32
+ yieldQTD: string;
33
+ yieldYTD: string;
34
+ yieldSinceLastPeriod: string;
35
+ }[];
36
+ };
37
+ };
38
+ export type TrancheSnapshot = {
39
+ id: string;
40
+ price: Price;
41
+ timestamp: string;
42
+ trancheId: string;
43
+ poolId: string;
44
+ tokenSupply: Balance;
45
+ pool: {
46
+ currency: {
47
+ decimals: number;
48
+ symbol: string;
49
+ };
50
+ };
51
+ outstandingInvestOrders: Balance;
52
+ outstandingRedeemOrders: Balance;
53
+ fulfilledInvestOrders: Balance;
54
+ fulfilledRedeemOrders: Balance;
55
+ yield7DaysAnnualized: Perquintill | null;
56
+ yield30DaysAnnualized: Perquintill | null;
57
+ yield90DaysAnnualized: Perquintill | null;
58
+ yieldSinceInception: Perquintill;
59
+ yieldMTD: Perquintill | null;
60
+ yieldQTD: Perquintill | null;
61
+ yieldYTD: Perquintill | null;
62
+ yieldSinceLastPeriod: Perquintill | null;
63
+ };
64
+ export type TrancheSnapshotsByDate = {
65
+ [timestamp: string]: TrancheSnapshot[];
66
+ };
67
+ export declare function trancheSnapshotsPostProcess(data: SubqueryTrancheSnapshot): {
68
+ [date: string]: TrancheSnapshot[];
69
+ };
70
+ //# sourceMappingURL=trancheSnapshots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trancheSnapshots.d.ts","sourceRoot":"","sources":["../../../src/entities/IndexerQueries/trancheSnapshots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAGnE,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,uBAAuB,CAAC,kBAAkB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;AAEvH,eAAO,MAAM,qBAAqB,utBAmCjC,CAAA;AACD,MAAM,MAAM,uBAAuB,GAAG;IACpC,gBAAgB,EAAE;QAChB,KAAK,EAAE;YACL,EAAE,EAAE,MAAM,CAAA;YACV,UAAU,EAAE,MAAM,CAAA;YAClB,WAAW,E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AE,WAAW,GAAG,IAAI,CAAA;IACxC,qBAAqB,EAAE,WAAW,GAAG,IAAI,CAAA;IACzC,qBAAqB,EAAE,WAAW,GAAG,IAAI,CAAA;IACzC,mBAAmB,EAAE,WAAW,CAAA;IAChC,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAA;IAC5B,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAA;IAC5B,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAA;IAC5B,oBAAoB,EAAE,WAAW,GAAG,IAAI,CAAA;CACzC,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,EAAE,CAAA;CACvC,CAAA;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,uBAAuB,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,EAAE,CAAA;CAAE,CAyChH"}
@@ -0,0 +1,76 @@
1
+ import { Balance, Perquintill, Price } from '../../utils/BigInt.js';
2
+ export const trancheSnapshotsQuery = `
3
+ query($filter: TrancheSnapshotFilter) {
4
+ trancheSnapshots(
5
+ orderBy: BLOCK_NUMBER_ASC,
6
+ filter: $filter
7
+ ) {
8
+ nodes {
9
+ tranche {
10
+ poolId
11
+ trancheId
12
+ pool {
13
+ currency {
14
+ decimals
15
+ symbol
16
+ }
17
+ }
18
+ }
19
+ timestamp
20
+ tokenSupply
21
+ tokenPrice
22
+ sumOutstandingInvestOrdersByPeriod
23
+ sumOutstandingRedeemOrdersByPeriod
24
+ sumFulfilledInvestOrdersByPeriod
25
+ sumFulfilledRedeemOrdersByPeriod
26
+ yield7DaysAnnualized
27
+ yield30DaysAnnualized
28
+ yield90DaysAnnualized
29
+ yieldSinceInception
30
+ yieldMTD
31
+ yieldQTD
32
+ yieldYTD
33
+ yieldSinceLastPeriod
34
+ }
35
+ }
36
+ }
37
+ `;
38
+ export function trancheSnapshotsPostProcess(data) {
39
+ const tranchesByDate = {};
40
+ data?.trancheSnapshots?.nodes?.forEach((tranche) => {
41
+ const date = tranche.timestamp.slice(0, 10);
42
+ if (!tranchesByDate[date]) {
43
+ tranchesByDate[date] = [];
44
+ }
45
+ const poolCurrency = tranche.tranche.pool.currency;
46
+ const trancheSnapshot = {
47
+ id: tranche.trancheId,
48
+ timestamp: tranche.timestamp,
49
+ poolId: tranche.tranche.poolId,
50
+ trancheId: tranche.tranche.trancheId,
51
+ pool: {
52
+ currency: {
53
+ decimals: poolCurrency.decimals,
54
+ symbol: poolCurrency.symbol,
55
+ },
56
+ },
57
+ price: new Price(tranche.tokenPrice ?? 0),
58
+ tokenSupply: new Balance(tranche.tokenSupply, poolCurrency.decimals),
59
+ fulfilledInvestOrders: new Balance(tranche.sumFulfilledInvestOrdersByPeriod, poolCurrency.decimals),
60
+ fulfilledRedeemOrders: new Balance(tranche.sumFulfilledRedeemOrdersByPeriod, poolCurrency.decimals),
61
+ outstandingInvestOrders: new Balance(tranche.sumOutstandingInvestOrdersByPeriod, poolCurrency.decimals),
62
+ outstandingRedeemOrders: new Balance(tranche.sumOutstandingRedeemOrdersByPeriod, poolCurrency.decimals),
63
+ yield7DaysAnnualized: new Perquintill(tranche.yield7DaysAnnualized ?? 0),
64
+ yield30DaysAnnualized: new Perquintill(tranche.yield30DaysAnnualized ?? 0),
65
+ yield90DaysAnnualized: new Perquintill(tranche.yield90DaysAnnualized ?? 0),
66
+ yieldSinceInception: new Perquintill(tranche.yieldSinceInception ?? 0),
67
+ yieldMTD: new Perquintill(tranche.yieldMTD ?? 0),
68
+ yieldQTD: new Perquintill(tranche.yieldQTD ?? 0),
69
+ yieldYTD: new Perquintill(tranche.yieldYTD ?? 0),
70
+ yieldSinceLastPeriod: new Perquintill(tranche.yieldSinceLastPeriod ?? 0),
71
+ };
72
+ tranchesByDate[date].push(trancheSnapshot);
73
+ });
74
+ return tranchesByDate;
75
+ }
76
+ //# sourceMappingURL=trancheSnapshots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trancheSnapsh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AC,QAAQ,CAAC;YACnG,qBAAqB,EAAE,IAAI,OAAO,CAAC,OAAO,CAAC,gCAAgC,EAAE,YAAY,CAAC,QAAQ,CAAC;YACnG,uBAAuB,EAAE,IAAI,OAAO,CAAC,OAAO,CAAC,kCAAkC,EAAE,YAAY,CAAC,QAAQ,CAAC;YACvG,uBAAuB,EAAE,IAAI,OAAO,CAAC,OAAO,CAAC,kCAAkC,EAAE,YAAY,CAAC,QAAQ,CAAC;YACvG,oBAAoB,EAAE,IAAI,WAAW,CAAC,OAAO,CAAC,oBAAoB,IAAI,CAAC,CAAC;YACxE,qBAAqB,EAAE,IAAI,WAAW,CAAC,OAAO,CAAC,qBAAqB,IAAI,CAAC,CAAC;YAC1E,qBAAqB,EAAE,IAAI,WAAW,CAAC,OAAO,CAAC,qBAAqB,IAAI,CAAC,CAAC;YAC1E,mBAAmB,EAAE,IAAI,WAAW,CAAC,OAAO,CAAC,mBAAmB,IAAI,CAAC,CAAC;YACtE,QAAQ,EAAE,IAAI,WAAW,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC;YAChD,QAAQ,EAAE,IAAI,WAAW,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC;YAChD,QAAQ,EAAE,IAAI,WAAW,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC;YAChD,oBAAoB,EAAE,IAAI,WAAW,CAAC,OAAO,CAAC,oBAAoB,IAAI,CAAC,CAAC;SACzE,CAAA;QAED,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;IAC5C,CAAC,CAAC,CAAA;IAEF,OAAO,cAAc,CAAA;AACvB,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { AssetListData, AssetListReport, AssetListReportFilter, AssetTimeSeriesData, AssetTimeSeriesReport, AssetTimeSeriesReportFilter, AssetTransactionReport, AssetTransactionReportFilter, AssetTransactionsData, BalanceSheetData, BalanceSheetReport, CashflowData, CashflowReport, FeeTransactionReport, FeeTransactionReportFilter, FeeTransactionsData, InvestorListData, InvestorListReport, InvestorListReportFilter, InvestorTransactionsData, InvestorTransactionsReport, InvestorTransactionsReportFilter, OrdersListData, OrdersListReport, ProfitAndLossData, ProfitAndLossReport, ReportFilter, TokenPriceData, TokenPriceReport, TokenPriceReportFilter } from '../../types/reports.js';
2
+ export declare class Processor {
3
+ /**
4
+ * Process raw data into a balance sheet report
5
+ * @param data Pool and tranche snapshot data
6
+ * @param filter Optional filtering and grouping options
7
+ * @returns Processed balance sheet report at the end of each period
8
+ */
9
+ balanceSheet(data: BalanceSheetData, filter?: Omit<ReportFilter, 'to' | 'from'>): BalanceSheetReport[];
10
+ /**
11
+ * Process raw data into an aggregated cashflow report, fees and endCashBalance are NOT aggregated by period
12
+ * @param data Pool snapshot data
13
+ * @param filter Optional filtering and grouping options
14
+ * @returns Processed cashflow report at the end of each period
15
+ */
16
+ cashflow(data: CashflowData, filter?: Omit<ReportFilter, 'to' | 'from'>): CashflowReport[];
17
+ /**
18
+ * Process raw data into an aggregated profit and loss report, fees and endCashBalance are NOT aggregated by period
19
+ * @param data Pool snapshot data
20
+ * @param filter Optional filtering and grouping options
21
+ * @returns Processed profit and loss report at the end of each period
22
+ */
23
+ profitAndLoss(data: ProfitAndLossData, filter?: Omit<ReportFilter, 'to' | 'from'>): ProfitAndLossReport[];
24
+ investorTransactions(data: InvestorTransactionsData, filter?: Omit<InvestorTransactionsReportFilter, 'to' | 'from'>): InvestorTransactionsReport[];
25
+ assetTransactions(data: AssetTransactionsData, filter?: Omit<AssetTransactionReportFilter, 'to' | 'from'>): AssetTransactionReport[];
26
+ feeTransactions(data: FeeTransactionsData, filter?: Omit<FeeTransactionReportFilter, 'to' | 'from'>): FeeTransactionReport[];
27
+ tokenPrice(data: TokenPriceData, filter?: Omit<TokenPriceReportFilter, 'to' | 'from'>): TokenPriceReport[];
28
+ assetList(data: AssetListData, filter?: Omit<AssetListReportFilter, 'to' | 'from'>): AssetListReport[];
29
+ investorList(data: InvestorListData, filter?: Omit<InvestorListReportFilter, 'to' | 'from'>): InvestorListReport[];
30
+ ordersList(data: OrdersListData): OrdersListReport[];
31
+ assetTimeSeries(data: AssetTimeSeriesData, filter?: Omit<AssetTimeSeriesReportFilter, 'to' | 'from'>): AssetTimeSeriesReport[];
32
+ /**
33
+ * Apply grouping to a report.
34
+ * @param items Report items
35
+ * @param filter Optional filtering and grouping options
36
+ * @param strategy Grouping strategy, sum aggregates data by period, latest returns the latest item in the period
37
+ * @returns Grouped report
38
+ *
39
+ * Note: if strategy is 'sum', only Decimal values that are not nested are aggregated, all
40
+ * other values are overwritten with the last value in the period
41
+ */
42
+ private applyGrouping;
43
+ private getDateKey;
44
+ }
45
+ export declare const processor: Processor;
46
+ //# sourceMappingURL=Processor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Processor.d.ts","sourceRoot":"","sources":["../../../src/entities/Reports/Processor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,eAAe,EACf,qBAAqB,EAGrB,mBAAmB,EACnB,qBAAqB,EACrB,2BAA2B,EAC3B,sBAAsB,EACtB,4BAA4B,EAC5B,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,0BAA0B,EAC1B,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,gCAAgC,EAChC,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,wBAAwB,CAAA;AAO/B,qBAAa,SAAS;IACpB;;;;;OAKG;IACH,YAAY,CAAC,IAAI,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,MAAM,CAAC,GAAG,kBAAkB,EAAE;IA2CtG;;;;;OAKG;IACH,QA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