@sonarwatch/portfolio-plugins 0.11.211 → 0.11.213
Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,19 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
+
## [0.11.213](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.212...plugins-0.11.213) (2024-05-24)
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
## [0.11.212](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.211...plugins-0.11.212) (2024-05-23)
|
10
|
+
|
11
|
+
|
12
|
+
### Reverts
|
13
|
+
|
14
|
+
* Revert "linting" ([cc27848](https://github.com/sonarwatch/portfolio/commit/cc27848b5a5e965d54457cd9dce7359a62c5e48d))
|
15
|
+
|
16
|
+
|
17
|
+
|
5
18
|
## [0.11.211](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.210...plugins-0.11.211) (2024-05-23)
|
6
19
|
|
7
20
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.11.
|
3
|
+
"version": "0.11.213",
|
4
4
|
"type": "commonjs",
|
5
5
|
"generators": "./generators.json",
|
6
6
|
"dependencies": {
|
@@ -42,7 +42,7 @@
|
|
42
42
|
"web3-v1": "npm:web3@^1.5.0"
|
43
43
|
},
|
44
44
|
"peerDependencies": {
|
45
|
-
"@sonarwatch/portfolio-core": "0.11.
|
45
|
+
"@sonarwatch/portfolio-core": "0.11.213"
|
46
46
|
},
|
47
47
|
"main": "./src/index.js",
|
48
48
|
"types": "./src/index.d.ts"
|
@@ -38,7 +38,7 @@ bcs.registerStructType('IncentivePoolInfoByPhase', {
|
|
38
38
|
phase: 'u64',
|
39
39
|
pools: 'vector<IncentivePoolInfo>',
|
40
40
|
});
|
41
|
-
function
|
41
|
+
function getTransactionBlock(owner, optionType) {
|
42
42
|
const tx = new transactions_1.TransactionBlock();
|
43
43
|
tx.moveCall({
|
44
44
|
target: constants_1.incentiveFunction,
|
@@ -47,22 +47,7 @@ function getSupplyRewardsTransactionBlock(owner) {
|
|
47
47
|
tx.object(constants_1.incentiveObjectId),
|
48
48
|
tx.object(constants_1.incentiveStorageObjectId),
|
49
49
|
tx.pure(0),
|
50
|
-
tx.pure(
|
51
|
-
tx.pure(owner),
|
52
|
-
],
|
53
|
-
});
|
54
|
-
return tx;
|
55
|
-
}
|
56
|
-
function getBorrowRewardsTransactionBlock(owner) {
|
57
|
-
const tx = new transactions_1.TransactionBlock();
|
58
|
-
tx.moveCall({
|
59
|
-
target: constants_1.incentiveFunction,
|
60
|
-
arguments: [
|
61
|
-
tx.object(portfolio_core_1.suiClockAddress),
|
62
|
-
tx.object(constants_1.incentiveObjectId),
|
63
|
-
tx.object(constants_1.incentiveStorageObjectId),
|
64
|
-
tx.pure(1),
|
65
|
-
tx.pure(3),
|
50
|
+
tx.pure(optionType),
|
66
51
|
tx.pure(owner),
|
67
52
|
],
|
68
53
|
});
|
@@ -70,27 +55,33 @@ function getBorrowRewardsTransactionBlock(owner) {
|
|
70
55
|
}
|
71
56
|
function getRewardPoolsData(client, tx, owner) {
|
72
57
|
return __awaiter(this, void 0, void 0, function* () {
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
58
|
+
try {
|
59
|
+
const rewardsPoolsInfos = yield client.devInspectTransactionBlock({
|
60
|
+
transactionBlock: tx,
|
61
|
+
sender: owner,
|
62
|
+
});
|
63
|
+
if (rewardsPoolsInfos.results &&
|
64
|
+
rewardsPoolsInfos.results[0].returnValues) {
|
65
|
+
const o = rewardsPoolsInfos.results[0].returnValues;
|
66
|
+
return o
|
67
|
+
.map((e) => bcs.de('vector<IncentivePoolInfoByPhase>', Uint8Array.from(e[0])))
|
68
|
+
.flat()
|
69
|
+
.sort((e, n) => Number(n.phase) - Number(e.phase));
|
70
|
+
}
|
71
|
+
}
|
72
|
+
catch (e) {
|
73
|
+
//
|
83
74
|
}
|
84
75
|
return [];
|
85
76
|
});
|
86
77
|
}
|
87
78
|
function getAvailableRewards(client, owner) {
|
88
79
|
return __awaiter(this, void 0, void 0, function* () {
|
80
|
+
const rewards = new Map();
|
89
81
|
const [supplyRewardPoolsData, borrowRewardPoolsData] = yield Promise.all([
|
90
|
-
getRewardPoolsData(client,
|
91
|
-
getRewardPoolsData(client,
|
82
|
+
getRewardPoolsData(client, getTransactionBlock(owner, 1), owner),
|
83
|
+
getRewardPoolsData(client, getTransactionBlock(owner, 3), owner),
|
92
84
|
]);
|
93
|
-
const rewards = new Map();
|
94
85
|
const browseRewardPoolData = (e) => {
|
95
86
|
e.pools.forEach((pool) => {
|
96
87
|
const funds = pool.funds;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getAvailableRewards.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/getAvailableRewards.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,8DAA+D;AAC/D,qCAAoD;AACpD,gEAAqC;AACrC,+DAA6D;AAE7D,2CAMqB;AAGrB,MAAM,GAAG,GAAG,IAAI,SAAG,CAAC,IAAA,sBAAgB,GAAE,CAAC,CAAC;AAExC,GAAG,CAAC,kBAAkB,CAAC,mBAAmB,EAAE;IAC1C,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,KAAK;IACZ,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,KAAK;IAChB,YAAY,EAAE,KAAK;IACnB,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,KAAK;IAClB,SAAS,EAAE,MAAM;IACjB,KAAK,EAAE,MAAM;CACd,CAAC,CAAC;AAEH,GAAG,CAAC,kBAAkB,CAAC,0BAA0B,EAAE;IACjD,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,2BAA2B;CACnC,CAAC,CAAC;AAEH,SAAS,
|
1
|
+
{"version":3,"file":"getAvailableRewards.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/getAvailableRewards.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,8DAA+D;AAC/D,qCAAoD;AACpD,gEAAqC;AACrC,+DAA6D;AAE7D,2CAMqB;AAGrB,MAAM,GAAG,GAAG,IAAI,SAAG,CAAC,IAAA,sBAAgB,GAAE,CAAC,CAAC;AAExC,GAAG,CAAC,kBAAkB,CAAC,mBAAmB,EAAE;IAC1C,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,KAAK;IACZ,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,KAAK;IAChB,YAAY,EAAE,KAAK;IACnB,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,KAAK;IAClB,SAAS,EAAE,MAAM;IACjB,KAAK,EAAE,MAAM;CACd,CAAC,CAAC;AAEH,GAAG,CAAC,kBAAkB,CAAC,0BAA0B,EAAE;IACjD,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,2BAA2B;CACnC,CAAC,CAAC;AAEH,SAAS,mBAAmB,CAAC,KAAa,EAAE,UAAkB;IAC5D,MAAM,EAAE,GAAG,IAAI,+BAAgB,EAAE,CAAC;IAElC,EAAE,CAAC,QAAQ,CAAC;QACV,MAAM,EAAE,6BAAiB;QACzB,SAAS,EAAE;YACT,EAAE,CAAC,MAAM,CAAC,gCAAe,CAAC;YAC1B,EAAE,CAAC,MAAM,CAAC,6BAAiB,CAAC;YAC5B,EAAE,CAAC,MAAM,CAAC,oCAAwB,CAAC;YACnC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;YACV,EAAE,CAAC,IAAI,CAAC,UAAU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