@sonarwatch/portfolio-plugins 0.11.138 → 0.11.140
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1275 -1267
- package/README.md +3 -3
- package/package.json +3 -3
- package/src/index.js +4 -0
- package/src/index.js.map +1 -1
- package/src/plugins/aptin/depositsFetcher.js +9 -9
- package/src/plugins/aptin/depositsFetcher.js.map +1 -1
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/foo/constants.js +1 -1
- package/src/plugins/foo/constants.js.map +1 -1
- package/src/plugins/native-stake/activeValidatorsJob.js +9 -4
- package/src/plugins/native-stake/activeValidatorsJob.js.map +1 -1
- package/src/plugins/native-stake/aptosFetcher.js +5 -3
- package/src/plugins/native-stake/aptosFetcher.js.map +1 -1
- package/src/plugins/pancakeswap/aptosLpJob.js +22 -17
- package/src/plugins/pancakeswap/aptosLpJob.js.map +1 -1
- package/src/plugins/staratlas/constants.d.ts +12 -0
- package/src/plugins/staratlas/constants.js +22 -0
- package/src/plugins/staratlas/constants.js.map +1 -0
- package/src/plugins/staratlas/helpers.d.ts +4 -0
- package/src/plugins/staratlas/helpers.js +26 -0
- package/src/plugins/staratlas/helpers.js.map +1 -0
- package/src/plugins/staratlas/index.d.ts +6 -0
- package/src/plugins/staratlas/index.js +13 -0
- package/src/plugins/staratlas/index.js.map +1 -0
- package/src/plugins/{tokens/fetchers/aptos-nfts.d.ts → staratlas/lockersFetcher.d.ts} +1 -1
- package/src/plugins/staratlas/lockersFetcher.js +54 -0
- package/src/plugins/staratlas/lockersFetcher.js.map +1 -0
- package/src/plugins/staratlas/stakingFetcher.d.ts +3 -0
- package/src/plugins/staratlas/stakingFetcher.js +64 -0
- package/src/plugins/staratlas/stakingFetcher.js.map +1 -0
- package/src/plugins/staratlas/structs.d.ts +33 -0
- package/src/plugins/staratlas/structs.js +34 -0
- package/src/plugins/staratlas/structs.js.map +1 -0
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/thala/constants.d.ts +3 -10
- package/src/plugins/thala/constants.js +4 -4
- package/src/plugins/thala/constants.js.map +1 -1
- package/src/plugins/thala/stabilityPoolFetcher.js +4 -1
- package/src/plugins/thala/stabilityPoolFetcher.js.map +1 -1
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/utils/aptos/getAccountCoinsData.d.ts +26 -0
- package/src/utils/aptos/getAccountCoinsData.js +10 -0
- package/src/utils/aptos/getAccountCoinsData.js.map +1 -0
- package/src/utils/aptos/getAccountResource.d.ts +2 -3
- package/src/utils/aptos/getAccountResource.js +4 -1
- package/src/utils/aptos/getAccountResource.js.map +1 -1
- package/src/utils/aptos/getAccountResources.d.ts +2 -5
- package/src/utils/aptos/getAccountResources.js +3 -1
- package/src/utils/aptos/getAccountResources.js.map +1 -1
- package/src/utils/aptos/getCoinInfoResource.d.ts +2 -2
- package/src/utils/aptos/getCoinStoreResource.d.ts +2 -2
- package/src/utils/aptos/getCoinStoreResources.d.ts +2 -5
- package/src/utils/aptos/getDecimals.d.ts +1 -1
- package/src/utils/aptos/getDecimals.js +1 -1
- package/src/utils/aptos/getDecimals.js.map +1 -1
- package/src/utils/aptos/getNestedType.d.ts +4 -0
- package/src/utils/aptos/getNestedType.js +4 -0
- package/src/utils/aptos/getNestedType.js.map +1 -1
- package/src/utils/aptos/getTableItem.d.ts +3 -3
- package/src/utils/aptos/getTableItem.js +1 -1
- package/src/utils/aptos/getTableItem.js.map +1 -1
- package/src/utils/aptos/getTableItemsByHandles.d.ts +3 -3
- package/src/utils/aptos/getTableItemsByHandles.js.map +1 -1
- package/src/utils/aptos/getTableItemsByKeys.d.ts +2 -2
- package/src/utils/aptos/getView.d.ts +3 -3
- package/src/utils/aptos/getView.js +1 -1
- package/src/utils/aptos/getView.js.map +1 -1
- package/src/utils/aptos/types.d.ts +0 -10
- package/src/utils/blank/isBlankAddressAptos.js +5 -1
- package/src/utils/blank/isBlankAddressAptos.js.map +1 -1
- package/src/utils/clients/constants.js +1 -1
- package/src/utils/clients/constants.js.map +1 -1
- package/src/utils/clients/getClientAptos.d.ts +1 -1
- package/src/utils/clients/getClientAptos.js +8 -3
- package/src/utils/clients/getClientAptos.js.map +1 -1
- package/src/utils/clients/types.d.ts +2 -0
- package/src/utils/misc/checkComputeAndStoreTokensPrices.d.ts +8 -0
- package/src/utils/misc/checkComputeAndStoreTokensPrices.js +8 -0
- package/src/utils/misc/checkComputeAndStoreTokensPrices.js.map +1 -1
- package/src/utils/misc/getDecimalsForToken.js +5 -3
- package/src/utils/misc/getDecimalsForToken.js.map +1 -1
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
- package/src/plugins/tokens/fetchers/aptos-nfts.js +0 -117
- package/src/plugins/tokens/fetchers/aptos-nfts.js.map +0 -1
package/README.md
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
# @sonarwatch/portfolio-plugins
|
2
|
-
|
3
|
-
This library is @sonarwatch/portfolio-plugins
|
1
|
+
# @sonarwatch/portfolio-plugins
|
2
|
+
|
3
|
+
This library is @sonarwatch/portfolio-plugins
|
package/package.json
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.11.
|
3
|
+
"version": "0.11.140",
|
4
4
|
"type": "commonjs",
|
5
5
|
"generators": "./generators.json",
|
6
6
|
"dependencies": {
|
7
7
|
"@aave/contract-helpers": "^1.18.3",
|
8
8
|
"@aave/math-utils": "^1.18.3",
|
9
|
+
"@aptos-labs/ts-sdk": "^1.10.0",
|
9
10
|
"@bonfida/spl-name-service": "^1.0.10",
|
10
11
|
"@cosmjs/cosmwasm-stargate": "^0.31.1",
|
11
12
|
"@ethersproject/address": "^5.7.0",
|
@@ -23,7 +24,6 @@
|
|
23
24
|
"@sei-js/core": "^3.0.1",
|
24
25
|
"@sei-js/proto": "^3.0.1",
|
25
26
|
"@solana/web3.js": "^1.89.1",
|
26
|
-
"aptos": "^1.13.1",
|
27
27
|
"axios": "^1.4.0",
|
28
28
|
"bignumber.js": "^9.1.1",
|
29
29
|
"bitcoin-address-validation": "^2.2.1",
|
@@ -41,7 +41,7 @@
|
|
41
41
|
"web3-v1": "npm:web3@^1.5.0"
|
42
42
|
},
|
43
43
|
"peerDependencies": {
|
44
|
-
"@sonarwatch/portfolio-core": "0.11.
|
44
|
+
"@sonarwatch/portfolio-core": "0.11.140"
|
45
45
|
},
|
46
46
|
"main": "./src/index.js",
|
47
47
|
"types": "./src/index.d.ts"
|
package/src/index.js
CHANGED
@@ -95,6 +95,7 @@ const abex_1 = require("./plugins/abex");
|
|
95
95
|
const kai_1 = require("./plugins/kai");
|
96
96
|
const suilend_1 = require("./plugins/suilend");
|
97
97
|
const symmetry_1 = require("./plugins/symmetry");
|
98
|
+
const staratlas_1 = require("./plugins/staratlas");
|
98
99
|
var constants_1 = require("./plugins/tokens/constants");
|
99
100
|
Object.defineProperty(exports, "walletTokensPlatform", { enumerable: true, get: function () { return constants_1.walletTokensPlatform; } });
|
100
101
|
Object.defineProperty(exports, "walletNftsPlatform", { enumerable: true, get: function () { return constants_1.walletNftsPlatform; } });
|
@@ -183,6 +184,7 @@ exports.platforms = [
|
|
183
184
|
...kai_1.platforms,
|
184
185
|
...suilend_1.platforms,
|
185
186
|
...symmetry_1.platforms,
|
187
|
+
...staratlas_1.platforms,
|
186
188
|
];
|
187
189
|
// JOBS //
|
188
190
|
exports.jobs = [
|
@@ -254,6 +256,7 @@ exports.jobs = [
|
|
254
256
|
...kai_1.jobs,
|
255
257
|
...suilend_1.jobs,
|
256
258
|
...symmetry_1.jobs,
|
259
|
+
...staratlas_1.jobs,
|
257
260
|
];
|
258
261
|
// FETCHERS //
|
259
262
|
exports.fetchers = [
|
@@ -327,6 +330,7 @@ exports.fetchers = [
|
|
327
330
|
...kai_1.fetchers,
|
328
331
|
...suilend_1.fetchers,
|
329
332
|
...symmetry_1.fetchers,
|
333
|
+
...staratlas_1.fetchers,
|
330
334
|
];
|
331
335
|
exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
|
332
336
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAGA,wFAAqF;AACrF,sEAA8C;AAC9C,6CAI0B;AAC1B,yDAIgC;AAChC,iDAG4B;AAC5B,iDAI4B;AAC5B,2CAGyB;AACzB,6CAI0B;AAC1B,+CAI2B;AAC3B,yCAIwB;AACxB,+CAI2B;AAC3B,2CAIyB;AACzB,6CAI0B;AAC1B,2CAIyB;AACzB,6CAG0B;AAC1B,6CAI0B;AAC1B,yCAIwB;AACxB,2DAGiC;AACjC,6CAI0B;AAC1B,2CAIyB;AACzB,2CAIyB;AACzB,qDAA6D;AAC7D,qEAIsC;AACtC,uDAI+B;AAC/B,mDAG6B;AAC7B,qDAG8B;AAC9B,uDAG+B;AAC/B,2CAIyB;AACzB,6CAI0B;AAC1B,6CAG0B;AAC1B,yCAIwB;AACxB,+CAI2B;AAC3B,uDAG+B;AAC/B,yCAGwB;AACxB,2CAIyB;AACzB,iDAI4B;AAC5B,iDAI4B;AAC5B,6CAI0B;AAC1B,+CAI2B;AAC3B,qDAG8B;AAC9B,iDAI4B;AAC5B,iDAI4B;AAC5B,mDAG6B;AAC7B,6CAI0B;AAC1B,2CAIyB;AACzB,iDAI4B;AAC5B,iDAI4B;AAC5B,+CAI2B;AAC3B,yCAIwB;AACxB,2CAIyB;AACzB,mDAI6B;AAC7B,2CAIyB;AACzB,2CAIyB;AACzB,sCAIsB;AACtB,+CAI2B;AAC3B,iDAI4B;AAC5B,yCAIwB;AACxB,mDAI6B;AAC7B,qDAI8B;AAC9B,2CAIyB;AACzB,2CAIyB;AACzB,yCAIwB;AACxB,+CAI2B;AAC3B,2CAIyB;AACzB,2CAIyB;AACzB,uDAI+B;AAC/B,6D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iBAAc;IACjB,GAAG,eAAY;IACf,GAAG,kBAAe;IAClB,GAAG,sBAAkB;IACrB,GAAG,gBAAa;IAChB,GAAG,mBAAgB;IACnB,GAAG,gBAAa;IAChB,GAAG,mBAAgB;IACnB,GAAG,eAAY;IACf,GAAG,iBAAc;IACjB,GAAG,qBAAiB;IACpB,GAAG,kBAAe;IAClB,GAAG,mBAAgB;IACnB,GAAG,mBAAgB;IACnB,GAAG,oBAAiB;IACpB,GAAG,iBAAc;IACjB,GAAG,gBAAa;IAChB,GAAG,mBAAgB;IACnB,GAAG,mBAAgB;IACnB,GAAG,kBAAe;IAClB,GAAG,eAAY;IACf,GAAG,gBAAa;IAChB,GAAG,oBAAiB;IACpB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,cAAe;IAClB,GAAG,kBAAe;IAClB,GAAG,mBAAgB;IACnB,GAAG,eAAY;IACf,GAAG,oBAAiB;IACpB,GAAG,kBAAe;IAClB,GAAG,qBAAkB;IACrB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,eAAY;IACf,GAAG,kBAAe;IAClB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,sBAAmB;IACtB,GAAG,yBAAsB;IACzB,GAAG,gBAAa;IAChB,GAAG,eAAY;IACf,GAAG,oBAAiB;IACpB,GAAG,iBAAc;IACjB,GAAG,2BAAsB;IACzB,GAAG,sBAAkB;IACrB,GAAG,eAAY;IACf,GAAG,cAAW;IACd,GAAG,kBAAe;IAClB,GAAG,mBAAgB;IACnB,GAAG,oBAAiB;CACrB,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,CAAC"}
|
@@ -23,8 +23,8 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
23
23
|
const poolPositions = yield (0, aptos_1.getAccountResource)(client, owner, constants_1.poolPositionsType);
|
24
24
|
if (!poolPositions)
|
25
25
|
return [];
|
26
|
-
if (poolPositions.
|
27
|
-
poolPositions.
|
26
|
+
if (poolPositions.supply_coins.length === 0 &&
|
27
|
+
poolPositions.borrow_coins.length === 0)
|
28
28
|
return [];
|
29
29
|
const configStores = yield cache.getItem(constants_1.configStoresKey, {
|
30
30
|
prefix: constants_1.platformId,
|
@@ -32,12 +32,12 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
32
32
|
});
|
33
33
|
if (!configStores)
|
34
34
|
return [];
|
35
|
-
const supplyPositions = poolPositions.
|
35
|
+
const supplyPositions = poolPositions.supply_coins.length === 0
|
36
36
|
? []
|
37
|
-
: yield (0, aptos_1.getTableItemsByKeys)(client, poolPositions.
|
38
|
-
const borrowPositions = poolPositions.
|
37
|
+
: yield (0, aptos_1.getTableItemsByKeys)(client, poolPositions.supply_position.handle, poolPositions.supply_coins, '0x1::string::String', '0x3c1d4a86594d681ff7e5d5a233965daeabdc6a15fe5672ceeda5260038857183::pool::SupplyPosition');
|
38
|
+
const borrowPositions = poolPositions.borrow_coins.length === 0
|
39
39
|
? []
|
40
|
-
: yield (0, aptos_1.getTableItemsByKeys)(client, poolPositions.
|
40
|
+
: yield (0, aptos_1.getTableItemsByKeys)(client, poolPositions.borrow_position.handle, poolPositions.borrow_coins, '0x1::string::String', '0x3c1d4a86594d681ff7e5d5a233965daeabdc6a15fe5672ceeda5260038857183::pool::BorrowPosition');
|
41
41
|
const borrowedAssets = [];
|
42
42
|
const borrowedYields = [];
|
43
43
|
const suppliedAssets = [];
|
@@ -45,7 +45,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
45
45
|
const rewardAssets = [];
|
46
46
|
const suppliedLtvs = [];
|
47
47
|
// Token prices
|
48
|
-
const tokenPricesRes = yield cache.getTokenPrices([...poolPositions.
|
48
|
+
const tokenPricesRes = yield cache.getTokenPrices([...poolPositions.supply_coins, ...poolPositions.borrow_coins], portfolio_core_1.NetworkId.aptos);
|
49
49
|
const tokenPrices = {};
|
50
50
|
tokenPricesRes.forEach((tp) => {
|
51
51
|
if (!tp)
|
@@ -58,7 +58,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
58
58
|
continue;
|
59
59
|
if (supplyPosition.amount === '0')
|
60
60
|
continue;
|
61
|
-
const coinType = poolPositions.
|
61
|
+
const coinType = poolPositions.supply_coins[i];
|
62
62
|
const address = (0, portfolio_core_1.formatTokenAddress)(coinType, portfolio_core_1.NetworkId.aptos);
|
63
63
|
const { decimals, ltv } = configStores[coinType];
|
64
64
|
const amount = new bignumber_js_1.default(supplyPosition.amount)
|
@@ -74,7 +74,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
74
74
|
continue;
|
75
75
|
if (borrowPosition.amount === '0')
|
76
76
|
continue;
|
77
|
-
const coinType = poolPositions.
|
77
|
+
const coinType = poolPositions.borrow_coins[i];
|
78
78
|
const address = (0, portfolio_core_1.formatTokenAddress)(coinType, portfolio_core_1.NetworkId.aptos);
|
79
79
|
const { decimals } = configStores[coinType];
|
80
80
|
const amount = new bignumber_js_1.default(borrowPosition.amount)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/aptin/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AAGrC,2CAA6E;AAO7E,qGAA6E;AAC7E,iDAAqD;AACrD,6CAA4E;AAE5E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,wBAAc,GAAE,CAAC;IAEhC,MAAM,aAAa,GAAG,MAAM,IAAA,0BAAkB,EAC5C,MAAM,EACN,KAAK,EACL,6BAAiB,CAClB,CAAC;IACF,IAAI,CAAC,aAAa;QAAE,OAAO,EAAE,CAAC;IAC9B,IACE,aAAa,CAAC,
|
1
|
+
{"version":3,"file":"depositsFetcher.js","source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,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,GACrE,IAAA,wCAAuB,EACrB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,CACb,CAAC;IAEJ,MAAM,OAAO,GAAqB;QAChC,IAAI,EAAE,qCAAoB,CAAC,UAAU;QACrC,SAAS,EAAE,0BAAS,CAAC,KAAK;QAC1B,UAAU,EAAV,sBAAU;QACV,KAAK,EAAE,SAAS;QAChB,KAAK;QACL,IAAI,EAAE;YACJ,cAAc;YACd,aAAa;YACb,cAAc;YACd,cAAc;YACd,aAAa;YACb,cAAc;YACd,eAAe,EAAE,IAAI;YACrB,WAAW;YACX,YAAY;YACZ,WAAW;YACX,KAAK;SACN;KACF,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,KAAK;IAC1B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -36,27 +36,27 @@ exports.getBalancerPoolsV2 = void 0;
|
|
36
36
|
const graphql_request_1 = __importStar(require("graphql-request"));
|
37
37
|
function getBalancerPoolsV2(url) {
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
39
|
-
const query = (0, graphql_request_1.gql) `
|
40
|
-
query pools {
|
41
|
-
pools(
|
42
|
-
first: 1000
|
43
|
-
orderBy: totalLiquidity
|
44
|
-
orderDirection: desc
|
45
|
-
where: { totalLiquidity_gt: "500" }
|
46
|
-
) {
|
47
|
-
id
|
48
|
-
address
|
49
|
-
symbol
|
50
|
-
totalLiquidity
|
51
|
-
totalShares
|
52
|
-
tokens {
|
53
|
-
balance
|
54
|
-
decimals
|
55
|
-
symbol
|
56
|
-
address
|
57
|
-
}
|
58
|
-
}
|
59
|
-
}
|
39
|
+
const query = (0, graphql_request_1.gql) `
|
40
|
+
query pools {
|
41
|
+
pools(
|
42
|
+
first: 1000
|
43
|
+
orderBy: totalLiquidity
|
44
|
+
orderDirection: desc
|
45
|
+
where: { totalLiquidity_gt: "500" }
|
46
|
+
) {
|
47
|
+
id
|
48
|
+
address
|
49
|
+
symbol
|
50
|
+
totalLiquidity
|
51
|
+
totalShares
|
52
|
+
tokens {
|
53
|
+
balance
|
54
|
+
decimals
|
55
|
+
symbol
|
56
|
+
address
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
60
|
`;
|
61
61
|
const res = yield (0, graphql_request_1.default)(url, query);
|
62
62
|
const pools = res.pools;
|
@@ -5,7 +5,7 @@ exports.platformId = 'foo';
|
|
5
5
|
exports.platform = {
|
6
6
|
id: exports.platformId,
|
7
7
|
name: 'Foo Finance',
|
8
|
-
image: 'https://sonar.watch/img/platforms/foo.
|
8
|
+
image: 'https://sonar.watch/img/platforms/foo.webp',
|
9
9
|
website: 'https://foo.com/',
|
10
10
|
twitter: 'https://twitter.com/foo_finance',
|
11
11
|
defiLlamaId: 'foo-finance', // from https://defillama.com/docs/api
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/foo/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,KAAK,CAAC;AACnB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/foo/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,KAAK,CAAC;AACnB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,4CAA4C;IACnD,OAAO,EAAE,kBAAkB;IAC3B,OAAO,EAAE,iCAAiC;IAC1C,WAAW,EAAE,aAAa,EAAE,sCAAsC;CACnE,CAAC;AACW,QAAA,kBAAkB,GAAG,GAAG,kBAAU,UAAU,CAAC"}
|
@@ -14,16 +14,21 @@ const clients_1 = require("../../utils/clients");
|
|
14
14
|
const constants_1 = require("./constants");
|
15
15
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
16
16
|
const client = (0, clients_1.getClientAptos)();
|
17
|
-
const resources = (yield client.getAccountResource(
|
17
|
+
const resources = (yield client.getAccountResource({
|
18
|
+
accountAddress: '0x1',
|
19
|
+
resourceType: '0x1::stake::ValidatorSet',
|
20
|
+
}));
|
18
21
|
const activeValidators = resources.data.active_validators;
|
19
22
|
const validatorsWithStake = [];
|
20
23
|
for (let i = 0; i < activeValidators.length; i++) {
|
21
24
|
const validator = activeValidators[i];
|
22
25
|
const hasStake = yield client
|
23
26
|
.view({
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
+
payload: {
|
28
|
+
function: '0x1::delegation_pool::operator_commission_percentage',
|
29
|
+
typeArguments: [],
|
30
|
+
functionArguments: [validator.addr],
|
31
|
+
},
|
27
32
|
})
|
28
33
|
.catch(() => { });
|
29
34
|
if (hasStake)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"activeValidatorsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/native-stake/activeValidatorsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,iDAAqD;AACrD,2CAA0E;AAG1E,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,wBAAc,GAAE,CAAC;IAChC,MAAM,SAAS,GAAG,CAAC,MAAM,MAAM,CAAC,kBAAkB,
|
1
|
+
{"version":3,"file":"activeValidatorsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/native-stake/activeValidatorsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,iDAAqD;AACrD,2CAA0E;AAG1E,MAAM,QAAQ,G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++) {
|
33
33
|
const validatorAddress = activeValidators[i];
|
34
34
|
const stakedValuesInValidator = (yield client.view({
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
payload: {
|
36
|
+
function: '0x1::delegation_pool::get_stake',
|
37
|
+
typeArguments: [],
|
38
|
+
functionArguments: [validatorAddress, owner],
|
39
|
+
},
|
38
40
|
}));
|
39
41
|
const amount = stakedValuesInValidator
|
40
42
|
.filter((item) => item !== '0')
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"aptosFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/native-stake/aptosFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,gEAAqC;AAGrC,2CAKqB;AACrB,iDAAqD;AACrD,qGAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,wBAAc,GAAE,CAAC;IAChC,MAAM,gBAAgB,GAAG,MAAM,KAAK,CAAC,OAAO,CAAW,yBAAa,EAAE;QACpE,MAAM,EAAE,4BAAgB;QACxB,SAAS,EAAE,0BAAS,CAAC,KAAK;KAC3B,CAAC,CAAC;IACH,IAAI,CAAC,gBAAgB;QAAE,OAAO,EAAE,CAAC;IAEjC,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,aAAa,CAC1C,6BAAY,CAAC,MAAM,CAAC,OAAO,EAC3B,0BAAS,CAAC,KAAK,CAChB,CAAC;IACF,IAAI,CAAC,UAAU;QAAE,OAAO,EAAE,CAAC;IAE3B,MAAM,QAAQ,GAAuB,EAAE,CAAC;IAExC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACjD,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAC7C,MAAM,uBAAuB,GAAG,CAAC,MAAM,MAAM,CA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,IAAI,KAAK,GAAG,CAAC;aAC9B,MAAM,CACL,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CACf,IAAI,sBAAS,CAAC,OAAO,CAAC;aACnB,GAAG,CAAC,SAAA,EAAE,EAAI,6BAAY,CAAC,MAAM,CAAC,QAAQ,CAAA,CAAC;aACvC,IAAI,CAAC,GAAG,CAAC;aACT,QAAQ,EAAE,EACf,CAAC,CACF,CAAC;QACJ,IAAI,MAAM,KAAK,CAAC;YAAE,SAAS;QAC3B,MAAM,KAAK,GAAG,IAAA,gCAAsB,EAClC,UAAU,CAAC,OAAO,EAClB,MAAM,EACN,0BAAS,CAAC,KAAK,EACf,UAAU,CACX,CAAC;QACF,QAAQ,CAAC,IAAI,CAAC;YACZ,SAAS,EAAE,0BAAS,CAAC,KAAK;YAC1B,UAAU,EAAE,+BAAmB,CAAC,EAAE;YAClC,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,CAAC,cAAc,CAAC;YACtB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,IAAI,EAAE;gBACJ,MAAM,EAAE,CAAC,KAAK,CAAC;aAChB;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,SAAS,EAAE,0BAAS,CAAC,KAAK;IAC1B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -17,12 +17,11 @@ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
|
17
17
|
const constants_1 = require("./constants");
|
18
18
|
const clients_1 = require("../../utils/clients");
|
19
19
|
const aptos_1 = require("../../utils/aptos");
|
20
|
-
const getTokensPricesMap_1 = __importDefault(require("../../utils/misc/getTokensPricesMap"));
|
21
20
|
const getLpUnderlyingTokenSource_1 = __importDefault(require("../../utils/misc/getLpUnderlyingTokenSource"));
|
22
|
-
const getDecimalsForToken_1 = require("../../utils/misc/getDecimalsForToken");
|
23
21
|
const getLpTokenSourceRaw_1 = __importDefault(require("../../utils/misc/getLpTokenSourceRaw"));
|
22
|
+
const getDecimals_1 = require("../../utils/aptos/getDecimals");
|
24
23
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
25
|
-
var _a, _b, _c;
|
24
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
26
25
|
const client = (0, clients_1.getClientAptos)();
|
27
26
|
const resources = yield (0, aptos_1.getAccountResources)(client, constants_1.programAddress);
|
28
27
|
if (!resources)
|
@@ -31,34 +30,39 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
30
|
resources.forEach((resource) => {
|
32
31
|
resourcesByType.set(resource.type, resource);
|
33
32
|
});
|
34
|
-
const tokenPriceById = yield
|
33
|
+
const tokenPriceById = yield cache.getTokenPricesAsMap(resources
|
35
34
|
.map((ressource) => {
|
36
35
|
const { keys } = (0, aptos_1.parseTypeString)(ressource.type);
|
37
36
|
return keys ? keys.map((key) => key.type) : [];
|
38
37
|
})
|
39
|
-
.flat(), portfolio_core_1.NetworkId.aptos
|
38
|
+
.flat(), portfolio_core_1.NetworkId.aptos);
|
39
|
+
const lpSources = [];
|
40
40
|
for (let i = 0; i < resources.length; i++) {
|
41
41
|
const resource = resources[i];
|
42
42
|
if (!resource.type.startsWith(constants_1.lpCoinInfoTypePrefix))
|
43
43
|
continue;
|
44
|
-
const lpType = (0, aptos_1.
|
44
|
+
const lpType = (_b = (_a = (0, aptos_1.parseTypeString)(resource.type).keys) === null || _a === void 0 ? void 0 : _a.at(0)) === null || _b === void 0 ? void 0 : _b.type;
|
45
|
+
if (!lpType)
|
46
|
+
continue;
|
45
47
|
const lpInfoData = resource.data;
|
46
|
-
const lpSupplyString = (
|
48
|
+
const lpSupplyString = (_e = (_d = (_c = lpInfoData.supply) === null || _c === void 0 ? void 0 : _c.vec[0]) === null || _d === void 0 ? void 0 : _d.integer.vec[0]) === null || _e === void 0 ? void 0 : _e.value;
|
47
49
|
if (!lpSupplyString)
|
48
50
|
continue;
|
49
51
|
const lpDecimals = lpInfoData.decimals;
|
50
52
|
const lpSupply = new bignumber_js_1.default(lpSupplyString);
|
51
53
|
if (lpSupply.isZero())
|
52
54
|
continue;
|
53
|
-
const tokenPairId = (0, aptos_1.
|
55
|
+
const tokenPairId = (_f = (0, aptos_1.parseTypeString)(lpType)
|
56
|
+
.keys) === null || _f === void 0 ? void 0 : _f.map((t) => t.type).join(', ');
|
57
|
+
if (!tokenPairId)
|
58
|
+
continue;
|
54
59
|
// TODO : get ride of those by using parseTypeString() instead of getNestedType()
|
55
60
|
if (tokenPairId.includes('swap::LPToken') ||
|
56
61
|
tokenPairId.includes('LPCoinV1::LPCoin') ||
|
57
62
|
tokenPairId.includes('lp_coin::LP'))
|
58
63
|
continue;
|
59
|
-
const
|
60
|
-
const
|
61
|
-
const typeY = splits.at(1);
|
64
|
+
const typeX = (_h = (_g = (0, aptos_1.parseTypeString)(lpType).keys) === null || _g === void 0 ? void 0 : _g.at(0)) === null || _h === void 0 ? void 0 : _h.type;
|
65
|
+
const typeY = (_k = (_j = (0, aptos_1.parseTypeString)(lpType).keys) === null || _j === void 0 ? void 0 : _j.at(1)) === null || _k === void 0 ? void 0 : _k.type;
|
62
66
|
const tokenPairResource = resourcesByType.get(`${constants_1.programAddress}::swap::TokenPairMetadata<${tokenPairId}>`);
|
63
67
|
if (!tokenPairResource)
|
64
68
|
throw new Error(`Failed to get tokenPairResource: ${lpType}`);
|
@@ -73,12 +77,12 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
77
|
tokenPairData.balance_y.value === '0')
|
74
78
|
continue;
|
75
79
|
const [tokenPriceX, tokenPriceY] = [
|
76
|
-
tokenPriceById.get(typeX),
|
77
|
-
tokenPriceById.get(typeY),
|
80
|
+
tokenPriceById.get((0, portfolio_core_1.formatTokenAddress)(typeX, portfolio_core_1.NetworkId.aptos)),
|
81
|
+
tokenPriceById.get((0, portfolio_core_1.formatTokenAddress)(typeY, portfolio_core_1.NetworkId.aptos)),
|
78
82
|
];
|
79
83
|
const [decimalsX, decimalsY] = yield Promise.all([
|
80
|
-
(0,
|
81
|
-
(0,
|
84
|
+
(0, getDecimals_1.getDecimals)(client, typeX),
|
85
|
+
(0, getDecimals_1.getDecimals)(client, typeY),
|
82
86
|
]);
|
83
87
|
const [reserveAmountRawX, reserveAmountRawY] = [
|
84
88
|
new bignumber_js_1.default(tokenPairData.balance_x.value),
|
@@ -98,7 +102,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
98
102
|
tokenPrice: tokenPriceY,
|
99
103
|
});
|
100
104
|
if (underlyingSource)
|
101
|
-
|
105
|
+
lpSources.push(underlyingSource);
|
102
106
|
if (!tokenPriceX || !tokenPriceY)
|
103
107
|
continue;
|
104
108
|
const lpSource = (0, getLpTokenSourceRaw_1.default)(portfolio_core_1.NetworkId.aptos, lpType, constants_1.platformId, {
|
@@ -119,8 +123,9 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
119
123
|
reserveAmountRaw: reserveAmountRawY,
|
120
124
|
},
|
121
125
|
], '');
|
122
|
-
|
126
|
+
lpSources.push(lpSource);
|
123
127
|
}
|
128
|
+
yield cache.setTokenPriceSources(lpSources);
|
124
129
|
});
|
125
130
|
const job = {
|
126
131
|
id: `${constants_1.platformId}-aptos-lp`,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"aptosLpJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/pancakeswap/aptosLpJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,gEAAqC;AACrC,+
|
1
|
+
{"version":3,"file":"aptosLpJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/pancakeswap/aptosLpJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,gEAAqC;AACrC,+DAIoC;A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AE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
2
|
+
import { Platform } from '@sonarwatch/portfolio-core';
|
3
|
+
export declare const platformId = "staratlas";
|
4
|
+
export declare const platform: Platform;
|
5
|
+
export declare const lockerAddress: PublicKey;
|
6
|
+
export declare const stakingPid: PublicKey;
|
7
|
+
export declare const proxyRewarderPid: PublicKey;
|
8
|
+
export declare const lockedVoterPid: PublicKey;
|
9
|
+
export declare const polisMint = "poLisWXnNRwC6oBu1vHiuKQzFjGL4XDSu4g9qjz9qVk";
|
10
|
+
export declare const polisDecimals = 8;
|
11
|
+
export declare const atlasMint = "ATLASXmbPQxBUYbxPsV97usA3fPQYEqzQBUHgiFCUsXx";
|
12
|
+
export declare const atlasDecimals = 8;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.atlasDecimals = exports.atlasMint = exports.polisDecimals = exports.polisMint = exports.lockedVoterPid = exports.proxyRewarderPid = exports.stakingPid = exports.lockerAddress = exports.platform = exports.platformId = void 0;
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
5
|
+
exports.platformId = 'staratlas';
|
6
|
+
exports.platform = {
|
7
|
+
id: exports.platformId,
|
8
|
+
name: 'Star Atlas',
|
9
|
+
image: 'https://sonar.watch/img/platforms/staratlas.webp',
|
10
|
+
website: 'https://staratlas.com/',
|
11
|
+
twitter: 'https://twitter.com/staratlas',
|
12
|
+
// defiLlamaId: 'foo-finance', // from https://defillama.com/docs/api
|
13
|
+
};
|
14
|
+
exports.lockerAddress = new web3_js_1.PublicKey('5WmM9c9WE71y78Ah8Bp8vgyoStscM1ZZyaaFqRf8b2Qa');
|
15
|
+
exports.stakingPid = new web3_js_1.PublicKey('ATLocKpzDbTokxgvnLew3d7drZkEzLzDpzwgrgWKDbmc');
|
16
|
+
exports.proxyRewarderPid = new web3_js_1.PublicKey('gateVwTnKyFrE8nxUUgfzoZTPKgJQZUbLsEidpG4Dp2');
|
17
|
+
exports.lockedVoterPid = new web3_js_1.PublicKey('Lock7kBijGCQLEFAmXcengzXKA88iDNQPriQ7TbgeyG');
|
18
|
+
exports.polisMint = 'poLisWXnNRwC6oBu1vHiuKQzFjGL4XDSu4g9qjz9qVk';
|
19
|
+
exports.polisDecimals = 8;
|
20
|
+
exports.atlasMint = 'ATLASXmbPQxBUYbxPsV97usA3fPQYEqzQBUHgiFCUsXx';
|
21
|
+
exports.atlasDecimals = 8;
|
22
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/staratlas/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,WAAW,CAAC;AACzB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,kDAAkD;IACzD,OAAO,EAAE,wBAAwB;IACjC,OAAO,EAAE,+BAA+B;IACxC,qEAAqE;CACtE,CAAC;AAEW,QAAA,aAAa,GAAG,IAAI,mBAAS,CACxC,8CAA8C,CAC/C,CAAC;AACW,QAAA,UAAU,GAAG,IAAI,mBAAS,CACrC,8CAA8C,CAC/C,CAAC;AACW,QAAA,gBAAgB,GAAG,IAAI,mBAAS,CAC3C,6CAA6C,CAC9C,CAAC;AACW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,6CAA6C,CAC9C,CAAC;AACW,QAAA,SAAS,GAAG,6CAA6C,CAAC;AAC1D,QAAA,aAAa,GAAG,CAAC,CAAC;AAClB,QAAA,SAAS,GAAG,8CAA8C,CAAC;AAC3D,QAAA,aAAa,GAAG,CAAC,CAAC"}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
2
|
+
export declare function getProxyEscrowAddress(owner: string): PublicKey;
|
3
|
+
export declare function getProxyAddress(proxyEscrowAddress: string, owner: string): PublicKey;
|
4
|
+
export declare function getEscrowAddress(escrowOwner: PublicKey): PublicKey;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getEscrowAddress = exports.getProxyAddress = exports.getProxyEscrowAddress = void 0;
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
5
|
+
const constants_1 = require("./constants");
|
6
|
+
function getProxyEscrowAddress(owner) {
|
7
|
+
return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('ProxyEscrow', 'utf8'), new web3_js_1.PublicKey(owner).toBuffer()], constants_1.proxyRewarderPid)[0];
|
8
|
+
}
|
9
|
+
exports.getProxyEscrowAddress = getProxyEscrowAddress;
|
10
|
+
function getProxyAddress(proxyEscrowAddress, owner) {
|
11
|
+
return web3_js_1.PublicKey.findProgramAddressSync([
|
12
|
+
Buffer.from('Proxy', 'utf8'),
|
13
|
+
new web3_js_1.PublicKey(proxyEscrowAddress).toBuffer(),
|
14
|
+
new web3_js_1.PublicKey(owner).toBuffer(),
|
15
|
+
], constants_1.proxyRewarderPid)[0];
|
16
|
+
}
|
17
|
+
exports.getProxyAddress = getProxyAddress;
|
18
|
+
function getEscrowAddress(escrowOwner) {
|
19
|
+
return web3_js_1.PublicKey.findProgramAddressSync([
|
20
|
+
Buffer.from('Escrow', 'utf8'),
|
21
|
+
constants_1.lockerAddress.toBuffer(),
|
22
|
+
escrowOwner.toBuffer(),
|
23
|
+
], constants_1.lockedVoterPid)[0];
|
24
|
+
}
|
25
|
+
exports.getEscrowAddress = getEscrowAddress;
|
26
|
+
//# sourceMappingURL=helpers.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/staratlas/helpers.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,2CAA8E;AAE9E,SAAgB,qBAAqB,CAAC,KAAa;IACjD,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,EAAE,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,EACrE,4BAAgB,CACjB,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AALD,sDAKC;AAED,SAAgB,eAAe,CAAC,kBAA0B,EAAE,KAAa;IACvE,OAAO,mBAAS,CAAC,sBAAsB,CACrC;QACE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC;QAC5B,IAAI,mBAAS,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE;QAC5C,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;KAChC,EACD,4BAAgB,CACjB,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AATD,0CASC;AAED,SAAgB,gBAAgB,CAAC,WAAsB;IACrD,OAAO,mBAAS,CAAC,sBAAsB,CACrC;QACE,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC7B,yBAAa,CAAC,QAAQ,EAAE;QACxB,WAAW,CAAC,QAAQ,EAAE;KACvB,EACD,0BAAc,CACf,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AATD,4CASC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.fetchers = exports.jobs = exports.platforms = void 0;
|
7
|
+
const constants_1 = require("./constants");
|
8
|
+
const lockersFetcher_1 = __importDefault(require("./lockersFetcher"));
|
9
|
+
const stakingFetcher_1 = __importDefault(require("./stakingFetcher"));
|
10
|
+
exports.platforms = [constants_1.platform];
|
11
|
+
exports.jobs = [];
|
12
|
+
exports.fetchers = [lockersFetcher_1.default, stakingFetcher_1.default];
|
13
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/staratlas/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,sEAA8C;AAC9C,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc,CAAC,wBAAc,EAAE,wBAAc,CAAC,CAAC"}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
+
const constants_1 = require("./constants");
|
17
|
+
const clients_1 = require("../../utils/clients");
|
18
|
+
const helpers_1 = require("./helpers");
|
19
|
+
const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
|
20
|
+
const structs_1 = require("./structs");
|
21
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
22
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
|
+
const connection = (0, clients_1.getClientSolana)();
|
24
|
+
const proxyEscrowAddress = (0, helpers_1.getProxyEscrowAddress)(owner);
|
25
|
+
const proxyAddress = (0, helpers_1.getProxyAddress)(proxyEscrowAddress.toString(), owner);
|
26
|
+
const escrowAddress = (0, helpers_1.getEscrowAddress)(proxyAddress);
|
27
|
+
const account = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(connection, structs_1.escrowStruct, escrowAddress);
|
28
|
+
if (!account || account.amount.isZero())
|
29
|
+
return [];
|
30
|
+
const polisTokenPrice = yield cache.getTokenPrice(constants_1.polisMint, portfolio_core_1.NetworkId.solana);
|
31
|
+
const amount = account.amount.div(Math.pow(10, constants_1.polisDecimals)).toNumber();
|
32
|
+
const asset = (0, tokenPriceToAssetToken_1.default)(constants_1.polisMint, amount, portfolio_core_1.NetworkId.solana, polisTokenPrice, polisTokenPrice === null || polisTokenPrice === void 0 ? void 0 : polisTokenPrice.price, {
|
33
|
+
lockedUntil: account.escrowEndsAt.toNumber() * 1000,
|
34
|
+
});
|
35
|
+
return [
|
36
|
+
{
|
37
|
+
type: portfolio_core_1.PortfolioElementType.multiple,
|
38
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
39
|
+
label: 'Staked',
|
40
|
+
platformId: constants_1.platformId,
|
41
|
+
data: {
|
42
|
+
assets: [asset],
|
43
|
+
},
|
44
|
+
value: asset.value,
|
45
|
+
},
|
46
|
+
];
|
47
|
+
});
|
48
|
+
const fetcher = {
|
49
|
+
id: `${constants_1.platformId}-lockers`,
|
50
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
51
|
+
executor,
|
52
|
+
};
|
53
|
+
exports.default = fetcher;
|
54
|
+
//# sourceMappingURL=lockersFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"lockersFetcher.js","sourceRoot":"","sources":["../../../../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