@sonarwatch/portfolio-plugins 0.11.219 → 0.11.221
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +8 -0
- package/package.json +2 -2
- package/src/index.js +8 -0
- package/src/index.js.map +1 -1
- package/src/plugins/cropper/clmmJob.d.ts +3 -0
- package/src/plugins/cropper/clmmJob.js +15 -0
- package/src/plugins/cropper/clmmJob.js.map +1 -0
- package/src/plugins/cropper/constants.d.ts +5 -0
- package/src/plugins/cropper/constants.js +15 -0
- package/src/plugins/cropper/constants.js.map +1 -0
- package/src/plugins/cropper/helpers.d.ts +2 -0
- package/src/plugins/cropper/helpers.js +9 -0
- package/src/plugins/cropper/helpers.js.map +1 -0
- package/src/plugins/cropper/index.d.ts +6 -0
- package/src/plugins/cropper/index.js +12 -0
- package/src/plugins/cropper/index.js.map +1 -0
- package/src/plugins/hedgehog/ammJob.d.ts +3 -0
- package/src/plugins/hedgehog/ammJob.js +119 -0
- package/src/plugins/hedgehog/ammJob.js.map +1 -0
- package/src/plugins/hedgehog/constants.d.ts +6 -0
- package/src/plugins/hedgehog/constants.js +16 -0
- package/src/plugins/hedgehog/constants.js.map +1 -0
- package/src/plugins/hedgehog/index.d.ts +6 -0
- package/src/plugins/hedgehog/index.js +12 -0
- package/src/plugins/hedgehog/index.js.map +1 -0
- package/src/plugins/hedgehog/structs.d.ts +40 -0
- package/src/plugins/hedgehog/structs.js +41 -0
- package/src/plugins/hedgehog/structs.js.map +1 -0
- package/src/plugins/navi/collateralFetcher.js +7 -5
- package/src/plugins/navi/collateralFetcher.js.map +1 -1
- package/src/plugins/orca/getWhirlpoolPositions.d.ts +4 -3
- package/src/plugins/orca/getWhirlpoolPositions.js +7 -6
- package/src/plugins/orca/getWhirlpoolPositions.js.map +1 -1
- package/src/plugins/orca/getWhirlpoolsJob.d.ts +3 -0
- package/src/plugins/orca/getWhirlpoolsJob.js +47 -0
- package/src/plugins/orca/getWhirlpoolsJob.js.map +1 -0
- package/src/plugins/orca/structs/whirlpool.d.ts +0 -5
- package/src/plugins/orca/structs/whirlpool.js.map +1 -1
- package/src/plugins/orca/whirlpoolsJob.js +2 -33
- package/src/plugins/orca/whirlpoolsJob.js.map +1 -1
- package/src/plugins/raydium/clmmJob.js +1 -1
- package/src/plugins/raydium/clmmJob.js.map +1 -1
- package/src/plugins/raydium/constants.d.ts +1 -0
- package/src/plugins/raydium/constants.js +2 -1
- package/src/plugins/raydium/constants.js.map +1 -1
- package/src/plugins/raydium/cpmmJob.d.ts +3 -0
- package/src/plugins/raydium/cpmmJob.js +98 -0
- package/src/plugins/raydium/cpmmJob.js.map +1 -0
- package/src/plugins/raydium/filters.d.ts +2 -1
- package/src/plugins/raydium/filters.js +5 -2
- package/src/plugins/raydium/filters.js.map +1 -1
- package/src/plugins/raydium/index.js +2 -1
- package/src/plugins/raydium/index.js.map +1 -1
- package/src/plugins/raydium/structs/cpmm.d.ts +30 -0
- package/src/plugins/raydium/structs/cpmm.js +32 -0
- package/src/plugins/raydium/structs/cpmm.js.map +1 -0
- package/src/plugins/scallop/cnyAirdropFetcher.d.ts +3 -0
- package/src/plugins/scallop/cnyAirdropFetcher.js +79 -0
- package/src/plugins/scallop/cnyAirdropFetcher.js.map +1 -0
- package/src/plugins/scallop/constants.d.ts +2 -0
- package/src/plugins/scallop/constants.js +3 -1
- package/src/plugins/scallop/constants.js.map +1 -1
- package/src/plugins/scallop/index.js +2 -0
- package/src/plugins/scallop/index.js.map +1 -1
- package/src/plugins/scallop/types/data.d.ts +29 -0
- package/src/plugins/tokens/fetchers/solana-nfts-underlyings.js +43 -24
- package/src/plugins/tokens/fetchers/solana-nfts-underlyings.js.map +1 -1
- package/src/plugins/tokens/fetchers/solana.js +2 -0
- package/src/plugins/tokens/fetchers/solana.js.map +1 -1
- package/src/plugins/tokens/types.d.ts +3 -0
- package/src/utils/misc/getLpTokenSourceRaw.js +1 -1
- package/src/utils/misc/getLpTokenSourceRaw.js.map +1 -1
- package/src/utils/misc/getLpUnderlyingTokenSource.js +6 -6
- package/src/utils/misc/getLpUnderlyingTokenSource.js.map +1 -1
@@ -18,19 +18,39 @@ const getRaydiumCLMMPositions_1 = require("../../raydium/getRaydiumCLMMPositions
|
|
18
18
|
const getWhirlpoolPositions_1 = require("../../orca/getWhirlpoolPositions");
|
19
19
|
const helpers_1 = require("../../raydium/helpers");
|
20
20
|
const helpers_2 = require("../../orca/helpers");
|
21
|
-
const helpers_3 = require("../../
|
21
|
+
const helpers_3 = require("../../cropper/helpers");
|
22
|
+
const helpers_4 = require("../../daos/helpers");
|
22
23
|
const getSolanaDasEndpoint_1 = __importDefault(require("../../../utils/clients/getSolanaDasEndpoint"));
|
23
24
|
const getAssetsByOwnerDas_1 = require("../../../utils/solana/das/getAssetsByOwnerDas");
|
24
25
|
const heliusAssetToAssetCollectible_1 = require("../../../utils/solana/das/heliusAssetToAssetCollectible");
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
[
|
33
|
-
|
26
|
+
const constants_2 = require("../../orca/constants");
|
27
|
+
const constants_3 = require("../../cropper/constants");
|
28
|
+
const nftsUnderlyingsMap = new Map([
|
29
|
+
[
|
30
|
+
'raydium',
|
31
|
+
{ checker: helpers_1.isARaydiumPosition, fetcher: getRaydiumCLMMPositions_1.getRaydiumCLMMPositions },
|
32
|
+
],
|
33
|
+
[
|
34
|
+
'orca',
|
35
|
+
{
|
36
|
+
checker: helpers_2.isAnOrcaPosition,
|
37
|
+
fetcher: (0, getWhirlpoolPositions_1.getOrcaNftFetcher)(constants_2.platformId, constants_2.whirlpoolProgram),
|
38
|
+
},
|
39
|
+
],
|
40
|
+
[
|
41
|
+
'cropper',
|
42
|
+
{
|
43
|
+
checker: helpers_3.isClmmPosition,
|
44
|
+
fetcher: (0, getWhirlpoolPositions_1.getOrcaNftFetcher)(constants_3.platformId, constants_3.clmmPid),
|
45
|
+
},
|
46
|
+
],
|
47
|
+
[
|
48
|
+
'helium',
|
49
|
+
{
|
50
|
+
checker: helpers_4.isAnHeliumNFTVote,
|
51
|
+
fetcher: helpers_4.getHeliumElementsFromNFTs,
|
52
|
+
},
|
53
|
+
],
|
34
54
|
]);
|
35
55
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
36
56
|
var _a, _b;
|
@@ -45,30 +65,29 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
45
65
|
};
|
46
66
|
const assets = yield (0, getAssetsByOwnerDas_1.getAssetsByOwnerDas)(dasEndpoint, owner, displayOptions);
|
47
67
|
const nftsByIndentifier = new Map();
|
48
|
-
for (let n = 0; n < assets.length; n
|
68
|
+
for (let n = 0; n < assets.length; n += 1) {
|
49
69
|
const nft = (0, heliusAssetToAssetCollectible_1.heliusAssetToAssetCollectible)(assets[n]);
|
50
70
|
if (!nft)
|
51
71
|
continue;
|
52
72
|
if ((_a = nft.attributes.tags) === null || _a === void 0 ? void 0 : _a.includes('compressed'))
|
53
73
|
continue;
|
54
|
-
for (const
|
55
|
-
if (
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
else {
|
60
|
-
(_b = nftsByIndentifier.get(identifier)) === null || _b === void 0 ? void 0 : _b.push(nft);
|
61
|
-
}
|
74
|
+
for (const [key, { checker }] of nftsUnderlyingsMap.entries()) {
|
75
|
+
if (!checker(nft))
|
76
|
+
continue;
|
77
|
+
if (!nftsByIndentifier.get(key)) {
|
78
|
+
nftsByIndentifier.set(key, []);
|
62
79
|
}
|
80
|
+
(_b = nftsByIndentifier.get(key)) === null || _b === void 0 ? void 0 : _b.push(nft);
|
81
|
+
break;
|
63
82
|
}
|
64
83
|
}
|
65
|
-
const
|
66
|
-
for (const [
|
67
|
-
const nfts = nftsByIndentifier.get(
|
84
|
+
const results = [];
|
85
|
+
for (const [key, { fetcher }] of nftsUnderlyingsMap) {
|
86
|
+
const nfts = nftsByIndentifier.get(key);
|
68
87
|
if (nfts)
|
69
|
-
|
88
|
+
results.push(fetcher(cache, nfts));
|
70
89
|
}
|
71
|
-
const result = yield Promise.allSettled(
|
90
|
+
const result = yield Promise.allSettled(results);
|
72
91
|
const elements = result
|
73
92
|
.map((res) => (res.status === 'rejected' ? [] : res.value))
|
74
93
|
.flat();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solana-nfts-underlyings.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana-nfts-underlyings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AAGpC,4CAAoD;AAEpD,mFAAgF;AAChF,
|
1
|
+
{"version":3,"file":"solana-nfts-underlyings.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana-nfts-underlyings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AAGpC,4CAAoD;AAEpD,mFAAgF;AAChF,4EAAqE;AACrE,mDAA2D;AAC3D,gDAAsD;AACtD,mDAA4E;AAE5E,gDAG4B;AAC5B,uGAA+E;AAC/E,uFAAoF;AAEpF,2GAAwG;AAExG,oDAG8B;AAC9B,uDAGiC;AAIjC,MAAM,kBAAkB,GAGpB,IAAI,GAAG,CAAC;IACV;QACE,SAAS;QACT,EAAE,OAAO,EAAE,4BAAkB,EAAE,OAAO,EAAE,iDAAuB,EAAE;KAClE;IACD;QACE,MAAM;QACN;YACE,OAAO,EAAE,0BAAgB;YACzB,OAAO,EAAE,IAAA,yCAAiB,EAAC,sBAAc,EAAE,4BAAgB,CAAC;SAC7D;KACF;IACD;QACE,SAAS;QACT;YACE,OAAO,EAAE,wBAAiB;YAC1B,OAAO,EAAE,IAAA,yCAAiB,EAAC,sBAAiB,EAAE,mBAAO,CAAC;SACvD;KACF;IACD;QACE,QAAQ;QACR;YACE,OAAO,EAAE,2BAAiB;YAC1B,OAAO,EAAE,mCAAyB;SACnC;KACF;CACF,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,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B,EAAE,CAAC;QACpD,MAAM,IAAI,GAAG,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACxC,IAAI,IAAI;YAAE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAEjD,MAAM,QAAQ,GAAG,MAAM;SACpB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SAC1D,IAAI,EAAE,CAAC;IAEV,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,0BAA0B;IACxD,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -26,6 +26,8 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
26
26
|
const dasEndpoint = (0, getSolanaDasEndpoint_1.default)();
|
27
27
|
const items = yield (0, getAssetsByOwnerDas_1.getAssetsByOwnerDas)(dasEndpoint, owner, {
|
28
28
|
showNativeBalance: false,
|
29
|
+
showGrandTotal: false,
|
30
|
+
showInscription: false,
|
29
31
|
});
|
30
32
|
const fungibleAddresses = items.reduce((addresses, curr) => {
|
31
33
|
if ((0, isHeliusFungibleAsset_1.isHeliusFungibleAsset)(curr))
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solana.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AAErC,4CAAwE;AAExE,wCAAkD;AAClD,wGAAgF;AAChF,sGAA8E;AAC9E,2GAAwG;AACxG,uFAAoF;AACpF,2FAAwF;AACxF,uGAA+E;AAE/E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,WAAW,GAAG,IAAA,8BAAoB,GAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,MAAM,IAAA,yCAAmB,EAAC,WAAW,EAAE,KAAK,EAAE;QAC1D,iBAAiB,EAAE,KAAK;
|
1
|
+
{"version":3,"file":"solana.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AAErC,4CAAwE;AAExE,wCAAkD;AAClD,wGAAgF;AAChF,sGAA8E;AAC9E,2GAAwG;AACxG,uFAAoF;AACpF,2FAAwF;AACxF,uGAA+E;AAE/E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,WAAW,GAAG,IAAA,8BAAoB,GAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,MAAM,IAAA,yCAAmB,EAAC,WAAW,EAAE,KAAK,EAAE;QAC1D,iBAAiB,EAAE,KAAK;QACxB,cAAc,EAAE,KAAK;QACrB,eAAe,EAAE,KAAK;KACvB,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,SAAmB,EAAE,IAAI,EAAE,EAAE;QACnE,IAAI,IAAA,6CAAqB,EAAC,IAAI,CAAC;YAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzD,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,gBAAgB,GAAG,MAAM,KAAK,CAAC,cAAc,CACjD,iBAAiB,EACjB,0BAAS,CAAC,MAAM,CACjB,CAAC;IACF,MAAM,WAAW,G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E,QAAQ;YACf,KAAK,EAAE,IAAA,+BAAc,EAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACtD,IAAI,EAAE;gBACJ,MAAM,EAAE,WAAW;aACpB;SACF,CAAC,CAAC;IACL,CAAC;IACD,KAAK,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAClE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,IAAA,oBAAU,EAAC,GAAG,CAAC,CAAC;QACpD,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,qCAAoB,CAAC,SAAS;YACpC,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU;YACV,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,eAAe;YACtB,KAAK,EAAE,IAAA,+BAAc,EAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACtD,IAAI,EAAE;gBACJ,WAAW;aACZ;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,SAAS;IACvC,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { PortfolioAssetCollectible, PortfolioElement } from '@sonarwatch/portfolio-core';
|
2
|
+
import { Cache } from '../../Cache';
|
1
3
|
export type TokenData = {
|
2
4
|
address: string;
|
3
5
|
decimals: number;
|
@@ -33,3 +35,4 @@ export type Token = {
|
|
33
35
|
index?: string;
|
34
36
|
};
|
35
37
|
};
|
38
|
+
export type NftFetcher = (cache: Cache, nfts: PortfolioAssetCollectible[]) => Promise<PortfolioElement[]>;
|
@@ -21,7 +21,7 @@ function getLpTokenSourceRaw(params) {
|
|
21
21
|
sourceId: params.sourceId,
|
22
22
|
poolUnderlyings: fPoolUnderlyingsRaw,
|
23
23
|
elementName: params.elementName,
|
24
|
-
liquidityName: params.
|
24
|
+
liquidityName: params.liquidityName,
|
25
25
|
priceUnderlyings: params.priceUnderlyings,
|
26
26
|
});
|
27
27
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getLpTokenSourceRaw.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/getLpTokenSourceRaw.ts"],"names":[],"mappings":";;;;;;AAKA,gEAAqC;AACrC,yDAAiE;AA4BjE,SAAgB,mBAAmB,CACjC,MAAiC;IAEjC,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAAC;IACjD,MAAM,UAAU,mCACX,SAAS,KACZ,MAAM,EAAE,IAAI,sBAAS,CAAC,SAAS,CAAC,SAAS,CAAC;aACvC,GAAG,CAAC,SAAA,EAAE,EAAI,SAAS,CAAC,QAAQ,CAAA,CAAC;aAC7B,QAAQ,EAAE,GACd,CAAC;IACF,MAAM,mBAAmB,GAAqB,kBAAkB,CAAC,GAAG,CAClE,CAAC,EAAE,EAAE,EAAE,CAAC,iCACH,EAAE,KACL,aAAa,EAAE,IAAI,sBAAS,CAAC,EAAE,CAAC,gBAAgB,CAAC;aAC9C,GAAG,CAAC,SAAA,EAAE,EAAI,EAAE,CAAC,QAAQ,CAAA,CAAC;aACtB,QAAQ,EAAE,IACb,CACH,CAAC;IAEF,OAAO,IAAA,mCAAgB,EAAC;QACtB,SAAS,EAAE,UAAU;QACrB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,eAAe,EAAE,mBAAmB;QACpC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,aAAa,EAAE,MAAM,CAAC,
|
1
|
+
{"version":3,"file":"getLpTokenSourceRaw.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/getLpTokenSourceRaw.ts"],"names":[],"mappings":";;;;;;AAKA,gEAAqC;AACrC,yDAAiE;AA4BjE,SAAgB,mBAAmB,CACjC,MAAiC;IAEjC,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAAC;IACjD,MAAM,UAAU,mCACX,SAAS,KACZ,MAAM,EAAE,IAAI,sBAAS,CAAC,SAAS,CAAC,SAAS,CAAC;aACvC,GAAG,CAAC,SAAA,EAAE,EAAI,SAAS,CAAC,QAAQ,CAAA,CAAC;aAC7B,QAAQ,EAAE,GACd,CAAC;IACF,MAAM,mBAAmB,GAAqB,kBAAkB,CAAC,GAAG,CAClE,CAAC,EAAE,EAAE,EAAE,CAAC,iCACH,EAAE,KACL,aAAa,EAAE,IAAI,sBAAS,CAAC,EAAE,CAAC,gBAAgB,CAAC;aAC9C,GAAG,CAAC,SAAA,EAAE,EAAI,EAAE,CAAC,QAAQ,CAAA,CAAC;aACtB,QAAQ,EAAE,IACb,CACH,CAAC;IAEF,OAAO,IAAA,mCAAgB,EAAC;QACtB,SAAS,EAAE,UAAU;QACrB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,eAAe,EAAE,mBAAmB;QACpC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;KAC1C,CAAC,CAAC;AACL,CAAC;AA7BD,kDA6BC"}
|
@@ -62,7 +62,7 @@ function getLpUnderlyingTokenSource(params) {
|
|
62
62
|
throw new Error(`Weights are greater than 1: ${totalWeight}`);
|
63
63
|
if (totalWeight < 0.99)
|
64
64
|
throw new Error(`Weights are smaller than 1: ${totalWeight}`);
|
65
|
-
let
|
65
|
+
let knownUnderlying;
|
66
66
|
const fAddresses = poolUnderlyings.map((u) => (0, portfolio_core_1.formatTokenAddress)(u.address, networkId));
|
67
67
|
let knownReserveValue;
|
68
68
|
for (let i = 0; i < poolUnderlyings.length; i++) {
|
@@ -72,18 +72,18 @@ function getLpUnderlyingTokenSource(params) {
|
|
72
72
|
if (!acceptedPairs.includes(fAddresses[i]))
|
73
73
|
continue;
|
74
74
|
const reserveValue = u.tokenPrice.price * u.reserveAmount;
|
75
|
-
if (
|
75
|
+
if (knownUnderlying &&
|
76
76
|
knownReserveValue &&
|
77
77
|
knownReserveValue > reserveValue)
|
78
78
|
continue;
|
79
|
-
|
79
|
+
knownUnderlying = u;
|
80
80
|
knownReserveValue = reserveValue;
|
81
81
|
}
|
82
|
-
if (!
|
82
|
+
if (!knownUnderlying || !knownReserveValue)
|
83
83
|
return [];
|
84
84
|
if (knownReserveValue < minReserveValue)
|
85
85
|
return [];
|
86
|
-
const knownUnderlayingAddress = (0, portfolio_core_1.formatTokenAddress)(
|
86
|
+
const knownUnderlayingAddress = (0, portfolio_core_1.formatTokenAddress)(knownUnderlying.address, networkId);
|
87
87
|
const sources = [];
|
88
88
|
for (let i = 0; i < poolUnderlyings.length; i++) {
|
89
89
|
const u = poolUnderlyings[i];
|
@@ -94,7 +94,7 @@ function getLpUnderlyingTokenSource(params) {
|
|
94
94
|
if (u.tokenPrice &&
|
95
95
|
u.tokenPrice.sources.some((s) => s.id === portfolio_core_1.coingeckoSourceId))
|
96
96
|
continue;
|
97
|
-
const price = ((u.weight /
|
97
|
+
const price = ((u.weight / knownUnderlying.weight) * knownReserveValue) /
|
98
98
|
u.reserveAmount;
|
99
99
|
const source = {
|
100
100
|
id: sourceId,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getLpUnderlyingTokenSource.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/getLpUnderlyingTokenSource.ts"],"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,CAAC;IACxD,IAAI,CAAC,UAAU;QAAE,UAAU,GAAG,gCAAoB,CAAC,EAAE,CAAC;IACtD,IAAI,CAAC,aAAa;QAAE,aAAa,GAAG,4BAAoB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACxE,IAAI,aAAa,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IAC3C,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAC1C,IAAI,CAAC,eAAe;QAAE,eAAe,GAAG,IAAI,CAAC;IAE7C,6BAA6B;IAC7B,MAAM,WAAW,GAAG,eAAe,CAAC,MAAM,CACxC,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC,UAAU,GAAG,CAAC,CAAC,MAAM,EACxC,CAAC,CACF,CAAC;IACF,IAAI,WAAW,GAAG,IAAI;QACpB,MAAM,IAAI,KAAK,CAAC,+BAA+B,WAAW,EAAE,CAAC,CAAC;IAChE,IAAI,WAAW,GAAG,IAAI;QACpB,MAAM,IAAI,KAAK,CAAC,+BAA+B,WAAW,EAAE,CAAC,CAAC;IAEhE,IAAI,
|
1
|
+
{"version":3,"file":"getLpUnderlyingTokenSource.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/getLpUnderlyingTokenSource.ts"],"names":[],"mappings":";;;;;;AAAA,+DAYoC;AACpC,8DAAsE;AACtE,wEAAgD;AAEnC,QAAA,oBAAoB,GAAG,IAAI,GAAG,CAA0B;IACnE;QACE,0BAAS,CAAC,GAAG;QACb;YACE,iCAAgB;YAChB,sEAAsE,EAAE,OAAO;YAC/E,qHAAqH,EAAE,SAAS;SACjI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,mCAAkB,EAAC,CAAC,EAAE,0BAAS,CAAC,GAAG,CAAC,CAAC;KACnD;IACD;QACE,0BAAS,CAAC,MAAM;QAChB;YACE,oCAAmB;YACnB,2CAA0B;YAC1B,8CAA8C,EAAE,OAAO;YAC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