@sonarwatch/portfolio-plugins 0.11.128 → 0.11.129
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1235 -1231
- package/README.md +3 -3
- package/package.json +2 -2
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/flexlend/depositsFetcher.js +8 -4
- package/src/plugins/flexlend/depositsFetcher.js.map +1 -1
- package/src/plugins/jupiter/helpers.d.ts +1 -1
- package/src/plugins/jupiter/helpers.js +3 -3
- package/src/plugins/jupiter/helpers.js.map +1 -1
- package/src/plugins/jupiter/index.js +0 -2
- package/src/plugins/jupiter/index.js.map +1 -1
- package/src/plugins/lifinity/xLfntyJob.js +4 -4
- package/src/plugins/lifinity/xLfntyJob.js.map +1 -1
- package/src/plugins/solend/obligationsFetcher.js +1 -10
- package/src/plugins/solend/obligationsFetcher.js.map +1 -1
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/symmetry/basketsJob.js +12 -9
- package/src/plugins/symmetry/basketsJob.js.map +1 -1
- package/src/plugins/symmetry/structs.d.ts +5 -1
- package/src/plugins/symmetry/structs.js +7 -2
- package/src/plugins/symmetry/structs.js.map +1 -1
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
- package/src/utils/solana/getDecimals.d.ts +3 -0
- package/src/utils/solana/getDecimals.js +26 -0
- package/src/utils/solana/getDecimals.js.map +1 -0
- package/src/utils/solana/getMultipleDecimals.d.ts +3 -0
- package/src/utils/solana/getMultipleDecimals.js +32 -0
- package/src/utils/solana/getMultipleDecimals.js.map +1 -0
- 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
@@ -0,0 +1,32 @@
|
|
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
|
+
exports.getMultipleDecimals = void 0;
|
13
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
14
|
+
const structs_1 = require("./structs");
|
15
|
+
const getParsedMultipleAccountsInfo_1 = require("./getParsedMultipleAccountsInfo");
|
16
|
+
const solMints = [portfolio_core_1.solanaNativeAddress, portfolio_core_1.solanaNativeWrappedAddress];
|
17
|
+
function getMultipleDecimals(connection, mints) {
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
19
|
+
const mintAccounts = yield (0, getParsedMultipleAccountsInfo_1.getParsedMultipleAccountsInfo)(connection, structs_1.mintAccountStruct, mints.filter((m) => solMints.includes(m.toString())));
|
20
|
+
const decimalsMap = new Map();
|
21
|
+
decimalsMap.set(portfolio_core_1.solanaNativeAddress, portfolio_core_1.solanaNativeDecimals);
|
22
|
+
decimalsMap.set(portfolio_core_1.solanaNativeWrappedAddress, portfolio_core_1.solanaNativeDecimals);
|
23
|
+
mintAccounts.forEach((acc) => {
|
24
|
+
if (!acc)
|
25
|
+
return;
|
26
|
+
decimalsMap.set(acc.pubkey.toString(), acc.decimals);
|
27
|
+
});
|
28
|
+
return mints.map((m) => decimalsMap.get(m.toString()) || null);
|
29
|
+
});
|
30
|
+
}
|
31
|
+
exports.getMultipleDecimals = getMultipleDecimals;
|
32
|
+
//# sourceMappingURL=getMultipleDecimals.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getMultipleDecimals.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/getMultipleDecimals.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,+DAIoC;AAEpC,uCAA8C;AAC9C,mFAAgF;AAEhF,MAAM,QAAQ,GAAG,CAAC,oCAAmB,EAAE,2CAA0B,CAAC,CAAC;AAEnE,SAAsB,mBAAmB,CACvC,UAAwB,EACxB,KAAkB;;QAElB,MAAM,YAAY,GAAG,MAAM,IAAA,6DAA6B,EACtD,UAAU,EACV,2BAAiB,EACjB,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CACrD,CAAC;QACF,MAAM,WAAW,GAAwB,IAAI,GAAG,EAAE,CAAC;QACnD,WAAW,CAAC,GAAG,CAAC,oCAAmB,EAAE,qCAAoB,CAAC,CAAC;QAC3D,WAAW,CAAC,GAAG,CAAC,2CAA0B,EAAE,qCAAoB,CAAC,CAAC;QAClE,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YAC3B,IAAI,CAAC,GAAG;gBAAE,OAAO;YACjB,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;QACH,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC;IACjE,CAAC;CAAA;AAjBD,kDAiBC"}
|
@@ -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":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