@sonarwatch/portfolio-core 0.15.16 → 0.15.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.15.18](https://github.com/sonarwatch/portfolio/compare/core-0.15.17...core-0.15.18) (2025-07-03)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **getAddressSystemFromNetworkId:** correct typo in parameter name ([bcb40a7](https://github.com/sonarwatch/portfolio/commit/bcb40a7a18242765e9d2b3f28cc7742c95e01ea1))
11
+
12
+
13
+ ### Features
14
+
15
+ * **fetchers:** add error handling and validation in getFetchersResult and runFetcherSafe ([7086461](https://github.com/sonarwatch/portfolio/commit/7086461d8864bdaefe4d7dda9db83727924de409))
16
+
17
+
18
+
19
+ ## [0.15.17](https://github.com/sonarwatch/portfolio/compare/core-0.15.16...core-0.15.17) (2025-06-27)
20
+
21
+
22
+
5
23
  ## [0.15.16](https://github.com/sonarwatch/portfolio/compare/core-0.15.15...core-0.15.16) (2025-06-23)
6
24
 
7
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-core",
3
- "version": "0.15.16",
3
+ "version": "0.15.18",
4
4
  "type": "commonjs",
5
5
  "types": "./src/index.d.ts",
6
6
  "dependencies": {
@@ -134,7 +134,7 @@ export type ProxyInfo = {
134
134
  id: string;
135
135
  address: string;
136
136
  };
137
- export type SourceRefName = 'Pool' | 'Farm' | 'Market' | 'Vault' | 'Lending Market' | 'Strategy' | 'NFT Mint' | 'Reserve' | 'Proposal' | 'Distributor' | 'Locker' | 'Pair';
137
+ export type SourceRefName = 'Pool' | 'Farm' | 'Market' | 'Vault' | 'Lending Market' | 'Strategy' | 'NFT Mint' | 'Reserve' | 'Proposal' | 'Distributor' | 'Locker' | 'Custody' | 'Pair';
138
138
  /**
139
139
  * Represents references to on-chain accounts.
140
140
  */
@@ -400,6 +400,7 @@ export type FetcherResult = {
400
400
  networdkId: NetworkIdType;
401
401
  duration: number;
402
402
  elements: PortfolioElement[];
403
+ error?: string;
403
404
  };
404
405
  /**
405
406
  * Represents the report of a fetcher.
@@ -1 +1 @@
1
- {"version":3,"file":"Portfolio.js","sourceRoot":"","sources":["../../../../packages/core/src/Portfolio.ts"],"names":[],"mappings":";;;AAMA;;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;AA0OX,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,+BAAe,CAAA;AACjB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB"}
1
+ {"version":3,"file":"Portfolio.js","sourceRoot":"","sources":["../../../../packages/core/src/Portfolio.ts"],"names":[],"mappings":";;;AAMA;;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;AA2OX,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,+BAAe,CAAA;AACjB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB"}
@@ -13,15 +13,18 @@ const applyPricesToElement = (element, tokenPrices) => {
13
13
  if (element.networkId !== tokenPrices.networkId)
14
14
  return element;
15
15
  if (element.type === Portfolio_1.PortfolioElementType.multiple) {
16
- return Object.assign(Object.assign({}, element), { data: Object.assign(Object.assign({}, element.data), { assets: element.data.assets.map((asset) => {
17
- if (asset.type === Portfolio_1.PortfolioAssetType.token) {
18
- const tokenPrice = tokenPrices.get(asset.data.address);
19
- if (!tokenPrice)
20
- return asset;
21
- return Object.assign(Object.assign({}, asset), { data: Object.assign(Object.assign({}, asset.data), { price: tokenPrice.price }), value: (0, fixUsdValue_1.fixUsdValue)(tokenPrice.price * asset.data.amount) });
22
- }
16
+ const assets = element.data.assets.map((asset) => {
17
+ if (asset.type === Portfolio_1.PortfolioAssetType.token) {
18
+ const tokenPrice = tokenPrices.get(asset.data.address);
19
+ if (!tokenPrice)
23
20
  return asset;
24
- }), value: element.data.assets.reduce((acc, asset) => acc + (asset.value || 0), 0) }) });
21
+ if (tokenPrice.price === undefined)
22
+ return asset;
23
+ return Object.assign(Object.assign({}, asset), { data: Object.assign(Object.assign({}, asset.data), { price: tokenPrice.price }), value: (0, fixUsdValue_1.fixUsdValue)(tokenPrice.price * asset.data.amount) });
24
+ }
25
+ return asset;
26
+ });
27
+ return Object.assign(Object.assign({}, element), { data: Object.assign(Object.assign({}, element.data), { assets, value: assets.reduce((acc, asset) => acc + (asset.value || 0), 0) }) });
25
28
  }
26
29
  return element;
27
30
  };
@@ -1 +1 @@
1
- {"version":3,"file":"applyPricesToElements.js","sourceRoot":"","sources":["../../../../../packages/core/src/utils/applyPricesToElements.ts"],"names":[],"mappings":";;;AAAA,4CAKsB;AAEtB,+CAA4C;AAErC,MAAM,qBAAqB,GAAG,CACnC,QAA4B,EAC5B,WAA0B,EACN,EAAE;IACtB,IAAI,CAAC,WAAW,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM;QAAE,OAAO,QAAQ,CAAC;IACtE,OAAO,QAAQ,CAAC,GAA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wBAoC/B"}
1
+ {"version":3,"file":"applyPricesToElements.js","sourceRoot":"","sources":["../../../../../packages/core/src/utils/applyPricesToElements.ts"],"names":[],"mappings":";;;AAAA,4CAKsB;AAEtB,+CAA4C;AAErC,MAAM,qBAAqB,GAAG,CACnC,QAA4B,EAC5B,WAA0B,EACN,EAAE;IACtB,IAAI,CAAC,WAAW,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM;QAAE,OAAO,QAAQ,CAAC;IACtE,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAA,4BAAoB,EAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;AAC/E,CAAC,CAAC;AANW,QAAA,qBAAqB,yBAMhC;AAEK,MAAM,oBAAoB,GAAG,CAClC,OAAyB,EACzB,WAA0B,EACR,EAAE;IACpB,IAAI,OAAO,CAAC,SAAS,KAAK,WAAW,CAAC,SAAS;QAAE,OAAO,OAAO,CAAC;IAEhE,IAAI,OAAO,CAAC,IAAI,KAAK,gCAAoB,CAAC,QAAQ,EAAE,CAAC;QACnD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YAC/C,IAAI,KAAK,CAAC,IAAI,KAAK,8BAAkB,CAAC,KAAK,EAAE,CAAC;gBAC5C,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACvD,IAAI,CAAC,UAAU;oBAAE,OAAO,KAAK,CAAC;gBAC9B,IAAI,UAAU,CAAC,KAAK,KAAK,SAAS;oBAAE,OAAO,KAAK,CAAC;gBAEjD,uCACK,KAAK,KACR,IAAI,kCACC,KAAK,CAAC,IAAI,KACb,KAAK,EAAE,UAAU,CAAC,KAAK,KAEzB,KAAK,EAAE,IAAA,yBAAW,EAAC,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IACxD;YACJ,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,OAAO,gCACF,OAAO,KACV,IAAI,kCACC,OAAO,CAAC,IAAI,KACf,MAAM,EACN,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,MAExC,CAAC;IAChC,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AApCW,QAAA,oBAAoB,wBAoC/B"}
@@ -1,2 +1,2 @@
1
1
  import { NetworkIdType } from '../Network';
2
- export declare function getAddressSystemFromNetworkId(networdkId: NetworkIdType): import("..").AddressSystemType;
2
+ export declare function getAddressSystemFromNetworkId(networkId: NetworkIdType): import("..").AddressSystemType;
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAddressSystemFromNetworkId = void 0;
4
4
  const constants_1 = require("../constants");
5
- function getAddressSystemFromNetworkId(networdkId) {
6
- return constants_1.networks[networdkId].addressSystem;
5
+ function getAddressSystemFromNetworkId(networkId) {
6
+ return constants_1.networks[networkId].addressSystem;
7
7
  }
8
8
  exports.getAddressSystemFromNetworkId = getAddressSystemFromNetworkId;
9
9
  //# sourceMappingURL=getAddressSystemFromNetworkId.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getAddressSystemFromNetworkId.js","sourceRoot":"","sources":["../../../../../packages/core/src/utils/getAddressSystemFromNetworkId.ts"],"names":[],"mappings":";;;AACA,4CAAwC;AAExC,SAAgB,6BAA6B,CAAC,UAAyB;IACrE,OAAO,oBAAQ,CAAC,UAAU,CAAC,CAAC,aAAa,CAAC;AAC5C,CAAC;AAFD,sEAEC"}
1
+ {"version":3,"file":"getAddressSystemFromNetworkId.js","sourceRoot":"","sources":["../../../../../packages/core/src/utils/getAddressSystemFromNetworkId.ts"],"names":[],"mappings":";;;AACA,4CAAwC;AAExC,SAAgB,6BAA6B,CAAC,SAAwB;IACpE,OAAO,oBAAQ,CAAC,SAAS,CAAC,CAAC,aAAa,CAAC;AAC3C,CAAC;AAFD,sEAEC"}