@sonarwatch/portfolio-core 0.16.78 → 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
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
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
|
+
|
|
9
|
+
## [0.16.79](https://github.com/sonarwatch/portfolio/compare/core-0.16.78...core-0.16.79) (2025-10-28)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
5
13
|
## [0.16.78](https://github.com/sonarwatch/portfolio/compare/core-0.16.77...core-0.16.78) (2025-10-23)
|
|
6
14
|
|
|
7
15
|
|
package/package.json
CHANGED
package/src/TokenPrice.d.ts
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
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";
|
|
20
|
+
/**
|
|
21
|
+
* List of source ids to prioritise when computing the token price.
|
|
22
|
+
* The first id in the list has the highest priority.
|
|
23
|
+
* The last id has the lowest priority.
|
|
24
|
+
*/
|
|
25
|
+
export declare const prioritisedSourceIds: string[];
|
|
6
26
|
export declare const tokenPriceSourceTtl: number;
|
|
7
27
|
export type TokenPriceUnderlying = {
|
|
8
28
|
networkId: NetworkIdType;
|
|
@@ -49,3 +69,13 @@ export declare function pushTokenPriceSource(sources: TokenPriceSource[], source
|
|
|
49
69
|
export declare function updateTokenPriceSources(sources: TokenPriceSource[]): TokenPriceSource[] | undefined;
|
|
50
70
|
export declare function getTokenPriceUnderlyingFromTokenPrice(tokenPrice: TokenPrice, amountPerLp: number): TokenPriceUnderlying;
|
|
51
71
|
export declare function getTokenPricesUnderlyingsFromTokensPrices(tokensPrices: TokenPrice[], amountsPerLp: number[]): TokenPriceUnderlying[];
|
|
72
|
+
/**
|
|
73
|
+
* Get the price information from a list of sources.
|
|
74
|
+
* The price is determined by prioritising sources present in the prioritisedSourceIds list
|
|
75
|
+
* If no prioritised source is found, the price is calculated as a weighted average of all sources' price
|
|
76
|
+
* @sources : list of TokenPriceSources
|
|
77
|
+
*/
|
|
78
|
+
export declare function getPriceInfoFromSources(sources: TokenPriceSource[]): {
|
|
79
|
+
price: number;
|
|
80
|
+
priceChange24h?: number;
|
|
81
|
+
};
|
package/src/TokenPrice.js
CHANGED
|
@@ -1,18 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTokenPricesUnderlyingsFromTokensPrices = exports.getTokenPriceUnderlyingFromTokenPrice = exports.updateTokenPriceSources = exports.pushTokenPriceSource = exports.tokenPriceFromSources = exports.tokenPriceSourceTtl = 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';
|
|
23
|
+
/**
|
|
24
|
+
* List of source ids to prioritise when computing the token price.
|
|
25
|
+
* The first id in the list has the highest priority.
|
|
26
|
+
* The last id has the lowest priority.
|
|
27
|
+
*/
|
|
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,
|
|
42
|
+
exports.primarySourceId,
|
|
43
|
+
exports.jupiterSourceId,
|
|
44
|
+
// Always leave coingeckoSourceId at the end to use it as fallback
|
|
45
|
+
exports.coingeckoSourceId,
|
|
46
|
+
];
|
|
9
47
|
exports.tokenPriceSourceTtl = 4 * 60 * 60 * 1000; // 4 hours
|
|
10
48
|
const MAX_N_SOURCES = 10;
|
|
11
49
|
function tokenPriceFromSources(sources) {
|
|
12
50
|
const updatedSources = updateTokenPriceSources(sources);
|
|
13
51
|
if (!updatedSources || updatedSources.length === 0)
|
|
14
52
|
return undefined;
|
|
15
|
-
|
|
53
|
+
// Determine which source should be used as the main source for the token informations (link, label, platformId, etc)
|
|
54
|
+
const displaySource = updatedSources.reduce((prev, current) => {
|
|
16
55
|
if (current.platformId !== constants_1.walletTokensPlatformId &&
|
|
17
56
|
prev.platformId !== constants_1.walletTokensPlatformId &&
|
|
18
57
|
current.platformId !== prev.platformId) {
|
|
@@ -23,54 +62,26 @@ function tokenPriceFromSources(sources) {
|
|
|
23
62
|
}
|
|
24
63
|
if (current.platformId !== constants_1.walletTokensPlatformId)
|
|
25
64
|
return current;
|
|
65
|
+
if (current.link && !prev.link)
|
|
66
|
+
return current;
|
|
26
67
|
return prev;
|
|
27
68
|
});
|
|
28
|
-
|
|
29
|
-
let priceChange24h;
|
|
30
|
-
let jupiterSource;
|
|
31
|
-
let coingeckoSource;
|
|
32
|
-
let primarySource;
|
|
33
|
-
for (const source of updatedSources) {
|
|
34
|
-
if (source.id === exports.primarySourceId)
|
|
35
|
-
primarySource = source;
|
|
36
|
-
if (source.id === exports.jupiterSourceId)
|
|
37
|
-
jupiterSource = source;
|
|
38
|
-
if (source.id === exports.coingeckoSourceId)
|
|
39
|
-
coingeckoSource = source;
|
|
40
|
-
}
|
|
41
|
-
if (primarySource) {
|
|
42
|
-
price = primarySource.price;
|
|
43
|
-
}
|
|
44
|
-
else if (jupiterSource) {
|
|
45
|
-
price = jupiterSource.price;
|
|
46
|
-
if (jupiterSource.priceChange24h)
|
|
47
|
-
priceChange24h = jupiterSource.priceChange24h;
|
|
48
|
-
}
|
|
49
|
-
else if (coingeckoSource) {
|
|
50
|
-
price = coingeckoSource.price;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
const [priceSum, weightSum] = updatedSources.reduce(([cPriceSum, cWeightSum], source) => [
|
|
54
|
-
cPriceSum + source.price * source.weight,
|
|
55
|
-
cWeightSum + source.weight,
|
|
56
|
-
], [0, 0]);
|
|
57
|
-
price = weightSum === 0 ? 0 : priceSum / weightSum;
|
|
58
|
-
}
|
|
69
|
+
const { price, priceChange24h } = getPriceInfoFromSources(updatedSources);
|
|
59
70
|
return {
|
|
60
|
-
address:
|
|
61
|
-
networkId:
|
|
62
|
-
platformId:
|
|
63
|
-
|
|
64
|
-
|
|
71
|
+
address: displaySource.address,
|
|
72
|
+
networkId: displaySource.networkId,
|
|
73
|
+
platformId: displaySource.platformId,
|
|
74
|
+
elementName: displaySource.elementName,
|
|
75
|
+
liquidityName: displaySource.liquidityName,
|
|
76
|
+
label: displaySource.label,
|
|
77
|
+
underlyings: displaySource.underlyings,
|
|
78
|
+
link: displaySource.link,
|
|
79
|
+
decimals: displaySource.decimals,
|
|
80
|
+
sourceRefs: displaySource.sourceRefs,
|
|
81
|
+
price: price,
|
|
65
82
|
priceChange24h,
|
|
66
|
-
underlyings: bestSource.underlyings,
|
|
67
|
-
elementName: bestSource.elementName,
|
|
68
|
-
label: bestSource.label,
|
|
69
|
-
liquidityName: bestSource.liquidityName,
|
|
70
83
|
timestamp: Date.now(),
|
|
71
84
|
sources: updatedSources,
|
|
72
|
-
link: bestSource.link,
|
|
73
|
-
sourceRefs: bestSource.sourceRefs,
|
|
74
85
|
};
|
|
75
86
|
}
|
|
76
87
|
exports.tokenPriceFromSources = tokenPriceFromSources;
|
|
@@ -122,4 +133,52 @@ function getTokenPricesUnderlyingsFromTokensPrices(tokensPrices, amountsPerLp) {
|
|
|
122
133
|
}));
|
|
123
134
|
}
|
|
124
135
|
exports.getTokenPricesUnderlyingsFromTokensPrices = getTokenPricesUnderlyingsFromTokensPrices;
|
|
136
|
+
/**
|
|
137
|
+
* Get the price information from a list of sources.
|
|
138
|
+
* The price is determined by prioritising sources present in the prioritisedSourceIds list
|
|
139
|
+
* If no prioritised source is found, the price is calculated as a weighted average of all sources' price
|
|
140
|
+
* @sources : list of TokenPriceSources
|
|
141
|
+
*/
|
|
142
|
+
function getPriceInfoFromSources(sources) {
|
|
143
|
+
const prioritisedSources = [];
|
|
144
|
+
let price;
|
|
145
|
+
let priceChange24h;
|
|
146
|
+
sources.forEach((s) => {
|
|
147
|
+
if (exports.prioritisedSourceIds.includes(s.id)) {
|
|
148
|
+
prioritisedSources.push(s);
|
|
149
|
+
}
|
|
150
|
+
// Get jupiter price change 24h if available
|
|
151
|
+
if (s.id === exports.jupiterSourceId) {
|
|
152
|
+
priceChange24h = s.priceChange24h;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
const [priceSum, weightSum] = sources.reduce(([cPriceSum, cWeightSum], source) => [
|
|
156
|
+
cPriceSum + source.price * source.weight,
|
|
157
|
+
cWeightSum + source.weight,
|
|
158
|
+
], [0, 0]);
|
|
159
|
+
price = weightSum === 0 ? 0 : priceSum / weightSum;
|
|
160
|
+
// If there is no high priority sources, return the weighted average of all sources price
|
|
161
|
+
if (!prioritisedSources)
|
|
162
|
+
return {
|
|
163
|
+
price,
|
|
164
|
+
priceChange24h,
|
|
165
|
+
};
|
|
166
|
+
// Else, find the highest priority source available and use its price
|
|
167
|
+
let highestPrioritySource;
|
|
168
|
+
let highestSourceIndex = Number.MAX_SAFE_INTEGER;
|
|
169
|
+
for (const prioritySource of prioritisedSources) {
|
|
170
|
+
const sourceIndex = exports.prioritisedSourceIds.indexOf(prioritySource.id);
|
|
171
|
+
if (sourceIndex !== -1 && sourceIndex < highestSourceIndex) {
|
|
172
|
+
highestPrioritySource = prioritySource;
|
|
173
|
+
highestSourceIndex = sourceIndex;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (highestPrioritySource)
|
|
177
|
+
price = highestPrioritySource.price;
|
|
178
|
+
return {
|
|
179
|
+
price,
|
|
180
|
+
priceChange24h,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
exports.getPriceInfoFromSources = getPriceInfoFromSources;
|
|
125
184
|
//# sourceMappingURL=TokenPrice.js.map
|
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;
|
|
1
|
+
{"version":3,"file":"TokenPrice.js","sourceRoot":"","sources":["../../../../pack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uBAAe,EAAE,CAAC;YAC7B,cAAc,GAAG,CAAC,CAAC,cAAc,CAAC;QACpC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,OAAO,CAAC,MAAM,CAC1C,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;QACnC,SAAS,GAAG,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM;QACxC,UAAU,GAAG,MAAM,CAAC,MAAM;KAC3B,EACD,CAAC,CAAC,EAAE,CAAC,CAAC,CACP,CAAC;IACF,KAAK,GAAG,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,SAAS,CAAC;IAEnD,yFAAyF;IACzF,IAAI,CAAC,kBAAkB;QACrB,OAAO;YACL,KAAK;YACL,cAAc;SACf,CAAC;IAEJ,qEAAqE;IACrE,IAAI,qBAAmD,CAAC;IACxD,IAAI,kBAAkB,GAAG,MAAM,CAAC,gBAAgB,CAAC;IACjD,KAAK,MAAM,cAAc,IAAI,kBAAkB,EAAE,CAAC;QAChD,MAAM,WAAW,GAAG,4BAAoB,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;QACpE,IAAI,WAAW,KAAK,CAAC,CAAC,IAAI,WAAW,GAAG,kBAAkB,EAAE,CAAC;YAC3D,qBAAqB,GAAG,cAAc,CAAC;YACvC,kBAAkB,GAAG,WAAW,CAAC;QACnC,CAAC;IACH,CAAC;IACD,IAAI,qBAAqB;QAAE,KAAK,GAAG,qBAAqB,CAAC,KAAK,CAAC;IAE/D,OAAO;QACL,KAAK;QACL,cAAc;KACf,CAAC;AACJ,CAAC;AAnDD,0DAmDC"}
|
|
@@ -12,6 +12,9 @@ function getAddressesFromElement(element, tokenOnly = true) {
|
|
|
12
12
|
...(((_b = element.data.cross) === null || _b === void 0 ? void 0 : _b.positions.map((p) => p.address).filter((v) => v !== undefined)) || []),
|
|
13
13
|
];
|
|
14
14
|
}
|
|
15
|
+
if (element.type === Portfolio_1.PortfolioElementType.trade) {
|
|
16
|
+
return [element.data.inputAddress, element.data.outputAddress];
|
|
17
|
+
}
|
|
15
18
|
const assets = (0, getAssetsFromElement_1.getAssetsFromElement)(element);
|
|
16
19
|
const addressesFromAssets = (0, getAddressesFromAssets_1.getAddressesFromAssets)(assets, tokenOnly);
|
|
17
20
|
const addressesFromYields = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAddressesFromElement.js","sourceRoot":"","sources":["../../../../../packages/core/src/utils/getAddressesFromElement.ts"],"names":[],"mappings":";;;AAAA,4CAAsE;AACtE,iEAA8D;AAC9D,qEAAkE;AAElE,SAAgB,uBAAuB,CACrC,OAAyB,EACzB,SAAS,GAAG,IAAI;;IAEhB,IAAI,OAAO,CAAC,IAAI,KAAK,gCAAoB,CAAC,QAAQ,EAAE,CAAC;QACnD,OAAO;YACL,GAAI,CAAC,CAAA,MAAA,OAAO,CAAC,IAAI,CAAC,QAAQ,0CAAE,SAAS,CAClC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,KAAI,EAAE,CAAc;YACrD,GAAI,CAAC,CAAA,MAAA,OAAO,CAAC,IAAI,CAAC,KAAK,0CAAE,SAAS,CAC/B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,KAAI,EAAE,CAAc;SACtD,CAAC;IACJ,CAAC;
|
|
1
|
+
{"version":3,"file":"getAddressesFromElement.js","sourceRoot":"","sources":["../../../../../packages/core/src/utils/getAddressesFromElement.ts"],"names":[],"mappings":";;;AAAA,4CAAsE;AACtE,iEAA8D;AAC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