@sonarwatch/portfolio-plugins 0.5.21 → 0.5.22
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 +61 -57
- package/package.json +2 -2
- package/src/index.js +3 -0
- package/src/index.js.map +1 -1
- package/src/plugins/native-stake/activeValidatorsJob.d.ts +3 -0
- package/src/plugins/native-stake/activeValidatorsJob.js +42 -0
- package/src/plugins/native-stake/activeValidatorsJob.js.map +1 -0
- package/src/plugins/native-stake/aptosFetcher.d.ts +3 -0
- package/src/plugins/native-stake/aptosFetcher.js +69 -0
- package/src/plugins/native-stake/aptosFetcher.js.map +1 -0
- package/src/plugins/native-stake/constants.d.ts +3 -0
- package/src/plugins/native-stake/constants.js +7 -0
- package/src/plugins/native-stake/constants.js.map +1 -0
- package/src/plugins/native-stake/filters.d.ts +2 -0
- package/src/plugins/native-stake/filters.js +16 -0
- package/src/plugins/native-stake/filters.js.map +1 -0
- package/src/plugins/native-stake/index.d.ts +4 -0
- package/src/plugins/native-stake/index.js +13 -0
- package/src/plugins/native-stake/index.js.map +1 -0
- package/src/plugins/native-stake/solanaFetcher.d.ts +3 -0
- package/src/plugins/native-stake/solanaFetcher.js +64 -0
- package/src/plugins/native-stake/solanaFetcher.js.map +1 -0
- package/src/plugins/native-stake/structs.d.ts +19 -0
- package/src/plugins/native-stake/structs.js +21 -0
- package/src/plugins/native-stake/structs.js.map +1 -0
- package/src/plugins/native-stake/suiFetcher.d.ts +3 -0
- package/src/plugins/native-stake/suiFetcher.js +65 -0
- package/src/plugins/native-stake/suiFetcher.js.map +1 -0
- package/src/plugins/native-stake/types.d.ts +21 -0
- package/src/plugins/native-stake/types.js +3 -0
- package/src/plugins/native-stake/types.js.map +1 -0
package/CHANGELOG.md
CHANGED
@@ -2,66 +2,70 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
-
## [0.5.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
## [0.5.20](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.19...plugins-0.5.20) (2023-08-03)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
## [0.5.19](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.18...plugins-0.5.19) (2023-08-03)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
## [0.5.18](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.17...plugins-0.5.18) (2023-08-03)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
## [0.5.17](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.16...plugins-0.5.17) (2023-08-03)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
## [0.5.16](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.15...plugins-0.5.16) (2023-08-02)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
## [0.5.15](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.14...plugins-0.5.15) (2023-08-02)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
## [0.5.14](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.13...plugins-0.5.14) (2023-08-02)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
## [0.5.13](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.12...plugins-0.5.13) (2023-08-02)
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
## [0.5.12](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.11...plugins-0.5.12) (2023-08-02)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
## [0.5.11](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.10...plugins-0.5.11) (2023-08-02)
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
## [0.5.10](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.9...plugins-0.5.10) (2023-08-02)
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
## [0.5.9](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.8...plugins-0.5.9) (2023-07-31)
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
## [0.5.8](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.7...plugins-0.5.8) (2023-07-27)
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
## [0.5.7](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.6...plugins-0.5.7) (2023-07-27)
|
5
|
+
## [0.5.22](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.21...plugins-0.5.22) (2023-08-08)
|
62
6
|
|
63
7
|
|
64
8
|
|
9
|
+
## [0.5.21](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.20...plugins-0.5.21) (2023-08-07)
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
## [0.5.20](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.19...plugins-0.5.20) (2023-08-03)
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
## [0.5.19](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.18...plugins-0.5.19) (2023-08-03)
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
## [0.5.18](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.17...plugins-0.5.18) (2023-08-03)
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
## [0.5.17](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.16...plugins-0.5.17) (2023-08-03)
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
## [0.5.16](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.15...plugins-0.5.16) (2023-08-02)
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
## [0.5.15](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.14...plugins-0.5.15) (2023-08-02)
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
## [0.5.14](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.13...plugins-0.5.14) (2023-08-02)
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
## [0.5.13](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.12...plugins-0.5.13) (2023-08-02)
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
## [0.5.12](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.11...plugins-0.5.12) (2023-08-02)
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
## [0.5.11](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.10...plugins-0.5.11) (2023-08-02)
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
## [0.5.10](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.9...plugins-0.5.10) (2023-08-02)
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
## [0.5.9](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.8...plugins-0.5.9) (2023-07-31)
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
## [0.5.8](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.7...plugins-0.5.8) (2023-07-27)
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
## [0.5.7](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.6...plugins-0.5.7) (2023-07-27)
|
66
|
+
|
67
|
+
|
68
|
+
|
65
69
|
## [0.5.6](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.5...plugins-0.5.6) (2023-07-24)
|
66
70
|
|
67
71
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.5.
|
3
|
+
"version": "0.5.22",
|
4
4
|
"type": "commonjs",
|
5
5
|
"generators": "./generators.json",
|
6
6
|
"dependencies": {
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"viem": "^1.2.9"
|
22
22
|
},
|
23
23
|
"peerDependencies": {
|
24
|
-
"@sonarwatch/portfolio-core": "0.5.
|
24
|
+
"@sonarwatch/portfolio-core": "0.5.22"
|
25
25
|
},
|
26
26
|
"main": "./src/index.js",
|
27
27
|
"types": "./src/index.d.ts"
|
package/src/index.js
CHANGED
@@ -29,6 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.fetchersByAddressSystem = exports.fetchers = exports.jobs = exports.platforms = void 0;
|
30
30
|
const platformsObj = __importStar(require("./platforms"));
|
31
31
|
const tokens_1 = require("./plugins/tokens");
|
32
|
+
const native_stake_1 = require("./plugins/native-stake");
|
32
33
|
const marinade_1 = require("./plugins/marinade");
|
33
34
|
const marginfi_1 = require("./plugins/marginfi");
|
34
35
|
const solend_1 = require("./plugins/solend");
|
@@ -50,6 +51,7 @@ __exportStar(require("./platforms"), exports);
|
|
50
51
|
exports.platforms = Object.values(platformsObj);
|
51
52
|
exports.jobs = [
|
52
53
|
...tokens_1.jobs,
|
54
|
+
...native_stake_1.jobs,
|
53
55
|
...thala_1.jobs,
|
54
56
|
...marginfi_1.jobs,
|
55
57
|
...raydium_1.jobs,
|
@@ -64,6 +66,7 @@ exports.jobs = [
|
|
64
66
|
];
|
65
67
|
exports.fetchers = [
|
66
68
|
...tokens_1.fetchers,
|
69
|
+
...native_stake_1.fetchers,
|
67
70
|
...tensor_1.fetchers,
|
68
71
|
...marginfi_1.fetchers,
|
69
72
|
...marinade_1.fetchers,
|
package/src/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,0DAA4C;AAC5C,6CAG0B;AAC1B,iDAAkE;AAClE,iDAG4B;AAC5B,6CAG0B;AAC1B,+CAG2B;AAC3B,yCAA4E;AAC5E,+CAAwD;AACxD,2CAA+E;AAC/E,6CAG0B;AAC1B,2CAA+E;AAC/E,6CAA8D;AAC9D,2CAA+E;AAC/E,2CAA+E;AAC/E,qDAA6D;AAC7D,wFAAqF;AAErF,0CAAwB;AACxB,4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ACb,GAAG,mBAAe;IAClB,GAAG,YAAS;IACZ,GAAG,eAAY;IACf,GAAG,cAAW;IACd,GAAG,aAAU;IACb,GAAG,cAAW;IACd,GAAG,WAAQ;IACX,GAAG,YAAS;IACZ,GAAG,YAAS;IACZ,GAAG,YAAS;IACZ,GAAG,aAAU;IACb,GAAG,iBAAa;CACjB,CAAC;AAEW,QAAA,QAAQ,GAAc;IACjC,GAAG,iBAAc;IACjB,GAAG,uBAAmB;IACtB,GAAG,iBAAc;IACjB,GAAG,mBAAgB;IACnB,GAAG,mBAAgB;IACnB,GAAG,iBAAc;IACjB,GAAG,gBAAa;IAChB,GAAG,kBAAe;IAClB,GAAG,eAAY;IACf,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,iBAAc;CAClB,CAAC;AAEW,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,CAAC"}
|
@@ -0,0 +1,42 @@
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
13
|
+
const clients_1 = require("../../utils/clients");
|
14
|
+
const constants_1 = require("./constants");
|
15
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
16
|
+
const client = (0, clients_1.getClientAptos)();
|
17
|
+
const resources = (yield client.getAccountResource('0x1', '0x1::stake::ValidatorSet'));
|
18
|
+
const activeValidators = resources.data.active_validators;
|
19
|
+
const validatorsWithStake = [];
|
20
|
+
for (let i = 0; i < activeValidators.length; i++) {
|
21
|
+
const validator = activeValidators[i];
|
22
|
+
const hasStake = yield client
|
23
|
+
.view({
|
24
|
+
function: '0x1::delegation_pool::operator_commission_percentage',
|
25
|
+
type_arguments: [],
|
26
|
+
arguments: [validator.addr],
|
27
|
+
})
|
28
|
+
.catch(() => { });
|
29
|
+
if (hasStake)
|
30
|
+
validatorsWithStake.push(validator.addr);
|
31
|
+
}
|
32
|
+
yield cache.setItem(constants_1.validatorsKey, validatorsWithStake, {
|
33
|
+
prefix: constants_1.validatorsPrefix,
|
34
|
+
networkId: portfolio_core_1.NetworkId.aptos,
|
35
|
+
});
|
36
|
+
});
|
37
|
+
const job = {
|
38
|
+
id: `${constants_1.platformId}-active-validators`,
|
39
|
+
executor,
|
40
|
+
};
|
41
|
+
exports.default = job;
|
42
|
+
//# sourceMappingURL=activeValidatorsJob.js.map
|
@@ -0,0 +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,CAChD,KAAK,EACL,0BAA0B,CAC3B,CAAiB,CAAC;IACnB,MAAM,gBAAgB,GAAG,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC;IAC1D,MAAM,mBAAmB,GAAa,EAAE,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAChD,MAAM,SAAS,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;QACtC,MAAM,QAAQ,GAAG,MAAM,MAAM;aAC1B,IAAI,CAAC;YACJ,QAAQ,EAAE,sDAAsD;YAChE,cAAc,EAAE,EAAE;YAClB,SAAS,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC;SAC5B,CAAC;aACD,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACnB,IAAI,QAAQ;YAAE,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;KACxD;IACD,MAAM,KAAK,CAAC,OAAO,CAAC,yBAAa,EAAE,mBAAmB,EAAE;QACtD,MAAM,EAAE,4BAAgB;QACxB,SAAS,EAAE,0BAAS,CAAC,KAAK;KAC3B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,oBAAoB;IACrC,QAAQ;CACT,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1,69 @@
|
|
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 bignumber_js_1 = __importDefault(require("bignumber.js"));
|
17
|
+
const constants_1 = require("./constants");
|
18
|
+
const clients_1 = require("../../utils/clients");
|
19
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
20
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
21
|
+
const client = (0, clients_1.getClientAptos)();
|
22
|
+
const activeValidators = yield cache.getItem(constants_1.validatorsKey, {
|
23
|
+
prefix: constants_1.validatorsPrefix,
|
24
|
+
networkId: portfolio_core_1.NetworkId.aptos,
|
25
|
+
});
|
26
|
+
if (!activeValidators)
|
27
|
+
return [];
|
28
|
+
const aptosPrice = yield cache.getTokenPrice(portfolio_core_1.aptosNetwork.native.address, portfolio_core_1.NetworkId.aptos);
|
29
|
+
if (!aptosPrice)
|
30
|
+
return [];
|
31
|
+
const elements = [];
|
32
|
+
for (let i = 0; i < activeValidators.length; i++) {
|
33
|
+
const validatorAddress = activeValidators[i];
|
34
|
+
const stakedValuesInValidator = (yield client.view({
|
35
|
+
function: '0x1::delegation_pool::get_stake',
|
36
|
+
type_arguments: [],
|
37
|
+
arguments: [validatorAddress, owner],
|
38
|
+
}));
|
39
|
+
const amount = stakedValuesInValidator
|
40
|
+
.filter((item) => item !== '0')
|
41
|
+
.reduce((sum, current) => new bignumber_js_1.default(current)
|
42
|
+
.div(Math.pow(10, portfolio_core_1.aptosNetwork.native.decimals))
|
43
|
+
.plus(sum)
|
44
|
+
.toNumber(), 0);
|
45
|
+
if (amount === 0)
|
46
|
+
continue;
|
47
|
+
const asset = (0, tokenPriceToAssetToken_1.default)(aptosPrice.address, amount, portfolio_core_1.NetworkId.aptos, aptosPrice);
|
48
|
+
elements.push({
|
49
|
+
networkId: portfolio_core_1.NetworkId.aptos,
|
50
|
+
platformId: constants_1.platformId,
|
51
|
+
type: 'multiple',
|
52
|
+
label: 'Staked',
|
53
|
+
tags: ['Native Stake'],
|
54
|
+
name: validatorAddress,
|
55
|
+
value: asset.value,
|
56
|
+
data: {
|
57
|
+
assets: [asset],
|
58
|
+
},
|
59
|
+
});
|
60
|
+
}
|
61
|
+
return elements;
|
62
|
+
});
|
63
|
+
const fetcher = {
|
64
|
+
id: `${constants_1.platformId}-aptos`,
|
65
|
+
networkId: portfolio_core_1.NetworkId.aptos,
|
66
|
+
executor,
|
67
|
+
};
|
68
|
+
exports.default = fetcher;
|
69
|
+
//# sourceMappingURL=aptosFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"aptosFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/native-stake/aptosFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,gEAAqC;AAGrC,2CAA0E;AAC1E,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;QAChD,MAAM,gBAAgB,GAAG,gBAAgB,CAA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OAAO,CAAC"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.validatorsPrefix = exports.validatorsKey = exports.platformId = void 0;
|
4
|
+
exports.platformId = 'native-stake';
|
5
|
+
exports.validatorsKey = 'activeValidators';
|
6
|
+
exports.validatorsPrefix = `${exports.platformId}-validators`;
|
7
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/native-stake/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG,cAAc,CAAC;AAC5B,QAAA,aAAa,GAAG,kBAAkB,CAAC;AACnC,QAAA,gBAAgB,GAAG,GAAG,kBAAU,aAAa,CAAC"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.stakeAccountsFilter = void 0;
|
4
|
+
const stakeAccountsFilter = (owner) => [
|
5
|
+
{
|
6
|
+
memcmp: {
|
7
|
+
offset: 44,
|
8
|
+
bytes: owner,
|
9
|
+
},
|
10
|
+
},
|
11
|
+
{
|
12
|
+
dataSize: 200,
|
13
|
+
},
|
14
|
+
];
|
15
|
+
exports.stakeAccountsFilter = stakeAccountsFilter;
|
16
|
+
//# sourceMappingURL=filters.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/native-stake/filters.ts"],"names":[],"mappings":";;;AAEO,MAAM,mBAAmB,GAAG,CACjC,KAAa,EACe,EAAE,CAAC;IAC/B;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,GAAG;KACd;CACF,CAAC;AAZW,QAAA,mBAAmB,uBAY9B"}
|
@@ -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 = void 0;
|
7
|
+
const suiFetcher_1 = __importDefault(require("./suiFetcher"));
|
8
|
+
const aptosFetcher_1 = __importDefault(require("./aptosFetcher"));
|
9
|
+
const solanaFetcher_1 = __importDefault(require("./solanaFetcher"));
|
10
|
+
const activeValidatorsJob_1 = __importDefault(require("./activeValidatorsJob"));
|
11
|
+
exports.jobs = [activeValidatorsJob_1.default];
|
12
|
+
exports.fetchers = [suiFetcher_1.default, aptosFetcher_1.default, solanaFetcher_1.default];
|
13
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/native-stake/index.ts"],"names":[],"mappings":";;;;;;AAEA,8DAAsC;AACtC,kEAA0C;AAC1C,oEAA4C;AAC5C,gFAAuD;AAE1C,QAAA,IAAI,GAAU,CAAC,6BAAkB,CAAC,CAAC;AACnC,QAAA,QAAQ,GAAc,CAAC,oBAAU,EAAE,sBAAY,EAAE,uBAAa,CAAC,CAAC"}
|
@@ -0,0 +1,64 @@
|
|
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 web3_js_1 = require("@solana/web3.js");
|
17
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
|
+
const constants_1 = require("./constants");
|
19
|
+
const filters_1 = require("./filters");
|
20
|
+
const clients_1 = require("../../utils/clients");
|
21
|
+
const solana_1 = require("../../utils/solana");
|
22
|
+
const structs_1 = require("./structs");
|
23
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
24
|
+
const stakeProgramId = new web3_js_1.PublicKey('Stake11111111111111111111111111111111111111');
|
25
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
26
|
+
const client = (0, clients_1.getClientSolana)();
|
27
|
+
const filters = (0, filters_1.stakeAccountsFilter)(owner.toString());
|
28
|
+
const programAccounts = yield (0, solana_1.getParsedProgramAccounts)(client, structs_1.stakeAccountStruct, stakeProgramId, filters);
|
29
|
+
if (programAccounts.length === 0)
|
30
|
+
return [];
|
31
|
+
const solTokenPrice = yield cache.getTokenPrice(portfolio_core_1.solanaNetwork.native.address, portfolio_core_1.NetworkId.solana);
|
32
|
+
if (!solTokenPrice)
|
33
|
+
return [];
|
34
|
+
const elements = [];
|
35
|
+
for (let i = 0; i < programAccounts.length; i += 1) {
|
36
|
+
const stakeAccount = programAccounts[i];
|
37
|
+
const amount = new bignumber_js_1.default(stakeAccount.stake)
|
38
|
+
.dividedBy(new bignumber_js_1.default(Math.pow(10, 9)))
|
39
|
+
.toNumber();
|
40
|
+
const value = amount * solTokenPrice.price;
|
41
|
+
const { voter } = stakeAccount;
|
42
|
+
const stakedAsset = (0, tokenPriceToAssetToken_1.default)(portfolio_core_1.solanaNetwork.native.address, amount, portfolio_core_1.NetworkId.solana, solTokenPrice);
|
43
|
+
elements.push({
|
44
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
45
|
+
platformId: constants_1.platformId,
|
46
|
+
type: 'multiple',
|
47
|
+
label: 'Staked',
|
48
|
+
tags: ['Native Stake'],
|
49
|
+
name: voter.toString(),
|
50
|
+
value,
|
51
|
+
data: {
|
52
|
+
assets: [stakedAsset],
|
53
|
+
},
|
54
|
+
});
|
55
|
+
}
|
56
|
+
return elements;
|
57
|
+
});
|
58
|
+
const fetcher = {
|
59
|
+
id: `${constants_1.platformId}-solana`,
|
60
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
61
|
+
executor,
|
62
|
+
};
|
63
|
+
exports.default = fetcher;
|
64
|
+
//# sourceMappingURL=solanaFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"solanaFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/native-stake/solanaFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,6CAA4C;AAC5C,gEAAqC;AAGrC,2CAAyC;AACzC,uCAAgD;AAChD,iDAAsD;AACtD,+CAA8D;AAC9D,uCAA+C;AAC/C,qGAA6E;AAE7E,MAAM,cAAc,GAAG,IAAI,mBAAS,CAClC,6CAA6C,CAC9C,CAAC;AAEF,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,OAAO,GAAG,IAAA,6BAAmB,EAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEtD,MAAM,eAAe,GAAG,MAAM,IAAA,iCAAwB,EACpD,MAAM,EACN,4BAAkB,EAClB,cAAc,EACd,OAAO,CACR,CAAC;IACF,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE5C,MAAM,aAAa,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AC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
|
+
import { PublicKey } from '@metaplex-foundation/js';
|
4
|
+
import BigNumber from 'bignumber.js';
|
5
|
+
export type StakeAccount = {
|
6
|
+
state: number;
|
7
|
+
buffer1: Buffer;
|
8
|
+
rent_exempt_reserve: BigNumber;
|
9
|
+
staker: PublicKey;
|
10
|
+
withdrawer: PublicKey;
|
11
|
+
buffer2: Buffer;
|
12
|
+
voter: PublicKey;
|
13
|
+
stake: BigNumber;
|
14
|
+
activation_epoch: BigNumber;
|
15
|
+
deactivation_epoch: BigNumber;
|
16
|
+
warmup_cooldown_rate: BigNumber;
|
17
|
+
credits_observed: BigNumber;
|
18
|
+
};
|
19
|
+
export declare const stakeAccountStruct: BeetStruct<StakeAccount, Partial<StakeAccount>>;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.stakeAccountStruct = void 0;
|
4
|
+
const beet_1 = require("@metaplex-foundation/beet");
|
5
|
+
const beet_solana_1 = require("@metaplex-foundation/beet-solana");
|
6
|
+
const solana_1 = require("../../utils/solana");
|
7
|
+
exports.stakeAccountStruct = new beet_1.BeetStruct([
|
8
|
+
['state', beet_1.u8],
|
9
|
+
['buffer1', (0, solana_1.blob)(3)],
|
10
|
+
['rent_exempt_reserve', solana_1.u64],
|
11
|
+
['staker', beet_solana_1.publicKey],
|
12
|
+
['withdrawer', beet_solana_1.publicKey],
|
13
|
+
['buffer2', (0, solana_1.blob)(48)],
|
14
|
+
['voter', beet_solana_1.publicKey],
|
15
|
+
['stake', solana_1.u64],
|
16
|
+
['activation_epoch', solana_1.u64],
|
17
|
+
['deactivation_epoch', solana_1.u64],
|
18
|
+
['warmup_cooldown_rate', solana_1.f64],
|
19
|
+
['credits_observed', solana_1.u64],
|
20
|
+
], (args) => args);
|
21
|
+
//# sourceMappingURL=structs.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/native-stake/structs.ts"],"names":[],"mappings":";;;AAAA,oDAA2D;AAG3D,kEAA6D;AAC7D,+CAAoD;AAiBvC,QAAA,kBAAkB,GAAG,IAAI,iBAAU,CAC9C;IACE,CAAC,OAAO,EAAE,SAAE,CAAC;IACb,CAAC,SAAS,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACpB,CAAC,qBAAqB,EAAE,YAAG,CAAC;IAC5B,CAAC,QAAQ,EAAE,uBAAS,CAAC;IACrB,CAAC,YAAY,EAAE,uBAAS,CAAC;IACzB,CAAC,SAAS,EAAE,IAAA,aAAI,EAAC,EAAE,CAAC,CAAC;IACrB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,OAAO,EAAE,YAAG,CAAC;IACd,CAAC,kBAAkB,EAAE,YAAG,CAAC;IACzB,CAAC,oBAAoB,EAAE,YAAG,CAAC;IAC3B,CAAC,sBAAsB,EAAE,YAAG,CAAC;IAC7B,CAAC,kBAAkB,EAAE,YAAG,CAAC;CAC1B,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAoB,CAC/B,CAAC"}
|
@@ -0,0 +1,65 @@
|
|
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 bignumber_js_1 = __importDefault(require("bignumber.js"));
|
17
|
+
const constants_1 = require("./constants");
|
18
|
+
const clients_1 = require("../../utils/clients");
|
19
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
20
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
21
|
+
const client = (0, clients_1.getClientSui)();
|
22
|
+
const stakedValidators = yield client.getStakes({ owner });
|
23
|
+
if (stakedValidators.length === 0)
|
24
|
+
return [];
|
25
|
+
const suiTokenPrice = yield cache.getTokenPrice(portfolio_core_1.suiNetwork.native.address, portfolio_core_1.NetworkId.sui);
|
26
|
+
if (!suiTokenPrice)
|
27
|
+
return [];
|
28
|
+
const elements = [];
|
29
|
+
for (let i = 0; i < stakedValidators.length; i++) {
|
30
|
+
const { stakes, validatorAddress } = stakedValidators[i];
|
31
|
+
if (stakes.length === 0)
|
32
|
+
continue;
|
33
|
+
const assets = [];
|
34
|
+
let value = 0;
|
35
|
+
for (let j = 0; j < stakes.length; j++) {
|
36
|
+
const stakeInfo = stakes[j];
|
37
|
+
const stakedAmount = new bignumber_js_1.default(stakeInfo.principal)
|
38
|
+
.div(Math.pow(10, portfolio_core_1.suiNetwork.native.decimals))
|
39
|
+
.toNumber();
|
40
|
+
const stakedAsset = (0, tokenPriceToAssetToken_1.default)(portfolio_core_1.suiNetwork.native.address, stakedAmount, portfolio_core_1.NetworkId.sui, suiTokenPrice);
|
41
|
+
assets.push(stakedAsset);
|
42
|
+
value += stakedAsset.value !== null ? stakedAsset.value : 0;
|
43
|
+
}
|
44
|
+
elements.push({
|
45
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
46
|
+
platformId: constants_1.platformId,
|
47
|
+
type: 'multiple',
|
48
|
+
label: 'Staked',
|
49
|
+
tags: ['Native Stake'],
|
50
|
+
name: validatorAddress,
|
51
|
+
value,
|
52
|
+
data: {
|
53
|
+
assets,
|
54
|
+
},
|
55
|
+
});
|
56
|
+
}
|
57
|
+
return elements;
|
58
|
+
});
|
59
|
+
const fetcher = {
|
60
|
+
id: `${constants_1.platformId}-sui`,
|
61
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
62
|
+
executor,
|
63
|
+
};
|
64
|
+
exports.default = fetcher;
|
65
|
+
//# sourceMappingURL=suiFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"suiFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/native-stake/suiFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,gEAAqC;AAGrC,2CAAyC;AACzC,iDAAmD;AACnD,qGAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9B,MAAM,gBAAgB,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3D,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE7C,MAAM,aAAa,GAAG,MAAM,KAAK,CAAC,aAAa,CAC7C,2BAAU,CAAC,MAAM,CAAC,OAAO,EACzB,0BAAS,CAAC,GAAG,CACd,CAAC;IACF,IAAI,CAAC,aAAa;QAAE,OAAO,EAAE,CAAC;IAE9B,MAAM,QAAQ,GAAuB,EAAE,CAAC;IACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAChD,MAAM,EAAE,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,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
export type ValidatorInfo = {
|
2
|
+
addr: string;
|
3
|
+
config: {
|
4
|
+
consensus_pubkey: string;
|
5
|
+
fullnode_addresses: string;
|
6
|
+
network_addresses: string;
|
7
|
+
validator_index: string;
|
8
|
+
};
|
9
|
+
voting_power: string;
|
10
|
+
};
|
11
|
+
export type ValidatorSet = {
|
12
|
+
type: string;
|
13
|
+
data: {
|
14
|
+
active_validators: ValidatorInfo[];
|
15
|
+
consensus_scheme: string;
|
16
|
+
pending_active: string[];
|
17
|
+
pending_inactive: string[];
|
18
|
+
total_joining_power: string;
|
19
|
+
total_voting_power: string;
|
20
|
+
};
|
21
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/native-stake/types.ts"],"names":[],"mappings":""}
|