@sonarwatch/portfolio-plugins 0.14.182 → 0.14.183
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 +14 -10
- package/package.json +1 -1
- package/src/plugins/solayer/airdropFetcher.js +5 -2
- package/src/plugins/solayer/airdropFetcher.js.map +1 -1
- package/src/utils/misc/getUnlockedAmountFromVesting.d.ts +1 -0
- package/src/utils/misc/getUnlockedAmountFromVesting.js +19 -0
- package/src/utils/misc/getUnlockedAmountFromVesting.js.map +1 -0
package/CHANGELOG.md
CHANGED
@@ -2,19 +2,23 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
-
## [0.14.
|
6
|
-
|
7
|
-
|
8
|
-
### Features
|
9
|
-
|
10
|
-
* **rain:** add stJup job for real-time token price updates ([161e3de](https://github.com/sonarwatch/portfolio/commit/161e3de497ea634bebd2462f1fedbae95e52d8cf))
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
## [0.14.181](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.180...plugins-0.14.181) (2025-04-18)
|
5
|
+
## [0.14.183](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.182...plugins-0.14.183) (2025-04-19)
|
15
6
|
|
16
7
|
|
17
8
|
|
9
|
+
## [0.14.182](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.181...plugins-0.14.182) (2025-04-18)
|
10
|
+
|
11
|
+
|
12
|
+
### Features
|
13
|
+
|
14
|
+
* **rain:** add stJup job for real-time token price updates ([161e3de](https://github.com/sonarwatch/portfolio/commit/161e3de497ea634bebd2462f1fedbae95e52d8cf))
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
## [0.14.181](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.180...plugins-0.14.181) (2025-04-18)
|
19
|
+
|
20
|
+
|
21
|
+
|
18
22
|
## [0.14.180](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.179...plugins-0.14.180) (2025-04-17)
|
19
23
|
|
20
24
|
|
package/package.json
CHANGED
@@ -19,6 +19,8 @@ const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
19
19
|
const AirdropFetcher_1 = require("../../AirdropFetcher");
|
20
20
|
const constants_1 = require("./constants");
|
21
21
|
const clients_1 = require("../../utils/clients");
|
22
|
+
const getUnlockedAmountFromVesting_1 = require("../../utils/misc/getUnlockedAmountFromVesting");
|
23
|
+
const oneMonth = 30 * 24 * 60 * 60 * 1000;
|
22
24
|
const executor = (owner) => __awaiter(void 0, void 0, void 0, function* () {
|
23
25
|
const epoch = yield (0, clients_1.getClientSolana)().getEpochInfo();
|
24
26
|
let res;
|
@@ -50,9 +52,10 @@ const executor = (owner) => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
52
|
},
|
51
53
|
],
|
52
54
|
});
|
53
|
-
const claimedAmount = new bignumber_js_1.default(res.data.claimedAmount);
|
54
55
|
const vestedAmount = new bignumber_js_1.default(res.data.totalAmount).times((epoch.epoch - res.data.startEpoch) /
|
55
56
|
(res.data.endEpoch - res.data.startEpoch));
|
57
|
+
const availableToClaim = new bignumber_js_1.default((0, getUnlockedAmountFromVesting_1.getUnlockedAmountFromLinearVesting)(1737201600000, 1752840000000, vestedAmount.toNumber(), oneMonth));
|
58
|
+
const claimedAmount = new bignumber_js_1.default(res.data.claimedAmount);
|
56
59
|
return (0, AirdropFetcher_1.getAirdropRaw)({
|
57
60
|
statics: constants_1.airdropStatics,
|
58
61
|
items: [
|
@@ -63,7 +66,7 @@ const executor = (owner) => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
66
|
address: constants_1.layerMint,
|
64
67
|
},
|
65
68
|
{
|
66
|
-
amount:
|
69
|
+
amount: availableToClaim.dividedBy(Math.pow(10, constants_1.layerDecimals)).toNumber(),
|
67
70
|
isClaimed: false,
|
68
71
|
label: 'LAYER',
|
69
72
|
address: constants_1.layerMint,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solayer/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA6C;AAC7C,gEAAqC;AACrC,yDAK8B;AAC9B,2CAMqB;AAErB,iDAAsD;
|
1
|
+
{"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solayer/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA6C;AAC7C,gEAAqC;AACrC,yDAK8B;AAC9B,2CAMqB;AAErB,iDAAsD;AACtD,gGAAmG;AAEnG,MAAM,QAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE1C,MAAM,QAAQ,GAA2B,CAAO,KAAa,EAAE,EAAE;IAC/D,MAAM,KAAK,GAAG,MAAM,IAAA,yBAAe,GAAE,CAAC,YAAY,EAAE,CAAC;IACrD,IAAI,GAAmC,CAAC;IACxC,IAAI,CAAC;QACH,GAAG,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,sBAAU,GAAG,KAAK,CAAC,CAAC;IAC5C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,IAAA,8BAAa,EAAC;YACnB,OAAO,EAAE,0BAAc;YACvB,KAAK,EAAE;gBACL;oBACE,MAAM,EAAE,CAAC;oBACT,SAAS,EAAE,KAAK;oBAChB,KAAK,EAAE,OAAO;oBACd,OAAO,EAAE,qBAAS;iBACnB;aACF;SACF,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK,GAAG;QAC3C,OAAO,IAAA,8BAAa,EAAC;YACnB,OAAO,EAAE,0BAAc;YACvB,KAAK,EAAE;gBACL;oBACE,MAAM,EAAE,CAAC;oBAC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,IAAA,wCAAuB,EAC5C,sBAAc,EACd,sBAAU,EACV,iBAAiB,EACjB,0BAAc,CAAC,QAAQ,CACxB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function getUnlockedAmountFromLinearVesting(startTime: number, endTime: number, totalAmount: number, vestingPeriod?: number): number;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getUnlockedAmountFromLinearVesting = void 0;
|
4
|
+
function getUnlockedAmountFromLinearVesting(startTime, endTime, totalAmount, vestingPeriod) {
|
5
|
+
const currentTime = Date.now();
|
6
|
+
if (currentTime < startTime)
|
7
|
+
return 0;
|
8
|
+
if (currentTime > endTime)
|
9
|
+
return totalAmount;
|
10
|
+
// If vestingPeriod is not provided, use the default linear vesting
|
11
|
+
if (!vestingPeriod) {
|
12
|
+
return ((currentTime - startTime) / (endTime - startTime)) * totalAmount;
|
13
|
+
}
|
14
|
+
// For linear vesting with a specific period
|
15
|
+
const unlockedAmount = ((currentTime - startTime) / vestingPeriod) * totalAmount;
|
16
|
+
return Math.min(unlockedAmount, totalAmount);
|
17
|
+
}
|
18
|
+
exports.getUnlockedAmountFromLinearVesting = getUnlockedAmountFromLinearVesting;
|
19
|
+
//# sourceMappingURL=getUnlockedAmountFromVesting.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getUnlockedAmountFromVesting.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/getUnlockedAmountFromVesting.ts"],"names":[],"mappings":";;;AAAA,SAAgB,kCAAkC,CAChD,SAAiB,EACjB,OAAe,EACf,WAAmB,EACnB,aAAsB;IAEtB,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC/B,IAAI,WAAW,GAAG,SAAS;QAAE,OAAO,CAAC,CAAC;IACtC,IAAI,WAAW,GAAG,OAAO;QAAE,OAAO,WAAW,CAAC;IAE9C,mEAAmE;IACnE,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,CAAC,CAAC,WAAW,GAAG,SAAS,CAAC,GAAG,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC,GAAG,WAAW,CAAC;IAC3E,CAAC;IAED,4CAA4C;IAC5C,MAAM,cAAc,GAClB,CAAC,CAAC,WAAW,GAAG,SAAS,CAAC,GAAG,aAAa,CAAC,GAAG,WAAW,CAAC;IAE5D,OAAO,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;AAC/C,CAAC;AApBD,gFAoBC"}
|