@sonarwatch/portfolio-plugins 0.4.11 → 0.4.13
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 +8 -0
- package/package.json +2 -2
- package/src/plugins/foo/index.js +2 -2
- package/src/plugins/foo/index.js.map +1 -1
- package/src/plugins/foo/{ammJob.js → marketsJob.js} +1 -1
- package/src/plugins/foo/marketsJob.js.map +1 -0
- package/src/plugins/tokens/fetchers/aptos.js +38 -53
- package/src/plugins/tokens/fetchers/aptos.js.map +1 -1
- package/src/utils/misc/durationForHumans.d.ts +1 -0
- package/src/utils/misc/durationForHumans.js +19 -0
- package/src/utils/misc/durationForHumans.js.map +1 -0
- package/src/utils/misc/tokenPriceToAssetToken.js +1 -1
- package/src/utils/misc/tokenPriceToAssetToken.js.map +1 -1
- package/src/utils/misc/tokenPriceToAssetTokens.d.ts +2 -0
- package/src/utils/misc/tokenPriceToAssetTokens.js +11 -0
- package/src/utils/misc/tokenPriceToAssetTokens.js.map +1 -0
- package/src/plugins/foo/ammJob.js.map +0 -1
- /package/src/plugins/foo/{ammJob.d.ts → marketsJob.d.ts} +0 -0
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.4.13](https://github.com/sonarwatch/portfolio/compare/plugins-0.4.12...plugins-0.4.13) (2023-07-09)
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
## [0.4.12](https://github.com/sonarwatch/portfolio/compare/plugins-0.4.11...plugins-0.4.12) (2023-07-08)
|
10
|
+
|
11
|
+
|
12
|
+
|
5
13
|
## [0.4.11](https://github.com/sonarwatch/portfolio/compare/plugins-0.4.10...plugins-0.4.11) (2023-07-08)
|
6
14
|
|
7
15
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.4.
|
3
|
+
"version": "0.4.13",
|
4
4
|
"type": "commonjs",
|
5
5
|
"generators": "./generators.json",
|
6
6
|
"dependencies": {
|
@@ -22,7 +22,7 @@
|
|
22
22
|
"viem": "^1.2.9"
|
23
23
|
},
|
24
24
|
"peerDependencies": {
|
25
|
-
"@sonarwatch/portfolio-core": "0.4.
|
25
|
+
"@sonarwatch/portfolio-core": "0.4.13"
|
26
26
|
},
|
27
27
|
"main": "./src/index.js",
|
28
28
|
"types": "./src/index.d.ts"
|
package/src/plugins/foo/index.js
CHANGED
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.fetchers = exports.jobs = void 0;
|
7
|
-
const
|
7
|
+
const marketsJob_1 = __importDefault(require("./marketsJob"));
|
8
8
|
const positionFetcher_1 = __importDefault(require("./positionFetcher"));
|
9
|
-
exports.jobs = [
|
9
|
+
exports.jobs = [marketsJob_1.default];
|
10
10
|
exports.fetchers = [positionFetcher_1.default];
|
11
11
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/foo/index.ts"],"names":[],"mappings":";;;;;;AACA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/foo/index.ts"],"names":[],"mappings":";;;;;;AACA,8DAAsC;AACtC,wEAAgD;AAEnC,QAAA,IAAI,GAAU,CAAC,oBAAU,CAAC,CAAC;AAC3B,QAAA,QAAQ,GAAc,CAAC,yBAAe,CAAC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/foo/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAgF;AAChF,2CAA6D;AAE7D,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,eAAe,EAAE;QAChD,MAAM,EAAE,8BAAkB;QAC1B,SAAS,EAAE,0BAAS,CAAC,QAAQ;KAC9B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;CACT,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -14,7 +14,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
16
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
17
|
-
const
|
17
|
+
const tokenPriceToAssetTokens_1 = require("packages/plugins/src/utils/misc/tokenPriceToAssetTokens");
|
18
|
+
const tokenPriceToAssetToken_1 = require("packages/plugins/src/utils/misc/tokenPriceToAssetToken");
|
18
19
|
const platforms_1 = require("../../../platforms");
|
19
20
|
const clients_1 = require("../../../utils/clients");
|
20
21
|
const aptos_1 = require("../../../utils/aptos");
|
@@ -24,14 +25,14 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
24
25
|
const resources = yield (0, aptos_1.getAccountResources)(client, owner);
|
25
26
|
if (!resources)
|
26
27
|
return [];
|
27
|
-
const
|
28
|
-
const
|
28
|
+
const walletTokensAssets = [];
|
29
|
+
const liquiditiesByPlatformId = {};
|
29
30
|
for (let i = 0; i < resources.length; i++) {
|
30
31
|
const resource = resources[i];
|
31
32
|
const resourceType = resource.type;
|
32
33
|
if (!(0, aptos_1.isCoinStoreRessourceType)(resourceType))
|
33
34
|
continue;
|
34
|
-
const parseCoinType = (0, aptos_1.parseTypeString)(
|
35
|
+
const parseCoinType = (0, aptos_1.parseTypeString)(resourceType);
|
35
36
|
if (parseCoinType.root !== aptos_1.coinStore)
|
36
37
|
continue;
|
37
38
|
if (!parseCoinType.keys)
|
@@ -39,77 +40,61 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
39
40
|
const coinType = (_a = parseCoinType.keys.at(0)) === null || _a === void 0 ? void 0 : _a.type;
|
40
41
|
if (coinType === undefined)
|
41
42
|
continue;
|
43
|
+
const coinStoreData = resource.data;
|
44
|
+
const rawAmount = new bignumber_js_1.default(coinStoreData.coin.value);
|
45
|
+
if (rawAmount.isZero())
|
46
|
+
continue;
|
42
47
|
const tokenPrice = yield cache.getTokenPrice(coinType, portfolio_core_1.NetworkId.aptos);
|
43
48
|
if (!tokenPrice)
|
44
49
|
continue;
|
45
|
-
const
|
46
|
-
const amount = new bignumber_js_1.default(coinStoreData.coin.value)
|
47
|
-
.div(Math.pow(10, tokenPrice.decimals))
|
48
|
-
.toNumber();
|
50
|
+
const amount = rawAmount.div(Math.pow(10, tokenPrice.decimals)).toNumber();
|
49
51
|
if (amount === 0)
|
50
52
|
continue;
|
51
|
-
const price = (tokenPrice === null || tokenPrice === void 0 ? void 0 : tokenPrice.price) || null;
|
52
|
-
const value = price ? amount * price : null;
|
53
|
-
const asset = {
|
54
|
-
networkId: portfolio_core_1.NetworkId.aptos,
|
55
|
-
type: portfolio_core_1.PortfolioAssetType.token,
|
56
|
-
value,
|
57
|
-
data: { address: coinType, price, amount },
|
58
|
-
};
|
59
53
|
if (tokenPrice.platformId !== platforms_1.walletTokensPlatform.id) {
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
if (!tokenPrice.underlyings)
|
65
|
-
return;
|
66
|
-
underlyingsAsset.push((0, tokenPriceToAssetToken_1.tokenPriceToAssetToken)(underlying.address, amount * underlying.amountPerLp, portfolio_core_1.NetworkId.aptos, underlying));
|
67
|
-
});
|
68
|
-
const lpToken = {
|
69
|
-
assets: underlyingsAsset,
|
70
|
-
assetsValue: (0, portfolio_core_1.getUsdValueSum)(underlyingsAsset.map((a) => a.value)),
|
54
|
+
const assets = (0, tokenPriceToAssetTokens_1.tokenPriceToAssetTokens)(coinType, amount, portfolio_core_1.NetworkId.aptos, tokenPrice);
|
55
|
+
const liquidity = {
|
56
|
+
assets,
|
57
|
+
assetsValue: (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value)),
|
71
58
|
rewardAssets: [],
|
72
59
|
rewardAssetsValue: 0,
|
73
|
-
value: (0, portfolio_core_1.getUsdValueSum)(
|
60
|
+
value: (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value)),
|
74
61
|
yields: [],
|
75
62
|
};
|
76
|
-
if (
|
77
|
-
|
63
|
+
if (!liquiditiesByPlatformId[tokenPrice.platformId]) {
|
64
|
+
liquiditiesByPlatformId[tokenPrice.platformId] = [];
|
78
65
|
}
|
79
|
-
|
66
|
+
liquiditiesByPlatformId[tokenPrice.platformId].push(liquidity);
|
80
67
|
}
|
81
68
|
else {
|
82
|
-
|
69
|
+
walletTokensAssets.push((0, tokenPriceToAssetToken_1.tokenPriceToAssetToken)(coinType, amount, portfolio_core_1.NetworkId.aptos, tokenPrice));
|
83
70
|
}
|
84
71
|
}
|
85
72
|
const elements = [];
|
86
|
-
if (
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
}
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
73
|
+
if (walletTokensAssets.length > 0) {
|
74
|
+
const walletTokensElement = {
|
75
|
+
type: portfolio_core_1.PortfolioElementType.multiple,
|
76
|
+
networkId: portfolio_core_1.NetworkId.aptos,
|
77
|
+
platformId: platforms_1.walletTokensPlatform.id,
|
78
|
+
label: 'Wallet',
|
79
|
+
value: (0, portfolio_core_1.getUsdValueSum)(walletTokensAssets.map((a) => a.value)),
|
80
|
+
data: {
|
81
|
+
assets: walletTokensAssets,
|
82
|
+
},
|
83
|
+
};
|
84
|
+
elements.push(walletTokensElement);
|
85
|
+
}
|
86
|
+
for (const [platformId, liquidities] of Object.entries(liquiditiesByPlatformId)) {
|
87
|
+
elements.push({
|
101
88
|
type: portfolio_core_1.PortfolioElementType.liquidity,
|
102
89
|
networkId: portfolio_core_1.NetworkId.aptos,
|
103
90
|
platformId,
|
104
91
|
label: 'LiquidityPool',
|
105
|
-
value: (0, portfolio_core_1.getUsdValueSum)(
|
92
|
+
value: (0, portfolio_core_1.getUsdValueSum)(liquidities.map((a) => a.value)),
|
106
93
|
data: {
|
107
|
-
liquidities
|
94
|
+
liquidities,
|
108
95
|
},
|
109
|
-
};
|
110
|
-
|
111
|
-
});
|
112
|
-
elements.push(walletTokensElement);
|
96
|
+
});
|
97
|
+
}
|
113
98
|
return elements;
|
114
99
|
});
|
115
100
|
const fetcher = {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"aptos.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/aptos.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":"aptos.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/aptos.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAWoC;AAEpC,gEAAqC;AACrC,qGAAkG;AAClG,mGAAgG;AAChG,kDAA0D;AAC1D,oDAAwD;AACxD,gDAM8B;AAE9B,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,MAAM,GAAG,IAAA,wBAAc,GAAE,CAAC;IAChC,MAAM,SAAS,GAAG,MAAM,IAAA,2BAAmB,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC3D,IAAI,CAAC,SAAS;QAAE,OAAO,EAAE,CAAC;IAE1B,MAAM,kBAAkB,GAA0B,EAAE,CAAC;IACrD,MAAM,uBAAuB,GAAyC,EAAE,CAAC;IAEzE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC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IAAI,MAAM,CAAC,OAAO,CACpD,uBAAuB,CACxB,EAAE;QACD,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,qCAAoB,CAAC,SAAS;YACpC,SAAS,EAAE,0BAAS,CAAC,KAAK;YAC1B,UAAU;YACV,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;KACJ;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,QAAQ;IACtC,SAAS,EAAE,0BAAS,CAAC,KAAK;IAC1B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export default function durationForHumans(milliseconds: number): string;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
function durationForHumans(milliseconds) {
|
4
|
+
if (milliseconds < 100) {
|
5
|
+
return `${milliseconds}ms`;
|
6
|
+
}
|
7
|
+
const seconds = milliseconds / 1000;
|
8
|
+
if (seconds < 60) {
|
9
|
+
return `${seconds.toFixed(2)}s`;
|
10
|
+
}
|
11
|
+
const minutes = seconds / 60;
|
12
|
+
if (minutes < 60) {
|
13
|
+
return `${minutes.toFixed(2)}min`;
|
14
|
+
}
|
15
|
+
const hours = minutes / 60;
|
16
|
+
return `${hours.toFixed(2)}hrs`;
|
17
|
+
}
|
18
|
+
exports.default = durationForHumans;
|
19
|
+
//# sourceMappingURL=durationForHumans.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"durationForHumans.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/durationForHumans.ts"],"names":[],"mappings":";;AAAA,SAAwB,iBAAiB,CAAC,YAAoB;IAC5D,IAAI,YAAY,GAAG,GAAG,EAAE;QACtB,OAAO,GAAG,YAAY,IAAI,CAAC;KAC5B;IAED,MAAM,OAAO,GAAG,YAAY,GAAG,IAAI,CAAC;IACpC,IAAI,OAAO,GAAG,EAAE,EAAE;QAChB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;KACjC;IAED,MAAM,OAAO,GAAG,OAAO,GAAG,EAAE,CAAC;IAC7B,IAAI,OAAO,GAAG,EAAE,EAAE;QAChB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;KACnC;IAED,MAAM,KAAK,GAAG,OAAO,GAAG,EAAE,CAAC;IAC3B,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AAClC,CAAC;AAjBD,oCAiBC"}
|
@@ -8,7 +8,7 @@ function tokenPriceToAssetToken(address, amount, networkId, tokenPrice) {
|
|
8
8
|
networkId,
|
9
9
|
value: tokenPrice ? tokenPrice.price * amount : null,
|
10
10
|
data: {
|
11
|
-
address,
|
11
|
+
address: (0, portfolio_core_1.formatTokenAddress)(address, networkId),
|
12
12
|
amount,
|
13
13
|
price: tokenPrice ? tokenPrice.price : null,
|
14
14
|
},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tokenPriceToAssetToken.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/tokenPriceToAssetToken.ts"],"names":[],"mappings":";;;AAAA,+
|
1
|
+
{"version":3,"file":"tokenPriceToAssetToken.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/tokenPriceToAssetToken.ts"],"names":[],"mappings":";;;AAAA,+DAOoC;AAEpC,SAAgB,sBAAsB,CACpC,OAAe,EACf,MAAc,EACd,SAAwB,EACxB,UAAqD;IAErD,OAAO;QACL,IAAI,EAAE,mCAAkB,CAAC,KAAK;QAC9B,SAAS;QACT,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI;QACpD,IAAI,EAAE;YACJ,OAAO,EAAE,IAAA,mCAAkB,EAAC,OAAO,EAAE,SAAS,CAAC;YAC/C,MAAM;YACN,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;SAC5C;KACF,CAAC;AACJ,CAAC;AAhBD,wDAgBC"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.tokenPriceToAssetTokens = void 0;
|
4
|
+
const tokenPriceToAssetToken_1 = require("./tokenPriceToAssetToken");
|
5
|
+
function tokenPriceToAssetTokens(address, amount, networkId, tokenPrice) {
|
6
|
+
if (!tokenPrice || !tokenPrice.underlyings)
|
7
|
+
return [(0, tokenPriceToAssetToken_1.tokenPriceToAssetToken)(address, amount, networkId, tokenPrice)];
|
8
|
+
return tokenPrice.underlyings.map((tokenPriceUnderlying) => (0, tokenPriceToAssetToken_1.tokenPriceToAssetToken)(tokenPriceUnderlying.address, amount * tokenPriceUnderlying.amountPerLp, tokenPriceUnderlying.networkId, tokenPriceUnderlying));
|
9
|
+
}
|
10
|
+
exports.tokenPriceToAssetTokens = tokenPriceToAssetTokens;
|
11
|
+
//# sourceMappingURL=tokenPriceToAssetTokens.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"tokenPriceToAssetTokens.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/tokenPriceToAssetTokens.ts"],"names":[],"mappings":";;;AAKA,qEAAkE;AAElE,SAAgB,uBAAuB,CACrC,OAAe,EACf,MAAc,EACd,SAAwB,EACxB,UAA8B;IAE9B,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,WAAW;QACxC,OAAO,CAAC,IAAA,+CAAsB,EAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IAC1E,OAAO,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,oBAAoB,EAAE,EAAE,CACzD,IAAA,+CAAsB,EACpB,oBAAoB,CAAC,OAAO,EAC5B,MAAM,GAAG,oBAAoB,CAAC,WAAW,EACzC,oBAAoB,CAAC,SAAS,EAC9B,oBAAoB,CACrB,CACF,CAAC;AACJ,CAAC;AAhBD,0DAgBC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ammJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/foo/ammJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAgF;AAChF,2CAA6D;AAE7D,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,eAAe,EAAE;QAChD,MAAM,EAAE,8BAAkB;QAC1B,SAAS,EAAE,0BAAS,CAAC,QAAQ;KAC9B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;CACT,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
File without changes
|