@sonarwatch/portfolio-core 0.16.4 → 0.16.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.
- package/CHANGELOG.md +80 -0
- package/package.json +5 -1
- package/src/FetcherResult.d.ts +38 -0
- package/src/FetcherResult.js +3 -0
- package/src/FetcherResult.js.map +1 -0
- package/src/Portfolio.d.ts +7 -35
- package/src/Portfolio.js.map +1 -1
- package/src/Yield.d.ts +4 -0
- package/src/constants/networks.js +9 -9
- package/src/constants/networks.js.map +1 -1
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/index.js.map +1 -1
- package/src/utils/index.d.ts +1 -0
- package/src/utils/index.js +1 -0
- package/src/utils/index.js.map +1 -1
- package/src/utils/reduceYieldElements.d.ts +2 -0
- package/src/utils/reduceYieldElements.js +12 -0
- package/src/utils/reduceYieldElements.js.map +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,86 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.16.6](https://github.com/sonarwatch/portfolio/compare/core-0.16.5...core-0.16.6) (2025-07-09)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [0.16.20](https://github.com/sonarwatch/portfolio/compare/core-0.16.19...core-0.16.20) (2025-07-09)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## [0.16.19](https://github.com/sonarwatch/portfolio/compare/core-0.16.18...core-0.16.19) (2025-07-09)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.16.18](https://github.com/sonarwatch/portfolio/compare/core-0.16.17...core-0.16.18) (2025-07-09)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## [0.16.17](https://github.com/sonarwatch/portfolio/compare/core-0.16.16...core-0.16.17) (2025-07-09)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [0.16.16](https://github.com/sonarwatch/portfolio/compare/core-0.16.15...core-0.16.16) (2025-07-09)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## [0.16.15](https://github.com/sonarwatch/portfolio/compare/core-0.16.14...core-0.16.15) (2025-07-09)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## [0.16.14](https://github.com/sonarwatch/portfolio/compare/core-0.16.13...core-0.16.14) (2025-07-08)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## [0.16.13](https://github.com/sonarwatch/portfolio/compare/core-0.16.12...core-0.16.13) (2025-07-08)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## [0.16.12](https://github.com/sonarwatch/portfolio/compare/core-0.16.11...core-0.16.12) (2025-07-08)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## [0.16.11](https://github.com/sonarwatch/portfolio/compare/core-0.16.10...core-0.16.11) (2025-07-08)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
## [0.16.10](https://github.com/sonarwatch/portfolio/compare/core-0.16.9...core-0.16.10) (2025-07-08)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
## [0.16.9](https://github.com/sonarwatch/portfolio/compare/core-0.16.8...core-0.16.9) (2025-07-08)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## [0.16.8](https://github.com/sonarwatch/portfolio/compare/core-0.16.7...core-0.16.8) (2025-07-08)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
## [0.16.7](https://github.com/sonarwatch/portfolio/compare/core-0.16.6...core-0.16.7) (2025-07-08)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## [0.16.6](https://github.com/sonarwatch/portfolio/compare/core-0.16.5...core-0.16.6) (2025-07-08)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
## [0.16.5](https://github.com/sonarwatch/portfolio/compare/core-0.16.4...core-0.16.5) (2025-07-08)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
### Bug Fixes
|
|
73
|
+
|
|
74
|
+
* **core:** handle empty yield items and correct revenue calculations in calcYieldSummary ([39ba5f3](https://github.com/sonarwatch/portfolio/commit/39ba5f3b6bb334b970e7b8e146cf80d24d45293c))
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
### Features
|
|
78
|
+
|
|
79
|
+
* **core:** add calcYieldSummary utility and FetcherResult types to enhance yield data calculations and integration ([9c26a0f](https://github.com/sonarwatch/portfolio/commit/9c26a0f618826a8dbec19ff7cf7685182aff27e5))
|
|
80
|
+
* **core:** add optional error field to FetcherResult ([76e3b84](https://github.com/sonarwatch/portfolio/commit/76e3b84bfb8ab07a42d3c238e256611885bd2b52))
|
|
81
|
+
* **plugins:** add netApy support across element builders and simplify yield calculations ([f0c97b7](https://github.com/sonarwatch/portfolio/commit/f0c97b74727e320370fcc6a298ff14eb7b74c256))
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
5
85
|
## [0.16.4](https://github.com/sonarwatch/portfolio/compare/core-0.16.3...core-0.16.4) (2025-07-04)
|
|
6
86
|
|
|
7
87
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonarwatch/portfolio-core",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.6",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"types": "./src/index.d.ts",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/sonarwatch/portfolio.git"
|
|
9
|
+
},
|
|
6
10
|
"dependencies": {
|
|
7
11
|
"@ethersproject/address": "^5.7.0",
|
|
8
12
|
"@ethersproject/bytes": "^5.7.0",
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { NetworkIdType } from './Network';
|
|
2
|
+
import { AddressSystemType } from './Address';
|
|
3
|
+
import { UsdValue } from './UsdValue';
|
|
4
|
+
import { TokenInfo } from './TokenList';
|
|
5
|
+
import { PortfolioElement } from './Portfolio';
|
|
6
|
+
/**
|
|
7
|
+
* Represents the result of a fetcher.
|
|
8
|
+
*/
|
|
9
|
+
export type FetcherResult = {
|
|
10
|
+
owner: string;
|
|
11
|
+
fetcherId: string;
|
|
12
|
+
networdkId: NetworkIdType;
|
|
13
|
+
duration: number;
|
|
14
|
+
elements: PortfolioElement[];
|
|
15
|
+
error?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Represents the report of a fetcher.
|
|
19
|
+
*/
|
|
20
|
+
export type FetcherReport = {
|
|
21
|
+
id: string;
|
|
22
|
+
status: 'succeeded' | 'failed';
|
|
23
|
+
duration?: number;
|
|
24
|
+
error?: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Represents the result of multiple fetchers.
|
|
28
|
+
*/
|
|
29
|
+
export type FetchersResult = {
|
|
30
|
+
date: number;
|
|
31
|
+
owner: string;
|
|
32
|
+
addressSystem: AddressSystemType;
|
|
33
|
+
fetcherReports: FetcherReport[];
|
|
34
|
+
value: UsdValue;
|
|
35
|
+
elements: PortfolioElement[];
|
|
36
|
+
duration: number;
|
|
37
|
+
tokenInfo?: Partial<Record<NetworkIdType, Record<string, TokenInfo>>>;
|
|
38
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetcherResult.js","sourceRoot":"","sources":["../../../../packages/core/src/FetcherResult.ts"],"names":[],"mappings":""}
|
package/src/Portfolio.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { UsdValue } from './UsdValue';
|
|
2
2
|
import { NetworkIdType } from './Network';
|
|
3
3
|
import { Yield } from './Yield';
|
|
4
|
-
import { AddressSystemType } from './Address';
|
|
5
|
-
import { TokenInfo } from './TokenList';
|
|
6
4
|
/**
|
|
7
5
|
* Represents the type of portfolio asset.
|
|
8
6
|
*/
|
|
@@ -154,6 +152,13 @@ export type PortfolioElementCommon = {
|
|
|
154
152
|
name?: string;
|
|
155
153
|
tags?: string[];
|
|
156
154
|
proxyInfo?: ProxyInfo;
|
|
155
|
+
/**
|
|
156
|
+
* Net APY (Annual Percentage Yield) as fraction.
|
|
157
|
+
* Includes internal token yields
|
|
158
|
+
* 0.28 means 28% APY
|
|
159
|
+
* -0.28 means -28% APR
|
|
160
|
+
*/
|
|
161
|
+
netApy?: number;
|
|
157
162
|
};
|
|
158
163
|
/**
|
|
159
164
|
* Represents the data of a multiple portfolio element.
|
|
@@ -391,36 +396,3 @@ export type PortfolioElementBorrowLend = PortfolioElementCommon & {
|
|
|
391
396
|
* Represents a portfolio element.
|
|
392
397
|
*/
|
|
393
398
|
export type PortfolioElement = PortfolioElementMultiple | PortfolioElementLiquidity | PortfolioElementLeverage | PortfolioElementBorrowLend | PortfolioElementTrade;
|
|
394
|
-
/**
|
|
395
|
-
* Represents the result of a fetcher.
|
|
396
|
-
*/
|
|
397
|
-
export type FetcherResult = {
|
|
398
|
-
owner: string;
|
|
399
|
-
fetcherId: string;
|
|
400
|
-
networdkId: NetworkIdType;
|
|
401
|
-
duration: number;
|
|
402
|
-
elements: PortfolioElement[];
|
|
403
|
-
error?: string;
|
|
404
|
-
};
|
|
405
|
-
/**
|
|
406
|
-
* Represents the report of a fetcher.
|
|
407
|
-
*/
|
|
408
|
-
export type FetcherReport = {
|
|
409
|
-
id: string;
|
|
410
|
-
status: 'succeeded' | 'failed';
|
|
411
|
-
duration?: number;
|
|
412
|
-
error?: string;
|
|
413
|
-
};
|
|
414
|
-
/**
|
|
415
|
-
* Represents the result of multiple fetchers.
|
|
416
|
-
*/
|
|
417
|
-
export type FetchersResult = {
|
|
418
|
-
date: number;
|
|
419
|
-
owner: string;
|
|
420
|
-
addressSystem: AddressSystemType;
|
|
421
|
-
fetcherReports: FetcherReport[];
|
|
422
|
-
value: UsdValue;
|
|
423
|
-
elements: PortfolioElement[];
|
|
424
|
-
duration: number;
|
|
425
|
-
tokenInfo?: Partial<Record<NetworkIdType, Record<string, TokenInfo>>>;
|
|
426
|
-
};
|
package/src/Portfolio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Portfolio.js","sourceRoot":"","sources":["../../../../packages/core/src/Portfolio.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Portfolio.js","sourceRoot":"","sources":["../../../../packages/core/src/Portfolio.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACU,QAAA,kBAAkB,GAAG;IAChC,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;CAClB,CAAC;AA6CX;;GAEG;AACU,QAAA,oBAAoB,GAAG;IAClC,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;IACxB,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;CACN,CAAC;AAkPX,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,+BAAe,CAAA;AACjB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB"}
|
package/src/Yield.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ const addresses_1 = require("./addresses");
|
|
|
7
7
|
exports.bitcoinNetwork = {
|
|
8
8
|
id: Network_1.NetworkId.bitcoin,
|
|
9
9
|
name: 'Bitcoin',
|
|
10
|
-
image: 'https://
|
|
10
|
+
image: 'https://raw.githubusercontent.com/sonarwatch/hub-platforms/main/img/networks/bitcoin.webp',
|
|
11
11
|
addressSystem: Address_1.AddressSystem.bitcoin,
|
|
12
12
|
chainId: 1,
|
|
13
13
|
native: {
|
|
@@ -24,7 +24,7 @@ exports.bitcoinNetwork = {
|
|
|
24
24
|
exports.ethereumNetwork = {
|
|
25
25
|
id: Network_1.NetworkId.ethereum,
|
|
26
26
|
name: 'Ethereum',
|
|
27
|
-
image: 'https://
|
|
27
|
+
image: 'https://raw.githubusercontent.com/sonarwatch/hub-platforms/main/img/networks/ethereum.webp',
|
|
28
28
|
addressSystem: Address_1.AddressSystem.evm,
|
|
29
29
|
chainId: 1,
|
|
30
30
|
native: {
|
|
@@ -45,7 +45,7 @@ exports.ethereumNetwork = {
|
|
|
45
45
|
exports.avalancheNetwork = {
|
|
46
46
|
id: Network_1.NetworkId.avalanche,
|
|
47
47
|
name: 'Avalanche',
|
|
48
|
-
image: 'https://
|
|
48
|
+
image: 'https://raw.githubusercontent.com/sonarwatch/hub-platforms/main/img/networks/avalanche.webp',
|
|
49
49
|
addressSystem: Address_1.AddressSystem.evm,
|
|
50
50
|
chainId: 43114,
|
|
51
51
|
native: {
|
|
@@ -66,7 +66,7 @@ exports.avalancheNetwork = {
|
|
|
66
66
|
exports.polygonNetwork = {
|
|
67
67
|
id: Network_1.NetworkId.polygon,
|
|
68
68
|
name: 'Polygon',
|
|
69
|
-
image: 'https://
|
|
69
|
+
image: 'https://raw.githubusercontent.com/sonarwatch/hub-platforms/main/img/networks/polygon.webp',
|
|
70
70
|
addressSystem: Address_1.AddressSystem.evm,
|
|
71
71
|
chainId: 137,
|
|
72
72
|
native: {
|
|
@@ -87,7 +87,7 @@ exports.polygonNetwork = {
|
|
|
87
87
|
exports.solanaNetwork = {
|
|
88
88
|
id: Network_1.NetworkId.solana,
|
|
89
89
|
name: 'Solana',
|
|
90
|
-
image: 'https://
|
|
90
|
+
image: 'https://raw.githubusercontent.com/sonarwatch/hub-platforms/main/img/networks/solana.webp',
|
|
91
91
|
addressSystem: Address_1.AddressSystem.solana,
|
|
92
92
|
chainId: 101,
|
|
93
93
|
native: {
|
|
@@ -104,7 +104,7 @@ exports.solanaNetwork = {
|
|
|
104
104
|
exports.aptosNetwork = {
|
|
105
105
|
id: Network_1.NetworkId.aptos,
|
|
106
106
|
name: 'Aptos',
|
|
107
|
-
image: 'https://
|
|
107
|
+
image: 'https://raw.githubusercontent.com/sonarwatch/hub-platforms/main/img/networks/aptos.webp',
|
|
108
108
|
addressSystem: Address_1.AddressSystem.move,
|
|
109
109
|
chainId: 1,
|
|
110
110
|
native: {
|
|
@@ -121,7 +121,7 @@ exports.aptosNetwork = {
|
|
|
121
121
|
exports.suiNetwork = {
|
|
122
122
|
id: Network_1.NetworkId.sui,
|
|
123
123
|
name: 'Sui',
|
|
124
|
-
image: 'https://
|
|
124
|
+
image: 'https://raw.githubusercontent.com/sonarwatch/hub-platforms/main/img/networks/sui.webp',
|
|
125
125
|
addressSystem: Address_1.AddressSystem.move,
|
|
126
126
|
chainId: 1,
|
|
127
127
|
native: {
|
|
@@ -138,7 +138,7 @@ exports.suiNetwork = {
|
|
|
138
138
|
exports.seiNetwork = {
|
|
139
139
|
id: Network_1.NetworkId.sei,
|
|
140
140
|
name: 'Sei',
|
|
141
|
-
image: 'https://
|
|
141
|
+
image: 'https://raw.githubusercontent.com/sonarwatch/hub-platforms/main/img/networks/sei.webp',
|
|
142
142
|
addressSystem: Address_1.AddressSystem.sei,
|
|
143
143
|
chainId: 1,
|
|
144
144
|
native: {
|
|
@@ -155,7 +155,7 @@ exports.seiNetwork = {
|
|
|
155
155
|
exports.bnbNetwork = {
|
|
156
156
|
id: Network_1.NetworkId.bnb,
|
|
157
157
|
name: 'BNB Chain',
|
|
158
|
-
image: 'https://
|
|
158
|
+
image: 'https://raw.githubusercontent.com/sonarwatch/hub-platforms/main/img/networks/bnb.webp',
|
|
159
159
|
addressSystem: Address_1.AddressSystem.evm,
|
|
160
160
|
chainId: 56,
|
|
161
161
|
native: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"networks.js","sourceRoot":"","sources":["../../../../../packages/core/src/constants/networks.ts"],"names":[],"mappings":";;;AAAA,wCAA8D;AAC9D,wCAA+D;AAC/D,2CAgBqB;AAER,QAAA,cAAc,GAAY;IACrC,EAAE,EAAE,mBAAS,CAAC,OAAO;IACrB,IAAI,EAAE,SAAS;IACf,KAAK,EACH,
|
|
1
|
+
{"version":3,"file":"networks.js","sourceRoot":"","sources":["../../../../../packages/core/src/constants/networks.ts"],"names":[],"mappings":";;;AAAA,wCAA8D;AAC9D,wCAA+D;AAC/D,2CAgBqB;AAER,QAAA,cAAc,GAAY;IACrC,EAAE,EAAE,mBAAS,CAAC,OAAO;IACrB,IAAI,EAAE,SAAS;IACf,KAAK,EACH,2FAA2F;IAC7F,aAAa,EAAE,uBAAa,CAAC,OAAO;IACpC,OAAO,EAAE,CAAC;IACV,MAAM,EAAE;QACN,OAAO,EAAE,gCAAoB;QAC7B,QAAQ,EAAE,CAAC;QACX,WAAW,EAAE,SAAS;KACvB;IACD,aAAa,EAAE,IAAI;IACnB,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,YAAY,EACV,sGAAsG;CACzG,CAAC;AACW,QAAA,eAAe,GAAY;IACtC,EAAE,EAAE,mBAAS,CAAC,QAAQ;IACtB,IAAI,EAAE,UAAU;IAChB,KAAK,EACH,4FAA4F;IAC9F,aAAa,EAAE,uBAAa,CAAC,GAAG;IAChC,OAAO,EAAE,CAAC;IACV,MAAM,EAAE;QACN,OAAO,EAAE,iCAAqB;QAC9B,QAAQ,EAAE,EAAE;QACZ,WAAW,EAAE,UAAU;KACxB;IACD,aAAa,EAAE;QACb,OAAO,EAAE,wCAA4B;QACrC,QAAQ,EAAE,EAAE;QACZ,WAAW,EAAE,MAAM;KACpB;IACD,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,UAAU;IACnB,OAAO,EAAE,UAAU;IACnB,YAAY,EACV,uGAAuG;CAC1G,CAAC;AACW,QAAA,gBAAgB,GAAY;IACvC,EAAE,EAAE,mBAAS,CAAC,SAAS;IACvB,IAAI,EAAE,WAAW;IACjB,KAAK,EACH,6FAA6F;IAC/F,aAAa,EAAE,uBAAa,CAAC,GAAG;IAChC,OAAO,EAAE,KAAK;IACd,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,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC,EAAE,CAAC;AAEM,QAAA,WAAW,GAAc,MAAM,CAAC,MAAM,CAAC,gBAAQ,CAAC,CAAC,MAAM,CAClE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,KAAK,uBAAa,CAAC,GAAG,CAC7C,CAAC"}
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -31,4 +31,5 @@ __exportStar(require("./TokenYield"), exports);
|
|
|
31
31
|
__exportStar(require("./Yield"), exports);
|
|
32
32
|
__exportStar(require("./BorrowLendRate"), exports);
|
|
33
33
|
__exportStar(require("./Transaction"), exports);
|
|
34
|
+
__exportStar(require("./FetcherResult"), exports);
|
|
34
35
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/core/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,2CAAyB;AACzB,iDAA+B;AAC/B,0CAAwB;AACxB,0CAAwB;AACxB,4CAA0B;AAC1B,4CAA0B;AAC1B,6CAA2B;AAC3B,2CAAyB;AACzB,4CAA0B;AAC1B,8CAA4B;AAC5B,8CAA4B;AAC5B,+CAA6B;AAC7B,+CAA6B;AAC7B,0CAAwB;AACxB,mDAAiC;AACjC,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/core/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,2CAAyB;AACzB,iDAA+B;AAC/B,0CAAwB;AACxB,0CAAwB;AACxB,4CAA0B;AAC1B,4CAA0B;AAC1B,6CAA2B;AAC3B,2CAAyB;AACzB,4CAA0B;AAC1B,8CAA4B;AAC5B,8CAA4B;AAC5B,+CAA6B;AAC7B,+CAA6B;AAC7B,0CAAwB;AACxB,mDAAiC;AACjC,gDAA8B;AAC9B,kDAAgC"}
|
package/src/utils/index.d.ts
CHANGED
package/src/utils/index.js
CHANGED
|
@@ -64,4 +64,5 @@ __exportStar(require("./getIsVerifiedFromAsset"), exports);
|
|
|
64
64
|
__exportStar(require("./TokenPriceMap"), exports);
|
|
65
65
|
__exportStar(require("./applyPricesToElements"), exports);
|
|
66
66
|
__exportStar(require("./fixUsdValue"), exports);
|
|
67
|
+
__exportStar(require("./reduceYieldElements"), exports);
|
|
67
68
|
//# sourceMappingURL=index.js.map
|
package/src/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/core/src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,oDAAkC;AAClC,kEAAgD;AAChD,sDAAoC;AACpC,iDAA+B;AAC/B,sDAAoC;AACpC,kDAAgC;AAChC,uDAAqC;AACrC,4DAA0C;AAC1C,+DAA6C;AAC7C,gDAA8B;AAC9B,oDAAkC;AAClC,mDAAiC;AACjC,wDAAsC;AACtC,qDAAmC;AACnC,+DAA6C;AAC7C,2DAAyC;AACzC,uDAAqC;AACrC,mDAAiC;AACjC,wDAAsC;AACtC,2DAAyC;AACzC,+DAA6C;AAC7C,kEAAgD;AAChD,yDAAuC;AACvC,0DAAwC;AACxC,4DAA0C;AAC1C,8DAA4C;AAC5C,mDAAiC;AACjC,yDAAuC;AACvC,mEAAiD;AACjD,oEAAkD;AAClD,+CAA6B;AAC7B,yDAAuC;AACvC,0DAAwC;AACxC,4DAA0C;AAC1C,wDAAsC;AACtC,2DAAyC;AACzC,sDAAoC;AACpC,uDAAqC;AACrC,uDAAqC;AACrC,sDAAoC;AACpC,uDAAqC;AACrC,8DAA4C;AAC5C,8DAA4C;AAC5C,mDAAiC;AACjC,uDAAqC;AACrC,2DAAyC;AACzC,kDAAgC;AAChC,0DAAwC;AACxC,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/core/src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,oDAAkC;AAClC,kEAAgD;AAChD,sDAAoC;AACpC,iDAA+B;AAC/B,sDAAoC;AACpC,kDAAgC;AAChC,uDAAqC;AACrC,4DAA0C;AAC1C,+DAA6C;AAC7C,gDAA8B;AAC9B,oDAAkC;AAClC,mDAAiC;AACjC,wDAAsC;AACtC,qDAAmC;AACnC,+DAA6C;AAC7C,2DAAyC;AACzC,uDAAqC;AACrC,mDAAiC;AACjC,wDAAsC;AACtC,2DAAyC;AACzC,+DAA6C;AAC7C,kEAAgD;AAChD,yDAAuC;AACvC,0DAAwC;AACxC,4DAA0C;AAC1C,8DAA4C;AAC5C,mDAAiC;AACjC,yDAAuC;AACvC,mEAAiD;AACjD,oEAAkD;AAClD,+CAA6B;AAC7B,yDAAuC;AACvC,0DAAwC;AACxC,4DAA0C;AAC1C,wDAAsC;AACtC,2DAAyC;AACzC,sDAAoC;AACpC,uDAAqC;AACrC,uDAAqC;AACrC,sDAAoC;AACpC,uDAAqC;AACrC,8DAA4C;AAC5C,8DAA4C;AAC5C,mDAAiC;AACjC,uDAAqC;AACrC,2DAAyC;AACzC,kDAAgC;AAChC,0DAAwC;AACxC,gDAA8B;AAC9B,wDAAsC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reduceYieldElements = void 0;
|
|
4
|
+
const getUsdValueSum_1 = require("./getUsdValueSum");
|
|
5
|
+
const reduceYieldElements = (yieldItems) => {
|
|
6
|
+
const totalValue = (0, getUsdValueSum_1.getUsdValueSum)(yieldItems.map((ye) => ye.value));
|
|
7
|
+
return yieldItems
|
|
8
|
+
.filter((ye) => ye.apy !== 0)
|
|
9
|
+
.reduce((sum, ye) => sum + (ye.apy * ye.value) / totalValue, 0);
|
|
10
|
+
};
|
|
11
|
+
exports.reduceYieldElements = reduceYieldElements;
|
|
12
|
+
//# sourceMappingURL=reduceYieldElements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reduceYieldElements.js","sourceRoot":"","sources":["../../../../../packages/core/src/utils/reduceYieldElements.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAG3C,MAAM,mBAAmB,GAAG,CAAC,UAA0B,EAAE,EAAE;IAChE,MAAM,UAAU,GAAG,IAAA,+BAAc,EAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACpE,OAAO,UAAU;SACd,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC;SAC5B,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,UAAU,EAAE,CAAC,CAAC,CAAC;AACpE,CAAC,CAAC;AALW,QAAA,mBAAmB,uBAK9B"}
|