@sonarwatch/portfolio-plugins 0.11.137 → 0.11.138
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +4 -0
- package/package.json +2 -2
- package/src/plugins/flexlend/depositsFetcher.js +8 -4
- package/src/plugins/flexlend/depositsFetcher.js.map +1 -1
- package/src/plugins/jupiter/index.js +0 -2
- package/src/plugins/jupiter/index.js.map +1 -1
- package/src/plugins/solend/obligationsFetcher.js +0 -6
- package/src/plugins/solend/obligationsFetcher.js.map +1 -1
- package/src/plugins/jupiter/testFetcher.d.ts +0 -3
- package/src/plugins/jupiter/testFetcher.js +0 -77
- package/src/plugins/jupiter/testFetcher.js.map +0 -1
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
+
## [0.11.138](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.137...plugins-0.11.138) (2024-03-20)
|
6
|
+
|
7
|
+
|
8
|
+
|
5
9
|
## [0.11.137](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.136...plugins-0.11.137) (2024-03-20)
|
6
10
|
|
7
11
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.11.
|
3
|
+
"version": "0.11.138",
|
4
4
|
"type": "commonjs",
|
5
5
|
"generators": "./generators.json",
|
6
6
|
"dependencies": {
|
@@ -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.138"
|
45
45
|
},
|
46
46
|
"main": "./src/index.js",
|
47
47
|
"types": "./src/index.d.ts"
|
@@ -16,15 +16,19 @@ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
|
16
16
|
const constants_1 = require("./constants");
|
17
17
|
const helpers_1 = require("./helpers");
|
18
18
|
const obligationsFetcher_1 = __importDefault(require("../solend/obligationsFetcher"));
|
19
|
+
const deposits_1 = __importDefault(require("../drift/deposits"));
|
20
|
+
const lendsFetcher_1 = __importDefault(require("../kamino/lendsFetcher"));
|
21
|
+
const collateralFetcher_1 = __importDefault(require("../mango/collateralFetcher"));
|
22
|
+
const index_1 = require("../marginfi/index");
|
19
23
|
const constants_2 = require("../tokens/constants");
|
20
24
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
21
25
|
const pda = (0, helpers_1.getDerivedAccount)(owner);
|
22
26
|
const portfolioElements = (yield Promise.all([
|
23
|
-
|
27
|
+
index_1.fetchers[0].executor(pda, cache),
|
24
28
|
obligationsFetcher_1.default.executor(pda, cache),
|
25
|
-
|
26
|
-
|
27
|
-
|
29
|
+
deposits_1.default.executor(pda, cache),
|
30
|
+
lendsFetcher_1.default.executor(pda, cache),
|
31
|
+
collateralFetcher_1.default.executor(pda, cache),
|
28
32
|
])).flat();
|
29
33
|
if (portfolioElements.length === 0)
|
30
34
|
return [];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flexlend/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAyE;AAGzE,2CAAyC;AACzC,uCAA8C;AAC9C,sFAAiE;
|
1
|
+
{"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flexlend/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAyE;AAGzE,2CAAyC;AACzC,uCAA8C;AAC9C,sFAAiE;AACjE,iEAAqD;AACrD,0EAA8D;AAC9D,mFAA6D;AAC7D,6CAAyE;AACzE,mDAA2D;AAE3D,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,GAAG,GAA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@@ const airdropFetcher_1 = __importDefault(require("./airdropFetcher"));
|
|
10
10
|
const voteFetcher_1 = __importDefault(require("./voteFetcher"));
|
11
11
|
const constants_1 = require("./constants");
|
12
12
|
const valueAverageFetcher_1 = __importDefault(require("./valueAverageFetcher"));
|
13
|
-
const testFetcher_1 = __importDefault(require("./testFetcher"));
|
14
13
|
exports.platforms = [constants_1.jupiterPlatform];
|
15
14
|
exports.jobs = [custodiesJob_1.default];
|
16
15
|
exports.fetchers = [
|
@@ -18,6 +17,5 @@ exports.fetchers = [
|
|
18
17
|
airdropFetcher_1.default,
|
19
18
|
voteFetcher_1.default,
|
20
19
|
valueAverageFetcher_1.default,
|
21
|
-
testFetcher_1.default,
|
22
20
|
];
|
23
21
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/index.ts"],"names":[],"mappings":";;;;;;AAGA,0EAAkD;AAClD,kEAA0C;AAC1C,sEAA8C;AAC9C,gEAAwC;AACxC,2CAA8C;AAC9C,gFAAwD;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/index.ts"],"names":[],"mappings":";;;;;;AAGA,0EAAkD;AAClD,kEAA0C;AAC1C,sEAA8C;AAC9C,gEAAwC;AACxC,2CAA8C;AAC9C,gFAAwD;AAE3C,QAAA,SAAS,GAAe,CAAC,2BAAe,CAAC,CAAC;AAC1C,QAAA,IAAI,GAAU,CAAC,sBAAY,CAAC,CAAC;AAC7B,QAAA,QAAQ,GAAc;IACjC,0BAAgB;IAChB,wBAAc;IACd,qBAAW;IACX,6BAAmB;CACpB,CAAC"}
|
@@ -52,18 +52,12 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
52
52
|
obligationAddresses.push(obligationAddress);
|
53
53
|
}
|
54
54
|
}
|
55
|
-
console.log('constexecutor:FetcherExecutor= ~ owner:', owner);
|
56
55
|
// Flexlend, only support the main pool on Solend
|
57
|
-
// mainMarket = 4UpD2fh7xH3VP9QQaXtsS1YY3bxzWhtfpks7FatyKvdY
|
58
56
|
const marketSeed = constants_1.mainMarket.slice(0, 16);
|
59
|
-
// owner = 5MBMRrJcAFmkQ39iSB3v6U8ifz4HqizS32voDrmSC6nu
|
60
57
|
const ownerSeed = owner.slice(0, 16);
|
61
58
|
const obligationSeed = ownerSeed + marketSeed;
|
62
|
-
// AUTOMATION PUBLIC KEY = 8PWR75ppAGonv9dXStjficjXmdsuDKmDoVNcy4oYhAMs
|
63
59
|
const oldFlexlendObligAddress = yield web3_js_1.PublicKey.createWithSeed(constants_2.AUTOMATION_PUBLIC_KEY, obligationSeed, constants_1.pid);
|
64
|
-
// -> gives : 3UHaFeLkzaHn1Rnks1p8s1xJdwHqMzD4JazWZH4PkzJ9 (correct)
|
65
60
|
const newFlexlendObligAddress = yield web3_js_1.PublicKey.createWithSeed(new web3_js_1.PublicKey(owner), obligationSeed, constants_1.pid);
|
66
|
-
// -> gives : AnwJKJf4YYKqYz6QBDbf1GhUFhPCExGAH4tNGjKXMBtP (inccorect)
|
67
61
|
obligationAddresses.push(...[oldFlexlendObligAddress, newFlexlendObligAddress]);
|
68
62
|
const obligations = yield (0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.obligationStruct, obligationAddresses);
|
69
63
|
if (obligations.length === 0)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"obligationsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/obligationsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AACrC,6CAA4C;AAG5C,2CAOqB;AACrB,uCAA6D;AAE7D,+CAAmE;AACnE,iDAAsD;AACtD,uCAA6C;AAC7C,qGAA6E;AAC7E,6EAAqD;AACrD,qDAA8D;AAC9D,6DAAiE;AAEjE,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE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1
|
+
{"version":3,"file":"obligationsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/obligationsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AACrC,6CAA4C;AAG5C,2CAOqB;AACrB,uCAA6D;AAE7D,+CAAmE;AACnE,iDAAsD;AACtD,uCAA6C;AAC7C,qGAA6E;AAC7E,6EAAqD;AACrD,qDAA8D;AAC9D,6DAAiE;AAEjE,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,mBAAmB,GAAG,EAAE,CAAC;IAE/B,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,WAAW,CAAa;QAClD,MAAM,EAAE,yBAAa;QACrB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IACH,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACpC,MAAM,gBAAgB,GAA4B,IAAI,GAAG,EAAE,CAAC;IAC5D,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QACzB,IAAI,MAAM;YAAE,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,KAAK,MAAM,UAAU,IAAI,OAAO,EAAE,CAAC;QACjC,IAAI,CAAC,UAAU;YAAE,SAAS;QAC1B,MAAM,KAAK,GAAG;YACZ,IAAA,2BAAiB,EAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;YACxC,IAAA,2BAAiB,EAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;YACxC,IAAA,2BAAiB,EAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;SACzC,CAAC;QACF,KAAK,IAAI,CAAC,GAAG,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CAAC;QAEJ,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,qCAAoB,CAAC,UAAU;YACrC,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,SAAS;YAChB,KAAK;YACL,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,eAAe,EAAE,IAAI;gBAErB,WAAW;gBACX,YAAY;gBACZ,WAAW;gBACX,KAAK;aACN;SACF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,cAAc;IAC/B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -1,77 +0,0 @@
|
|
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 solana_1 = require("../../utils/solana");
|
19
|
-
const clients_1 = require("../../utils/clients");
|
20
|
-
const vote_1 = require("./structs/vote");
|
21
|
-
const filters_1 = require("../../utils/solana/filters");
|
22
|
-
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
|
-
const client = (0, clients_1.getClientSolana)();
|
24
|
-
const escrowAccount = yield (0, solana_1.getParsedProgramAccounts)(client, vote_1.escrowStruct, constants_1.voteProgramId, (0, filters_1.dataSizeFilter)(322));
|
25
|
-
if (!escrowAccount)
|
26
|
-
return [];
|
27
|
-
const jupTokenPrice = yield cache.getTokenPrice(constants_1.jupMint, portfolio_core_1.NetworkId.solana);
|
28
|
-
if (!jupTokenPrice)
|
29
|
-
return [];
|
30
|
-
const { decimals } = jupTokenPrice;
|
31
|
-
let lockedWithoutWithdraw = 0;
|
32
|
-
const unlockEachDay = [];
|
33
|
-
for (const account of escrowAccount) {
|
34
|
-
const amount = account.amount.dividedBy(Math.pow(10, decimals)).toNumber();
|
35
|
-
if (!account.escrowStartedAt.isZero()) {
|
36
|
-
const unlockingAt = new Date(account.escrowEndsAt.times(1000).toNumber());
|
37
|
-
const daysUntilUnlock = new bignumber_js_1.default(unlockingAt.getTime() - Date.now())
|
38
|
-
.dividedBy(1000 * 60 * 60 * 24)
|
39
|
-
.decimalPlaces(0, bignumber_js_1.default.ROUND_DOWN)
|
40
|
-
.toNumber();
|
41
|
-
if (unlockEachDay[daysUntilUnlock]) {
|
42
|
-
unlockEachDay[daysUntilUnlock] += amount;
|
43
|
-
}
|
44
|
-
else {
|
45
|
-
unlockEachDay[daysUntilUnlock] = amount;
|
46
|
-
}
|
47
|
-
}
|
48
|
-
else {
|
49
|
-
lockedWithoutWithdraw += amount;
|
50
|
-
}
|
51
|
-
}
|
52
|
-
const unlockingAmount = unlockEachDay.reduce((amount, sum) => amount + sum);
|
53
|
-
const total = unlockingAmount + lockedWithoutWithdraw;
|
54
|
-
console.log('Amount Total : ', total);
|
55
|
-
console.log(`Amount Locked : ${lockedWithoutWithdraw}(${(lockedWithoutWithdraw / total) * 100}%)`);
|
56
|
-
console.log(`Amount unlocking :${unlockingAmount}(${(unlockingAmount / total) * 100}%)`);
|
57
|
-
for (let i = 0; i < unlockEachDay.length; i++) {
|
58
|
-
const unlocking = unlockEachDay[i];
|
59
|
-
if (!unlocking)
|
60
|
-
continue;
|
61
|
-
const value = unlocking * jupTokenPrice.price;
|
62
|
-
const percent = new bignumber_js_1.default(unlocking / total)
|
63
|
-
.times(100)
|
64
|
-
.decimalPlaces(2, bignumber_js_1.default.ROUND_DOWN)
|
65
|
-
.toNumber();
|
66
|
-
console.log(`Unlock in ${i} days : ${percent}% (${unlocking} JUP/ ${value}$) `);
|
67
|
-
}
|
68
|
-
const elements = [];
|
69
|
-
return elements;
|
70
|
-
});
|
71
|
-
const fetcher = {
|
72
|
-
id: `${constants_1.platformId}-test`,
|
73
|
-
networkId: portfolio_core_1.NetworkId.solana,
|
74
|
-
executor,
|
75
|
-
};
|
76
|
-
exports.default = fetcher;
|
77
|
-
//# sourceMappingURL=testFetcher.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"testFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/testFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAyE;AACzE,gEAAqC;AAGrC,2CAAiE;AACjE,+CAA8D;AAC9D,iDAAsD;AACtD,yCAA8C;AAC9C,wDAA4D;AAE5D,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,aAAa,GAAG,MAAM,IAAA,iCAAwB,EAClD,MAAM,EACN,mBAAY,EACZ,yBAAa,EACb,IAAA,wBAAc,EAAC,GAAG,CAAC,CACpB,CAAC;IAEF,IAAI,C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