@sonarwatch/portfolio-core 0.16.79 → 0.16.80
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 +4 -0
- package/package.json +1 -1
- package/src/TokenPrice.d.ts +14 -0
- package/src/TokenPrice.js +31 -1
- package/src/TokenPrice.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.16.80](https://github.com/sonarwatch/portfolio/compare/core-0.16.79...core-0.16.80) (2025-11-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
5
9
|
## [0.16.79](https://github.com/sonarwatch/portfolio/compare/core-0.16.78...core-0.16.79) (2025-10-28)
|
|
6
10
|
|
|
7
11
|
|
package/package.json
CHANGED
package/src/TokenPrice.d.ts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { NetworkIdType } from './Network';
|
|
2
2
|
import { PortfolioElementLabel, SourceRef } from './Portfolio';
|
|
3
|
+
export declare const hyloSourceId = "hylo-tokens-pricing";
|
|
4
|
+
export declare const adrasteaSourceId = "adrastea-lst-pricing";
|
|
5
|
+
export declare const adrenaSourceId = "adrena-token-pricing";
|
|
6
|
+
export declare const exponentSourceId = "exponent-token-pricing";
|
|
7
|
+
export declare const fragmetricApiSourceId = "fragmetric-api-pricing";
|
|
8
|
+
export declare const fragmetricSourceId = "fragmetric-fund-account-pricing";
|
|
9
|
+
export declare const jitoSourceId = "jito-vaults-pricing";
|
|
10
|
+
export declare const jupLendSourceId = "jupiter-jtokens-pricing";
|
|
11
|
+
export declare const xOrcaSourceId = "x-orca-pricing";
|
|
12
|
+
export declare const rainSourceId = "rain-liquid-pricing";
|
|
13
|
+
export declare const usdcPlusSourceId = "reflect-usdc-plus-pricing";
|
|
14
|
+
export declare const sandglassSourceId = "sandglass-markets-pricing";
|
|
15
|
+
export declare const xStakingSourceId = "x-staking-pricing";
|
|
16
|
+
export declare const piggyBankSourceId = "piggy-bank-pricing";
|
|
3
17
|
export declare const primarySourceId = "primary";
|
|
4
18
|
export declare const coingeckoSourceId = "coingecko";
|
|
5
19
|
export declare const jupiterSourceId = "jupiter-datapi";
|
package/src/TokenPrice.js
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPriceInfoFromSources = exports.getTokenPricesUnderlyingsFromTokensPrices = exports.getTokenPriceUnderlyingFromTokenPrice = exports.updateTokenPriceSources = exports.pushTokenPriceSource = exports.tokenPriceFromSources = exports.tokenPriceSourceTtl = exports.prioritisedSourceIds = exports.jupiterSourceId = exports.coingeckoSourceId = exports.primarySourceId = void 0;
|
|
3
|
+
exports.getPriceInfoFromSources = exports.getTokenPricesUnderlyingsFromTokensPrices = exports.getTokenPriceUnderlyingFromTokenPrice = exports.updateTokenPriceSources = exports.pushTokenPriceSource = exports.tokenPriceFromSources = exports.tokenPriceSourceTtl = exports.prioritisedSourceIds = exports.jupiterSourceId = exports.coingeckoSourceId = exports.primarySourceId = exports.piggyBankSourceId = exports.xStakingSourceId = exports.sandglassSourceId = exports.usdcPlusSourceId = exports.rainSourceId = exports.xOrcaSourceId = exports.jupLendSourceId = exports.jitoSourceId = exports.fragmetricSourceId = exports.fragmetricApiSourceId = exports.exponentSourceId = exports.adrenaSourceId = exports.adrasteaSourceId = exports.hyloSourceId = void 0;
|
|
4
4
|
const helpers_1 = require("./helpers");
|
|
5
5
|
const constants_1 = require("./constants");
|
|
6
|
+
exports.hyloSourceId = 'hylo-tokens-pricing';
|
|
7
|
+
exports.adrasteaSourceId = 'adrastea-lst-pricing';
|
|
8
|
+
exports.adrenaSourceId = 'adrena-token-pricing';
|
|
9
|
+
exports.exponentSourceId = 'exponent-token-pricing';
|
|
10
|
+
exports.fragmetricApiSourceId = 'fragmetric-api-pricing';
|
|
11
|
+
exports.fragmetricSourceId = 'fragmetric-fund-account-pricing';
|
|
12
|
+
exports.jitoSourceId = 'jito-vaults-pricing';
|
|
13
|
+
exports.jupLendSourceId = 'jupiter-jtokens-pricing';
|
|
14
|
+
exports.xOrcaSourceId = 'x-orca-pricing';
|
|
15
|
+
exports.rainSourceId = 'rain-liquid-pricing';
|
|
16
|
+
exports.usdcPlusSourceId = 'reflect-usdc-plus-pricing';
|
|
17
|
+
exports.sandglassSourceId = 'sandglass-markets-pricing';
|
|
18
|
+
exports.xStakingSourceId = 'x-staking-pricing';
|
|
19
|
+
exports.piggyBankSourceId = 'piggy-bank-pricing';
|
|
6
20
|
exports.primarySourceId = 'primary';
|
|
7
21
|
exports.coingeckoSourceId = 'coingecko';
|
|
8
22
|
exports.jupiterSourceId = 'jupiter-datapi';
|
|
@@ -12,6 +26,19 @@ exports.jupiterSourceId = 'jupiter-datapi';
|
|
|
12
26
|
* The last id has the lowest priority.
|
|
13
27
|
*/
|
|
14
28
|
exports.prioritisedSourceIds = [
|
|
29
|
+
exports.hyloSourceId,
|
|
30
|
+
exports.adrasteaSourceId,
|
|
31
|
+
exports.adrenaSourceId,
|
|
32
|
+
exports.exponentSourceId,
|
|
33
|
+
exports.fragmetricApiSourceId,
|
|
34
|
+
exports.fragmetricSourceId,
|
|
35
|
+
exports.jitoSourceId,
|
|
36
|
+
exports.jupLendSourceId,
|
|
37
|
+
exports.xOrcaSourceId,
|
|
38
|
+
exports.rainSourceId,
|
|
39
|
+
exports.usdcPlusSourceId,
|
|
40
|
+
exports.sandglassSourceId,
|
|
41
|
+
exports.xStakingSourceId,
|
|
15
42
|
exports.primarySourceId,
|
|
16
43
|
exports.jupiterSourceId,
|
|
17
44
|
// Always leave coingeckoSourceId at the end to use it as fallback
|
|
@@ -35,6 +62,8 @@ function tokenPriceFromSources(sources) {
|
|
|
35
62
|
}
|
|
36
63
|
if (current.platformId !== constants_1.walletTokensPlatformId)
|
|
37
64
|
return current;
|
|
65
|
+
if (current.link && !prev.link)
|
|
66
|
+
return current;
|
|
38
67
|
return prev;
|
|
39
68
|
});
|
|
40
69
|
const { price, priceChange24h } = getPriceInfoFromSources(updatedSources);
|
|
@@ -48,6 +77,7 @@ function tokenPriceFromSources(sources) {
|
|
|
48
77
|
underlyings: displaySource.underlyings,
|
|
49
78
|
link: displaySource.link,
|
|
50
79
|
decimals: displaySource.decimals,
|
|
80
|
+
sourceRefs: displaySource.sourceRefs,
|
|
51
81
|
price: price,
|
|
52
82
|
priceChange24h,
|
|
53
83
|
timestamp: Date.now(),
|
package/src/TokenPrice.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenPrice.js","sourceRoot":"","sources":["../../../../packages/core/src/TokenPrice.ts"],"names":[],"mappings":";;;AACA,uCAAsC;AACtC,2CAAqD;AAGxC,QAAA,eAAe,GAAG,SAAS,CAAC;AAC5B,QAAA,iBAAiB,GAAG,WAAW,CAAC;AAChC,QAAA,eAAe,GAAG,gBAAgB,CAAC;AAEhD;;;;GAIG;AACU,QAAA,oBAAoB,GAAa;IAC5C,uBAAe;IACf,uBAAe;IACf,kEAAkE;IAClE,yBAAiB;CAClB,CAAC;AAEW,QAAA,mBAAmB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,UAAU;AACjE,MAAM,aAAa,GAAG,EAAE,CAAC;AA6CzB,SAAgB,qBAAqB,CACnC,OAA2B;IAE3B,MAAM,cAAc,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;IACxD,IAAI,CAAC,cAAc,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAErE,qHAAqH;IACrH,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;QAC5D,IACE,OAAO,CAAC,UAAU,KAAK,kCAAsB;YAC7C,IAAI,CAAC,UA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